private static void CopyFFmpeg(string destination, bool include32bit, bool include64bit) { if (include32bit) { if (!File.Exists(FFmpeg32bit)) { string filename = SetupHelpers.DownloadFile("https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.2-win64-static.zip"); ZipManager.Extract(filename, ".", false, new List <string>() { "ffmpeg.exe" }); File.Move("ffmpeg.exe", FFmpeg32bit); } SetupHelpers.CopyFile(FFmpeg32bit, destination); } if (include64bit) { if (!File.Exists(FFmpeg64bit)) { string filename = SetupHelpers.DownloadFile("https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-4.2-win32-static.zip"); ZipManager.Extract(filename, ".", false, new List <string>() { "ffmpeg.exe" }); File.Move("ffmpeg.exe", FFmpeg64bit); } SetupHelpers.CopyFile(FFmpeg64bit, destination); } }
private static void CopyFFmpeg(string destination, bool include32bit, bool include64bit) { if (include32bit) { if (!File.Exists(FFmpeg32bit)) { string filename = SetupHelpers.DownloadFile("https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-4.3.1-win32-static.zip"); ZipManager.Extract(filename, ".", false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase), 1_000_000_000); File.Move("ffmpeg.exe", FFmpeg32bit); } SetupHelpers.CopyFile(FFmpeg32bit, destination); } if (include64bit) { if (!File.Exists(FFmpeg64bit)) { string filename = SetupHelpers.DownloadFile("https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.3.1-win64-static.zip"); ZipManager.Extract(filename, ".", false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase), 1_000_000_000); File.Move("ffmpeg.exe", FFmpeg64bit); } SetupHelpers.CopyFile(FFmpeg64bit, destination); } }
private static void CopyFFmpeg(string destination, bool include32bit, bool include64bit) { if (include32bit) { if (!File.Exists(FFmpeg32bit)) { string filePath = SetupHelpers.DownloadFile("https://github.com/ShareX/FFmpeg/releases/download/v4.3.1/ffmpeg-4.3.1-win32.zip"); ZipManager.Extract(filePath, ".", false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase), 100_000_000); File.Move("ffmpeg.exe", FFmpeg32bit); } SetupHelpers.CopyFile(FFmpeg32bit, destination); } if (include64bit) { if (!File.Exists(FFmpeg64bit)) { string filePath = SetupHelpers.DownloadFile("https://github.com/ShareX/FFmpeg/releases/download/v4.3.1/ffmpeg-4.3.1-win64.zip"); ZipManager.Extract(filePath, ".", false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase), 100_000_000); File.Move("ffmpeg.exe", FFmpeg64bit); } SetupHelpers.CopyFile(FFmpeg64bit, destination); } }
private static void CreateSteamFolder() { Console.WriteLine("Creating Steam folder:" + SteamOutputDir); if (Directory.Exists(SteamOutputDir)) { Directory.Delete(SteamOutputDir, true); } Directory.CreateDirectory(SteamOutputDir); SetupHelpers.CopyFile(Path.Combine(SteamLauncherDir, "ShareX_Launcher.exe"), SteamOutputDir); SetupHelpers.CopyFile(Path.Combine(SteamLauncherDir, "steam_appid.txt"), SteamOutputDir); SetupHelpers.CopyFile(Path.Combine(SteamLauncherDir, "installscript.vdf"), SteamOutputDir); SetupHelpers.CopyFiles(SteamLauncherDir, "*.dll", SteamOutputDir); CreateFolder(SteamDir, SteamUpdatesDir, SetupJobs.CreateSteamFolder); }
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.CreateWindowsStoreDebugFolder) { SetupHelpers.CopyFiles(source, "*.pdb", destination); } SetupHelpers.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"); } 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", "ko-KR", "nl-NL", "pt-BR", "pt-PT", "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)); } Helpers.CopyAll(Path.Combine(ParentDir, @"ShareX.ScreenCaptureLib\Stickers"), Path.Combine(destination, "Stickers")); if (job == SetupJobs.CreatePortableAppsFolder) { Helpers.CreateEmptyFile(Path.Combine(destination, "PortableApps")); } else if (job == SetupJobs.CreateWindowsStoreFolder || job == SetupJobs.CreateWindowsStoreDebugFolder) { 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"); ZipManager.Compress(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; } 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 (AppVeyor) { Helpers.CopyAll(OutputDir, ParentDir); } if (Job.HasFlag(SetupJobs.OpenOutputDirectory)) { OpenOutputDirectory(); } if (Job.HasFlag(SetupJobs.UploadOutputFile)) { UploadLatestFile(); } Console.WriteLine("ShareX setup successfully completed."); }