mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Code refactoring
This commit is contained in:
parent
6fcc6dcab9
commit
9d266a310a
1 changed files with 23 additions and 23 deletions
|
@ -75,6 +75,7 @@ private enum SetupJobs
|
||||||
private static string DebugOutputDir => Path.Combine(OutputDir, "ShareX-debug");
|
private static string DebugOutputDir => Path.Combine(OutputDir, "ShareX-debug");
|
||||||
private static string SteamOutputDir => Path.Combine(OutputDir, "ShareX-Steam");
|
private static string SteamOutputDir => Path.Combine(OutputDir, "ShareX-Steam");
|
||||||
private static string MicrosoftStoreOutputDir => Path.Combine(OutputDir, "ShareX-MicrosoftStore");
|
private static string MicrosoftStoreOutputDir => Path.Combine(OutputDir, "ShareX-MicrosoftStore");
|
||||||
|
private static string MicrosoftStoreDebugOutputDir => Path.Combine(OutputDir, "ShareX-MicrosoftStore-debug");
|
||||||
|
|
||||||
private static string SetupDir => Path.Combine(ParentDir, "ShareX.Setup");
|
private static string SetupDir => Path.Combine(ParentDir, "ShareX.Setup");
|
||||||
private static string InnoSetupDir => Path.Combine(SetupDir, "InnoSetup");
|
private static string InnoSetupDir => Path.Combine(SetupDir, "InnoSetup");
|
||||||
|
@ -87,6 +88,7 @@ private enum SetupJobs
|
||||||
private static string SteamUpdatesDir => Path.Combine(SteamOutputDir, "Updates");
|
private static string SteamUpdatesDir => Path.Combine(SteamOutputDir, "Updates");
|
||||||
private static string SteamZipPath => Path.Combine(OutputDir, $"ShareX-{AppVersion}-Steam.zip");
|
private static string SteamZipPath => Path.Combine(OutputDir, $"ShareX-{AppVersion}-Steam.zip");
|
||||||
private static string MicrosoftStoreAppxPath => Path.Combine(OutputDir, $"ShareX-{AppVersion}.appx");
|
private static string MicrosoftStoreAppxPath => Path.Combine(OutputDir, $"ShareX-{AppVersion}.appx");
|
||||||
|
private static string MicrosoftStoreDebugAppxPath => Path.Combine(OutputDir, $"ShareX-{AppVersion}-debug.appx");
|
||||||
private static string FFmpegPath => Path.Combine(OutputDir, "ffmpeg.exe");
|
private static string FFmpegPath => Path.Combine(OutputDir, "ffmpeg.exe");
|
||||||
private static string MakeAppxPath => Path.Combine(WindowsKitsDir, "x64", "makeappx.exe");
|
private static string MakeAppxPath => Path.Combine(WindowsKitsDir, "x64", "makeappx.exe");
|
||||||
|
|
||||||
|
@ -123,31 +125,42 @@ private static void Main(string[] args)
|
||||||
if (Job.HasFlag(SetupJobs.CreatePortable))
|
if (Job.HasFlag(SetupJobs.CreatePortable))
|
||||||
{
|
{
|
||||||
CreateFolder(BinDir, PortableOutputDir, SetupJobs.CreatePortable);
|
CreateFolder(BinDir, PortableOutputDir, SetupJobs.CreatePortable);
|
||||||
|
|
||||||
|
CreateZipFile(PortableOutputDir, PortableZipPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Job.HasFlag(SetupJobs.CreateDebug))
|
if (Job.HasFlag(SetupJobs.CreateDebug))
|
||||||
{
|
{
|
||||||
CreateFolder(BinDir, DebugOutputDir, SetupJobs.CreateDebug);
|
CreateFolder(BinDir, DebugOutputDir, SetupJobs.CreateDebug);
|
||||||
|
|
||||||
|
CreateZipFile(DebugOutputDir, DebugZipPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Job.HasFlag(SetupJobs.CreateSteamFolder))
|
if (Job.HasFlag(SetupJobs.CreateSteamFolder))
|
||||||
{
|
{
|
||||||
CreateSteamFolder();
|
CreateSteamFolder();
|
||||||
|
|
||||||
|
CreateZipFile(SteamOutputDir, SteamZipPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Job.HasFlag(SetupJobs.CreateMicrosoftStoreFolder))
|
if (Job.HasFlag(SetupJobs.CreateMicrosoftStoreFolder))
|
||||||
{
|
{
|
||||||
CreateFolder(BinDir, MicrosoftStoreOutputDir, SetupJobs.CreateMicrosoftStoreFolder);
|
CreateFolder(BinDir, MicrosoftStoreOutputDir, SetupJobs.CreateMicrosoftStoreFolder);
|
||||||
|
|
||||||
|
if (Job.HasFlag(SetupJobs.CompileAppx))
|
||||||
|
{
|
||||||
|
CompileAppx(MicrosoftStoreOutputDir, MicrosoftStoreAppxPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Job.HasFlag(SetupJobs.CreateMicrosoftStoreDebugFolder))
|
if (Job.HasFlag(SetupJobs.CreateMicrosoftStoreDebugFolder))
|
||||||
{
|
{
|
||||||
CreateFolder(BinDir, MicrosoftStoreOutputDir, SetupJobs.CreateMicrosoftStoreDebugFolder);
|
CreateFolder(BinDir, MicrosoftStoreDebugOutputDir, SetupJobs.CreateMicrosoftStoreDebugFolder);
|
||||||
}
|
|
||||||
|
|
||||||
if (Job.HasFlag(SetupJobs.CompileAppx))
|
if (Job.HasFlag(SetupJobs.CompileAppx))
|
||||||
{
|
{
|
||||||
CompileAppx();
|
CompileAppx(MicrosoftStoreDebugOutputDir, MicrosoftStoreDebugAppxPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AppVeyor)
|
if (AppVeyor)
|
||||||
|
@ -291,16 +304,16 @@ private static void CompileISSFile(string fileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CompileAppx()
|
private static void CompileAppx(string contentDirectory, string outputPackageName)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Compiling appx file: " + MicrosoftStoreAppxPath);
|
Console.WriteLine("Compiling appx file: " + contentDirectory);
|
||||||
|
|
||||||
using (Process process = new Process())
|
using (Process process = new Process())
|
||||||
{
|
{
|
||||||
ProcessStartInfo psi = new ProcessStartInfo()
|
ProcessStartInfo psi = new ProcessStartInfo()
|
||||||
{
|
{
|
||||||
FileName = MakeAppxPath,
|
FileName = MakeAppxPath,
|
||||||
Arguments = $"pack /d \"{MicrosoftStoreOutputDir}\" /p \"{MicrosoftStoreAppxPath}\" /l /o",
|
Arguments = $"pack /d \"{contentDirectory}\" /p \"{outputPackageName}\" /l /o",
|
||||||
UseShellExecute = false
|
UseShellExecute = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -309,9 +322,9 @@ private static void CompileAppx()
|
||||||
process.WaitForExit();
|
process.WaitForExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("Appx file compiled: " + MicrosoftStoreAppxPath);
|
Console.WriteLine("Appx file compiled: " + outputPackageName);
|
||||||
|
|
||||||
CreateChecksumFile(MicrosoftStoreAppxPath);
|
CreateChecksumFile(outputPackageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CreateSteamFolder()
|
private static void CreateSteamFolder()
|
||||||
|
@ -392,19 +405,6 @@ private static void CreateFolder(string source, string destination, SetupJobs jo
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("Folder created: " + destination);
|
Console.WriteLine("Folder created: " + destination);
|
||||||
|
|
||||||
if (job == SetupJobs.CreatePortable)
|
|
||||||
{
|
|
||||||
CreateZipFile(destination, PortableZipPath);
|
|
||||||
}
|
|
||||||
else if (job == SetupJobs.CreateDebug)
|
|
||||||
{
|
|
||||||
CreateZipFile(destination, DebugZipPath);
|
|
||||||
}
|
|
||||||
else if (job == SetupJobs.CreateSteamFolder)
|
|
||||||
{
|
|
||||||
CreateZipFile(destination, SteamZipPath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CreateZipFile(string source, string archivePath)
|
private static void CreateZipFile(string source, string archivePath)
|
||||||
|
|
Loading…
Reference in a new issue