private static void Main(string[] args) { Console.WriteLine("ShareX setup started."); if (Helpers.CheckArguments(args, "-AppVeyorRelease")) { AppVeyor = true; Job = SetupJobs.AppVeyorRelease; } else if (Helpers.CheckArguments(args, "-AppVeyorSteam")) { AppVeyor = true; Job = SetupJobs.AppVeyorSteam; } Console.WriteLine("Setup job: " + Job); if (Directory.Exists(OutputDir)) { Console.WriteLine("Cleaning output directory: " + OutputDir); Directory.Delete(OutputDir, true); } if (Job.HasFlag(SetupJobs.CreateSetup)) { CompileSetup(); } if (Job.HasFlag(SetupJobs.CreatePortable)) { CreatePortable(PortableOutputDir, ReleaseDir); } if (Job.HasFlag(SetupJobs.CreateSteamFolder)) { CreateSteamFolder(); } if (Job.HasFlag(SetupJobs.CreatePortableAppsFolder)) { CreatePortable(PortableAppsOutputDir, ReleaseDir); } if (Job.HasFlag(SetupJobs.OpenOutputDirectory)) { OpenOutputDirectory(); } if (Job.HasFlag(SetupJobs.UploadOutputFile)) { UploadLatestFile(); } Console.WriteLine("ShareX setup successfully completed."); }
private static void Main(string[] args) { Console.WriteLine("ShareX setup started."); if (Helpers.CheckArguments(args, "-AppVeyorRelease")) { AppVeyor = true; Job = SetupJobs.AppVeyorRelease; } else if (Helpers.CheckArguments(args, "-AppVeyorSteam")) { AppVeyor = true; Job = SetupJobs.AppVeyorSteam; } else if (Helpers.CheckArguments(args, "-AppVeyorWindowsStore")) { AppVeyor = true; Job = SetupJobs.AppVeyorWindowsStore; } Console.WriteLine("Setup job: " + Job); if (Directory.Exists(OutputDir)) { Console.WriteLine("Cleaning output directory: " + OutputDir); Directory.Delete(OutputDir, true); } if (Job.HasFlag(SetupJobs.CreateSetup)) { CompileSetup(); } if (Job.HasFlag(SetupJobs.CreatePortable)) { CreateFolder(ReleaseDir, PortableOutputDir, SetupJobs.CreatePortable); } if (Job.HasFlag(SetupJobs.CreateSteamFolder)) { CreateSteamFolder(); } if (Job.HasFlag(SetupJobs.CreateWindowsStoreFolder)) { CreateFolder(WindowsStoreDir, WindowsStoreOutputDir, SetupJobs.CreateWindowsStoreFolder); } if (Job.HasFlag(SetupJobs.CreateWindowsStoreDebugFolder)) { CreateFolder(WindowsStoreDebugDir, WindowsStoreOutputDir, SetupJobs.CreateWindowsStoreDebugFolder); } if (Job.HasFlag(SetupJobs.CompileAppx)) { Process.Start(@"C:\Program Files (x86)\Windows Kits\10\bin\x64\makeappx.exe", $"pack /d \"{WindowsStoreOutputDir}\" /p \"{WindowsStoreAppxPath}\" /l /o").WaitForExit(); Directory.Delete(WindowsStoreOutputDir, true); } if (Job.HasFlag(SetupJobs.CreatePortableAppsFolder)) { CreateFolder(ReleaseDir, PortableAppsOutputDir, SetupJobs.CreatePortableAppsFolder); } if (Job.HasFlag(SetupJobs.OpenOutputDirectory)) { OpenOutputDirectory(); } if (Job.HasFlag(SetupJobs.UploadOutputFile)) { UploadLatestFile(); } Console.WriteLine("ShareX setup successfully completed."); }
private static void CreateFolder(string source, string destination, SetupJobs job) { Console.WriteLine("Creating folder: " + destination); if (Directory.Exists(destination)) { Directory.Delete(destination, true); } Directory.CreateDirectory(destination); Helpers.CopyFile(Path.Combine(source, "ShareX.exe"), destination); Helpers.CopyFile(Path.Combine(source, "ShareX.exe.config"), destination); if (job == SetupJobs.CreateWindowsStoreFolder || job == SetupJobs.CreateWindowsStoreDebugFolder) { Helpers.CopyFiles(source, "*.dll", destination, new string[] { "7z.dll" }); } else { Helpers.CopyFiles(source, "*.dll", destination); } if (job == SetupJobs.CreateWindowsStoreDebugFolder) { Helpers.CopyFiles(source, "*.pdb", destination); } Helpers.CopyFiles(Path.Combine(ParentDir, "Licenses"), "*.txt", Path.Combine(destination, "Licenses")); if (job != SetupJobs.CreateWindowsStoreFolder && job != SetupJobs.CreateWindowsStoreDebugFolder) { if (!File.Exists(RecorderDevicesSetupPath)) { CompileISSFile("Recorder-devices-setup.iss"); } Helpers.CopyFile(RecorderDevicesSetupPath, destination); Helpers.CopyFile(Path.Combine(NativeMessagingHostDir, "ShareX_NativeMessagingHost.exe"), destination); } string[] languages = new string[] { "de", "es", "fr", "hu", "ko-KR", "nl-NL", "pt-BR", "ru", "tr", "vi-VN", "zh-CN", "zh-TW" }; foreach (string language in languages) { Helpers.CopyFiles(Path.Combine(source, language), "*.resources.dll", Path.Combine(destination, "Languages", language)); } if (job == SetupJobs.CreateSteamFolder) { CopyFFmpeg(destination); } else if (job == SetupJobs.CreatePortableAppsFolder) { Helpers.CreateEmptyFile(Path.Combine(destination, "PortableApps")); } else if (job == SetupJobs.CreateWindowsStoreFolder || job == SetupJobs.CreateWindowsStoreDebugFolder) { Helpers.CopyFile(Path.Combine(DesktopBridgeHelperDir, "ShareX_DesktopBridgeHelper.exe"), destination); Helpers.CopyAll(WindowsStorePackageFilesDir, destination); } else if (job == SetupJobs.CreatePortable) { Helpers.CreateEmptyFile(Path.Combine(destination, "Portable")); //FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(Path.Combine(releaseDir, "ShareX.exe")); //string zipFilename = string.Format("ShareX-{0}.{1}.{2}-portable.zip", versionInfo.ProductMajorPart, versionInfo.ProductMinorPart, versionInfo.ProductBuildPart); string zipPath = Path.Combine(OutputDir, "ShareX-portable.zip"); if (File.Exists(zipPath)) { File.Delete(zipPath); } Helpers.Zip(Path.GetFullPath(destination) + "\\*", Path.GetFullPath(zipPath)); Directory.Delete(destination, true); } Console.WriteLine("Folder created."); }
private static void Main(string[] args) { Console.WriteLine("ShareX setup started."); if (SetupHelpers.CheckArguments(args, "-AppVeyorRelease")) { AppVeyor = true; Job = SetupJobs.AppVeyorRelease; } else if (SetupHelpers.CheckArguments(args, "-AppVeyorSteam")) { AppVeyor = true; Job = SetupJobs.AppVeyorSteam; } else if (SetupHelpers.CheckArguments(args, "-AppVeyorWindowsStore")) { AppVeyor = true; Job = SetupJobs.AppVeyorWindowsStore; } else if (SetupHelpers.CheckArguments(args, "-AppVeyorSteamRelease")) { AppVeyor = true; Job = SetupJobs.AppVeyorSteamRelease; } else if (SetupHelpers.CheckArguments(args, "-AppVeyorWindowsStoreRelease")) { AppVeyor = true; Job = SetupJobs.AppVeyorWindowsStoreRelease; } Console.WriteLine("Setup job: " + Job); if (Directory.Exists(OutputDir)) { Console.WriteLine("Cleaning output directory: " + OutputDir); Directory.Delete(OutputDir, true); } if (Job.HasFlag(SetupJobs.CreateSetup)) { CompileSetup(); } if (Job.HasFlag(SetupJobs.CreatePortable)) { CreateFolder(ReleaseDir, PortableOutputDir, SetupJobs.CreatePortable); } if (Job.HasFlag(SetupJobs.CreateSteamFolder)) { CreateSteamFolder(); if (Job.HasFlag(SetupJobs.DownloadFFmpeg)) { CopyFFmpeg(SteamUpdatesDir, true, true); } } if (Job.HasFlag(SetupJobs.CreateWindowsStoreFolder)) { CreateFolder(WindowsStoreDir, WindowsStoreOutputDir, SetupJobs.CreateWindowsStoreFolder); if (Job.HasFlag(SetupJobs.DownloadFFmpeg)) { CopyFFmpeg(WindowsStoreOutputDir, false, true); } } if (Job.HasFlag(SetupJobs.CreateWindowsStoreDebugFolder)) { CreateFolder(WindowsStoreDebugDir, WindowsStoreOutputDir, SetupJobs.CreateWindowsStoreDebugFolder); } if (Job.HasFlag(SetupJobs.CompileAppx)) { using (Process process = new Process()) { ProcessStartInfo psi = new ProcessStartInfo() { FileName = MakeAppxPath, Arguments = $"pack /d \"{WindowsStoreOutputDir}\" /p \"{WindowsStoreAppxPath}\" /l /o", UseShellExecute = false, RedirectStandardOutput = true }; process.OutputDataReceived += (s, e) => Console.WriteLine(e.Data); process.StartInfo = psi; process.Start(); process.BeginOutputReadLine(); process.WaitForExit(); } Directory.Delete(WindowsStoreOutputDir, true); } if (Job.HasFlag(SetupJobs.CreatePortableAppsFolder)) { CreateFolder(ReleaseDir, PortableAppsOutputDir, SetupJobs.CreatePortableAppsFolder); } if (AppVeyor) { Helpers.CopyAll(OutputDir, ParentDir); } if (Job.HasFlag(SetupJobs.OpenOutputDirectory)) { OpenOutputDirectory(); } if (Job.HasFlag(SetupJobs.UploadOutputFile)) { UploadLatestFile(); } Console.WriteLine("ShareX setup successfully completed."); }
private static void CreateFolder(string source, string destination, SetupJobs job) { Console.WriteLine("Creating folder: " + destination); if (Directory.Exists(destination)) { Directory.Delete(destination, true); } Directory.CreateDirectory(destination); SetupHelpers.CopyFile(Path.Combine(source, "ShareX.exe"), destination); SetupHelpers.CopyFile(Path.Combine(source, "ShareX.exe.config"), destination); SetupHelpers.CopyFiles(source, "*.dll", destination); if (job == SetupJobs.CreateMicrosoftStoreDebugFolder) { SetupHelpers.CopyFiles(source, "*.pdb", destination); } SetupHelpers.CopyFiles(Path.Combine(ParentDir, "Licenses"), "*.txt", Path.Combine(destination, "Licenses")); if (job != SetupJobs.CreateMicrosoftStoreFolder && job != SetupJobs.CreateMicrosoftStoreDebugFolder) { if (!File.Exists(RecorderDevicesSetupPath)) { CompileISSFile("Recorder-devices-setup.iss"); } SetupHelpers.CopyFile(RecorderDevicesSetupPath, destination); SetupHelpers.CopyFile(Path.Combine(NativeMessagingHostDir, "ShareX_NativeMessagingHost.exe"), destination); } string[] languages = new string[] { "de", "es", "es-MX", "fa-IR", "fr", "hu", "id-ID", "it-IT", "ja-JP", "ko-KR", "nl-NL", "pl", "pt-BR", "pt-PT", "ro", "ru", "tr", "uk", "vi-VN", "zh-CN", "zh-TW" }; foreach (string language in languages) { SetupHelpers.CopyFiles(Path.Combine(source, language), "*.resources.dll", Path.Combine(destination, "Languages", language)); } FileHelpers.CopyAll(Path.Combine(ParentDir, @"ShareX.ScreenCaptureLib\Stickers"), Path.Combine(destination, "Stickers")); if (job == SetupJobs.CreateMicrosoftStoreFolder || job == SetupJobs.CreateMicrosoftStoreDebugFolder) { FileHelpers.CopyAll(MicrosoftStorePackageFilesDir, destination); } else if (job == SetupJobs.CreatePortable) { FileHelpers.CreateEmptyFile(Path.Combine(destination, "Portable")); 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."); }