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
325df2ea2c
commit
6f868f5c5e
1 changed files with 10 additions and 8 deletions
|
@ -82,6 +82,8 @@ private enum SetupJobs
|
||||||
private static string InnoSetupDir => Path.Combine(SetupDir, "InnoSetup");
|
private static string InnoSetupDir => Path.Combine(SetupDir, "InnoSetup");
|
||||||
private static string MicrosoftStorePackageFilesDir => Path.Combine(SetupDir, "MicrosoftStore");
|
private static string MicrosoftStorePackageFilesDir => Path.Combine(SetupDir, "MicrosoftStore");
|
||||||
|
|
||||||
|
private static string PortableFileName => $"ShareX-{AppVersion}-portable.zip";
|
||||||
|
private static string PortableFilePath => Path.Combine(OutputDir, PortableFileName);
|
||||||
private static string SteamLauncherDir => Path.Combine(ParentDir, @"ShareX.Steam\bin\Release");
|
private static string SteamLauncherDir => Path.Combine(ParentDir, @"ShareX.Steam\bin\Release");
|
||||||
private static string SteamUpdatesDir => Path.Combine(SteamOutputDir, "Updates");
|
private static string SteamUpdatesDir => Path.Combine(SteamOutputDir, "Updates");
|
||||||
private static string NativeMessagingHostDir => Path.Combine(ParentDir, @"ShareX.NativeMessagingHost\bin\Release");
|
private static string NativeMessagingHostDir => Path.Combine(ParentDir, @"ShareX.NativeMessagingHost\bin\Release");
|
||||||
|
@ -91,6 +93,7 @@ private enum SetupJobs
|
||||||
|
|
||||||
private static string InnoSetupCompilerPath = @"C:\Program Files (x86)\Inno Setup 6\ISCC.exe";
|
private static string InnoSetupCompilerPath = @"C:\Program Files (x86)\Inno Setup 6\ISCC.exe";
|
||||||
private static string MakeAppxPath = @"C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64\makeappx.exe";
|
private static string MakeAppxPath = @"C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64\makeappx.exe";
|
||||||
|
private static string AppVersion = GetAppVersion();
|
||||||
|
|
||||||
private static void Main(string[] args)
|
private static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
@ -316,14 +319,7 @@ private static void CreateFolder(string source, string destination, SetupJobs jo
|
||||||
else if (job == SetupJobs.CreatePortable)
|
else if (job == SetupJobs.CreatePortable)
|
||||||
{
|
{
|
||||||
FileHelpers.CreateEmptyFile(Path.Combine(destination, "Portable"));
|
FileHelpers.CreateEmptyFile(Path.Combine(destination, "Portable"));
|
||||||
|
ZipManager.Compress(Path.GetFullPath(destination), Path.GetFullPath(PortableFilePath));
|
||||||
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(ReleaseExecutablePath);
|
|
||||||
string zipFileName = string.Format("ShareX-{0}.{1}.{2}-portable.zip", versionInfo.ProductMajorPart, versionInfo.ProductMinorPart, versionInfo.ProductBuildPart);
|
|
||||||
string zipPath = Path.Combine(OutputDir, zipFileName);
|
|
||||||
//string zipPath = Path.Combine(OutputDir, "ShareX-portable.zip");
|
|
||||||
ZipManager.Compress(Path.GetFullPath(destination), Path.GetFullPath(zipPath));
|
|
||||||
|
|
||||||
Directory.Delete(destination, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("Folder created.");
|
Console.WriteLine("Folder created.");
|
||||||
|
@ -353,5 +349,11 @@ private static void UploadLatestFile()
|
||||||
Process.Start(DebugExecutablePath, fileInfo.FullName);
|
Process.Start(DebugExecutablePath, fileInfo.FullName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string GetAppVersion()
|
||||||
|
{
|
||||||
|
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(ReleaseExecutablePath);
|
||||||
|
return $"{versionInfo.ProductMajorPart}.{versionInfo.ProductMinorPart}.{versionInfo.ProductBuildPart}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue