diff --git a/NanaGet.ProjectAssetsGenerator/Program.cs b/NanaGet.ProjectAssetsGenerator/Program.cs index 52f314f..ac85f51 100644 --- a/NanaGet.ProjectAssetsGenerator/Program.cs +++ b/NanaGet.ProjectAssetsGenerator/Program.cs @@ -1,9 +1,133 @@ -namespace NanaGet.ProjectAssetsGenerator +using ImageMagick; +using Mile.Project.Helpers; +using System.Collections.Concurrent; + +namespace NanaGet.ProjectAssetsGenerator { internal class Program { + static string RepositoryRoot = GitRepository.GetRootPath(); + static void Main(string[] args) { + { + string SourcePath = RepositoryRoot + @"\Assets\OriginalAssets\NanaGet"; + + string OutputPath = RepositoryRoot + @"\Assets\PackageAssets"; + + ConcurrentDictionary StandardSources = + new ConcurrentDictionary(); + ConcurrentDictionary ContrastBlackSources = + new ConcurrentDictionary(); + ConcurrentDictionary ContrastWhiteSources = + new ConcurrentDictionary(); + + ConcurrentDictionary MetadataFileSources = + new ConcurrentDictionary(); + + 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)); + + MetadataFileSources[AssetSize] = new MagickImage(string.Format( + @"{0}\{1}\{1}_{2}.png", + SourcePath, + "MetadataFile", + AssetSize)); + } + + ProjectAssetsUtilities.GeneratePackageApplicationImageAssets( + StandardSources, + ContrastBlackSources, + ContrastWhiteSources, + OutputPath); + + ProjectAssetsUtilities.GeneratePackageFileAssociationImageAssets( + MetadataFileSources, + OutputPath, + @"MetadataFile"); + + ProjectAssetsUtilities.GenerateIconFile( + StandardSources, + OutputPath + @"\..\NanaGet.ico"); + + StandardSources[64].Write( + OutputPath + @"\..\NanaGet.png"); + } + + { + string SourcePath = RepositoryRoot + @"\Assets\OriginalAssets\NanaGetPreview"; + + string OutputPath = RepositoryRoot + @"\Assets\PreviewPackageAssets"; + + ConcurrentDictionary StandardSources = + new ConcurrentDictionary(); + ConcurrentDictionary ContrastBlackSources = + new ConcurrentDictionary(); + ConcurrentDictionary ContrastWhiteSources = + new ConcurrentDictionary(); + + ConcurrentDictionary MetadataFileSources = + new ConcurrentDictionary(); + + 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)); + + MetadataFileSources[AssetSize] = new MagickImage(string.Format( + @"{0}\{1}\{1}_{2}.png", + SourcePath, + "MetadataFile", + AssetSize)); + } + + ProjectAssetsUtilities.GeneratePackageApplicationImageAssets( + StandardSources, + ContrastBlackSources, + ContrastWhiteSources, + OutputPath); + + ProjectAssetsUtilities.GeneratePackageFileAssociationImageAssets( + MetadataFileSources, + OutputPath, + @"MetadataFile"); + + ProjectAssetsUtilities.GenerateIconFile( + StandardSources, + OutputPath + @"\..\NanaGetPreview.ico"); + + StandardSources[64].Write( + OutputPath + @"\..\NanaGetPreview.png"); + } + Console.WriteLine( "NanaGet.ProjectAssetsGenerator task has been completed."); Console.ReadKey();