Skip to content

Commit

Permalink
Implemeent NanaZip.ProjectAssetsGenerator project.
Browse files Browse the repository at this point in the history
  • Loading branch information
MouriNaruto committed Jun 22, 2024
1 parent 872e8a3 commit 472b215
Showing 1 changed file with 151 additions and 1 deletion.
152 changes: 151 additions & 1 deletion NanaZip.ProjectAssetsGenerator/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,159 @@
namespace NanaZip.ProjectAssetsGenerator
using ImageMagick;
using Mile.Project.Helpers;
using System.Collections.Concurrent;

namespace NanaZip.ProjectAssetsGenerator
{
internal class Program
{
static string RepositoryRoot = GitRepository.GetRootPath();

static void Main(string[] args)
{
{
string SourcePath = RepositoryRoot + @"\Assets\OriginalAssets\NanaZip";

string OutputPath = RepositoryRoot + @"\Assets\PackageAssets";

ConcurrentDictionary<int, MagickImage> StandardSources =
new ConcurrentDictionary<int, MagickImage>();
ConcurrentDictionary<int, MagickImage> ContrastBlackSources =
new ConcurrentDictionary<int, MagickImage>();
ConcurrentDictionary<int, MagickImage> ContrastWhiteSources =
new ConcurrentDictionary<int, MagickImage>();

ConcurrentDictionary<int, MagickImage> ArchiveFileSources =
new ConcurrentDictionary<int, MagickImage>();

ConcurrentDictionary<int, MagickImage> SfxStubSources =
new ConcurrentDictionary<int, MagickImage>();

foreach (var AssetSize in ProjectAssetsUtilities.AssetSizes)
{
StandardSources[AssetSize] = new MagickImage(string.Format(
@"{0}\{1}\{1}_{2}.png",
SourcePath,
"Standard",
AssetSize));
ContrastBlackSources[AssetSize] = new MagickImage(string.Format(
@"{0}\{1}\{1}_{2}.png",
SourcePath,
"ContrastBlack",
AssetSize));
ContrastWhiteSources[AssetSize] = new MagickImage(string.Format(
@"{0}\{1}\{1}_{2}.png",
SourcePath,
"ContrastWhite",
AssetSize));

ArchiveFileSources[AssetSize] = new MagickImage(string.Format(
@"{0}\{1}\{1}_{2}.png",
SourcePath,
"ArchiveFile",
AssetSize));

SfxStubSources[AssetSize] = new MagickImage(string.Format(
@"{0}\{1}\{1}_{2}.png",
SourcePath,
"SelfExtractingExecutable",
AssetSize));
}

ProjectAssetsUtilities.GeneratePackageApplicationImageAssets(
StandardSources,
ContrastBlackSources,
ContrastWhiteSources,
OutputPath);

ProjectAssetsUtilities.GeneratePackageFileAssociationImageAssets(
ArchiveFileSources,
OutputPath,
@"ArchiveFile");

ProjectAssetsUtilities.GenerateIconFile(
StandardSources,
OutputPath + @"\..\NanaZip.ico");

ProjectAssetsUtilities.GenerateIconFile(
SfxStubSources,
OutputPath + @"\..\NanaZipSfx.ico");

StandardSources[64].Write(
OutputPath + @"\..\NanaZip.png");
}

{
string SourcePath = RepositoryRoot + @"\Assets\OriginalAssets\NanaZipPreview";

string OutputPath = RepositoryRoot + @"\Assets\PreviewPackageAssets";

ConcurrentDictionary<int, MagickImage> StandardSources =
new ConcurrentDictionary<int, MagickImage>();
ConcurrentDictionary<int, MagickImage> ContrastBlackSources =
new ConcurrentDictionary<int, MagickImage>();
ConcurrentDictionary<int, MagickImage> ContrastWhiteSources =
new ConcurrentDictionary<int, MagickImage>();

ConcurrentDictionary<int, MagickImage> ArchiveFileSources =
new ConcurrentDictionary<int, MagickImage>();

ConcurrentDictionary<int, MagickImage> SfxStubSources =
new ConcurrentDictionary<int, MagickImage>();

foreach (var AssetSize in ProjectAssetsUtilities.AssetSizes)
{
StandardSources[AssetSize] = new MagickImage(string.Format(
@"{0}\{1}\{1}_{2}.png",
SourcePath,
"Standard",
AssetSize));
ContrastBlackSources[AssetSize] = new MagickImage(string.Format(
@"{0}\{1}\{1}_{2}.png",
SourcePath,
"ContrastBlack",
AssetSize));
ContrastWhiteSources[AssetSize] = new MagickImage(string.Format(
@"{0}\{1}\{1}_{2}.png",
SourcePath,
"ContrastWhite",
AssetSize));

ArchiveFileSources[AssetSize] = new MagickImage(string.Format(
@"{0}\{1}\{1}_{2}.png",
SourcePath,
"ArchiveFile",
AssetSize));

SfxStubSources[AssetSize] = new MagickImage(string.Format(
@"{0}\{1}\{1}_{2}.png",
SourcePath,
"SelfExtractingExecutable",
AssetSize));
}

ProjectAssetsUtilities.GeneratePackageApplicationImageAssets(
StandardSources,
ContrastBlackSources,
ContrastWhiteSources,
OutputPath);

ProjectAssetsUtilities.GeneratePackageFileAssociationImageAssets(
ArchiveFileSources,
OutputPath,
@"ArchiveFile");

ProjectAssetsUtilities.GenerateIconFile(
StandardSources,
OutputPath + @"\..\NanaZipPreview.ico");

ProjectAssetsUtilities.GenerateIconFile(
SfxStubSources,
OutputPath + @"\..\NanaZipPreviewSfx.ico");

StandardSources[64].Write(
OutputPath + @"\..\NanaZipPreview.png");
}

Console.WriteLine(
"NanaZip.ProjectAssetsGenerator task has been completed.");
Console.ReadKey();
Expand Down

0 comments on commit 472b215

Please sign in to comment.