diff --git a/build/Version.props b/build/Version.props index a95bf24..b409e73 100644 --- a/build/Version.props +++ b/build/Version.props @@ -1,5 +1,5 @@ - 0.1.17759-alpha + 0.1.19002-alpha \ No newline at end of file diff --git a/src/dotnetCampus.SourceYard/Assets/Current/dotnetCampus.SourceYard.targets b/src/dotnetCampus.SourceYard/Assets/Current/dotnetCampus.SourceYard.targets index d8497eb..105a687 100644 --- a/src/dotnetCampus.SourceYard/Assets/Current/dotnetCampus.SourceYard.targets +++ b/src/dotnetCampus.SourceYard/Assets/Current/dotnetCampus.SourceYard.targets @@ -85,7 +85,7 @@ -i "$(SourcePackingDirectory)Package " -n "$(PackageOutputPath) " -n "$(OutputPath) " - --PackageReferenceVersion $(PackageReferenceVersionFile) + --PackageReferenceVersion "$(PackageReferenceVersionFile)" diff --git a/src/dotnetCampus.SourceYard/Properties/launchSettings.json b/src/dotnetCampus.SourceYard/Properties/launchSettings.json deleted file mode 100644 index 7a50fba..0000000 --- a/src/dotnetCampus.SourceYard/Properties/launchSettings.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "profiles": - { - "Pack for Test": - { - "commandName": "Project", - "commandLineArgs": " -p D:\\程序\\ethylene156\\KatemBallpaka\\NemsaBairgasmay\\NemsaBairgasmay.csproj -i obj\\Debug\\netcoreapp2.1\\SourcePacking\\Package -n bin\\Debug\\ -v 1.0.1 --Compile obj\\Debug\\netcoreapp2.1\\SourcePacking\\CompileFile.txt --Resource obj\\Debug\\netcoreapp2.1\\SourcePacking\\ResourceFile.txt --Content obj\\Debug\\netcoreapp2.1\\SourcePacking\\ContentFile.txt --Page obj\\Debug\\netcoreapp2.1\\SourcePacking\\PageFile.txt --ApplicationDefinition obj\\Debug\\netcoreapp2.1\\SourcePacking\\ApplicationDefinitionFile.txt --Authors NemsaBairgasmay --debug true ", - "workingDirectory": "D:\\程序\\ethylene156\\KatemBallpaka\\NemsaBairgasmay" - }, - "lindexi": { - "commandName": "Project", - "commandLineArgs": " -p D:\\程序\\ethylene156\\KatemBallpaka\\BemateRaimarhas\\BemateRaimarhas.csproj -i obj\\Debug\\net45\\SourcePacking\\Package -n bin\\Debug\\ -v 1.0.0 --Compile obj\\Debug\\net45\\SourcePacking\\CompileFile.txt --Resource obj\\Debug\\net45\\SourcePacking\\ResourceFile.txt --Content obj\\Debug\\net45\\SourcePacking\\ContentFile.txt --Page obj\\Debug\\net45\\SourcePacking\\PageFile.txt --ApplicationDefinition obj\\Debug\\net45\\SourcePacking\\ApplicationDefinitionFile.txt --None obj\\Debug\\net45\\SourcePacking\\NoneFile.txt --EmbeddedResource obj\\Debug\\net45\\SourcePacking\\EmbeddedResourceFile.txt --Authors BemateRaimarhas --debug true", - "workingDirectory": "D:\\程序\\ethylene156\\KatemBallpaka\\BemateRaimarhas" - } - } -} \ No newline at end of file diff --git a/src/dotnetCampus.SourceYard/Utils/BuildProps.cs b/src/dotnetCampus.SourceYard/Utils/BuildProps.cs index fafd7e1..edba459 100644 --- a/src/dotnetCampus.SourceYard/Utils/BuildProps.cs +++ b/src/dotnetCampus.SourceYard/Utils/BuildProps.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using dotnetCampus.Configurations; +using dotnetCampus.Configurations.Core; namespace dotnetCampus.SourceYard.Utils { @@ -126,107 +128,16 @@ public void SetSourcePackingDirectory(string packingDirectory) // 这个文件里面存放使用 fkv 配置 if (File.Exists(sourceProjectPackageFile)) { - // todo 等待高性能配置发布 - var configList = DeserializeFile(new FileInfo(sourceProjectPackageFile)); + var fileConfigurationRepo = new FileConfigurationRepo(sourceProjectPackageFile); - if (configList.TryGetValue("RepositoryType", out var repositoryType)) - { - RepositoryType = repositoryType.Trim(); - } - - if (configList.TryGetValue("PackageProjectUrl", out var packageProjectUrl)) - { - PackageProjectUrl = packageProjectUrl.Trim(); - } - - if (configList.TryGetValue("RepositoryUrl", out var repositoryUrl)) - { - RepositoryUrl = repositoryUrl.Trim(); - } - } - } + var appConfigurator = fileConfigurationRepo.CreateAppConfigurator(); - // 这里代码从Configurations复制 - private Dictionary DeserializeFile(FileInfo file) - { - // 一次性读取完的性能最好 - var str = File.ReadAllText(file.FullName); - str = str.Replace("\r\n", "\n"); - return Deserialize(str); - } - private static string _splitString = ">"; + RepositoryType = appConfigurator.Default.GetValue("RepositoryType"); - private static string _escapeString = "?"; + PackageProjectUrl = appConfigurator.Default.GetValue("PackageProjectUrl"); - /// - /// 反序列化的核心实现,反序列化字符串 - /// - /// - private Dictionary Deserialize(string str) - { - var keyValuePairList = str.Split('\n'); - var keyValue = new Dictionary(StringComparer.Ordinal); - string? key = null; - var splitString = _splitString; - - foreach (var temp in keyValuePairList.Select(temp => temp.Trim())) - { - if (temp.StartsWith(splitString, StringComparison.Ordinal)) - { - // 分割,可以作为注释,这一行忽略 - // 下一行必须是key - key = null; - continue; - } - - var unescapedString = UnescapeString(temp); - - if (key == null) - { - key = unescapedString; - - // 文件存在多个地方都记录相同的值 - // 如果有多个地方记录相同的值,使用最后的值替换前面文件 - if (keyValue.ContainsKey(key)) - { - keyValue.Remove(key); - } - } - else - { - if (keyValue.ContainsKey(key)) - { - // key - // v1 - // v2 - // 返回 {"key","v1\nv2"} - keyValue[key] = keyValue[key] + "\n" + unescapedString; - } - else - { - keyValue.Add(key, unescapedString); - } - } + RepositoryUrl = appConfigurator.Default.GetValue("RepositoryUrl"); } - - return keyValue; - } - - /// - /// 存储的反转义 - /// - /// - /// - private static string UnescapeString(string str) - { - var escapeString = _escapeString; - - if (str.StartsWith(escapeString, StringComparison.Ordinal)) - { - return str.Substring(1); - } - - return str; } } } \ No newline at end of file diff --git a/src/dotnetCampus.SourceYard/dotnetCampus.SourceYard.csproj b/src/dotnetCampus.SourceYard/dotnetCampus.SourceYard.csproj index 04d37e7..d82984d 100644 --- a/src/dotnetCampus.SourceYard/dotnetCampus.SourceYard.csproj +++ b/src/dotnetCampus.SourceYard/dotnetCampus.SourceYard.csproj @@ -31,6 +31,7 @@ + @@ -41,6 +42,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive +