Skip to content

Commit 1221a04

Browse files
author
Sébastien Geiser
committed
Easier C# Code generation in Npp tab.
1 parent 53f0f1e commit 1221a04

26 files changed

+458
-269
lines changed

CSharpRegexTools4Npp/BNpp.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ public static void SelectTextAndShow(int start, int end)
198198
/// </summary>
199199
/// <param name="start">Position du début du texte à sélectionner dans le texte entier<br/> Si plus petit que 0 -> forcé à zéro<br/> Si plus grand que Text.Length -> forcé à Text.Length</param>
200200
/// <param name="end">Position de fin du texte à sélectionner dans le texte entier<br/> Si plus petit que 0 -> forcé à zéro<br/> Si plus grand que Text.Length -> forcé à Text.Length<br/> Si plus petit que start -> forcé à start</param>
201-
202201
public static void AddSelection(int start, int end)
203202
{
204203
string allText = Text;

CSharpRegexTools4Npp/CSharpRegexTools4Npp.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<RootNamespace>CSharpRegexTools4Npp</RootNamespace>
1111
<AssemblyName>CSharpRegexTools4Npp</AssemblyName>
1212
<OutputPath>bin\Debug\</OutputPath>
13-
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
13+
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
1414
<TargetFrameworkProfile />
1515
<NuGetPackageImportStamp>
1616
</NuGetPackageImportStamp>
@@ -86,6 +86,7 @@
8686
</ItemGroup>
8787
<ItemGroup>
8888
<Compile Include="BNpp.cs" />
89+
<Compile Include="GlobalSuppressions.cs" />
8990
<Compile Include="PluginInfrastructure\ClikeStringArray.cs" />
9091
<Compile Include="PluginInfrastructure\DllExport\DllExportAttribute.cs" />
9192
<Compile Include="PluginInfrastructure\Win32.cs" />
@@ -146,9 +147,9 @@
146147
<ErrorText>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}.</ErrorText>
147148
</PropertyGroup>
148149
<Error Condition="!Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
149-
<Error Condition="!Exists('..\packages\Fody.6.1.1\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.1.1\build\Fody.targets'))" />
150+
<Error Condition="!Exists('..\packages\Fody.6.3.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.3.0\build\Fody.targets'))" />
150151
</Target>
151-
<Import Project="..\packages\Fody.6.1.1\build\Fody.targets" Condition="Exists('..\packages\Fody.6.1.1\build\Fody.targets')" />
152+
<Import Project="..\packages\Fody.6.3.0\build\Fody.targets" Condition="Exists('..\packages\Fody.6.3.0\build\Fody.targets')" />
152153
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
153154
Other similar extension points exist, see Microsoft.Common.targets.
154155
<Target Name="BeforeBuild">

CSharpRegexTools4Npp/FodyWeavers.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
3-
<Costura />
3+
<Costura>
4+
<ExcludeAssemblies>
5+
CSScriptLibrary
6+
</ExcludeAssemblies>
7+
</Costura>
48
</Weavers>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// This file is used by Code Analysis to maintain SuppressMessage
2+
// attributes that are applied to this project.
3+
// Project-level suppressions either have no target or are given
4+
// a specific target and scoped to a namespace, type, member, etc.
5+
6+
using System.Diagnostics.CodeAnalysis;
7+
8+
[assembly: SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>", Scope = "namespaceanddescendants", Target = "~N:CSharpRegexTools4Npp")]
9+
[assembly: SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "<Pending>", Scope = "namespaceanddescendants", Target = "~N:CSharpRegexTools4Npp")]

CSharpRegexTools4Npp/Main.cs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace CSharpRegexTools4Npp
1212
{
13-
public class Main
13+
public static class Main
1414
{
1515
internal const string PluginName = "C# Regex Tools 4 Npp";
1616
private static int idMyDlg = 0;
@@ -41,16 +41,16 @@ public class Main
4141

4242
private enum WindowLongFlags : int
4343
{
44+
GWL_USERDATA = -21,
4445
GWL_EXSTYLE = -20,
45-
GWLP_HINSTANCE = -6,
46-
GWLP_HWNDPARENT = -8,
47-
GWL_ID = -12,
4846
GWL_STYLE = -16,
49-
GWL_USERDATA = -21,
47+
GWL_ID = -12,
48+
GWLP_HWNDPARENT = -8,
49+
GWLP_HINSTANCE = -6,
5050
GWL_WNDPROC = -4,
51-
DWLP_USER = 0x8,
5251
DWLP_MSGRESULT = 0x0,
5352
DWLP_DLGPROC = 0x4,
53+
DWLP_USER = 0x8,
5454
WS_EX_LAYERED = 0x80000
5555
}
5656

@@ -62,7 +62,6 @@ private enum LayeredWindowAttributesFlags : byte
6262

6363
public static void OnNotification(ScNotification notification)
6464
{
65-
6665
}
6766

6867
internal static void CommandMenuInit()
@@ -86,10 +85,8 @@ internal static void SetToolBarIcon()
8685

8786
public static void ShowTheDialog()
8887
{
89-
9088
try
9189
{
92-
9390
IntPtr hWnd = FindWindow(null, "C# Regex Tools");
9491

9592
if (hWnd.ToInt64() > 0)
@@ -131,6 +128,8 @@ public static void ShowTheDialog()
131128

132129
SaveCurrentDocument = () => BNpp.NotepadPP.SaveCurrentFile(),
133130

131+
SetCurrentTabInCSharpHighlighting = () => BNpp.NotepadPP.SetCurrentLanguage(LangType.L_CS),
132+
134133
TryOpen = (fileName, onlyIfAlreadyOpen) =>
135134
{
136135
try
@@ -167,7 +166,6 @@ public static void ShowTheDialog()
167166
{
168167
return false;
169168
}
170-
171169
},
172170

173171
GetCurrentFileName = () => BNpp.NotepadPP.CurrentFileName
@@ -177,15 +175,12 @@ public static void ShowTheDialog()
177175

178176
SetWindowLong(new WindowInteropHelper(dialog).Handle, (int)WindowLongFlags.GWLP_HWNDPARENT, PluginBase.nppData._nppHandle);
179177
SetLayeredWindowAttributes(new WindowInteropHelper(dialog).Handle, 0, 128, LWA_ALPHA);
180-
181178
}
182179
}
183180
catch (Exception exception)
184181
{
185182
MessageBox.Show(exception.Message + "\r\n" + exception.StackTrace, "Erreur", MessageBoxButton.OK, MessageBoxImage.Error);
186183
}
187-
188-
189184
}
190185
}
191186
}

CSharpRegexTools4Npp/PluginInfrastructure/Docking_h.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
namespace CSharpRegexTools4Npp.PluginInfrastructure
1212
{
13-
1413
[Flags]
1514
public enum NppTbMsg : uint
1615
{
@@ -67,5 +66,4 @@ public RECT(int left, int top, int right, int bottom)
6766
public int Right;
6867
public int Bottom;
6968
}
70-
7169
}

CSharpRegexTools4Npp/PluginInfrastructure/IScintillaGateway.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace CSharpRegexTools4Npp.PluginInfrastructure
66
{
7-
87
/// <summary>
98
/// This it the plugin-writers primary interface to Notepad++/Scintilla.
109
/// It takes away all the complexity with command numbers and Int-pointer casting.

CSharpRegexTools4Npp/PluginInfrastructure/NppPluginNETBase.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public static IntPtr GetCurrentScintilla()
4545
return (curScintilla == 0) ? nppData._scintillaMainHandle : nppData._scintillaSecondHandle;
4646
}
4747

48-
4948
public static readonly Func<IScintillaGateway> gatewayFactory = () => new ScintillaGateway(GetCurrentScintilla());
5049

5150
public static Func<IScintillaGateway> GetGatewayFactory()

CSharpRegexTools4Npp/Resources.Designer.cs

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CSharpRegexTools4Npp/app.config

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3-
<startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup>
3+
<startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7" /></startup>
44
<runtime>
55
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
66
<dependentAssembly>
77
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
8-
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
8+
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
99
</dependentAssembly>
1010
<dependentAssembly>
1111
<assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
12-
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
12+
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
1313
</dependentAssembly>
1414
<dependentAssembly>
1515
<assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
16-
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
16+
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
1717
</dependentAssembly>
1818
<dependentAssembly>
1919
<assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
@@ -25,11 +25,11 @@
2525
</dependentAssembly>
2626
<dependentAssembly>
2727
<assemblyIdentity name="System.Runtime.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
28-
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
28+
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
2929
</dependentAssembly>
3030
<dependentAssembly>
3131
<assemblyIdentity name="System.Runtime.InteropServices" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
32-
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
32+
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
3333
</dependentAssembly>
3434
<dependentAssembly>
3535
<assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
@@ -65,19 +65,19 @@
6565
</dependentAssembly>
6666
<dependentAssembly>
6767
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
68-
<bindingRedirect oldVersion="0.0.0.0-1.2.3.0" newVersion="1.2.3.0" />
68+
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
6969
</dependentAssembly>
7070
<dependentAssembly>
7171
<assemblyIdentity name="Microsoft.CodeAnalysis.Scripting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
72-
<bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
72+
<bindingRedirect oldVersion="0.0.0.0-3.8.0.0" newVersion="3.8.0.0" />
7373
</dependentAssembly>
7474
<dependentAssembly>
7575
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral" />
76-
<bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
76+
<bindingRedirect oldVersion="0.0.0.0-3.8.0.0" newVersion="3.8.0.0" />
7777
</dependentAssembly>
7878
<dependentAssembly>
7979
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Scripting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
80-
<bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
80+
<bindingRedirect oldVersion="0.0.0.0-3.8.0.0" newVersion="3.8.0.0" />
8181
</dependentAssembly>
8282
<dependentAssembly>
8383
<assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
@@ -91,6 +91,14 @@
9191
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
9292
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
9393
</dependentAssembly>
94+
<dependentAssembly>
95+
<assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
96+
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
97+
</dependentAssembly>
98+
<dependentAssembly>
99+
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
100+
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
101+
</dependentAssembly>
94102
</assemblyBinding>
95103
</runtime>
96104
</configuration>

CSharpRegexTools4Npp/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Costura.Fody" version="4.1.0" targetFramework="net46" developmentDependency="true" />
4-
<package id="Fody" version="6.1.1" targetFramework="net46" developmentDependency="true" />
4+
<package id="Fody" version="6.3.0" targetFramework="net46" developmentDependency="true" />
55
</packages>

RegexDialog/BracketColorizer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,5 @@ protected override void ColorizeLine(DocumentLine line)
2727
}
2828
}
2929
}
30-
3130
}
3231
}

RegexDialog/FodyWeavers.xsd

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
1212
</xs:annotation>
1313
</xs:attribute>
14+
<xs:attribute name="TriggerDependentProperties" type="xs:boolean">
15+
<xs:annotation>
16+
<xs:documentation>Used to control if the Dependent properties feature is enabled.</xs:documentation>
17+
</xs:annotation>
18+
</xs:attribute>
19+
<xs:attribute name="EnableIsChangedProperty" type="xs:boolean">
20+
<xs:annotation>
21+
<xs:documentation>Used to control if the IsChanged property feature is enabled.</xs:documentation>
22+
</xs:annotation>
23+
</xs:attribute>
1424
<xs:attribute name="EventInvokerNames" type="xs:string">
1525
<xs:annotation>
1626
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
@@ -31,6 +41,16 @@
3141
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
3242
</xs:annotation>
3343
</xs:attribute>
44+
<xs:attribute name="SuppressWarnings" type="xs:boolean">
45+
<xs:annotation>
46+
<xs:documentation>Used to turn off build warnings from this weaver.</xs:documentation>
47+
</xs:annotation>
48+
</xs:attribute>
49+
<xs:attribute name="SuppressOnPropertyNameChangedWarning" type="xs:boolean">
50+
<xs:annotation>
51+
<xs:documentation>Used to turn off build warnings about mismatched On_PropertyName_Changed methods.</xs:documentation>
52+
</xs:annotation>
53+
</xs:attribute>
3454
</xs:complexType>
3555
</xs:element>
3656
</xs:all>

RegexDialog/GlobalSuppressions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This file is used by Code Analysis to maintain SuppressMessage
2+
// attributes that are applied to this project.
3+
// Project-level suppressions either have no target or are given
4+
// a specific target and scoped to a namespace, type, member, etc.
5+
6+
using System.Diagnostics.CodeAnalysis;
7+
8+
[assembly: SuppressMessage("Style", "IDE0063:Use simple 'using' statement", Justification = "<Pending>", Scope = "namespaceanddescendants", Target = "~N:RegexDialog")]

0 commit comments

Comments
 (0)