2014-01-13 04:00:28 +13:00
|
|
|
|
#region License Information (GPL v3)
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
ShareX - A program that allows you to take screenshots and share any file type
|
2022-01-12 05:32:17 +13:00
|
|
|
|
Copyright (c) 2007-2022 ShareX Team
|
2014-01-13 04:00:28 +13:00
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
|
|
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#endregion License Information (GPL v3)
|
|
|
|
|
|
2018-03-03 10:06:40 +13:00
|
|
|
|
using ShareX.HelpersLib;
|
2014-01-13 04:00:28 +13:00
|
|
|
|
using System;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
2014-12-11 09:25:20 +13:00
|
|
|
|
namespace ShareX.Setup
|
2014-01-13 04:00:28 +13:00
|
|
|
|
{
|
|
|
|
|
internal class Program
|
|
|
|
|
{
|
2016-08-27 12:28:05 +12:00
|
|
|
|
[Flags]
|
|
|
|
|
private enum SetupJobs
|
2014-11-14 11:54:00 +13:00
|
|
|
|
{
|
2016-08-27 12:28:05 +12:00
|
|
|
|
None = 0,
|
|
|
|
|
CreateSetup = 1,
|
|
|
|
|
CreatePortable = 1 << 1,
|
2022-10-23 18:46:34 +13:00
|
|
|
|
CreateDebug = 1 << 2,
|
|
|
|
|
CreateSteamFolder = 1 << 3,
|
2022-10-14 12:15:36 +13:00
|
|
|
|
CreateMicrosoftStoreFolder = 1 << 4,
|
|
|
|
|
CreateMicrosoftStoreDebugFolder = 1 << 5,
|
|
|
|
|
CompileAppx = 1 << 6,
|
|
|
|
|
DownloadFFmpeg = 1 << 7,
|
|
|
|
|
CreateChecksumFile = 1 << 8,
|
2022-10-23 18:46:34 +13:00
|
|
|
|
OpenOutputDirectory = 1 << 9,
|
2016-08-27 12:28:05 +12:00
|
|
|
|
|
2022-10-24 16:56:59 +13:00
|
|
|
|
Release = CreateSetup | CreatePortable | DownloadFFmpeg | CreateChecksumFile | OpenOutputDirectory,
|
|
|
|
|
Debug = CreateDebug | DownloadFFmpeg | CreateChecksumFile | OpenOutputDirectory,
|
|
|
|
|
Steam = CreateSteamFolder | DownloadFFmpeg | CreateChecksumFile | OpenOutputDirectory,
|
|
|
|
|
MicrosoftStore = CreateMicrosoftStoreFolder | CompileAppx | DownloadFFmpeg | CreateChecksumFile | OpenOutputDirectory,
|
|
|
|
|
MicrosoftStoreDebug = CreateMicrosoftStoreDebugFolder | CompileAppx | DownloadFFmpeg | CreateChecksumFile | OpenOutputDirectory
|
2014-11-14 11:54:00 +13:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-08 17:52:26 +13:00
|
|
|
|
private static SetupJobs Job { get; set; } = SetupJobs.Release;
|
|
|
|
|
private static bool Silent { get; set; } = false;
|
2022-11-15 03:47:45 +13:00
|
|
|
|
private static bool AppVeyor { get; set; } = false;
|
2015-09-28 01:46:29 +13:00
|
|
|
|
|
2022-11-03 04:06:49 +13:00
|
|
|
|
private static string ParentDir;
|
|
|
|
|
private static string Configuration;
|
|
|
|
|
private static string AppVersion;
|
2022-10-14 12:15:36 +13:00
|
|
|
|
|
2022-11-08 17:47:30 +13:00
|
|
|
|
private static string SolutionPath => Path.Combine(ParentDir, "ShareX.sln");
|
2022-10-23 19:31:26 +13:00
|
|
|
|
private static string BinDir => Path.Combine(ParentDir, "ShareX", "bin", Configuration);
|
|
|
|
|
private static string NativeMessagingHostDir => Path.Combine(ParentDir, "ShareX.NativeMessagingHost", "bin", Configuration);
|
|
|
|
|
private static string SteamLauncherDir => Path.Combine(ParentDir, "ShareX.Steam", "bin", Configuration);
|
|
|
|
|
private static string ExecutablePath => Path.Combine(BinDir, "ShareX.exe");
|
|
|
|
|
|
2017-11-03 00:44:10 +13:00
|
|
|
|
private static string OutputDir => Path.Combine(ParentDir, "Output");
|
2016-08-27 12:02:43 +12:00
|
|
|
|
private static string PortableOutputDir => Path.Combine(OutputDir, "ShareX-portable");
|
2022-10-23 18:46:34 +13:00
|
|
|
|
private static string DebugOutputDir => Path.Combine(OutputDir, "ShareX-debug");
|
2016-08-27 11:55:53 +12:00
|
|
|
|
private static string SteamOutputDir => Path.Combine(OutputDir, "ShareX-Steam");
|
2022-02-04 21:32:41 +13:00
|
|
|
|
private static string MicrosoftStoreOutputDir => Path.Combine(OutputDir, "ShareX-MicrosoftStore");
|
2017-04-23 05:38:19 +12:00
|
|
|
|
|
|
|
|
|
private static string SetupDir => Path.Combine(ParentDir, "ShareX.Setup");
|
|
|
|
|
private static string InnoSetupDir => Path.Combine(SetupDir, "InnoSetup");
|
2022-02-04 21:32:41 +13:00
|
|
|
|
private static string MicrosoftStorePackageFilesDir => Path.Combine(SetupDir, "MicrosoftStore");
|
2016-08-27 12:02:43 +12:00
|
|
|
|
|
2022-11-02 01:36:31 +13:00
|
|
|
|
private static string SetupPath => Path.Combine(OutputDir, $"ShareX-{AppVersion}-setup.exe");
|
|
|
|
|
private static string RecorderDevicesSetupPath => Path.Combine(OutputDir, "Recorder-devices-setup.exe");
|
2022-10-14 11:44:23 +13:00
|
|
|
|
private static string PortableZipPath => Path.Combine(OutputDir, $"ShareX-{AppVersion}-portable.zip");
|
2022-10-23 18:46:34 +13:00
|
|
|
|
private static string DebugZipPath => Path.Combine(OutputDir, $"ShareX-{AppVersion}-debug.zip");
|
2016-08-26 13:51:37 +12:00
|
|
|
|
private static string SteamUpdatesDir => Path.Combine(SteamOutputDir, "Updates");
|
2022-10-14 11:44:23 +13:00
|
|
|
|
private static string SteamZipPath => Path.Combine(OutputDir, $"ShareX-{AppVersion}-Steam.zip");
|
2022-10-14 11:27:58 +13:00
|
|
|
|
private static string MicrosoftStoreAppxPath => Path.Combine(OutputDir, $"ShareX-{AppVersion}.appx");
|
2022-09-11 16:42:39 +12:00
|
|
|
|
private static string FFmpegPath => Path.Combine(OutputDir, "ffmpeg.exe");
|
2016-08-27 12:02:43 +12:00
|
|
|
|
|
2022-11-03 04:06:49 +13:00
|
|
|
|
private const string InnoSetupCompilerPath = @"C:\Program Files (x86)\Inno Setup 6\ISCC.exe";
|
2022-11-17 03:10:53 +13:00
|
|
|
|
private const string MakeAppxPath = @"C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\makeappx.exe";
|
2022-11-03 04:06:49 +13:00
|
|
|
|
private const string FFmpegDownloadURL = "https://github.com/ShareX/FFmpeg/releases/download/v5.1/ffmpeg-5.1-win64.zip";
|
2014-11-14 11:54:00 +13:00
|
|
|
|
|
2014-01-13 04:00:28 +13:00
|
|
|
|
private static void Main(string[] args)
|
|
|
|
|
{
|
2016-08-27 12:28:05 +12:00
|
|
|
|
Console.WriteLine("ShareX setup started.");
|
2016-08-26 12:01:05 +12:00
|
|
|
|
|
2022-10-15 11:28:50 +13:00
|
|
|
|
CheckArgs(args);
|
2016-08-27 12:28:05 +12:00
|
|
|
|
|
2022-11-03 04:06:49 +13:00
|
|
|
|
Console.WriteLine("Job: " + Job);
|
2016-08-27 12:28:05 +12:00
|
|
|
|
|
2022-11-03 04:06:49 +13:00
|
|
|
|
UpdatePaths();
|
2022-10-14 12:35:03 +13:00
|
|
|
|
|
2016-08-27 12:32:02 +12:00
|
|
|
|
if (Directory.Exists(OutputDir))
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Cleaning output directory: " + OutputDir);
|
|
|
|
|
|
|
|
|
|
Directory.Delete(OutputDir, true);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-11 16:42:39 +12:00
|
|
|
|
if (Job.HasFlag(SetupJobs.DownloadFFmpeg))
|
|
|
|
|
{
|
|
|
|
|
DownloadFFmpeg();
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-27 12:28:05 +12:00
|
|
|
|
if (Job.HasFlag(SetupJobs.CreateSetup))
|
|
|
|
|
{
|
|
|
|
|
CompileSetup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Job.HasFlag(SetupJobs.CreatePortable))
|
2016-08-26 12:01:05 +12:00
|
|
|
|
{
|
2022-10-23 19:31:26 +13:00
|
|
|
|
CreateFolder(BinDir, PortableOutputDir, SetupJobs.CreatePortable);
|
2016-08-26 12:01:05 +12:00
|
|
|
|
}
|
|
|
|
|
|
2022-10-23 18:46:34 +13:00
|
|
|
|
if (Job.HasFlag(SetupJobs.CreateDebug))
|
|
|
|
|
{
|
2022-10-23 19:31:26 +13:00
|
|
|
|
CreateFolder(BinDir, DebugOutputDir, SetupJobs.CreateDebug);
|
2022-10-23 18:46:34 +13:00
|
|
|
|
}
|
|
|
|
|
|
2016-08-27 12:28:05 +12:00
|
|
|
|
if (Job.HasFlag(SetupJobs.CreateSteamFolder))
|
|
|
|
|
{
|
|
|
|
|
CreateSteamFolder();
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-04 21:32:41 +13:00
|
|
|
|
if (Job.HasFlag(SetupJobs.CreateMicrosoftStoreFolder))
|
2017-04-21 11:17:34 +12:00
|
|
|
|
{
|
2022-10-23 19:31:26 +13:00
|
|
|
|
CreateFolder(BinDir, MicrosoftStoreOutputDir, SetupJobs.CreateMicrosoftStoreFolder);
|
2017-04-22 05:08:29 +12:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-04 21:32:41 +13:00
|
|
|
|
if (Job.HasFlag(SetupJobs.CreateMicrosoftStoreDebugFolder))
|
2017-04-22 05:08:29 +12:00
|
|
|
|
{
|
2022-10-23 19:31:26 +13:00
|
|
|
|
CreateFolder(BinDir, MicrosoftStoreOutputDir, SetupJobs.CreateMicrosoftStoreDebugFolder);
|
2017-04-21 11:17:34 +12:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-30 02:15:03 +12:00
|
|
|
|
if (Job.HasFlag(SetupJobs.CompileAppx))
|
|
|
|
|
{
|
2022-11-02 01:36:31 +13:00
|
|
|
|
CompileAppx();
|
2021-11-10 21:57:10 +13:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-15 03:47:45 +13:00
|
|
|
|
if (AppVeyor)
|
|
|
|
|
{
|
|
|
|
|
FileHelpers.CopyAll(OutputDir, ParentDir);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-08 17:52:26 +13:00
|
|
|
|
if (!Silent && Job.HasFlag(SetupJobs.OpenOutputDirectory))
|
2016-08-27 12:28:05 +12:00
|
|
|
|
{
|
2022-10-15 11:46:28 +13:00
|
|
|
|
FileHelpers.OpenFolder(OutputDir, false);
|
2016-08-27 12:28:05 +12:00
|
|
|
|
}
|
2015-09-06 21:32:34 +12:00
|
|
|
|
|
2016-08-27 12:28:05 +12:00
|
|
|
|
Console.WriteLine("ShareX setup successfully completed.");
|
2016-08-26 12:01:05 +12:00
|
|
|
|
}
|
|
|
|
|
|
2022-10-15 11:28:50 +13:00
|
|
|
|
private static void CheckArgs(string[] args)
|
2022-09-11 16:42:39 +12:00
|
|
|
|
{
|
2022-10-15 11:28:50 +13:00
|
|
|
|
CLIManager cli = new CLIManager(args);
|
|
|
|
|
cli.ParseCommands();
|
|
|
|
|
|
2022-11-08 17:52:26 +13:00
|
|
|
|
Silent = cli.IsCommandExist("Silent");
|
2022-11-15 03:47:45 +13:00
|
|
|
|
AppVeyor = cli.IsCommandExist("AppVeyor");
|
2022-10-15 11:28:50 +13:00
|
|
|
|
|
2022-11-08 17:52:26 +13:00
|
|
|
|
if (Silent)
|
2022-09-11 16:42:39 +12:00
|
|
|
|
{
|
2022-11-08 17:52:26 +13:00
|
|
|
|
Console.WriteLine("Silent: " + Silent);
|
2022-11-06 09:54:09 +13:00
|
|
|
|
}
|
2022-10-15 11:28:50 +13:00
|
|
|
|
|
2022-11-06 09:54:09 +13:00
|
|
|
|
CLICommand command = cli.GetCommand("Job");
|
2022-10-15 11:28:50 +13:00
|
|
|
|
|
2022-11-06 09:54:09 +13:00
|
|
|
|
if (command != null)
|
|
|
|
|
{
|
|
|
|
|
string parameter = command.Parameter;
|
2022-10-15 11:28:50 +13:00
|
|
|
|
|
2022-11-06 09:54:09 +13:00
|
|
|
|
if (Enum.TryParse(parameter, out SetupJobs job))
|
2022-10-15 11:28:50 +13:00
|
|
|
|
{
|
2022-11-06 09:54:09 +13:00
|
|
|
|
Job = job;
|
2022-10-15 11:28:50 +13:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-11-06 09:54:09 +13:00
|
|
|
|
Console.WriteLine("Invalid job: " + parameter);
|
|
|
|
|
|
2022-10-15 11:28:50 +13:00
|
|
|
|
Environment.Exit(0);
|
|
|
|
|
}
|
2022-09-11 16:42:39 +12:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-03 04:06:49 +13:00
|
|
|
|
private static void UpdatePaths()
|
2022-10-15 11:46:28 +13:00
|
|
|
|
{
|
2022-11-08 17:47:30 +13:00
|
|
|
|
ParentDir = Directory.GetCurrentDirectory();
|
|
|
|
|
|
|
|
|
|
if (!File.Exists(SolutionPath))
|
2022-11-03 04:06:49 +13:00
|
|
|
|
{
|
2022-11-08 17:47:30 +13:00
|
|
|
|
Console.WriteLine("Invalid parent directory: " + ParentDir);
|
|
|
|
|
|
2022-11-03 04:06:49 +13:00
|
|
|
|
ParentDir = FileHelpers.GetAbsolutePath(@"..\..\..\");
|
2022-11-08 17:47:30 +13:00
|
|
|
|
|
|
|
|
|
if (!File.Exists(SolutionPath))
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Invalid parent directory: " + ParentDir);
|
|
|
|
|
|
|
|
|
|
Environment.Exit(0);
|
|
|
|
|
}
|
2022-11-03 04:06:49 +13:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Parent directory: " + ParentDir);
|
|
|
|
|
|
|
|
|
|
if (Job.HasFlag(SetupJobs.CreateDebug))
|
|
|
|
|
{
|
|
|
|
|
Configuration = "Debug";
|
|
|
|
|
}
|
|
|
|
|
else if (Job.HasFlag(SetupJobs.CreateSteamFolder))
|
|
|
|
|
{
|
|
|
|
|
Configuration = "Steam";
|
|
|
|
|
}
|
|
|
|
|
else if (Job.HasFlag(SetupJobs.CreateMicrosoftStoreFolder))
|
|
|
|
|
{
|
|
|
|
|
Configuration = "MicrosoftStore";
|
|
|
|
|
}
|
|
|
|
|
else if (Job.HasFlag(SetupJobs.CreateMicrosoftStoreDebugFolder))
|
|
|
|
|
{
|
|
|
|
|
Configuration = "MicrosoftStoreDebug";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Configuration = "Release";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Configuration: " + Configuration);
|
|
|
|
|
|
2022-10-15 11:46:28 +13:00
|
|
|
|
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(ExecutablePath);
|
2022-11-03 04:06:49 +13:00
|
|
|
|
AppVersion = $"{versionInfo.ProductMajorPart}.{versionInfo.ProductMinorPart}.{versionInfo.ProductBuildPart}";
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Application version: " + AppVersion);
|
2022-10-15 11:46:28 +13:00
|
|
|
|
}
|
|
|
|
|
|
2014-11-22 02:34:50 +13:00
|
|
|
|
private static void CompileSetup()
|
2014-11-14 11:54:00 +13:00
|
|
|
|
{
|
2016-08-28 08:32:41 +12:00
|
|
|
|
CompileISSFile("Recorder-devices-setup.iss");
|
|
|
|
|
CompileISSFile("ShareX-setup.iss");
|
2022-11-02 01:36:31 +13:00
|
|
|
|
CreateChecksumFile(SetupPath);
|
2014-11-14 11:54:00 +13:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-12 10:21:19 +13:00
|
|
|
|
private static void CompileISSFile(string fileName)
|
2016-08-26 15:41:34 +12:00
|
|
|
|
{
|
2016-08-28 08:32:41 +12:00
|
|
|
|
if (File.Exists(InnoSetupCompilerPath))
|
|
|
|
|
{
|
2021-12-12 10:21:19 +13:00
|
|
|
|
Console.WriteLine("Compiling setup file: " + fileName);
|
2016-08-26 15:41:34 +12:00
|
|
|
|
|
2018-12-07 07:51:41 +13:00
|
|
|
|
using (Process process = new Process())
|
|
|
|
|
{
|
|
|
|
|
ProcessStartInfo psi = new ProcessStartInfo()
|
|
|
|
|
{
|
|
|
|
|
FileName = InnoSetupCompilerPath,
|
2022-11-03 04:06:49 +13:00
|
|
|
|
WorkingDirectory = InnoSetupDir,
|
2022-11-03 09:31:57 +13:00
|
|
|
|
Arguments = $"/Q \"{fileName}\"",
|
2018-12-07 07:51:41 +13:00
|
|
|
|
UseShellExecute = false
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
process.StartInfo = psi;
|
|
|
|
|
process.Start();
|
|
|
|
|
process.WaitForExit();
|
|
|
|
|
}
|
2016-08-26 15:41:34 +12:00
|
|
|
|
|
2022-11-03 09:31:57 +13:00
|
|
|
|
Console.WriteLine("Setup file compiled: " + fileName);
|
2016-08-28 08:32:41 +12:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("InnoSetup compiler is missing: " + InnoSetupCompilerPath);
|
|
|
|
|
}
|
2016-08-26 15:41:34 +12:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-02 01:36:31 +13:00
|
|
|
|
private static void CompileAppx()
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Compiling appx file: " + MicrosoftStoreAppxPath);
|
|
|
|
|
|
|
|
|
|
using (Process process = new Process())
|
|
|
|
|
{
|
|
|
|
|
ProcessStartInfo psi = new ProcessStartInfo()
|
|
|
|
|
{
|
|
|
|
|
FileName = MakeAppxPath,
|
|
|
|
|
Arguments = $"pack /d \"{MicrosoftStoreOutputDir}\" /p \"{MicrosoftStoreAppxPath}\" /l /o",
|
2022-11-05 07:30:39 +13:00
|
|
|
|
UseShellExecute = false
|
2022-11-02 01:36:31 +13:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
process.StartInfo = psi;
|
|
|
|
|
process.Start();
|
|
|
|
|
process.WaitForExit();
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-05 07:30:39 +13:00
|
|
|
|
Console.WriteLine("Appx file compiled: " + MicrosoftStoreAppxPath);
|
2022-11-02 01:51:44 +13:00
|
|
|
|
|
|
|
|
|
CreateChecksumFile(MicrosoftStoreAppxPath);
|
2022-11-02 01:36:31 +13:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-06 21:32:34 +12:00
|
|
|
|
private static void CreateSteamFolder()
|
|
|
|
|
{
|
2022-11-02 01:36:31 +13:00
|
|
|
|
Console.WriteLine("Creating Steam folder: " + SteamOutputDir);
|
2016-08-27 11:55:53 +12:00
|
|
|
|
|
2016-08-26 13:51:37 +12:00
|
|
|
|
if (Directory.Exists(SteamOutputDir))
|
2015-09-06 21:32:34 +12:00
|
|
|
|
{
|
2016-08-26 13:51:37 +12:00
|
|
|
|
Directory.Delete(SteamOutputDir, true);
|
2015-09-06 21:32:34 +12:00
|
|
|
|
}
|
|
|
|
|
|
2016-08-26 13:51:37 +12:00
|
|
|
|
Directory.CreateDirectory(SteamOutputDir);
|
2015-09-06 21:32:34 +12:00
|
|
|
|
|
2022-11-03 06:04:28 +13:00
|
|
|
|
FileHelpers.CopyFiles(Path.Combine(SteamLauncherDir, "ShareX_Launcher.exe"), SteamOutputDir);
|
|
|
|
|
FileHelpers.CopyFiles(Path.Combine(SteamLauncherDir, "steam_appid.txt"), SteamOutputDir);
|
|
|
|
|
FileHelpers.CopyFiles(Path.Combine(SteamLauncherDir, "installscript.vdf"), SteamOutputDir);
|
|
|
|
|
FileHelpers.CopyFiles(SteamLauncherDir, SteamOutputDir, "*.dll");
|
2015-09-06 21:32:34 +12:00
|
|
|
|
|
2022-10-23 19:31:26 +13:00
|
|
|
|
CreateFolder(BinDir, SteamUpdatesDir, SetupJobs.CreateSteamFolder);
|
2015-09-06 21:32:34 +12:00
|
|
|
|
}
|
|
|
|
|
|
2017-04-22 05:08:29 +12:00
|
|
|
|
private static void CreateFolder(string source, string destination, SetupJobs job)
|
2017-04-21 11:17:34 +12:00
|
|
|
|
{
|
2017-04-22 05:08:29 +12:00
|
|
|
|
Console.WriteLine("Creating folder: " + destination);
|
2017-04-21 11:17:34 +12:00
|
|
|
|
|
2017-04-22 05:08:29 +12:00
|
|
|
|
if (Directory.Exists(destination))
|
2017-04-21 11:17:34 +12:00
|
|
|
|
{
|
2017-04-22 05:08:29 +12:00
|
|
|
|
Directory.Delete(destination, true);
|
2017-04-21 11:17:34 +12:00
|
|
|
|
}
|
|
|
|
|
|
2017-04-22 05:08:29 +12:00
|
|
|
|
Directory.CreateDirectory(destination);
|
2017-04-21 11:17:34 +12:00
|
|
|
|
|
2022-11-03 06:04:28 +13:00
|
|
|
|
FileHelpers.CopyFiles(Path.Combine(source, "ShareX.exe"), destination);
|
|
|
|
|
FileHelpers.CopyFiles(Path.Combine(source, "ShareX.exe.config"), destination);
|
|
|
|
|
FileHelpers.CopyFiles(source, destination, "*.dll");
|
2014-01-13 04:00:28 +13:00
|
|
|
|
|
2022-10-23 18:46:34 +13:00
|
|
|
|
if (job == SetupJobs.CreateDebug || job == SetupJobs.CreateMicrosoftStoreDebugFolder)
|
2014-11-14 12:28:07 +13:00
|
|
|
|
{
|
2022-11-03 06:04:28 +13:00
|
|
|
|
FileHelpers.CopyFiles(source, destination, "*.pdb");
|
2014-11-14 12:28:07 +13:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-03 06:04:28 +13:00
|
|
|
|
FileHelpers.CopyFiles(Path.Combine(ParentDir, "Licenses"), Path.Combine(destination, "Licenses"), "*.txt");
|
2016-08-28 10:08:18 +12:00
|
|
|
|
|
2022-02-04 21:32:41 +13:00
|
|
|
|
if (job != SetupJobs.CreateMicrosoftStoreFolder && job != SetupJobs.CreateMicrosoftStoreDebugFolder)
|
2016-08-28 06:35:13 +12:00
|
|
|
|
{
|
2017-05-04 02:07:35 +12:00
|
|
|
|
if (!File.Exists(RecorderDevicesSetupPath))
|
|
|
|
|
{
|
|
|
|
|
CompileISSFile("Recorder-devices-setup.iss");
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-03 06:04:28 +13:00
|
|
|
|
FileHelpers.CopyFiles(RecorderDevicesSetupPath, destination);
|
2016-08-28 10:08:18 +12:00
|
|
|
|
|
2022-11-03 06:04:28 +13:00
|
|
|
|
FileHelpers.CopyFiles(Path.Combine(NativeMessagingHostDir, "ShareX_NativeMessagingHost.exe"), destination);
|
2017-05-04 02:07:35 +12:00
|
|
|
|
}
|
2014-01-13 04:00:28 +13:00
|
|
|
|
|
2022-07-10 18:54:38 +12:00
|
|
|
|
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",
|
2022-06-30 00:01:25 +12:00
|
|
|
|
"ro", "ru", "tr", "uk", "vi-VN", "zh-CN", "zh-TW" };
|
2015-01-05 05:53:04 +13:00
|
|
|
|
|
|
|
|
|
foreach (string language in languages)
|
|
|
|
|
{
|
2022-11-03 06:04:28 +13:00
|
|
|
|
FileHelpers.CopyFiles(Path.Combine(source, language), Path.Combine(destination, "Languages", language), "*.resources.dll");
|
2015-01-05 05:53:04 +13:00
|
|
|
|
}
|
2014-01-13 04:00:28 +13:00
|
|
|
|
|
2022-09-11 16:42:39 +12:00
|
|
|
|
if (File.Exists(FFmpegPath))
|
|
|
|
|
{
|
2022-11-03 06:04:28 +13:00
|
|
|
|
FileHelpers.CopyFiles(FFmpegPath, destination);
|
2022-09-11 16:42:39 +12:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-03 18:34:18 +12:00
|
|
|
|
FileHelpers.CopyAll(Path.Combine(ParentDir, @"ShareX.ScreenCaptureLib\Stickers"), Path.Combine(destination, "Stickers"));
|
2018-03-17 08:58:25 +13:00
|
|
|
|
|
2022-10-14 11:44:23 +13:00
|
|
|
|
if (job == SetupJobs.CreatePortable)
|
2017-04-21 11:17:34 +12:00
|
|
|
|
{
|
2022-10-14 11:44:23 +13:00
|
|
|
|
FileHelpers.CreateEmptyFile(Path.Combine(destination, "Portable"));
|
2022-11-03 09:31:57 +13:00
|
|
|
|
}
|
|
|
|
|
else if (job == SetupJobs.CreateMicrosoftStoreFolder || job == SetupJobs.CreateMicrosoftStoreDebugFolder)
|
|
|
|
|
{
|
|
|
|
|
FileHelpers.CopyAll(MicrosoftStorePackageFilesDir, destination);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Folder created: " + destination);
|
|
|
|
|
|
|
|
|
|
if (job == SetupJobs.CreatePortable)
|
|
|
|
|
{
|
2022-11-02 01:36:31 +13:00
|
|
|
|
CreateZipFile(destination, PortableZipPath);
|
2016-01-08 07:36:01 +13:00
|
|
|
|
}
|
2022-10-23 18:46:34 +13:00
|
|
|
|
else if (job == SetupJobs.CreateDebug)
|
|
|
|
|
{
|
2022-11-02 01:36:31 +13:00
|
|
|
|
CreateZipFile(destination, DebugZipPath);
|
2022-10-23 18:46:34 +13:00
|
|
|
|
}
|
2022-10-14 11:44:23 +13:00
|
|
|
|
else if (job == SetupJobs.CreateSteamFolder)
|
2015-09-06 21:32:34 +12:00
|
|
|
|
{
|
2022-11-02 01:36:31 +13:00
|
|
|
|
CreateZipFile(destination, SteamZipPath);
|
2022-10-14 11:44:23 +13:00
|
|
|
|
}
|
2014-01-13 04:00:28 +13:00
|
|
|
|
}
|
2014-01-13 05:05:31 +13:00
|
|
|
|
|
2022-11-02 01:36:31 +13:00
|
|
|
|
private static void CreateZipFile(string source, string archivePath)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Creating zip file: " + archivePath);
|
|
|
|
|
|
2022-11-03 04:06:49 +13:00
|
|
|
|
ZipManager.Compress(source, archivePath);
|
2022-11-02 01:36:31 +13:00
|
|
|
|
CreateChecksumFile(archivePath);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-11 16:42:39 +12:00
|
|
|
|
private static void DownloadFFmpeg()
|
2016-08-28 05:57:46 +12:00
|
|
|
|
{
|
2022-09-11 16:42:39 +12:00
|
|
|
|
if (!File.Exists(FFmpegPath))
|
2016-08-28 06:35:13 +12:00
|
|
|
|
{
|
2022-11-03 05:27:16 +13:00
|
|
|
|
string fileName = Path.GetFileName(FFmpegDownloadURL);
|
|
|
|
|
string filePath = Path.Combine(OutputDir, fileName);
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Downloading: " + FFmpegDownloadURL);
|
|
|
|
|
URLHelpers.DownloadFile(FFmpegDownloadURL, filePath);
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Extracting: " + filePath);
|
2022-11-02 04:22:43 +13:00
|
|
|
|
ZipManager.Extract(filePath, OutputDir, false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase));
|
2017-12-05 19:53:04 +13:00
|
|
|
|
}
|
2016-08-28 05:57:46 +12:00
|
|
|
|
}
|
2022-11-02 01:36:31 +13:00
|
|
|
|
|
|
|
|
|
private static void CreateChecksumFile(string filePath)
|
|
|
|
|
{
|
|
|
|
|
if (Job.HasFlag(SetupJobs.CreateChecksumFile))
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Creating checksum file: " + filePath);
|
|
|
|
|
|
|
|
|
|
Helpers.CreateChecksumFile(filePath);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-01-13 04:00:28 +13:00
|
|
|
|
}
|
|
|
|
|
}
|