From 2b035123a691b459496250cde9cbd4432a9ee61a Mon Sep 17 00:00:00 2001 From: MouriNaruto Date: Sat, 22 Jun 2024 15:12:15 +0800 Subject: [PATCH] Implement GenerateAppxManifestResourceIdentifies in NanaGet.RefreshPackageVersion. --- NanaGet.RefreshPackageVersion/Program.cs | 54 ++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/NanaGet.RefreshPackageVersion/Program.cs b/NanaGet.RefreshPackageVersion/Program.cs index cf97f5c..3ab4b8c 100644 --- a/NanaGet.RefreshPackageVersion/Program.cs +++ b/NanaGet.RefreshPackageVersion/Program.cs @@ -115,12 +115,66 @@ static void SwitchDevelopmentChannel() } } + static void GenerateAppxManifestResourceIdentifies() + { + string FilePath = string.Format( + @"{0}\NanaGetPackage\Package.appxmanifest", + RepositoryRoot); + + string Content = File.ReadAllText(FilePath); + + string PreviousContent = string.Empty; + { + string StartString = " \r\n"; + string EndString = " "; + + int Start = Content.IndexOf(StartString) + StartString.Length; + int End = Content.IndexOf(EndString); + + PreviousContent = Content.Substring(Start, End - Start); + } + + if (string.IsNullOrEmpty(PreviousContent)) + { + return; + } + + string NewContent = string.Empty; + { + DirectoryInfo Folder = new DirectoryInfo(string.Format( + @"{0}\NanaGetPackage\Strings", + RepositoryRoot)); + foreach (var item in Folder.GetDirectories()) + { + NewContent += string.Format( + " \r\n", + item.Name); + } + + int[] Scales = [100, 125, 150, 200, 400]; + foreach (var Scale in Scales) + { + NewContent += string.Format( + " \r\n", + Scale.ToString()); + } + } + + FileUtilities.SaveTextToFileAsUtf8Bom( + FilePath, + File.ReadAllText(FilePath).Replace( + PreviousContent, + NewContent)); + } + static void Main(string[] args) { RefreshAppxManifestVersion(); SwitchDevelopmentChannel(); + GenerateAppxManifestResourceIdentifies(); + Console.WriteLine( "NanaGet.RefreshPackageVersion task has been completed."); Console.ReadKey();