Skip to content

Commit b193679

Browse files
新增功能:单个或批量更新AssemblyInfo.cs文件;保存为模板。
1 parent 9f45a7d commit b193679

14 files changed

Lines changed: 1421 additions & 42 deletions

AssemblyInfoManager.csproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,24 @@
5757
<Reference Include="System.Xml" />
5858
</ItemGroup>
5959
<ItemGroup>
60+
<Compile Include="Entity\Actions.cs" />
6061
<Compile Include="Entity\AssemblyInformation.cs" />
6162
<Compile Include="Entity\AssemblyVersion.cs" />
63+
<Compile Include="Entity\ProgressStatus.cs" />
64+
<Compile Include="Generators\TemplateGenerator.cs">
65+
<AutoGen>True</AutoGen>
66+
<DesignTime>True</DesignTime>
67+
<DependentUpon>TemplateGenerator.tt</DependentUpon>
68+
</Compile>
69+
<Compile Include="Generators\TemplateGeneratorPartial.cs" />
6270
<Compile Include="Globalization\Culture.cs" />
6371
<Compile Include="Program.cs" />
6472
<Compile Include="Properties\AssemblyInfo.cs" />
6573
<Compile Include="Resources\Resource.cs" />
6674
<Compile Include="Resources\ResourceReader.cs" />
75+
<Compile Include="Threading\ProgressDescriptionUpdater.cs" />
76+
<Compile Include="Threading\ThreadArgs.cs" />
77+
<Compile Include="Threading\ThreadPoolHelper.cs" />
6778
<Compile Include="Windows\MainWindow.cs">
6879
<SubType>Form</SubType>
6980
</Compile>
@@ -84,6 +95,10 @@
8495
<DependentUpon>MainWindow.cs</DependentUpon>
8596
</EmbeddedResource>
8697
<None Include="app.config" />
98+
<None Include="Generators\TemplateGenerator.tt">
99+
<Generator>TextTemplatingFilePreprocessor</Generator>
100+
<LastGenOutput>TemplateGenerator.cs</LastGenOutput>
101+
</None>
87102
<None Include="Properties\Settings.settings">
88103
<Generator>SettingsSingleFileGenerator</Generator>
89104
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -100,6 +115,9 @@
100115
<EmbeddedResource Include="Resources\Icon.ico" />
101116
</ItemGroup>
102117
<ItemGroup />
118+
<ItemGroup>
119+
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
120+
</ItemGroup>
103121
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
104122
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
105123
Other similar extension points exist, see Microsoft.Common.targets.

Entity/Actions.cs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#region README
2+
3+
/*
4+
* README
5+
*
6+
* Current Thread User : GUOCOLAND\wangyucai
7+
* Machine Name : GLCHQWYCWINW7
8+
* Visual Studio : Microsoft Visual Studio 2010 Ultimate Edition
9+
* Create Time : 2014-11-21 9:57:49
10+
* Common Language Runtime : 4.0.30319.18444
11+
* Minimum .Net Framework Version : 4.0
12+
*
13+
* SourcePro Studio 2014
14+
* Project Url : https://github.com/SourceproStudio/CodeTemplates
15+
* Home Page Url : https://github.com/SourceproStudio
16+
* E-mail Address : MasterDuner@yeah.net or Yucai.Wang-Public@outlook.com
17+
* QQ : 180261899
18+
*/
19+
20+
#endregion
21+
22+
using System;
23+
24+
namespace SourcePro.Csharp.Lab.Entity
25+
{
26+
/// <summary>
27+
/// <para>
28+
/// 定义了更新动作。
29+
/// </para>
30+
/// <para>
31+
/// Namespace : <see cref="SourcePro.Csharp.Lab.Entity"/>
32+
/// </para>
33+
/// <para>
34+
/// Type : <see cref="Actions"/>
35+
/// </para>
36+
/// <para>
37+
/// The minimum .Net Framework version requirements : 4.0
38+
/// </para>
39+
/// </summary>
40+
/// <seealso cref="SourcePro.Csharp.Lab.Entity"/>
41+
[Serializable]
42+
public enum Actions : int
43+
{
44+
/// <summary>
45+
/// 仅更新单一程序集信息文件。
46+
/// </summary>
47+
SingleAssemblyInfoFile = 1,
48+
/// <summary>
49+
/// 更新指定目录下的所有程序集信息文件。
50+
/// </summary>
51+
AllAssemblyInfoFiles = 2
52+
}
53+
}
54+
55+
/*
56+
* Copyright © 2014 Wang Yucai. All rights reserved.
57+
*/

Entity/AssemblyInformation.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,13 @@ public sealed class AssemblyInformation
5555
private string _productName;
5656
private string _copyright;
5757
private string _trademark;
58-
private const string AssemblyTitle = @"^\[assembly\s?:\s*AssemblyTitle\(\""(?<AssemblyTitle>[\u0020\u0021\u0023-\uFFFF]*)\""\)]";
59-
private const string AssemblyDescription = @"^\[assembly\s?:\s*AssemblyDescription\(\""(?<AssemblyDescription>[\u0020\u0021\u0023-\uFFFF]*)\""\)]";
60-
private const string AssemblyCompany = @"^\[assembly\s?:\s*AssemblyCompany\(\""(?<AssemblyCompany>[\u0020\u0021\u0023-\uFFFF]*)\""\)]";
61-
private const string AssemblyProduct = @"^\[assembly\s?:\s*AssemblyProduct\(\""(?<AssemblyProduct>[\u0020\u0021\u0023-\uFFFF]*)\""\)]";
62-
private const string AssemblyCopyright = @"^\[assembly\s?:\s*AssemblyCopyright\(\""(?<AssemblyCopyright>[\u0020\u0021\u0023-\uFFFF]*)\""\)]";
63-
private const string AssemblyTrademark = @"^\[assembly\s?:\s*AssemblyTrademark\(\""(?<AssemblyTrademark>[\u0020\u0021\u0023-\uFFFF]*)\""\)]";
58+
public const string AssemblyTitle = @"^\[assembly\s?:\s*AssemblyTitle\(\""(?<AssemblyTitle>[\u0020\u0021\u0023-\uFFFF]*)\""\)]";
59+
public const string AssemblyDescription = @"^\[assembly\s?:\s*AssemblyDescription\(\""(?<AssemblyDescription>[\u0020\u0021\u0023-\uFFFF]*)\""\)]";
60+
public const string AssemblyCompany = @"^\[assembly\s?:\s*AssemblyCompany\(\""(?<AssemblyCompany>[\u0020\u0021\u0023-\uFFFF]*)\""\)]";
61+
public const string AssemblyProduct = @"^\[assembly\s?:\s*AssemblyProduct\(\""(?<AssemblyProduct>[\u0020\u0021\u0023-\uFFFF]*)\""\)]";
62+
public const string AssemblyCopyright = @"^\[assembly\s?:\s*AssemblyCopyright\(\""(?<AssemblyCopyright>[\u0020\u0021\u0023-\uFFFF]*)\""\)]";
63+
public const string AssemblyTrademark = @"^\[assembly\s?:\s*AssemblyTrademark\(\""(?<AssemblyTrademark>[\u0020\u0021\u0023-\uFFFF]*)\""\)]";
64+
public const string GeneratorComments = @"^/\*Generate\sBy\sAssemblyInfoManager\sv\d+\.\d+\.\d+\.\d+\s*\.\sTime\s?:\s\d{4}-\d{1,2}-\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2}\s?\*/$";
6465

6566
#region AssemblyInformation Constructors
6667

@@ -72,6 +73,7 @@ public sealed class AssemblyInformation
7273
public AssemblyInformation()
7374
{
7475
this.Version = new AssemblyVersion();
76+
this.Title = this.Description = this.CompanyName = this.ProductName = this.Copyright = this.Trademark = string.Empty;
7577
}
7678

7779
#endregion

Entity/AssemblyVersion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public sealed class AssemblyVersion
6262
private const string AutoBuildAndRevision = @"^\[assembly\s?:\s*AssemblyVersion\(\""(?<Major>\d+)\.(?<Minor>\d+).\*\""\)\]$";
6363
private const string AutoRevision = @"^\[assembly\s?:\s*AssemblyVersion\(\""(?<Major>\d+)\.(?<Minor>\d+).(?<Build>\d+).\*\""\)\]$";
6464
private const string AssemblyVersionStr = @"^\[assembly\s?:\s*AssemblyVersion\(\""(?<Major>\d+)\.(?<Minor>\d+).(?<Build>\d+).(?<Revision>\d+)\""\)\]$";
65-
private const string AssemblyFileVersionStr = @"^\[assembly\s?:\s*AssemblyFileVersion\(\""(?<Major>\d+)\.(?<Minor>\d+).(?<Build>\d+).(?<Revision>\d+)\""\)\]$";
65+
public const string AssemblyFileVersionStr = @"^\[assembly\s?:\s*AssemblyFileVersion\(\""(?<Major>\d+)\.(?<Minor>\d+).(?<Build>\d+).(?<Revision>\d+)\""\)\]$";
6666

6767

6868
#region AssemblyVersion Constructors

Entity/ProgressStatus.cs

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#region README
2+
3+
/*
4+
* README
5+
*
6+
* Current Thread User : GUOCOLAND\wangyucai
7+
* Machine Name : GLCHQWYCWINW7
8+
* Visual Studio : Microsoft Visual Studio 2010 Ultimate Edition
9+
* Create Time : 2014-11-21 10:03:14
10+
* Common Language Runtime : 4.0.30319.18444
11+
* Minimum .Net Framework Version : 4.0
12+
*
13+
* SourcePro Studio 2014
14+
* Project Url : https://github.com/SourceproStudio/CodeTemplates
15+
* Home Page Url : https://github.com/SourceproStudio
16+
* E-mail Address : MasterDuner@yeah.net or Yucai.Wang-Public@outlook.com
17+
* QQ : 180261899
18+
*/
19+
20+
#endregion
21+
22+
using System;
23+
24+
namespace SourcePro.Csharp.Lab.Entity
25+
{
26+
/// <summary>
27+
/// <para>
28+
/// 定义了进度状态。
29+
/// </para>
30+
/// <para>
31+
/// Namespace : <see cref="SourcePro.Csharp.Lab.Entity"/>
32+
/// </para>
33+
/// <para>
34+
/// Type : <see cref="ProgressStatus"/>
35+
/// </para>
36+
/// <para>
37+
/// The minimum .Net Framework version requirements : 4.0
38+
/// </para>
39+
/// </summary>
40+
/// <seealso cref="SourcePro.Csharp.Lab.Entity"/>
41+
[Serializable, Flags]
42+
public enum ProgressStatus
43+
{
44+
/// <summary>
45+
/// 准备中。
46+
/// </summary>
47+
Preparing = 1,
48+
/// <summary>
49+
/// 开始。
50+
/// </summary>
51+
Begin = 2,
52+
/// <summary>
53+
/// 进行中。
54+
/// </summary>
55+
Working = 4,
56+
/// <summary>
57+
/// 结束。
58+
/// </summary>
59+
End = 8,
60+
/// <summary>
61+
/// 成功完成。
62+
/// </summary>
63+
Completed = 16,
64+
/// <summary>
65+
/// 失败。
66+
/// </summary>
67+
Failed = 32
68+
}
69+
}
70+
71+
/*
72+
* Copyright © 2014 Wang Yucai. All rights reserved.
73+
*/

0 commit comments

Comments
 (0)