diff --git a/CopyrightHelper/CH.csproj b/CopyrightHelper/CH.csproj index 85f82bd1cd482b60442076ac1388d2cb9839be48..819ad7c12384a134161461098c6f682d5b8dde21 100644 --- a/CopyrightHelper/CH.csproj +++ b/CopyrightHelper/CH.csproj @@ -17,9 +17,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/CopyrightHelper/ConfigToolWindowControl.xaml b/CopyrightHelper/ConfigToolWindowControl.xaml index ec959a34565ddb86cc29cb2115939b6277783d02..7210c83c73a7e8c4dd1a1e789e78354d057853fa 100644 --- a/CopyrightHelper/ConfigToolWindowControl.xaml +++ b/CopyrightHelper/ConfigToolWindowControl.xaml @@ -23,7 +23,12 @@ - + + + + + + @@ -40,18 +45,24 @@ - + - + + + diff --git a/CopyrightHelper/ConfigToolWindowControl.xaml.cs b/CopyrightHelper/ConfigToolWindowControl.xaml.cs index 9ed2850c1bdd3e43204f6c9a967f124425ace0f8..ab551e534fa16bb34f2b98b7f8f6d79f541e0035 100644 --- a/CopyrightHelper/ConfigToolWindowControl.xaml.cs +++ b/CopyrightHelper/ConfigToolWindowControl.xaml.cs @@ -43,7 +43,9 @@ namespace CopyrightHelper txtYourName.Text = cfg.YourName; cbIsInsertToTop.IsChecked = cfg.IsInsertToTop; txtTimeFormat.Text = cfg.TimeFormat; - + txtEmail.Text = cfg.Email; + txtVersion.Text = cfg.Version; + BindTypeList(); lbType.SelectedIndex = 0; @@ -184,6 +186,11 @@ namespace CopyrightHelper cfg.YourName = txtYourName.Text.Trim(); cfg.IsInsertToTop = cbIsInsertToTop.IsChecked == true; var tf = txtTimeFormat.Text.Trim(); + + cfg.Email = txtEmail.Text.Trim(); + cfg.Version= txtVersion.Text.Trim (); + + if (!string.IsNullOrEmpty(tf)) { try @@ -232,8 +239,9 @@ namespace CopyrightHelper MessageBox.Show($"CopyrightHelper v{Constants.FileVersion} by Fallstar" + Environment.NewLine + "Home : http://git.oschina.net/fallstar/CopyrightHelper"); } - #endregion + #endregion + } } \ No newline at end of file diff --git a/CopyrightHelper/Core/CopyrightCore.cs b/CopyrightHelper/Core/CopyrightCore.cs index dd12323425a3d51b664ca9f0a7c2e8b9898df2a1..291b95ad9ed91b7093d4037801f684942ace46d5 100644 --- a/CopyrightHelper/Core/CopyrightCore.cs +++ b/CopyrightHelper/Core/CopyrightCore.cs @@ -85,6 +85,9 @@ namespace CopyrightHelper.Core return ConvertToolItem(it); } + + + /// /// 转换为用于插入的语句 /// @@ -102,12 +105,14 @@ namespace CopyrightHelper.Core content = content.Replace("@yourname", cfg.YourName); content = content.Replace("@year", DateTime.Now.Year.ToString()); content = content.Replace("@time", DateTime.Now.ToString(tf)); + content = content.Replace("@email", cfg.Email); + content = content.Replace("@guid", Guid.NewGuid().ToString().ToUpper()); + content = content.Replace("@version", cfg.Version); //修正换行不对问题 if (content.Contains("\r\n")) content.Replace("\r\n", Environment.NewLine); else if (content.Contains("\n")) content.Replace("\n", Environment.NewLine); - return content; } #endregion diff --git a/CopyrightHelper/Core/StoreHelper.cs b/CopyrightHelper/Core/StoreHelper.cs index 4bae423137291287901916fd8b7b812bfc91c662..b0f82e8dac881578beaad5a22abdd7a7d72e9013 100644 --- a/CopyrightHelper/Core/StoreHelper.cs +++ b/CopyrightHelper/Core/StoreHelper.cs @@ -4,6 +4,7 @@ * 说明:用于对配置文件的读写。 * ======================================================================== */ + using System; using System.Collections.Generic; using System.Linq; @@ -41,6 +42,8 @@ namespace CopyrightHelper.Core return store; } + + /// /// 生成默认配置 /// @@ -57,13 +60,20 @@ namespace CopyrightHelper.Core { Key = "*.*", }; - it.Content = @"//=================================================== -// Copyright @ @company @year -// 作者:@yourname -// 时间:@time -// 说明: -//=================================================== -"; + it.Content = +@"#region << 版 本 注 释 >> + /*---------------------------------------------------------------- + * 版权所有 Copyright © @company @year。 + * 作者:@yourname + * 时间:@time + * 邮箱:@email + * Guid:@guid + * 版本:@version + * 描述: + * + *----------------------------------------------------------------*/ + #endregion << 版 本 注 释 >>"; + cfg.Configs.Add(it); return cfg; } diff --git a/CopyrightHelper/Models/StoreConfig.cs b/CopyrightHelper/Models/StoreConfig.cs index 358e8114578a28a3d7a0e1356f35d015d69e03db..e78beb9e2d01b221151f10845848631f009b6b65 100644 --- a/CopyrightHelper/Models/StoreConfig.cs +++ b/CopyrightHelper/Models/StoreConfig.cs @@ -30,6 +30,7 @@ namespace CopyrightHelper.Models /// 你的名称 /// public string YourName { get; set; } + /// /// 公司名称 /// @@ -40,6 +41,21 @@ namespace CopyrightHelper.Models /// public string TimeFormat { get; set; } = "yyyy-MM-dd HH:mm:ss"; + /// + /// 邮箱 + /// + public string Email { get; set; } + + /// + /// 版本号 + /// + public string Version { get; set; } + + + + + + /// /// 是否将结果插入到文件头 /// diff --git a/UnitTest/CopyrightCoreTest.cs b/UnitTest/CopyrightCoreTest.cs index c5cf04cc50df73ad97469adf7109983244769e61..516090142fc682d71e01cdb5093f755404ccbdf0 100644 --- a/UnitTest/CopyrightCoreTest.cs +++ b/UnitTest/CopyrightCoreTest.cs @@ -1,9 +1,5 @@ -//=================================================== -// Copyright @ Thpower.com 2016 -// 作者:Fallstar -// 时间:2016-05-30 14:27:11 -// 说明: -//=================================================== + + using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using CopyrightHelper.Core; diff --git a/UnitTest/UnitTest.csproj b/UnitTest/UnitTest.csproj index 13dbc4d7543b13b98fdf367ed200fb447c319b1c..99537c306c5eae64744e930187c5dbe195f26add 100644 --- a/UnitTest/UnitTest.csproj +++ b/UnitTest/UnitTest.csproj @@ -8,7 +8,7 @@ Properties UnitTest UnitTest - v4.5.2 + v4.8 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10.0 @@ -16,6 +16,7 @@ $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages False UnitTest + true diff --git a/UnitTest/app.config b/UnitTest/app.config index cb0013633a61025c46c6145a2b94db471c1e9691..dccc41098c48dceb2eef165a2e97d375cbd3d749 100644 --- a/UnitTest/app.config +++ b/UnitTest/app.config @@ -1,39 +1,39 @@ - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - \ No newline at end of file +