Skip to content

Commit

Permalink
Implement GenerateAppxManifestResourceIdentifies in NanaGet.RefreshPa…
Browse files Browse the repository at this point in the history
…ckageVersion.
  • Loading branch information
MouriNaruto committed Jun 22, 2024
1 parent 3bd48c0 commit 2b03512
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions NanaGet.RefreshPackageVersion/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = " <Resources>\r\n";
string EndString = " </Resources>";

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(
" <Resource Language=\"{0}\" />\r\n",
item.Name);
}

int[] Scales = [100, 125, 150, 200, 400];
foreach (var Scale in Scales)
{
NewContent += string.Format(
" <Resource uap:Scale=\"{0}\" />\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();
Expand Down

0 comments on commit 2b03512

Please sign in to comment.