Skip to content

Commit 6352f9b

Browse files
committed
升级到 .NET Standard 1.4
1 parent adccdff commit 6352f9b

21 files changed

+18
-781
lines changed

Analysis/Ini2DotNet.vb

-5
This file was deleted.

Entities/EntityInferContext.vb

+3-3
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Public Class EntityInferContext
176176
End If
177177
Next
178178
Dim helptext = TrimHelp(HelpProvider.GetHelpText(key))
179-
cls.Item1.Properties.Add(key, New VBPropertyDeclaration(NamespaceBuilder.sb, helptext, helptext.Contains("<已"), New VBPropertyDeclarationSilm(key, HelpProvider.TempAnalizeUsage(values)) With {.TypeNameOverride = itf, .IsQueryable = valueArray.Length > 1}, Nothing, False))
179+
cls.Item1.Properties.Add(key, New VBPropertyDeclaration(NamespaceBuilder.BaseStringBuilder, helptext, helptext.Contains("<已"), New VBPropertyDeclarationSilm(key, HelpProvider.TempAnalizeUsage(values)) With {.TypeNameOverride = itf, .IsQueryable = valueArray.Length > 1}, Nothing, False))
180180
Next
181181
Next
182182
End Sub
@@ -224,7 +224,7 @@ Public Class EntityInferContext
224224
'可能的基类的主键
225225
Dim itfName = curItf.Name
226226
Dim pkSilm As New VBPropertyDeclarationSilm(itfName + "Id", "String")
227-
Dim pk As New VBPropertyDeclaration(NamespaceBuilder.sb, $"用于在Ini中索引{itfName}数据", False, pkSilm, Nothing, True)
227+
Dim pk As New VBPropertyDeclaration(NamespaceBuilder.BaseStringBuilder, $"用于在Ini中索引{itfName}数据", False, pkSilm, Nothing, True)
228228
curBase.Properties.Add(pkSilm.Name, pk)
229229
If itf.Item2 Is Nothing Then Continue For
230230
'查阅接口记录注册了哪些类
@@ -257,7 +257,7 @@ Public Class EntityInferContext
257257
'向接口添加冗余的临时属性
258258
curItf.Properties.Add(key, declSilm)
259259
'向可能的基类添加属性
260-
Dim decl As New VBPropertyDeclaration(NamespaceBuilder.sb, helpText, helpText.Contains("<已"), declSilm, Nothing, False)
260+
Dim decl As New VBPropertyDeclaration(NamespaceBuilder.BaseStringBuilder, helpText, helpText.Contains("<已"), declSilm, Nothing, False)
261261
curBase.Properties.Add(key, decl)
262262
End If
263263
Next

Entities/GeneratedCodeFile.vb

-9
This file was deleted.

Entities/ProjectBasicInformation.vb

-31
This file was deleted.

Entities/VBClassBuilder.vb

-38
This file was deleted.

Entities/VBInterfaceBuilder.vb

-21
This file was deleted.

Entities/VBNamespaceBuilder.vb

-22
This file was deleted.

Entities/VBProjectWriter.vb

+5-147
Original file line numberDiff line numberDiff line change
@@ -1,153 +1,11 @@
11
Imports System.Reflection
22
Imports System.Text
3-
Imports Nukepayload2.Ra2CodeAnalysis.Linq
3+
Imports Nukepayload2.CodeAnalysis
4+
Imports Nukepayload2.CodeAnalysis.Linq
45

5-
Public Class VBProjectWriter
6-
7-
''' <summary>
8-
''' 项目名称(不含拓展名)
9-
''' </summary>
10-
Public Property ProjectName As String
11-
''' <summary>
12-
''' 生成与 .NET Standard 1.2 等价目标的 VB 14 类库项目文件
13-
''' </summary>
14-
''' <param name="CodeFileNames">生成的代码文件名(可以省略.vb拓展名)</param>
15-
Public Function GeneratePcl44Proj(CodeFileNames As IEnumerable(Of String)) As GeneratedCodeFile
16-
Dim xdoc =
17-
$"<?xml version=""1.0"" encoding=""utf-8""?>
18-
<Project ToolsVersion=""14.0"" DefaultTargets=""Build"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
19-
<Import Project=""$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"" Condition=""Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')""/>
20-
<PropertyGroup>
21-
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
22-
<Configuration Condition="" '$(Configuration)' == '' "">Debug</Configuration>
23-
<Platform Condition="" '$(Platform)' == '' "">AnyCPU</Platform>
24-
<ProjectGuid>{{1FCBC551-B7E3-4FC8-8CCF-111A7A1F1469}}</ProjectGuid>
25-
<OutputType>Library</OutputType>
26-
<RootNamespace>{ProjectName}</RootNamespace>
27-
<AssemblyName>{ProjectName}</AssemblyName>
28-
<DefaultLanguage>zh-CN</DefaultLanguage>
29-
<ProjectTypeGuids>{{14182A97-F7F0-4C62-8B27-98AA8AE2109A}};{{F184B08F-C81C-45F6-A57F-5ABD9991F28F}}</ProjectTypeGuids>
30-
<TargetFrameworkProfile>Profile44</TargetFrameworkProfile>
31-
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
32-
</PropertyGroup>
33-
<PropertyGroup Condition="" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "">
34-
<DebugSymbols>true</DebugSymbols>
35-
<DebugType>full</DebugType>
36-
<DefineDebug>true</DefineDebug>
37-
<DefineTrace>true</DefineTrace>
38-
<DefineConstants>
39-
</DefineConstants>
40-
<OutputPath>bin\Debug</OutputPath>
41-
<DocumentationFile>{ProjectName}.xml</DocumentationFile>
42-
<NoWarn>40057,42016,41999,42020,42021,42022</NoWarn>
43-
<WarningsAsErrors>42017,42018,42019,42032,42036</WarningsAsErrors>
44-
</PropertyGroup>
45-
<PropertyGroup Condition="" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "">
46-
<DebugType>pdbonly</DebugType>
47-
<DefineDebug>false</DefineDebug>
48-
<DefineTrace>true</DefineTrace>
49-
<DefineConstants>
50-
</DefineConstants>
51-
<Optimize>true</Optimize>
52-
<OutputPath>bin\Release</OutputPath>
53-
<DocumentationFile>{ProjectName}.xml</DocumentationFile>
54-
<NoWarn>40057,42016,41999,42020,42021,42022</NoWarn>
55-
<WarningsAsErrors>42017,42018,42019,42032,42036</WarningsAsErrors>
56-
</PropertyGroup>
57-
<PropertyGroup>
58-
<OptionExplicit>On</OptionExplicit>
59-
</PropertyGroup>
60-
<PropertyGroup>
61-
<OptionCompare>Binary</OptionCompare>
62-
</PropertyGroup>
63-
<PropertyGroup>
64-
<OptionStrict>On</OptionStrict>
65-
</PropertyGroup>
66-
<PropertyGroup>
67-
<OptionInfer>On</OptionInfer>
68-
</PropertyGroup>
69-
<ItemGroup>
70-
<Import Include=""Microsoft.VisualBasic""/>
71-
<Import Include=""System""/>
72-
<Import Include=""System.Collections""/>
73-
<Import Include=""System.Collections.Generic""/>
74-
<Import Include=""System.Collections.ObjectModel""/>
75-
<Import Include=""System.ComponentModel""/>
76-
<Import Include=""System.Diagnostics""/>
77-
<Import Include=""System.IO""/>
78-
<Import Include=""System.Linq""/>
79-
<Import Include=""System.Runtime.CompilerServices""/>
80-
<Import Include=""System.Threading.Tasks""/>
81-
<Import Include=""System.Xml.Linq""/>
82-
<Import Include=""System.ComponentModel.DataAnnotations""/>
83-
</ItemGroup>
84-
<ItemGroup>
85-
{Aggregate f In CodeFileNames Select $"<Compile Include=""{If(f.EndsWith(".vb"), f, f + ".vb")}""/>" Into Join(8)}
86-
<Compile Include=""My Project\AssemblyInfo.vb""/>
87-
</ItemGroup>
88-
<ItemGroup>
89-
<None Include=""packages.config""/>
90-
</ItemGroup>
91-
<Import Project=""$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.VisualBasic.targets""/>
92-
</Project>"
93-
Return New GeneratedCodeFile(ProjectName + ".vbproj", xdoc)
94-
End Function
95-
96-
Public Function GenerateAssemblyInfo() As GeneratedCodeFile
97-
Dim fileName = "AssemblyInfo.vb"
98-
Dim content = $"Imports System
99-
Imports System.Resources
100-
Imports System.Reflection
101-
102-
' 有关程序集的一般信息由以下
103-
' 控制。更改这些特性值可修改
104-
' 与程序集关联的信息。
105-
106-
'查看程序集特性的值
107-
108-
<Assembly: AssemblyTitle(""{ProjectName}"")>
109-
<Assembly: AssemblyDescription("" Nukepayload2.Ra2CodeAnalysis 生成"")>
110-
<Assembly: AssemblyCompany("""")>
111-
<Assembly: AssemblyProduct(""{ProjectName}"")>
112-
<Assembly: AssemblyCopyright(""版权所有(C) 2016"")>
113-
<Assembly: AssemblyTrademark("""")>
114-
<Assembly: NeutralResourcesLanguage(""zh-Hans"")>
115-
116-
' 程序集的版本信息由下列四个值组成:
117-
'
118-
' 主版本
119-
' 次版本
120-
' 生成号
121-
' 修订号
122-
'
123-
'可以指定所有这些值,也可以使用 ""生成号"" 和 ""修订号"" 的默认值,
124-
' 方法是按如下所示使用""*"": :
125-
' <Assembly: AssemblyVersion(""1.0.*"")>
126-
127-
<Assembly: AssemblyVersion(""1.0.0.0"")>
128-
<Assembly: AssemblyFileVersion(""1.0.0.0"")>
129-
"
130-
Return New GeneratedCodeFile(fileName, content)
131-
End Function
132-
133-
''' <summary>
134-
''' 获取嵌入的类型以便解析某些ini文件
135-
''' </summary>
136-
Public Async Function GetEmbeddedCodeFileAsync() As Task(Of GeneratedCodeFile)
137-
Dim content As String
138-
Using strm = Me.GetType.GetTypeInfo.Assembly.GetManifestResourceStream("Nukepayload2.Ra2CodeAnalysis.Percentage.vb"), sr = New StreamReader(strm, Encoding.UTF8)
139-
content = Await sr.ReadToEndAsync()
140-
End Using
141-
Return New GeneratedCodeFile("Percentage.vb", content)
142-
End Function
143-
144-
Public Function GeneratePackageConfig() As GeneratedCodeFile
145-
Return New GeneratedCodeFile("packages.config", "<?xml version=""1.0"" encoding=""utf-8""?>
146-
<packages>
147-
<package id=""System.ComponentModel.Annotations"" version=""4.1.0"" targetFramework=""portable46-net451+win81"" />
148-
</packages>")
149-
End Function
6+
Public Module VBProjectWriterExtension
1507

8+
<Extension>
1519
Public Function GenerateVBFileFromIni(d As NamedIniAnalyzer) As GeneratedCodeFile
15210
Dim hlp As HelpProvider = New EmptyHelpProvider
15311
Select Case d.FileNameWithoutExt.ToLower
@@ -173,4 +31,4 @@ Imports System.Reflection
17331
ns.EndBlock()
17432
Return New GeneratedCodeFile(d.FileNameWithoutExt + ".vb", sb.ToString)
17533
End Function
176-
End Class
34+
End Module

Entities/VBPropertyAssignmentDeclaration.vb

-23
This file was deleted.

0 commit comments

Comments
 (0)