mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
ShareX_Setup project for be able to compile setup, create portable zip and upload it automatically
This commit is contained in:
parent
dfaa163f8b
commit
928532a6a4
8 changed files with 74 additions and 25 deletions
|
@ -1,2 +0,0 @@
|
||||||
"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" "InnoSetup\ShareX setup.iss"
|
|
||||||
start "" "InnoSetup\Output"
|
|
|
@ -26,7 +26,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{B1CCDF
|
||||||
.nuget\NuGet.targets = .nuget\NuGet.targets
|
.nuget\NuGet.targets = .nuget\NuGet.targets
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShareXPortable", "ShareXPortable\ShareXPortable.csproj", "{3D19A94A-7A58-4451-A686-EE70B471C206}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShareX_Setup", "ShareX_Setup\ShareX_Setup.csproj", "{3D19A94A-7A58-4451-A686-EE70B471C206}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|
|
@ -530,10 +530,6 @@
|
||||||
<None Include="Resources\pencil.png" />
|
<None Include="Resources\pencil.png" />
|
||||||
<None Include="Resources\folder-tree.png" />
|
<None Include="Resources\folder-tree.png" />
|
||||||
<None Include="Resources\color.png" />
|
<None Include="Resources\color.png" />
|
||||||
<None Include="..\VersionHistory.txt">
|
|
||||||
<Link>VersionHistory.txt</Link>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="Resources\image-saturation.png" />
|
<None Include="Resources\image-saturation.png" />
|
||||||
<None Include="Resources\pipette.png" />
|
<None Include="Resources\pipette.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
Binary file not shown.
|
@ -34,12 +34,69 @@ namespace ShareXPortable
|
||||||
{
|
{
|
||||||
internal class Program
|
internal class Program
|
||||||
{
|
{
|
||||||
|
private enum SetupType
|
||||||
|
{
|
||||||
|
Stable, // Release build setup, creates portable zip file
|
||||||
|
Beta // Debug build setup, uploads it using Debug/ShareX.exe
|
||||||
|
}
|
||||||
|
|
||||||
|
private const SetupType Setup = SetupType.Beta;
|
||||||
|
|
||||||
|
private static string parentDir = @"..\..\..\";
|
||||||
|
private static string binDir = Path.Combine(parentDir, @"ShareX\bin");
|
||||||
|
private static string releaseDir = Path.Combine(binDir, "Release");
|
||||||
|
private static string debugDir = Path.Combine(binDir, "Debug");
|
||||||
|
private static string releasePath = Path.Combine(releaseDir, "ShareX.exe");
|
||||||
|
private static string debugPath = Path.Combine(debugDir, "ShareX.exe");
|
||||||
|
private static string outputDir = Path.Combine(parentDir, @"InnoSetup\Output");
|
||||||
|
private static string portableDir = Path.Combine(outputDir, "ShareX-portable");
|
||||||
|
private static string innoSetupPath = @"C:\Program Files (x86)\Inno Setup 5\ISCC.exe";
|
||||||
|
private static string innoSetupScriptPath = Path.Combine(parentDir, @"InnoSetup\ShareX setup.iss");
|
||||||
|
|
||||||
private static void Main(string[] args)
|
private static void Main(string[] args)
|
||||||
{
|
{
|
||||||
string parentDir = @"..\..\..\";
|
switch (Setup)
|
||||||
string releaseDir = Path.Combine(parentDir, @"ShareX\bin\Release");
|
{
|
||||||
string outputDir = Path.Combine(parentDir, @"InnoSetup\Output");
|
case SetupType.Stable:
|
||||||
string portableDir = Path.Combine(outputDir, "ShareX-portable");
|
CompileSetup("Release");
|
||||||
|
CreatePortable();
|
||||||
|
OpenOutputDirectory();
|
||||||
|
break;
|
||||||
|
case SetupType.Beta:
|
||||||
|
CompileSetup("Debug");
|
||||||
|
UploadLatestFile();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Done.");
|
||||||
|
//Console.Read();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OpenOutputDirectory()
|
||||||
|
{
|
||||||
|
Process.Start("explorer.exe", outputDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void UploadLatestFile()
|
||||||
|
{
|
||||||
|
FileInfo fileInfo = new DirectoryInfo(outputDir).GetFiles("*.exe").OrderByDescending(f => f.LastWriteTime).FirstOrDefault();
|
||||||
|
if (fileInfo != null)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Uploading setup file...");
|
||||||
|
Process.Start(debugPath, fileInfo.FullName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CompileSetup(string buildType)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Compiling " + buildType + " setup...");
|
||||||
|
Process.Start(innoSetupPath, string.Format("\"{0}\" /d{1}", innoSetupScriptPath, buildType)).WaitForExit();
|
||||||
|
Console.WriteLine("Setup file created.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CreatePortable()
|
||||||
|
{
|
||||||
|
Console.WriteLine("Creating portable...");
|
||||||
|
|
||||||
List<string> files = new List<string>();
|
List<string> files = new List<string>();
|
||||||
|
|
||||||
|
@ -58,11 +115,11 @@ private static void Main(string[] args)
|
||||||
if (Directory.Exists(portableDir))
|
if (Directory.Exists(portableDir))
|
||||||
{
|
{
|
||||||
Directory.Delete(portableDir, true);
|
Directory.Delete(portableDir, true);
|
||||||
Console.WriteLine("Directory.Delete: \"{0}\"", portableDir);
|
//Console.WriteLine("Directory.Delete: \"{0}\"", portableDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
Directory.CreateDirectory(portableDir);
|
Directory.CreateDirectory(portableDir);
|
||||||
Console.WriteLine("Directory.Create: \"{0}\"", portableDir);
|
//Console.WriteLine("Directory.Create: \"{0}\"", portableDir);
|
||||||
|
|
||||||
foreach (string filepath in files)
|
foreach (string filepath in files)
|
||||||
{
|
{
|
||||||
|
@ -70,11 +127,11 @@ private static void Main(string[] args)
|
||||||
string dest = Path.Combine(portableDir, filename);
|
string dest = Path.Combine(portableDir, filename);
|
||||||
|
|
||||||
File.Copy(filepath, dest);
|
File.Copy(filepath, dest);
|
||||||
Console.WriteLine("File.Copy: \"{0}\" -> \"{1}\"", filepath, dest);
|
//Console.WriteLine("File.Copy: \"{0}\" -> \"{1}\"", filepath, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
File.WriteAllText(Path.Combine(portableDir, "PersonalPath.cfg"), "ShareX", Encoding.UTF8);
|
File.WriteAllText(Path.Combine(portableDir, "PersonalPath.cfg"), "ShareX", Encoding.UTF8);
|
||||||
Console.WriteLine("Created PersonalPath.cfg file.");
|
//Console.WriteLine("Created PersonalPath.cfg file.");
|
||||||
|
|
||||||
//FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(Path.Combine(releaseDir, "ShareX.exe"));
|
//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 zipFilename = string.Format("ShareX-{0}.{1}.{2}-portable.zip", versionInfo.ProductMajorPart, versionInfo.ProductMinorPart, versionInfo.ProductBuildPart);
|
||||||
|
@ -83,21 +140,19 @@ private static void Main(string[] args)
|
||||||
if (File.Exists(zipPath))
|
if (File.Exists(zipPath))
|
||||||
{
|
{
|
||||||
File.Delete(zipPath);
|
File.Delete(zipPath);
|
||||||
Console.WriteLine("File.Delete: \"{0}\"", zipPath);
|
//Console.WriteLine("File.Delete: \"{0}\"", zipPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Zip(portableDir + "\\*.*", zipPath);
|
Zip(portableDir + "\\*.*", zipPath);
|
||||||
Console.WriteLine("Zip: \"{0}\"", zipPath);
|
//Console.WriteLine("Zip: \"{0}\"", zipPath);
|
||||||
|
|
||||||
if (Directory.Exists(portableDir))
|
if (Directory.Exists(portableDir))
|
||||||
{
|
{
|
||||||
Directory.Delete(portableDir, true);
|
Directory.Delete(portableDir, true);
|
||||||
Console.WriteLine("Directory.Delete: \"{0}\"", portableDir);
|
//Console.WriteLine("Directory.Delete: \"{0}\"", portableDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
Process.Start("explorer.exe", outputDir);
|
Console.WriteLine("Portable created.");
|
||||||
Console.WriteLine("Done.");
|
|
||||||
//Console.Read();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Zip(string source, string target)
|
private static void Zip(string source, string target)
|
|
@ -4,11 +4,11 @@
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("ShareXPortable")]
|
[assembly: AssemblyTitle("ShareX")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("ShareX Developers")]
|
[assembly: AssemblyCompany("ShareX Developers")]
|
||||||
[assembly: AssemblyProduct("ShareXPortable")]
|
[assembly: AssemblyProduct("ShareX")]
|
||||||
[assembly: AssemblyCopyright("Copyright (C) 2007-2014 ShareX Developers")]
|
[assembly: AssemblyCopyright("Copyright (C) 2007-2014 ShareX Developers")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
|
@ -7,8 +7,8 @@
|
||||||
<ProjectGuid>{3D19A94A-7A58-4451-A686-EE70B471C206}</ProjectGuid>
|
<ProjectGuid>{3D19A94A-7A58-4451-A686-EE70B471C206}</ProjectGuid>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>ShareXPortable</RootNamespace>
|
<RootNamespace>ShareX</RootNamespace>
|
||||||
<AssemblyName>ShareXPortable</AssemblyName>
|
<AssemblyName>ShareX</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
Loading…
Reference in a new issue