Skip to content

Commit

Permalink
Implement GenerateAppxManifestResourceIdentifies in NanaBox.RefreshPa…
Browse files Browse the repository at this point in the history
…ckageVersion.
  • Loading branch information
MouriNaruto committed Jun 20, 2024
1 parent 9be9989 commit f70e3d2
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions NanaBox.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}\NanaBoxPackage\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}\NanaBox\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(
"NanaBox.RefreshPackageVersion task has been completed.");
Console.ReadKey();
Expand Down

0 comments on commit f70e3d2

Please sign in to comment.