Skip to content

Commit

Permalink
Support to C# 8.0, several fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
PLTHLOU committed Jan 13, 2021
1 parent a92a97e commit cd809d3
Show file tree
Hide file tree
Showing 136 changed files with 830 additions and 894 deletions.
2 changes: 1 addition & 1 deletion Dapper.Crud.Tests/Dapper.Crud.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="xunit">
<Version>2.4.1</Version>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions Dapper.Crud.VSExtension.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2037
# Visual Studio Version 16
VisualStudioVersion = 16.0.30804.86
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapper.Crud.VSExtension", "Dapper.Crud.VSExtension\Dapper.Crud.VSExtension.csproj", "{E1F9280B-5191-4741-A4A9-C78DE32FFF7E}"
EndProject
Expand Down
203 changes: 114 additions & 89 deletions Dapper.Crud.VSExtension/Dapper.Crud.VSExtension.csproj

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion Dapper.Crud.VSExtension/Helpers/AssemblyHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace Dapper.Crud.VSExtension.Helpers
{
public static class AssemblyHelper
{
public static string codeGlobal;

private static Assembly BuildAssembly(string code)
{
using (var compiler = new Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider())
Expand All @@ -19,7 +21,7 @@ private static Assembly BuildAssembly(string code)
{
GenerateExecutable = false,
GenerateInMemory = true,
CompilerOptions = "/unsafe /optimize /langversion:7.1"
CompilerOptions = "/unsafe /optimize /langversion:8.0"
};

var assemblies = AppDomain.CurrentDomain
Expand Down Expand Up @@ -55,6 +57,7 @@ private static Assembly BuildAssembly(string code)

public static object ExecuteCode(string code, string namespacename, string classname, bool isstatic)
{
codeGlobal = code;
Assembly asm = BuildAssembly(code);
classname = FixClassName(classname);

Expand Down
4 changes: 3 additions & 1 deletion Dapper.Crud.VSExtension/Helpers/FileHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ public static string GenerateRawStringAllFiles(IEnumerable<string> fileList)
var strContent = File.ReadAllLines(file);
foreach (var line in strContent)
{
if (line.Contains("using"))
if (line.StartsWith("using") && line.EndsWith(";"))
{
lstUsings.Add(line);
}
else
lstContent.Add(line);
}
Expand Down
8 changes: 3 additions & 5 deletions Dapper.Crud.VSExtension/Logger/Logger.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Threading;
using Microsoft.VisualStudio.Shell.Interop;
using System;

namespace Dapper.Crud.VSExtension
Expand All @@ -23,7 +21,7 @@ public static void Log(object message)
{
if (EnsurePane())
{
ThreadHelper.Generic.BeginInvoke(() =>
Microsoft.VisualStudio.Shell.ThreadHelper.Generic.BeginInvoke(() =>
{
_pane.OutputStringThreadSafe(DateTime.Now + ": " + message + Environment.NewLine);
});
Expand All @@ -39,7 +37,7 @@ private static bool EnsurePane()
{
if (_pane == null)
{
ThreadHelper.JoinableTaskFactory.Run(async () =>
Microsoft.VisualStudio.Shell.ThreadHelper.JoinableTaskFactory.Run(async () =>
{
IVsOutputWindow output = (IVsOutputWindow)_provider.GetService(typeof(SVsOutputWindow));
if (_pane == null)
Expand Down
2 changes: 1 addition & 1 deletion Dapper.Crud.VSExtension/frmExtension.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cd809d3

Please sign in to comment.