Skip to content

Commit 837a5fd

Browse files
author
Sébastien Geiser
committed
Version 1.1.6.0
1 parent 5a183d7 commit 837a5fd

11 files changed

+164
-8
lines changed

CSharpRegexTools4Npp/FodyWeavers.xml

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
33
<Costura>
4-
<ExcludeAssemblies>
5-
CSScriptLibrary
6-
</ExcludeAssemblies>
74
</Costura>
85
</Weavers>

CSharpRegexTools4Npp/Main.cs

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using RegexDialog;
33
using System;
44
using System.Drawing;
5+
using System.IO;
56
using System.Linq;
67
using System.Runtime.InteropServices;
78
using System.Windows;
@@ -87,6 +88,8 @@ public static void ShowTheDialog()
8788
{
8889
try
8990
{
91+
AppDomain.CurrentDomain.SetupInformation.PrivateBinPath = @"plugins\CSharpRegexTools4Npp";
92+
9093
IntPtr hWnd = FindWindow(null, "C# Regex Tools");
9194

9295
if (hWnd.ToInt64() > 0)

CSharpRegexTools4Npp/PluginInfrastructure/DllExport/NppPlugin.DllExport.targets

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
$(ProgramW6432) points to the 64bit Program Files (on 32 bit windows it is blank) -->
3737
<MakeDir Directories="$(MSBuildProgramFiles32)\Notepad++\plugins\$(TargetName)\" Condition="Exists('$(MSBuildProgramFiles32)\Notepad++\plugins\') AND !Exists('$(MSBuildProgramFiles32)\Notepad++\plugins\$(TargetName)\') AND '$(Platform)'=='x86'" />
3838
<Copy
39-
SourceFiles="@(ReleaseFiles)"
39+
SourceFiles="@(ReleaseFiles)"
4040
DestinationFolder="$(MSBuildProgramFiles32)\Notepad++\plugins\$(TargetName)\"
4141
Condition="Exists('$(MSBuildProgramFiles32)\Notepad++\plugins\$(TargetName)\') AND '$(Platform)'=='x86'"
4242
ContinueOnError="false" />

CSharpRegexTools4Npp/PluginInfrastructure/UnmanagedExports.cs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Runtime.InteropServices;
66
using System.Windows.Forms;
7+
using CSScriptNativeApi;
78

89
namespace CSharpRegexTools4Npp
910
{

CSharpRegexTools4Npp/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.1.5.0")]
35-
[assembly: AssemblyFileVersion("1.1.5.0")]
34+
[assembly: AssemblyVersion("1.1.6.0")]
35+
[assembly: AssemblyFileVersion("1.1.6.0")]

RegexDialog/FodyWeavers.xml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
33
<PropertyChanged />
4+
<Costura />
45
</Weavers>

RegexDialog/FodyWeavers.xsd

+86
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,92 @@
44
<xs:element name="Weavers">
55
<xs:complexType>
66
<xs:all>
7+
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
8+
<xs:complexType>
9+
<xs:all>
10+
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
11+
<xs:annotation>
12+
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
13+
</xs:annotation>
14+
</xs:element>
15+
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
16+
<xs:annotation>
17+
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
18+
</xs:annotation>
19+
</xs:element>
20+
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
21+
<xs:annotation>
22+
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
23+
</xs:annotation>
24+
</xs:element>
25+
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
26+
<xs:annotation>
27+
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
28+
</xs:annotation>
29+
</xs:element>
30+
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
31+
<xs:annotation>
32+
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
33+
</xs:annotation>
34+
</xs:element>
35+
</xs:all>
36+
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
37+
<xs:annotation>
38+
<xs:documentation>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.</xs:documentation>
39+
</xs:annotation>
40+
</xs:attribute>
41+
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
42+
<xs:annotation>
43+
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
44+
</xs:annotation>
45+
</xs:attribute>
46+
<xs:attribute name="DisableCompression" type="xs:boolean">
47+
<xs:annotation>
48+
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
49+
</xs:annotation>
50+
</xs:attribute>
51+
<xs:attribute name="DisableCleanup" type="xs:boolean">
52+
<xs:annotation>
53+
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
54+
</xs:annotation>
55+
</xs:attribute>
56+
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
57+
<xs:annotation>
58+
<xs:documentation>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.</xs:documentation>
59+
</xs:annotation>
60+
</xs:attribute>
61+
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
62+
<xs:annotation>
63+
<xs:documentation>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.</xs:documentation>
64+
</xs:annotation>
65+
</xs:attribute>
66+
<xs:attribute name="ExcludeAssemblies" type="xs:string">
67+
<xs:annotation>
68+
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
69+
</xs:annotation>
70+
</xs:attribute>
71+
<xs:attribute name="IncludeAssemblies" type="xs:string">
72+
<xs:annotation>
73+
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
74+
</xs:annotation>
75+
</xs:attribute>
76+
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
77+
<xs:annotation>
78+
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
79+
</xs:annotation>
80+
</xs:attribute>
81+
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
82+
<xs:annotation>
83+
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
84+
</xs:annotation>
85+
</xs:attribute>
86+
<xs:attribute name="PreloadOrder" type="xs:string">
87+
<xs:annotation>
88+
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
89+
</xs:annotation>
90+
</xs:attribute>
91+
</xs:complexType>
92+
</xs:element>
793
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
894
<xs:complexType>
995
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">

RegexDialog/RegExToolDialog.xaml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public partial class RegExToolDialog : Window
4848

4949
private bool mustSelectEditor;
5050

51-
private readonly IEvaluator csEval = CSScript.Evaluator;
51+
private readonly IEvaluator csEval = CSScript.MonoEvaluator;
5252

5353
private readonly BracketColorizer currentBracketColorizer = new BracketColorizer();
5454
private readonly BracketColorizer matchingBracketColorizer = new BracketColorizer();

RegexDialog/RegexDialog.csproj

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" />
34
<Import Project="..\packages\Microsoft.Net.Compilers.3.8.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.3.8.0\build\Microsoft.Net.Compilers.props')" />
45
<Import Project="..\packages\Microsoft.CodeAnalysis.Analyzers.3.3.2\build\Microsoft.CodeAnalysis.Analyzers.props" Condition="Exists('..\packages\Microsoft.CodeAnalysis.Analyzers.3.3.2\build\Microsoft.CodeAnalysis.Analyzers.props')" />
56
<Import Project="..\packages\PropertyChanged.Fody.3.3.1\build\PropertyChanged.Fody.props" Condition="Exists('..\packages\PropertyChanged.Fody.3.3.1\build\PropertyChanged.Fody.props')" />
@@ -44,11 +45,15 @@
4445
<StartupObject />
4546
</PropertyGroup>
4647
<ItemGroup>
48+
<Reference Include="Costura, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
49+
<HintPath>..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
50+
</Reference>
4751
<Reference Include="CSScriptLibrary, Version=3.30.5.1, Culture=neutral, PublicKeyToken=70fcc3d18c749033, processorArchitecture=MSIL">
4852
<HintPath>..\packages\CS-Script.bin.3.30.5.1\lib\net45\CSScriptLibrary.dll</HintPath>
53+
<EmbedInteropTypes>False</EmbedInteropTypes>
4954
</Reference>
5055
<Reference Include="CSSRoslynProvider, Version=3.28.3.0, Culture=neutral, processorArchitecture=MSIL">
51-
<HintPath>..\packages\CS-Script.RoslynProvider.3.28.7\lib\net46\CSSRoslynProvider.dll</HintPath>
56+
<HintPath>..\packages\CS-Script.RoslynProvider.3.30.3\lib\net46\CSSRoslynProvider.dll</HintPath>
5257
</Reference>
5358
<Reference Include="EPPlus, Version=4.5.3.2, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
5459
<HintPath>..\packages\EPPlus.4.5.3.2\lib\net40\EPPlus.dll</HintPath>
@@ -263,6 +268,7 @@
263268
</ItemGroup>
264269
<ItemGroup>
265270
<Compile Include="GlobalSuppressions.cs" />
271+
<Compile Include="Scripting.native.Roslyn.cs" />
266272
<Compile Include="UIHelpers\AttachedProperties\TextBoxHelper.cs" />
267273
<Compile Include="UIHelpers\AttachedProperties\WindowHelper.cs" />
268274
<Compile Include="UIHelpers\Behaviors\SimplePropertyBindingBehavior.cs" />
@@ -449,6 +455,7 @@
449455
<Error Condition="!Exists('..\packages\Microsoft.CodeAnalysis.Analyzers.3.3.2\build\Microsoft.CodeAnalysis.Analyzers.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeAnalysis.Analyzers.3.3.2\build\Microsoft.CodeAnalysis.Analyzers.targets'))" />
450456
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.3.8.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.3.8.0\build\Microsoft.Net.Compilers.props'))" />
451457
<Error Condition="!Exists('..\packages\Ookii.Dialogs.3.1.0\build\Ookii.Dialogs.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Ookii.Dialogs.3.1.0\build\Ookii.Dialogs.targets'))" />
458+
<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'))" />
452459
</Target>
453460
<Import Project="..\packages\Fody.6.3.0\build\Fody.targets" Condition="Exists('..\packages\Fody.6.3.0\build\Fody.targets')" />
454461
<Import Project="..\packages\Microsoft.CodeAnalysis.Analyzers.3.3.2\build\Microsoft.CodeAnalysis.Analyzers.targets" Condition="Exists('..\packages\Microsoft.CodeAnalysis.Analyzers.3.3.2\build\Microsoft.CodeAnalysis.Analyzers.targets')" />
+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
using System;
2+
using System.IO;
3+
using System.Linq;
4+
using System.Reflection;
5+
using CSScriptLibrary;
6+
7+
// The VB.NET samples can be found here: https://github.com/oleg-shilo/cs-script/tree/master/Source/NuGet/content/vb
8+
9+
namespace CSScriptNativeApi
10+
{
11+
public class CodeDom_Roslyn
12+
{
13+
public static void Test()
14+
{
15+
CSScript.GlobalSettings.UseAlternativeCompiler = LocateRoslynCSSProvider();
16+
CSScript.GlobalSettings.RoslynDir = LocateRoslynCompilers();
17+
18+
var sayHello = CSScript.LoadMethod(@"static void SayHello(string greeting)
19+
{
20+
var tuple = (1,2);
21+
void test()
22+
{
23+
Console.WriteLine(""Hello from C#7!"");
24+
Console.WriteLine(tuple);
25+
}
26+
test();
27+
28+
Console.WriteLine(greeting);
29+
}")
30+
.GetStaticMethod();
31+
32+
sayHello("Hello World!");
33+
}
34+
static string Root { get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); } }
35+
36+
static string LocateRoslynCompilers()
37+
{
38+
try
39+
{
40+
// Roslyn compilers are distributed as a NuGet package but the binaries are never copied into the output folder.
41+
// Thus the path tho the compilers needs to be discovered dynamically.
42+
// The algorithm below is simplistic and does not check for highest version if multiple packages are found.
43+
44+
string packageDir = Path.Combine(Root, "..", "..", "..", "packages");
45+
string roslynDir = Path.Combine(Directory.GetDirectories(packageDir, "Microsoft.Net.Compilers.*").First(), "tools");
46+
return roslynDir;
47+
}
48+
catch
49+
{
50+
throw new Exception("Cannot locate Roslyn compiler (csc.exe). You can set it manually ");
51+
}
52+
}
53+
54+
static string LocateRoslynCSSProvider()
55+
{
56+
return Path.Combine(Root, "CSSRoslynProvider.dll");
57+
}
58+
}
59+
}

RegexDialog/packages.config

+2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="AvalonEdit" version="6.0.1" targetFramework="net46" />
4+
<package id="Costura.Fody" version="4.1.0" targetFramework="net47" />
45
<package id="CS-Script.bin" version="3.30.5.1" targetFramework="net46" />
56
<package id="CS-Script.lib" version="3.30.5.1" targetFramework="net46" />
7+
<package id="CS-Script.RoslynProvider" version="3.30.3" targetFramework="net47" />
68
<package id="EPPlus" version="4.5.3.2" targetFramework="net46" />
79
<package id="Fody" version="6.3.0" targetFramework="net46" developmentDependency="true" />
810
<package id="Microsoft.CodeAnalysis.Analyzers" version="3.3.2" targetFramework="net46" developmentDependency="true" />

0 commit comments

Comments
 (0)