mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-29 17:02:05 +13:00
Move few methods to HelpersLib from Setup project
This commit is contained in:
parent
fa22ad8b2a
commit
68eda57ca5
3 changed files with 23 additions and 55 deletions
|
@ -99,17 +99,17 @@ private static void Main(string[] args)
|
|||
{
|
||||
Console.WriteLine("ShareX setup started.");
|
||||
|
||||
if (Helpers.CheckArguments(args, "-AppVeyorRelease"))
|
||||
if (SetupHelpers.CheckArguments(args, "-AppVeyorRelease"))
|
||||
{
|
||||
AppVeyor = true;
|
||||
Job = SetupJobs.AppVeyorRelease;
|
||||
}
|
||||
else if (Helpers.CheckArguments(args, "-AppVeyorSteam"))
|
||||
else if (SetupHelpers.CheckArguments(args, "-AppVeyorSteam"))
|
||||
{
|
||||
AppVeyor = true;
|
||||
Job = SetupJobs.AppVeyorSteam;
|
||||
}
|
||||
else if (Helpers.CheckArguments(args, "-AppVeyorWindowsStore"))
|
||||
else if (SetupHelpers.CheckArguments(args, "-AppVeyorWindowsStore"))
|
||||
{
|
||||
AppVeyor = true;
|
||||
Job = SetupJobs.AppVeyorWindowsStore;
|
||||
|
@ -217,10 +217,10 @@ private static void CreateSteamFolder()
|
|||
|
||||
Directory.CreateDirectory(SteamOutputDir);
|
||||
|
||||
Helpers.CopyFile(Path.Combine(SteamLauncherDir, "ShareX_Launcher.exe"), SteamOutputDir);
|
||||
Helpers.CopyFile(Path.Combine(SteamLauncherDir, "steam_appid.txt"), SteamOutputDir);
|
||||
Helpers.CopyFile(Path.Combine(SteamLauncherDir, "installscript.vdf"), SteamOutputDir);
|
||||
Helpers.CopyFiles(SteamLauncherDir, "*.dll", 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);
|
||||
}
|
||||
|
@ -236,24 +236,24 @@ private static void CreateFolder(string source, string destination, SetupJobs jo
|
|||
|
||||
Directory.CreateDirectory(destination);
|
||||
|
||||
Helpers.CopyFile(Path.Combine(source, "ShareX.exe"), destination);
|
||||
Helpers.CopyFile(Path.Combine(source, "ShareX.exe.config"), destination);
|
||||
SetupHelpers.CopyFile(Path.Combine(source, "ShareX.exe"), destination);
|
||||
SetupHelpers.CopyFile(Path.Combine(source, "ShareX.exe.config"), destination);
|
||||
|
||||
if (job == SetupJobs.CreateWindowsStoreFolder || job == SetupJobs.CreateWindowsStoreDebugFolder)
|
||||
{
|
||||
Helpers.CopyFiles(source, "*.dll", destination, new string[] { "7z.dll" });
|
||||
SetupHelpers.CopyFiles(source, "*.dll", destination, new string[] { "7z.dll" });
|
||||
}
|
||||
else
|
||||
{
|
||||
Helpers.CopyFiles(source, "*.dll", destination);
|
||||
SetupHelpers.CopyFiles(source, "*.dll", destination);
|
||||
}
|
||||
|
||||
if (job == SetupJobs.CreateWindowsStoreDebugFolder)
|
||||
{
|
||||
Helpers.CopyFiles(source, "*.pdb", destination);
|
||||
SetupHelpers.CopyFiles(source, "*.pdb", destination);
|
||||
}
|
||||
|
||||
Helpers.CopyFiles(Path.Combine(ParentDir, "Licenses"), "*.txt", Path.Combine(destination, "Licenses"));
|
||||
SetupHelpers.CopyFiles(Path.Combine(ParentDir, "Licenses"), "*.txt", Path.Combine(destination, "Licenses"));
|
||||
|
||||
if (job != SetupJobs.CreateWindowsStoreFolder && job != SetupJobs.CreateWindowsStoreDebugFolder)
|
||||
{
|
||||
|
@ -262,16 +262,16 @@ private static void CreateFolder(string source, string destination, SetupJobs jo
|
|||
CompileISSFile("Recorder-devices-setup.iss");
|
||||
}
|
||||
|
||||
Helpers.CopyFile(RecorderDevicesSetupPath, destination);
|
||||
SetupHelpers.CopyFile(RecorderDevicesSetupPath, destination);
|
||||
|
||||
Helpers.CopyFile(Path.Combine(NativeMessagingHostDir, "ShareX_NativeMessagingHost.exe"), destination);
|
||||
SetupHelpers.CopyFile(Path.Combine(NativeMessagingHostDir, "ShareX_NativeMessagingHost.exe"), destination);
|
||||
}
|
||||
|
||||
string[] languages = new string[] { "de", "es", "fr", "hu", "it-IT", "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));
|
||||
SetupHelpers.CopyFiles(Path.Combine(source, language), "*.resources.dll", Path.Combine(destination, "Languages", language));
|
||||
}
|
||||
|
||||
if (job == SetupJobs.CreateSteamFolder)
|
||||
|
@ -284,7 +284,7 @@ private static void CreateFolder(string source, string destination, SetupJobs jo
|
|||
}
|
||||
else if (job == SetupJobs.CreateWindowsStoreFolder || job == SetupJobs.CreateWindowsStoreDebugFolder)
|
||||
{
|
||||
Helpers.CopyFile(Path.Combine(DesktopBridgeHelperDir, "ShareX_DesktopBridgeHelper.exe"), destination);
|
||||
SetupHelpers.CopyFile(Path.Combine(DesktopBridgeHelperDir, "ShareX_DesktopBridgeHelper.exe"), destination);
|
||||
Helpers.CopyAll(WindowsStorePackageFilesDir, destination);
|
||||
CopyFFmpeg(destination, false, true);
|
||||
}
|
||||
|
@ -309,24 +309,24 @@ private static void CopyFFmpeg(string destination, bool include32bit, bool inclu
|
|||
{
|
||||
if (!File.Exists(FFmpeg32bit))
|
||||
{
|
||||
string filename = Helpers.DownloadFile("http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20171130-83ecdc9-win32-static.zip");
|
||||
string filename = SetupHelpers.DownloadFile("http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20171130-83ecdc9-win32-static.zip");
|
||||
ZipManager.Extract(filename, "", new List<string>() { "ffmpeg.exe" });
|
||||
File.Move("ffmpeg.exe", FFmpeg32bit);
|
||||
}
|
||||
|
||||
Helpers.CopyFile(FFmpeg32bit, destination);
|
||||
SetupHelpers.CopyFile(FFmpeg32bit, destination);
|
||||
}
|
||||
|
||||
if (include64bit)
|
||||
{
|
||||
if (!File.Exists(FFmpeg64bit))
|
||||
{
|
||||
string filename = Helpers.DownloadFile("http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20171130-83ecdc9-win64-static.zip");
|
||||
string filename = SetupHelpers.DownloadFile("http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20171130-83ecdc9-win64-static.zip");
|
||||
ZipManager.Extract(filename, "", new List<string>() { "ffmpeg.exe" });
|
||||
File.Move("ffmpeg.exe", FFmpeg64bit);
|
||||
}
|
||||
|
||||
Helpers.CopyFile(FFmpeg64bit, destination);
|
||||
SetupHelpers.CopyFile(FFmpeg64bit, destination);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
namespace ShareX.Setup
|
||||
{
|
||||
internal class Helpers
|
||||
internal class SetupHelpers
|
||||
{
|
||||
public static string DownloadFile(string url)
|
||||
{
|
||||
|
@ -90,33 +90,6 @@ public static void CopyFiles(string directory, string searchPattern, string toFo
|
|||
CopyFiles(files, toFolder);
|
||||
}
|
||||
|
||||
public static void CopyAll(string sourceDirectory, string targetDirectory)
|
||||
{
|
||||
DirectoryInfo diSource = new DirectoryInfo(sourceDirectory);
|
||||
DirectoryInfo diTarget = new DirectoryInfo(targetDirectory);
|
||||
|
||||
CopyAll(diSource, diTarget);
|
||||
}
|
||||
|
||||
public static void CopyAll(DirectoryInfo source, DirectoryInfo target)
|
||||
{
|
||||
if (!Directory.Exists(target.FullName))
|
||||
{
|
||||
Directory.CreateDirectory(target.FullName);
|
||||
}
|
||||
|
||||
foreach (FileInfo fi in source.GetFiles())
|
||||
{
|
||||
fi.CopyTo(Path.Combine(target.FullName, fi.Name), true);
|
||||
}
|
||||
|
||||
foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
|
||||
{
|
||||
DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(diSourceSubDir.Name);
|
||||
CopyAll(diSourceSubDir, nextTargetSubDir);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ProcessStart(string filePath, string arguments)
|
||||
{
|
||||
Console.WriteLine($"Process starting: {filePath} {arguments}");
|
||||
|
@ -147,10 +120,5 @@ public static bool CheckArguments(string[] args, string check)
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void CreateEmptyFile(string path)
|
||||
{
|
||||
File.Create(path).Dispose();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -72,7 +72,7 @@
|
|||
<Compile Include="..\SharedAssemblyInfo.cs">
|
||||
<Link>Properties\SharedAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Helpers.cs" />
|
||||
<Compile Include="SetupHelpers.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
|
Loading…
Reference in a new issue