|
@@ -1,4 +1,5 @@
|
|
|
-using System.IO.Compression;
|
|
|
+using System.Diagnostics;
|
|
|
+using System.IO.Compression;
|
|
|
|
|
|
namespace PackTool
|
|
|
{
|
|
@@ -40,81 +41,55 @@ namespace PackTool
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- static void Main(string[] args)
|
|
|
+ private static void CopyFiles(string reveiveSource, string copyDest, string repoName, string productName, bool unzip)
|
|
|
{
|
|
|
- if(args.Length != 11)
|
|
|
+ var distRootFolder = Environment.GetEnvironmentVariable("DistFolder");
|
|
|
+ if (string.IsNullOrEmpty(distRootFolder))
|
|
|
{
|
|
|
- Console.WriteLine("Argument List:");
|
|
|
- Console.WriteLine("[01] -- RepoName \n\t\t\t\tThe name of the packing repo.");
|
|
|
-
|
|
|
- Console.WriteLine("[02] -- RepoVersion \n\t\t\t\tThe version of the packing repo.");
|
|
|
-
|
|
|
- Console.WriteLine("[03] -- Src \n\t\t\t\tThe source of the output file/folder.");
|
|
|
-
|
|
|
- Console.WriteLine("[04] -- Unzip \n\t\t\t\tUnzip the source while it is a zip file.");
|
|
|
-
|
|
|
- Console.WriteLine("[05] -- Dest \n\t\t\t\tThe dest folder/file to copy/unzip.");
|
|
|
-
|
|
|
- Console.WriteLine("[06] -- UpdateVersion \n\t\t\t\tUpdate the version in the project folder.");
|
|
|
-
|
|
|
- Console.WriteLine("[07] -- ProjectName \n\t\t\t\tThe name of the project(The repo can be one of the sub-project of the project).");
|
|
|
-
|
|
|
- Console.WriteLine("[08] -- ProjectFolder \n\t\t\t\tThe folder of the project.");
|
|
|
-
|
|
|
- Console.WriteLine("[09] -- Repack \n\t\t\t\tRepack the project folder which means create a new release file in dist.ius.plus.");
|
|
|
-
|
|
|
- Console.WriteLine("[10] -- RepackFolder \n\t\t\t\tThe folder to store the repacked files.");
|
|
|
-
|
|
|
- Console.WriteLine("[11] -- AttachTimestamp \n\t\t\t\tAdd the timestamp on repacked file name.");
|
|
|
- return;
|
|
|
+ Console.WriteLine("The environment variable [DistFolder] is missing, use default dist folder.");
|
|
|
+ //Using default repackFolder
|
|
|
+ distRootFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Packages");
|
|
|
}
|
|
|
-
|
|
|
- var repoName = args[0];
|
|
|
- var repoVersion = args[1];
|
|
|
-
|
|
|
- var src = args[2];
|
|
|
- if(!File.Exists(src) && !Directory.Exists(src))
|
|
|
+ if (!Directory.Exists(distRootFolder))
|
|
|
{
|
|
|
- Console.WriteLine("The src args[2] does not exist.");
|
|
|
- return;
|
|
|
+ Directory.CreateDirectory(distRootFolder);
|
|
|
}
|
|
|
- if(!bool.TryParse(args[3], out var unzip))
|
|
|
+ var repoDistFolder = Path.Combine(distRootFolder, repoName, "Dist");
|
|
|
+ if (!Directory.Exists(repoDistFolder))
|
|
|
{
|
|
|
- Console.WriteLine("The Unzip args[3] should be a bool value:[true/false]");
|
|
|
- return;
|
|
|
+ Directory.CreateDirectory(repoDistFolder);
|
|
|
}
|
|
|
-
|
|
|
- var dest = args[4];
|
|
|
-
|
|
|
- if (!bool.TryParse(args[5], out var updateVersion))
|
|
|
+ var productRootFolder = Environment.GetEnvironmentVariable("ProductFolder");
|
|
|
+ if (string.IsNullOrEmpty(productRootFolder))
|
|
|
{
|
|
|
- Console.WriteLine("The UpdateVersion args[5] should be a bool value:[true/false]");
|
|
|
- return;
|
|
|
+ Console.WriteLine("The environment variable [ProductFolder] is missing, use default product folder.");
|
|
|
+ //Using default repackFolder
|
|
|
+ productRootFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Product");
|
|
|
}
|
|
|
-
|
|
|
- var projectName = args[6];
|
|
|
- var projectFolder = args[7];
|
|
|
-
|
|
|
- if (!bool.TryParse(args[8], out var repack))
|
|
|
+ if (!Directory.Exists(productRootFolder))
|
|
|
{
|
|
|
- Console.WriteLine("The Repack args[8] should be a bool value:[true/false]");
|
|
|
- return;
|
|
|
+ Directory.CreateDirectory(productRootFolder);
|
|
|
+ }
|
|
|
+ var productFolder = Path.Combine(productRootFolder, productName);
|
|
|
+ if (!Directory.Exists(productFolder))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(productFolder);
|
|
|
}
|
|
|
|
|
|
- var repackFolder = args[9];
|
|
|
+ var source = Path.Combine(repoDistFolder, reveiveSource);
|
|
|
+ var dest = Path.Combine(productFolder, copyDest);
|
|
|
|
|
|
- if (!bool.TryParse(args[10], out var attachTimestamp))
|
|
|
+ if (!File.Exists(source) && !Directory.Exists(source))
|
|
|
{
|
|
|
- Console.WriteLine("The AttachTimestamp args[10] should be a bool value:[true/false]");
|
|
|
+ Console.WriteLine($"The received file/s {reveiveSource} can not be found.");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if(File.Exists(src))
|
|
|
+ if (File.Exists(source))
|
|
|
{
|
|
|
- if(unzip)
|
|
|
+ if (unzip)
|
|
|
{
|
|
|
- ZipFile.ExtractToDirectory(src, dest, true);
|
|
|
+ ZipFile.ExtractToDirectory(source, dest, true);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -127,83 +102,377 @@ namespace PackTool
|
|
|
Directory.CreateDirectory(destFolder);
|
|
|
}
|
|
|
}
|
|
|
- File.Copy(src, dest, true);
|
|
|
+ File.Copy(source, dest, true);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(!Directory.Exists(dest))
|
|
|
+ if (!Directory.Exists(dest))
|
|
|
{
|
|
|
Directory.CreateDirectory(dest);
|
|
|
}
|
|
|
- DirectoryCopy(src, dest, true);
|
|
|
+ DirectoryCopy(source, dest, true);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ private static void UpdateVersion(string productName, string repoName, string repoVersion)
|
|
|
+ {
|
|
|
+ var productRootFolder = Environment.GetEnvironmentVariable("ProductFolder");
|
|
|
+ if (string.IsNullOrEmpty(productRootFolder))
|
|
|
+ {
|
|
|
+ Console.WriteLine("The environment variable [ProductFolder] is missing, use default product folder.");
|
|
|
+ //Using default repackFolder
|
|
|
+ productRootFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Product");
|
|
|
+ }
|
|
|
+ if (!Directory.Exists(productRootFolder))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(productRootFolder);
|
|
|
+ }
|
|
|
+ var productFolder = Path.Combine(productRootFolder, productName);
|
|
|
+ if(!Directory.Exists(productFolder))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(productFolder);
|
|
|
+ }
|
|
|
|
|
|
- //Write version info.
|
|
|
- if (updateVersion)
|
|
|
+ var projectVersionFile = Path.Combine(productFolder, "Versions.txt");
|
|
|
+ var versions = new List<string>();
|
|
|
+ if (File.Exists(projectVersionFile))
|
|
|
{
|
|
|
- if (!Directory.Exists(projectFolder))
|
|
|
+ versions = File.ReadLines(projectVersionFile).ToList();
|
|
|
+ bool updated = false;
|
|
|
+ for (var i = 0; i < versions.Count; i++)
|
|
|
{
|
|
|
- Directory.CreateDirectory(projectFolder);
|
|
|
- }
|
|
|
- var projectVersionFile = Path.Combine(projectFolder, "Versions.txt");
|
|
|
- var versions = new List<string>();
|
|
|
- if (File.Exists(projectVersionFile))
|
|
|
- {
|
|
|
- versions = File.ReadLines(projectVersionFile).ToList();
|
|
|
- bool updated = false;
|
|
|
- for (var i = 0; i < versions.Count; i++)
|
|
|
+ var line = versions[i];
|
|
|
+ var nameAndVersion = line.Split('=');
|
|
|
+ var name = nameAndVersion[0];
|
|
|
+ if (name == repoName)
|
|
|
{
|
|
|
- var line = versions[i];
|
|
|
- var nameAndVersion = line.Split('=');
|
|
|
- var name = nameAndVersion[0];
|
|
|
- if (name == repoName)
|
|
|
- {
|
|
|
- versions[i] = repoName + "=" + repoVersion;
|
|
|
- File.WriteAllLines(projectVersionFile, versions);
|
|
|
- updated = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!updated)
|
|
|
- {
|
|
|
- versions.Add(repoName + "=" + repoVersion);
|
|
|
+ versions[i] = repoName + "=" + repoVersion;
|
|
|
File.WriteAllLines(projectVersionFile, versions);
|
|
|
+ updated = true;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
+ if (!updated)
|
|
|
{
|
|
|
versions.Add(repoName + "=" + repoVersion);
|
|
|
File.WriteAllLines(projectVersionFile, versions);
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ versions.Add(repoName + "=" + repoVersion);
|
|
|
+ File.WriteAllLines(projectVersionFile, versions);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void RepackProduct(string productName, bool attachTimestamp)
|
|
|
+ {
|
|
|
+ var productRootFolder = Environment.GetEnvironmentVariable("ProductFolder");
|
|
|
+ if (string.IsNullOrEmpty(productRootFolder))
|
|
|
+ {
|
|
|
+ Console.WriteLine("The environment variable [ProductFolder] is missing, use default product folder.");
|
|
|
+ //Using default repackFolder
|
|
|
+ productRootFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Product");
|
|
|
+ }
|
|
|
+ if (!Directory.Exists(productRootFolder))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(productRootFolder);
|
|
|
+ }
|
|
|
+ var productFolder = Path.Combine(productRootFolder, productName);
|
|
|
+ if (!Directory.Exists(productFolder))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(productFolder);
|
|
|
+ }
|
|
|
|
|
|
- if (repack)
|
|
|
+ var repackRootFolder = Environment.GetEnvironmentVariable("RepackFolder");
|
|
|
+ if(string.IsNullOrEmpty(repackRootFolder))
|
|
|
+ {
|
|
|
+ Console.WriteLine("The environment variable [RepackFolder] is missing, use default repack folder.");
|
|
|
+ //Using default repackFolder
|
|
|
+ repackRootFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Repack");
|
|
|
+ }
|
|
|
+ if (!Directory.Exists(repackRootFolder))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(repackRootFolder);
|
|
|
+ }
|
|
|
+ var repackFolder = Path.Combine(repackRootFolder, productName);
|
|
|
+ if(!Directory.Exists(repackFolder))
|
|
|
{
|
|
|
- if (!Directory.Exists(repackFolder))
|
|
|
+ Directory.CreateDirectory(repackFolder);
|
|
|
+ }
|
|
|
+ var repackFilePath = Path.Combine(repackFolder, $"{productName}.zip");
|
|
|
+ if (attachTimestamp)
|
|
|
+ {
|
|
|
+ var timestamp = DateTime.Now.ToString("yyyyMMdd");
|
|
|
+ var buildTime = 1;
|
|
|
+ var formattedBuildTime = buildTime.ToString("D2");
|
|
|
+ repackFilePath = Path.Combine(repackFolder, $"{productName}_{timestamp}.{formattedBuildTime}.zip");
|
|
|
+ while (File.Exists(repackFilePath))
|
|
|
{
|
|
|
- Directory.CreateDirectory(repackFolder);
|
|
|
+ buildTime++;
|
|
|
+ formattedBuildTime = buildTime.ToString("D2");
|
|
|
+ repackFilePath = Path.Combine(repackFolder, $"{productName}_{timestamp}.{formattedBuildTime}.zip");
|
|
|
}
|
|
|
- var repackFilePath = Path.Combine(repackFolder, $"{projectName}.zip");
|
|
|
- if(attachTimestamp)
|
|
|
+ }
|
|
|
+ if (File.Exists(repackFilePath))
|
|
|
+ {
|
|
|
+ File.Delete(repackFilePath);
|
|
|
+ }
|
|
|
+ ZipFile.CreateFromDirectory(productFolder, repackFilePath);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void HandleCopy(Dictionary<string,string> argMap)
|
|
|
+ {
|
|
|
+ //Copy the file/s
|
|
|
+ if (!argMap.TryGetValue("/rs", out var receivedSource))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/rs] - received source argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!argMap.TryGetValue("/cd", out var extractDest))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/cd] - copy dest argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!argMap.TryGetValue("/pn", out var productName))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/pn] - product name argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!argMap.TryGetValue("/rn", out var repoName))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/rn] - repo name argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var unzip = false;
|
|
|
+ if (argMap.TryGetValue("/unzip", out var unzipStr))
|
|
|
+ {
|
|
|
+ if (!bool.TryParse(unzipStr, out unzip))
|
|
|
{
|
|
|
- var timestamp = DateTime.Now.ToString("yyyyMMdd");
|
|
|
- var buildTime = 1;
|
|
|
- var formattedBuildTime = buildTime.ToString("D2");
|
|
|
- repackFilePath = Path.Combine(repackFolder, $"{projectName}_{timestamp}.{formattedBuildTime}.zip");
|
|
|
- while(File.Exists(repackFilePath))
|
|
|
- {
|
|
|
- buildTime++;
|
|
|
- formattedBuildTime = buildTime.ToString("D2");
|
|
|
- repackFilePath = Path.Combine(repackFolder, $"{projectName}_{timestamp}.{formattedBuildTime}.zip");
|
|
|
- }
|
|
|
+ Console.WriteLine($"The unzip argument {unzipStr} is not a bool value.");
|
|
|
}
|
|
|
- if(File.Exists(repackFilePath))
|
|
|
+ }
|
|
|
+ CopyFiles(receivedSource, extractDest, repoName, productName, unzip);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void HandleUpdateVersion(Dictionary<string,string> argMap)
|
|
|
+ {
|
|
|
+ //Only update version.
|
|
|
+ if (!argMap.TryGetValue("/pn", out var productName))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/pn] - product name argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!argMap.TryGetValue("/rn", out var repoName))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/rn] - repo name argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!argMap.TryGetValue("/rv", out var repoVersion))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/rv] - repo version argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ UpdateVersion(productName, repoName, repoVersion);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void HandleRepack(Dictionary<string,string> argMap)
|
|
|
+ {
|
|
|
+ if (!argMap.TryGetValue("/pn", out var productName))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/pn] - product name argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var attachTimestamp = true;
|
|
|
+ if (argMap.TryGetValue("/at", out var attachTimestampStr))
|
|
|
+ {
|
|
|
+ if (!bool.TryParse(attachTimestampStr, out attachTimestamp))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The attachTimestamp argument {attachTimestampStr} is not a bool value.");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ RepackProduct(productName, attachTimestamp);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private static void HandleFull(Dictionary<string, string> argMap)
|
|
|
+ {
|
|
|
+ if (!argMap.TryGetValue("/rs", out var receivedSource))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/rs] - received source argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!argMap.TryGetValue("/cd", out var extractDest))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/cd] - copy dest argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!argMap.TryGetValue("/pn", out var productName))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/pn] - product name argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!argMap.TryGetValue("/rn", out var repoName))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/rn] - repo name argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!argMap.TryGetValue("/rv", out var repoVersion))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/rv] - repo version argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var unzip = false;
|
|
|
+ if (argMap.TryGetValue("/unzip", out var unzipStr))
|
|
|
+ {
|
|
|
+ if (!bool.TryParse(unzipStr, out unzip))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The unzip argument {unzipStr} is not a bool value.");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ CopyFiles(receivedSource, extractDest, repoName, productName, unzip);
|
|
|
+ UpdateVersion(productName, repoName, repoVersion);
|
|
|
+ var attachTimestamp = true;
|
|
|
+ if (argMap.TryGetValue("/at", out var attachTimestampStr))
|
|
|
+ {
|
|
|
+ if (!bool.TryParse(attachTimestampStr, out attachTimestamp))
|
|
|
{
|
|
|
- File.Delete(repackFilePath);
|
|
|
+ Console.WriteLine($"The attachTimestamp argument {attachTimestampStr} is not a bool value.");
|
|
|
}
|
|
|
- ZipFile.CreateFromDirectory(projectFolder, repackFilePath);
|
|
|
+ }
|
|
|
+ RepackProduct(productName, attachTimestamp);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void StartInno(string innoSourceFileName, string setupSource, string productName, string productVersion,string outputDir)
|
|
|
+ {
|
|
|
+ var productRootFolder = Environment.GetEnvironmentVariable("ProductFolder");
|
|
|
+ if (string.IsNullOrEmpty(productRootFolder))
|
|
|
+ {
|
|
|
+ Console.WriteLine("The environment variable [ProductFolder] is missing, use default product folder.");
|
|
|
+ //Using default repackFolder
|
|
|
+ productRootFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Product");
|
|
|
+ }
|
|
|
+ if (!Directory.Exists(productRootFolder))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(productRootFolder);
|
|
|
+ }
|
|
|
+ var productFolder = Path.Combine(productRootFolder, productName);
|
|
|
+ if (!Directory.Exists(productFolder))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(productFolder);
|
|
|
+ }
|
|
|
+ var innoSourceFilePath = Path.Combine(productFolder, innoSourceFileName);
|
|
|
+ var projectSetupSource = Path.Combine(productFolder, setupSource);
|
|
|
+ var setupOutputDir = Path.Combine(productFolder, outputDir);
|
|
|
+
|
|
|
+ if(!File.Exists(innoSourceFilePath))
|
|
|
+ {
|
|
|
+ Console.WriteLine("The inno setup source file does not exist.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(!Directory.Exists(projectSetupSource))
|
|
|
+ {
|
|
|
+ Console.WriteLine("The setup project source folder does not exist");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(Directory.GetFiles(projectSetupSource).Length == 0)
|
|
|
+ {
|
|
|
+ Console.WriteLine("No file in setup project source folder.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!Directory.Exists(setupOutputDir))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(setupOutputDir);
|
|
|
+ }
|
|
|
+ var iscc_argument = $"/dProjectFolder={projectSetupSource} /dSetupAppVersion={productVersion} /dSetupOutputDir={setupOutputDir} {innoSourceFilePath}";
|
|
|
+ Console.WriteLine($"Inno arg: {iscc_argument}");
|
|
|
+ var process = Process.Start(new ProcessStartInfo("ISCC", iscc_argument) { UseShellExecute = true });
|
|
|
+ process?.WaitForExit();
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void HandleInno(Dictionary<string, string> argMap)
|
|
|
+ {
|
|
|
+ if (!argMap.TryGetValue("/pn", out var productName))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/pn] - product name argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!argMap.TryGetValue("/pv", out var productVersion))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/pv] - product version argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!argMap.TryGetValue("/ss", out var setupSource))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/ss] - setup source argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!argMap.TryGetValue("/od", out var outputDir))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/od] - output dir argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!argMap.TryGetValue("/iss", out var issFile))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"The [/iss] - inno setup source argument is missing.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ StartInno(issFile, setupSource, productName, productVersion, outputDir);
|
|
|
+ }
|
|
|
+
|
|
|
+ static void Main(string[] args)
|
|
|
+ {
|
|
|
+ var argMap = new Dictionary<string, string>();
|
|
|
+ foreach (var arg in args)
|
|
|
+ {
|
|
|
+ var nameAndValue = arg.Split('=');
|
|
|
+ if (nameAndValue.Length == 2)
|
|
|
+ {
|
|
|
+ var name = nameAndValue[0].ToLower();
|
|
|
+ if (string.IsNullOrEmpty(name))
|
|
|
+ {
|
|
|
+ Console.WriteLine("An empty arg name is not acceptable.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (argMap.ContainsKey(name))
|
|
|
+ {
|
|
|
+ Console.WriteLine($"Arg name {name} already exists");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ argMap.Add(name, nameAndValue[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!argMap.TryGetValue("/mode", out var mode))
|
|
|
+ {
|
|
|
+ mode = "full";
|
|
|
+ }
|
|
|
+
|
|
|
+ Console.WriteLine($"Run in {mode} mode.");
|
|
|
+ switch (mode)
|
|
|
+ {
|
|
|
+ case "full":
|
|
|
+ //Copy files then pack the files then update the version then pack the files.
|
|
|
+ HandleFull(argMap);
|
|
|
+ break;
|
|
|
+ case "copy":
|
|
|
+ HandleCopy(argMap);
|
|
|
+ break;
|
|
|
+ case "version":
|
|
|
+ HandleUpdateVersion(argMap);
|
|
|
+ break;
|
|
|
+ case "repack":
|
|
|
+ //Obly Pack the files.
|
|
|
+ HandleRepack(argMap);
|
|
|
+ break;
|
|
|
+ case "inno":
|
|
|
+ HandleInno(argMap);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ Console.WriteLine($"Not suported mode: {mode}");
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|