From a4b36e29fc7b697d938071c9e19860a8c2034b8f Mon Sep 17 00:00:00 2001 From: Coding Seb Date: Tue, 4 Jun 2019 11:22:36 +0200 Subject: [PATCH 01/88] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 99c8346..765817e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # CSharpRegexTools4Npp -Some tools for using C# Regex in Notepad++ (As Notepad++ Plugin) +Some tools to using C# Regex in Notepad++ (As Notepad++ Plugin) ## Features * Syntax Highlight of the C# Regex From c2213ffbce94542a336046cc53472e2a602cbd0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geiser?= Date: Tue, 10 Nov 2020 15:44:52 +0100 Subject: [PATCH 02/88] Hide Export --- RegexDialog/RegExToolDialog.xaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RegexDialog/RegExToolDialog.xaml b/RegexDialog/RegExToolDialog.xaml index de6933e..09bb8f3 100644 --- a/RegexDialog/RegExToolDialog.xaml +++ b/RegexDialog/RegExToolDialog.xaml @@ -98,12 +98,12 @@ - + From 2ffa25a6785fb429dbd9c32de98e8226022e72fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geiser?= Date: Tue, 10 Nov 2020 16:10:10 +0100 Subject: [PATCH 03/88] Version 1.1.4.0. Show version and link on github --- CSharpRegexTools4Npp/Properties/AssemblyInfo.cs | 4 ++-- RegexDialog/RegExToolDialog.xaml | 3 +++ RegexDialog/RegExToolDialog.xaml.cs | 12 ++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CSharpRegexTools4Npp/Properties/AssemblyInfo.cs b/CSharpRegexTools4Npp/Properties/AssemblyInfo.cs index 66a05a2..548f82c 100644 --- a/CSharpRegexTools4Npp/Properties/AssemblyInfo.cs +++ b/CSharpRegexTools4Npp/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.3.0")] -[assembly: AssemblyFileVersion("1.1.3.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.1.4.0")] +[assembly: AssemblyFileVersion("1.1.4.0")] \ No newline at end of file diff --git a/RegexDialog/RegExToolDialog.xaml b/RegexDialog/RegExToolDialog.xaml index 09bb8f3..ee78ee3 100644 --- a/RegexDialog/RegExToolDialog.xaml +++ b/RegexDialog/RegExToolDialog.xaml @@ -169,6 +169,9 @@ + + + diff --git a/RegexDialog/RegExToolDialog.xaml.cs b/RegexDialog/RegExToolDialog.xaml.cs index f237d96..c48d9e1 100644 --- a/RegexDialog/RegExToolDialog.xaml.cs +++ b/RegexDialog/RegExToolDialog.xaml.cs @@ -10,6 +10,7 @@ using System.Diagnostics; using System.IO; using System.Linq; +using System.Reflection; using System.Text; using System.Text.RegularExpressions; using System.Windows; @@ -213,6 +214,8 @@ public RegExToolDialog() InitializeComponent(); + Title += " - " + Assembly.GetCallingAssembly().GetName().Version.ToString(); + Init(); } @@ -2273,5 +2276,14 @@ private void FindLanguageElementTextBox_PreviewKeyDown(object sender, KeyEventAr } } } + + private void Help_MenuItem_Click(object sender, RoutedEventArgs e) + { + try + { + Process.Start("https://github.com/codingseb/CSharpRegexTools4Npp"); + } + catch { } + } } } From 53f0f1ed86094066bf5432b4ec2efc66d2f70357 Mon Sep 17 00:00:00 2001 From: Coding Seb Date: Tue, 10 Nov 2020 16:13:55 +0100 Subject: [PATCH 04/88] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 765817e..ab1dd1e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # CSharpRegexTools4Npp -Some tools to using C# Regex in Notepad++ (As Notepad++ Plugin) +Some tools to use C# Regex in Notepad++ (As Notepad++ Plugin) ## Features * Syntax Highlight of the C# Regex From 9f2655c884793961c90973767167f1079face782 Mon Sep 17 00:00:00 2001 From: Coding Seb Date: Tue, 22 Dec 2020 07:31:41 +0100 Subject: [PATCH 05/88] Update README.md --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ab1dd1e..948cc47 100644 --- a/README.md +++ b/README.md @@ -61,15 +61,15 @@ To Launch the tools use one of these 3 methods : ![Text-sources](https://raw.githubusercontent.com/codingseb/CSharpRegexTools4Npp/master/doc/Text-Sources.png) ## Credits -Based on : [NotepadPlusPlusPluginPack](https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net) (under the [Apache-2.0 license](https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net/blob/master/LICENSE.md)) Merged manually with a part of the version used in [CS-Script.Npp](https://github.com/oleg-shilo/cs-script.npp) (under MIT license) for better x64 support and remodified for the way I use it. +Based on : [NotepadPlusPlusPluginPack](https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net) ([Apache-2.0 license](https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net/blob/master/LICENSE.md)) Merged manually with a part of the version used in [CS-Script.Npp](https://github.com/oleg-shilo/cs-script.npp) (under MIT license) for better x64 support and remodified for the way I use it. use : -[AvalonEdit](https://github.com/icsharpcode/AvalonEdit) For Regex edition and syntax Highlighting (under MIT license) -[CS-Script](https://github.com/oleg-shilo/cs-script/) For C# Match replace (under MIT license) -[Newtonsoft.Json](https://www.newtonsoft.com/json) (under MIT license) -[Ookii.Dialogs](http://www.ookii.org/software/dialogs/) (For Open and Save dialogs [under specific license](https://github.com/codingseb/CSharpRegexTools4Npp/blob/master/Licenses/Ooki%20license.txt)) -[PropertyChanged.Fody](https://github.com/Fody/PropertyChanged) (under MIT license) -[Costura.fody](https://github.com/Fody/Costura) Merge all in one DLL, without it it doesn't work (under MIT license) +[AvalonEdit](https://github.com/icsharpcode/AvalonEdit) For Regex edition and syntax Highlighting (MIT license) +[CS-Script](https://github.com/oleg-shilo/cs-script/) For C# Match replace (MIT license) +[Newtonsoft.Json](https://www.newtonsoft.com/json) (MIT license) +[Ookii.Dialogs](http://www.ookii.org/software/dialogs/) (For Open and Save dialogs [specific license](https://github.com/codingseb/CSharpRegexTools4Npp/blob/master/Licenses/Ooki%20license.txt)) +[PropertyChanged.Fody](https://github.com/Fody/PropertyChanged) (MIT license) +[Costura.fody](https://github.com/Fody/Costura) Merge all in one DLL, without it it doesn't work (MIT license) And for icons : -[FatCow](https://www.fatcow.com/free-icons) (under [Creative Commons 3.0](https://creativecommons.org/licenses/by/3.0/us/)) +[FatCow](https://www.fatcow.com/free-icons) ([Creative Commons 3.0](https://creativecommons.org/licenses/by/3.0/us/)) From 93c9400d85dd2c263cd5c65aca249f24ec005790 Mon Sep 17 00:00:00 2001 From: Coding Seb Date: Tue, 22 Dec 2020 08:36:29 +0100 Subject: [PATCH 06/88] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 948cc47..cec93b5 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Some tools to use C# Regex in Notepad++ (As Notepad++ Plugin) Need a [Notepad++](https://notepad-plus-plus.org/) x86 or x64 installed on the machine and the right to write in the plugin directory. (At least version 7.6.3, older versions can work but need modification of the file [NppPlugin.DllExport.targets](https://github.com/codingseb/CSharpRegexTools4Npp/blob/master/CSharpRegexTools4Npp/PluginInfrastructure/DllExport/NppPlugin.DllExport.targets) see [Notepad++ plugins new directories structures](https://notepad-plus-plus.org/community/topic/16996/new-plugins-home-round-2)) -Need .Net Framework 4.6 or greater +Need .Net Framework 4.7 or greater ## Installation From 1221a0473776381d0c55b3ce38e937c0c705203a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geiser?= Date: Tue, 22 Dec 2020 13:26:14 +0100 Subject: [PATCH 07/88] Easier C# Code generation in Npp tab. --- CSharpRegexTools4Npp/BNpp.cs | 1 - .../CSharpRegexTools4Npp.csproj | 7 +- CSharpRegexTools4Npp/FodyWeavers.xml | 6 +- CSharpRegexTools4Npp/GlobalSuppressions.cs | 9 ++ CSharpRegexTools4Npp/Main.cs | 21 +-- .../PluginInfrastructure/Docking_h.cs | 2 - .../PluginInfrastructure/IScintillaGateway.cs | 1 - .../PluginInfrastructure/NppPluginNETBase.cs | 1 - CSharpRegexTools4Npp/Resources.Designer.cs | 28 ++-- CSharpRegexTools4Npp/app.config | 28 ++-- CSharpRegexTools4Npp/packages.config | 2 +- RegexDialog/BracketColorizer.cs | 1 - RegexDialog/FodyWeavers.xsd | 20 +++ RegexDialog/GlobalSuppressions.cs | 8 + RegexDialog/RegExToolDialog.xaml | 89 ++++++----- RegexDialog/RegExToolDialog.xaml.cs | 116 ++++++++++++-- ....GeneratedMSBuildEditorConfig.editorconfig | 8 + RegexDialog/RegexDialog.csproj | 90 ++++++----- RegexDialog/Res.Designer.cs | 149 ++++++++++-------- RegexDialog/Resources/page_white_csharp.png | Bin 0 -> 779 bytes .../UIHelpers/Converters/ChainingConverter.cs | 1 - RegexDialog/Utils/Extensions.cs | 10 +- RegexDialog/Utils/IniFile.cs | 7 - RegexDialog/Utils/ObservableDictionary.cs | 12 +- RegexDialog/app.config | 28 ++-- RegexDialog/packages.config | 82 +++++----- 26 files changed, 458 insertions(+), 269 deletions(-) create mode 100644 CSharpRegexTools4Npp/GlobalSuppressions.cs create mode 100644 RegexDialog/GlobalSuppressions.cs create mode 100644 RegexDialog/RegexDialog.GeneratedMSBuildEditorConfig.editorconfig create mode 100644 RegexDialog/Resources/page_white_csharp.png diff --git a/CSharpRegexTools4Npp/BNpp.cs b/CSharpRegexTools4Npp/BNpp.cs index 61479ba..511167b 100644 --- a/CSharpRegexTools4Npp/BNpp.cs +++ b/CSharpRegexTools4Npp/BNpp.cs @@ -198,7 +198,6 @@ public static void SelectTextAndShow(int start, int end) /// /// Position du début du texte à sélectionner dans le texte entier
Si plus petit que 0 -> forcé à zéro
Si plus grand que Text.Length -> forcé à Text.Length /// Position de fin du texte à sélectionner dans le texte entier
Si plus petit que 0 -> forcé à zéro
Si plus grand que Text.Length -> forcé à Text.Length
Si plus petit que start -> forcé à start - public static void AddSelection(int start, int end) { string allText = Text; diff --git a/CSharpRegexTools4Npp/CSharpRegexTools4Npp.csproj b/CSharpRegexTools4Npp/CSharpRegexTools4Npp.csproj index 98f4373..6b2a63f 100644 --- a/CSharpRegexTools4Npp/CSharpRegexTools4Npp.csproj +++ b/CSharpRegexTools4Npp/CSharpRegexTools4Npp.csproj @@ -10,7 +10,7 @@ CSharpRegexTools4Npp CSharpRegexTools4Npp bin\Debug\ - v4.6 + v4.7 @@ -86,6 +86,7 @@ + @@ -146,9 +147,9 @@ Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : {0}. - + - + diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs b/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs index dc4eb51..0446065 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs @@ -4,6 +4,7 @@ using System; using System.Runtime.InteropServices; using System.Windows.Forms; +using CSScriptNativeApi; namespace CSharpRegexTools4Npp { diff --git a/CSharpRegexTools4Npp/Properties/AssemblyInfo.cs b/CSharpRegexTools4Npp/Properties/AssemblyInfo.cs index ec99eb5..7c91287 100644 --- a/CSharpRegexTools4Npp/Properties/AssemblyInfo.cs +++ b/CSharpRegexTools4Npp/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.5.0")] -[assembly: AssemblyFileVersion("1.1.5.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.1.6.0")] +[assembly: AssemblyFileVersion("1.1.6.0")] \ No newline at end of file diff --git a/RegexDialog/FodyWeavers.xml b/RegexDialog/FodyWeavers.xml index 4e68ed1..79b41a9 100644 --- a/RegexDialog/FodyWeavers.xml +++ b/RegexDialog/FodyWeavers.xml @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/RegexDialog/FodyWeavers.xsd b/RegexDialog/FodyWeavers.xsd index 69dbe48..813d003 100644 --- a/RegexDialog/FodyWeavers.xsd +++ b/RegexDialog/FodyWeavers.xsd @@ -4,6 +4,92 @@ + + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with line breaks. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with line breaks. + + + + + The order of preloaded assemblies, delimited with line breaks. + + + + + + This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. + + + + + Controls if .pdbs for reference assemblies are also embedded. + + + + + Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. + + + + + As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. + + + + + Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. + + + + + Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with |. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with |. + + + + + The order of preloaded assemblies, delimited with |. + + + + diff --git a/RegexDialog/RegExToolDialog.xaml.cs b/RegexDialog/RegExToolDialog.xaml.cs index 08e5593..733d87d 100644 --- a/RegexDialog/RegExToolDialog.xaml.cs +++ b/RegexDialog/RegExToolDialog.xaml.cs @@ -48,7 +48,7 @@ public partial class RegExToolDialog : Window private bool mustSelectEditor; - private readonly IEvaluator csEval = CSScript.Evaluator; + private readonly IEvaluator csEval = CSScript.MonoEvaluator; private readonly BracketColorizer currentBracketColorizer = new BracketColorizer(); private readonly BracketColorizer matchingBracketColorizer = new BracketColorizer(); diff --git a/RegexDialog/RegexDialog.csproj b/RegexDialog/RegexDialog.csproj index fcc4d9f..ff97a60 100644 --- a/RegexDialog/RegexDialog.csproj +++ b/RegexDialog/RegexDialog.csproj @@ -1,5 +1,6 @@  + @@ -44,11 +45,15 @@ + + ..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll + ..\packages\CS-Script.bin.3.30.5.1\lib\net45\CSScriptLibrary.dll + False - ..\packages\CS-Script.RoslynProvider.3.28.7\lib\net46\CSSRoslynProvider.dll + ..\packages\CS-Script.RoslynProvider.3.30.3\lib\net46\CSSRoslynProvider.dll ..\packages\EPPlus.4.5.3.2\lib\net40\EPPlus.dll @@ -263,6 +268,7 @@ + @@ -449,6 +455,7 @@ + diff --git a/RegexDialog/Scripting.native.Roslyn.cs b/RegexDialog/Scripting.native.Roslyn.cs new file mode 100644 index 0000000..7d8f05a --- /dev/null +++ b/RegexDialog/Scripting.native.Roslyn.cs @@ -0,0 +1,59 @@ +using System; +using System.IO; +using System.Linq; +using System.Reflection; +using CSScriptLibrary; + +// The VB.NET samples can be found here: https://github.com/oleg-shilo/cs-script/tree/master/Source/NuGet/content/vb + +namespace CSScriptNativeApi +{ + public class CodeDom_Roslyn + { + public static void Test() + { + CSScript.GlobalSettings.UseAlternativeCompiler = LocateRoslynCSSProvider(); + CSScript.GlobalSettings.RoslynDir = LocateRoslynCompilers(); + + var sayHello = CSScript.LoadMethod(@"static void SayHello(string greeting) + { + var tuple = (1,2); + void test() + { + Console.WriteLine(""Hello from C#7!""); + Console.WriteLine(tuple); + } + test(); + + Console.WriteLine(greeting); + }") + .GetStaticMethod(); + + sayHello("Hello World!"); + } + static string Root { get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); } } + + static string LocateRoslynCompilers() + { + try + { + // Roslyn compilers are distributed as a NuGet package but the binaries are never copied into the output folder. + // Thus the path tho the compilers needs to be discovered dynamically. + // The algorithm below is simplistic and does not check for highest version if multiple packages are found. + + string packageDir = Path.Combine(Root, "..", "..", "..", "packages"); + string roslynDir = Path.Combine(Directory.GetDirectories(packageDir, "Microsoft.Net.Compilers.*").First(), "tools"); + return roslynDir; + } + catch + { + throw new Exception("Cannot locate Roslyn compiler (csc.exe). You can set it manually "); + } + } + + static string LocateRoslynCSSProvider() + { + return Path.Combine(Root, "CSSRoslynProvider.dll"); + } + } +} \ No newline at end of file diff --git a/RegexDialog/packages.config b/RegexDialog/packages.config index 0bea689..60cd59a 100644 --- a/RegexDialog/packages.config +++ b/RegexDialog/packages.config @@ -1,8 +1,10 @@  + + From acaa639a8670fca946565b109ef525443fa92339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geiser?= Date: Mon, 4 Jan 2021 14:49:10 +0100 Subject: [PATCH 13/88] Refactroring --- CSharpRegexTools4Npp/FodyWeavers.xml | 3 +-- CSharpRegexTools4Npp/Main.cs | 1 - CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/CSharpRegexTools4Npp/FodyWeavers.xml b/CSharpRegexTools4Npp/FodyWeavers.xml index 37fe15b..a5dcf04 100644 --- a/CSharpRegexTools4Npp/FodyWeavers.xml +++ b/CSharpRegexTools4Npp/FodyWeavers.xml @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/CSharpRegexTools4Npp/Main.cs b/CSharpRegexTools4Npp/Main.cs index bfda05d..7295cbd 100644 --- a/CSharpRegexTools4Npp/Main.cs +++ b/CSharpRegexTools4Npp/Main.cs @@ -2,7 +2,6 @@ using RegexDialog; using System; using System.Drawing; -using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Windows; diff --git a/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs b/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs index 0446065..dc4eb51 100644 --- a/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs +++ b/CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs @@ -4,7 +4,6 @@ using System; using System.Runtime.InteropServices; using System.Windows.Forms; -using CSScriptNativeApi; namespace CSharpRegexTools4Npp { From 6b05d0408d4f46f46c75cdd76d683f769508aa14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geiser?= Date: Thu, 7 Jan 2021 11:10:47 +0100 Subject: [PATCH 14/88] Search also in RegexlanguageElement values --- RegexDialog/Model/RegexLanguageElement.cs | 5 ++++- RegexDialog/Model/RegexLanguageElementGroup.cs | 2 ++ RegexDialog/RegExToolDialog.xaml.cs | 10 +++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/RegexDialog/Model/RegexLanguageElement.cs b/RegexDialog/Model/RegexLanguageElement.cs index d486487..8b39cf5 100644 --- a/RegexDialog/Model/RegexLanguageElement.cs +++ b/RegexDialog/Model/RegexLanguageElement.cs @@ -1,5 +1,8 @@ -namespace RegexDialog +using System.Diagnostics; + +namespace RegexDialog { + [DebuggerDisplay("[{GetType().Name}] - {Name} - {Value} - {Description}")] internal class RegexLanguageElement : NotifyPropertyChangedBaseClass { public string Name { get; set; } diff --git a/RegexDialog/Model/RegexLanguageElementGroup.cs b/RegexDialog/Model/RegexLanguageElementGroup.cs index c1ef779..d74460e 100644 --- a/RegexDialog/Model/RegexLanguageElementGroup.cs +++ b/RegexDialog/Model/RegexLanguageElementGroup.cs @@ -1,7 +1,9 @@ using System.Collections.Generic; +using System.Diagnostics; namespace RegexDialog { + [DebuggerDisplay("[{GetType().Name}] - {Name} - {Description}")] internal class RegexLanguageElementGroup : NotifyPropertyChangedBaseClass { public string Name { get; set; } diff --git a/RegexDialog/RegExToolDialog.xaml.cs b/RegexDialog/RegExToolDialog.xaml.cs index 733d87d..cf26c49 100644 --- a/RegexDialog/RegExToolDialog.xaml.cs +++ b/RegexDialog/RegExToolDialog.xaml.cs @@ -2248,9 +2248,13 @@ private void FindLanguageElementTextBox_TextChanged(object sender, TextChangedEv { languageElementGroups.ForEach(languageElementGroup => { - languageElementGroup.Elements.ForEach(regexLanguageElement => regexLanguageElement.Visible = - regexLanguageElement.Name.RemoveAccents().IndexOf(FindLanguageElementTextBox.Text.RemoveAccents(), StringComparison.OrdinalIgnoreCase) >= 0 - || regexLanguageElement.Description.RemoveAccents().IndexOf(FindLanguageElementTextBox.Text.RemoveAccents(), StringComparison.OrdinalIgnoreCase) >= 0); + languageElementGroup.Elements.ForEach(regexLanguageElement => + { + regexLanguageElement.Visible = + regexLanguageElement.Name.RemoveAccents().IndexOf(FindLanguageElementTextBox.Text.RemoveAccents(), StringComparison.OrdinalIgnoreCase) >= 0 + || regexLanguageElement.Value.IndexOf(FindLanguageElementTextBox.Text.RemoveAccents(), StringComparison.OrdinalIgnoreCase) >= 0 + || regexLanguageElement.Description.RemoveAccents().IndexOf(FindLanguageElementTextBox.Text.RemoveAccents(), StringComparison.OrdinalIgnoreCase) >= 0; + }); languageElementGroup.Visible = languageElementGroup.Elements.Any(regexLanguageElement => regexLanguageElement.Visible); languageElementGroup.IsExpanded = languageElementGroup.Visible; }); From ad0061142dfed386db6fb900f0ff70d0d8f1f79e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geiser?= Date: Fri, 8 Jan 2021 14:26:29 +0100 Subject: [PATCH 15/88] Doc for Regex options --- CSharpRegexTools4Npp/Main.cs | 5 ++- RegexDialog/Model/RegExOptionModel.cs | 29 ++++-------- RegexDialog/Model/RegexResult.cs | 14 +++--- RegexDialog/RegExToolDialog.xaml | 44 ++++++++++++------- RegexDialog/RegExToolDialog.xaml.cs | 8 +++- RegexDialog/RegexDialog.csproj | 1 + RegexDialog/Res.Designer.cs | 12 +++++ RegexDialog/Res.resx | 3 ++ .../Resources/RegexOptionsDescriptions.json | 12 +++++ .../UIHelpers/Converters/ChainingConverter.cs | 4 +- .../CustomBoolToVisibilityConverter.cs | 4 +- .../Converters/EnumBooleanConverter.cs | 2 +- .../Converters/ExpressionEvalConverter.cs | 8 ++-- RegexDialog/Utils/Config.cs | 4 +- RegexDialog/Utils/ExpressionEvaluator.cs | 16 +++---- RegexDialog/Utils/IniFile.cs | 4 +- 16 files changed, 104 insertions(+), 66 deletions(-) create mode 100644 RegexDialog/Resources/RegexOptionsDescriptions.json diff --git a/CSharpRegexTools4Npp/Main.cs b/CSharpRegexTools4Npp/Main.cs index 7295cbd..114dfce 100644 --- a/CSharpRegexTools4Npp/Main.cs +++ b/CSharpRegexTools4Npp/Main.cs @@ -3,6 +3,7 @@ using System; using System.Drawing; using System.Linq; +using System.Reflection; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Input; @@ -89,7 +90,7 @@ public static void ShowTheDialog() { AppDomain.CurrentDomain.SetupInformation.PrivateBinPath = @"plugins\CSharpRegexTools4Npp"; - IntPtr hWnd = FindWindow(null, "C# Regex Tools"); + IntPtr hWnd = FindWindow(null, "C# Regex Tools - " + Assembly.GetCallingAssembly().GetName().Version.ToString()); if (hWnd.ToInt64() > 0) { @@ -156,7 +157,7 @@ public static void ShowTheDialog() result = false; } - hWnd = FindWindow(null, "C# Regex Tool"); + hWnd = FindWindow(null, "C# Regex Tool - " + Assembly.GetCallingAssembly().GetName().Version.ToString()); if (hWnd.ToInt64() > 0) { SetForegroundWindow(hWnd); diff --git a/RegexDialog/Model/RegExOptionModel.cs b/RegexDialog/Model/RegExOptionModel.cs index 0504b64..c82311c 100644 --- a/RegexDialog/Model/RegExOptionModel.cs +++ b/RegexDialog/Model/RegExOptionModel.cs @@ -1,10 +1,14 @@ -using System; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; using System.Text.RegularExpressions; namespace RegexDialog { internal class RegExOptionViewModel : NotifyPropertyChangedBaseClass { + private static readonly Dictionary optionNameToDescriptionDictionary = JsonConvert.DeserializeObject>(Res.RegexOptionsDescriptions); + /// /// Sélectionné /// @@ -18,34 +22,19 @@ public bool Selected { Config.Instance.RegexOptionsSelection[Name] = value; Config.Instance.Save(); - NotifyPropertyChanged(); } } - private RegexOptions regexOptions; - /// /// L'option d'expression régulière représentée /// - public RegexOptions RegexOptions - { - get { return regexOptions; } - set - { - regexOptions = value; - NotifyPropertyChanged(); - } - } + public RegexOptions RegexOptions { get; set; } /// /// Nom à affiché /// - public string Name - { - get - { - return Enum.GetName(typeof(RegexOptions), regexOptions); - } - } + public string Name => Enum.GetName(typeof(RegexOptions), RegexOptions); + + public string Description => optionNameToDescriptionDictionary[Name]; } } diff --git a/RegexDialog/Model/RegexResult.cs b/RegexDialog/Model/RegexResult.cs index cbcaf71..6c7f373 100644 --- a/RegexDialog/Model/RegexResult.cs +++ b/RegexDialog/Model/RegexResult.cs @@ -19,9 +19,9 @@ public RegexResult(Regex regex, Capture regexElement, int regexElementNb, string public virtual void RefreshExpands() { } - public virtual bool IsExpanded { get; set; } = false; + public virtual bool IsExpanded { get; set; } - public bool IsSelected { get; set; } = false; + public bool IsSelected { get; set; } public virtual string ElementType { @@ -33,15 +33,15 @@ public virtual string ElementType public string FileName { get; set; } = string.Empty; - public Capture RegexElement { get; } = null; + public Capture RegexElement { get; } - public int RegexElementNb { get; } = 0; + public int RegexElementNb { get; } - public RegexResult Parent { get; set; } = null; + public RegexResult Parent { get; set; } public List Children { get; set; } = new List(); - public Regex Regex { get; private set; } + public Regex Regex { get; } public virtual string Name { @@ -91,7 +91,7 @@ public virtual string OneLineValue } } - public virtual int SelectionIndex { get; set; } = 0; + public virtual int SelectionIndex { get; set; } public virtual int Index { diff --git a/RegexDialog/RegExToolDialog.xaml b/RegexDialog/RegExToolDialog.xaml index e9686d5..f00f36b 100644 --- a/RegexDialog/RegExToolDialog.xaml +++ b/RegexDialog/RegExToolDialog.xaml @@ -77,7 +77,7 @@ - + @@ -85,12 +85,12 @@ - + - + @@ -582,19 +582,23 @@ + + + + - + + A new version of C# Regex Tools is available
- + - + @@ -468,7 +468,7 @@