diff --git a/CompileSetup.cmd b/CompileSetup.cmd deleted file mode 100644 index 22860cdbc..000000000 --- a/CompileSetup.cmd +++ /dev/null @@ -1,2 +0,0 @@ -"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" "InnoSetup\ShareX setup.iss" -start "" "InnoSetup\Output" \ No newline at end of file diff --git a/ShareX.sln b/ShareX.sln index 8168c06e6..9a4bd58c4 100644 --- a/ShareX.sln +++ b/ShareX.sln @@ -26,7 +26,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{B1CCDF .nuget\NuGet.targets = .nuget\NuGet.targets EndProjectSection 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 Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/ShareX/ShareX.csproj b/ShareX/ShareX.csproj index 0e562b426..aac107fb6 100644 --- a/ShareX/ShareX.csproj +++ b/ShareX/ShareX.csproj @@ -530,10 +530,6 @@ - - VersionHistory.txt - PreserveNewest - diff --git a/ShareXPortable/7za.exe b/ShareXPortable/7za.exe deleted file mode 100644 index 7f6bf86bc..000000000 Binary files a/ShareXPortable/7za.exe and /dev/null differ diff --git a/ShareXPortable/Program.cs b/ShareX_Setup/Program.cs similarity index 55% rename from ShareXPortable/Program.cs rename to ShareX_Setup/Program.cs index bff003ba2..c62621a16 100644 --- a/ShareXPortable/Program.cs +++ b/ShareX_Setup/Program.cs @@ -34,12 +34,69 @@ namespace ShareXPortable { 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) { - string parentDir = @"..\..\..\"; - string releaseDir = Path.Combine(parentDir, @"ShareX\bin\Release"); - string outputDir = Path.Combine(parentDir, @"InnoSetup\Output"); - string portableDir = Path.Combine(outputDir, "ShareX-portable"); + switch (Setup) + { + case SetupType.Stable: + 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 files = new List(); @@ -58,11 +115,11 @@ private static void Main(string[] args) if (Directory.Exists(portableDir)) { Directory.Delete(portableDir, true); - Console.WriteLine("Directory.Delete: \"{0}\"", portableDir); + //Console.WriteLine("Directory.Delete: \"{0}\"", portableDir); } Directory.CreateDirectory(portableDir); - Console.WriteLine("Directory.Create: \"{0}\"", portableDir); + //Console.WriteLine("Directory.Create: \"{0}\"", portableDir); foreach (string filepath in files) { @@ -70,11 +127,11 @@ private static void Main(string[] args) string dest = Path.Combine(portableDir, filename); 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); - Console.WriteLine("Created PersonalPath.cfg file."); + //Console.WriteLine("Created PersonalPath.cfg file."); //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); @@ -83,21 +140,19 @@ private static void Main(string[] args) if (File.Exists(zipPath)) { File.Delete(zipPath); - Console.WriteLine("File.Delete: \"{0}\"", zipPath); + //Console.WriteLine("File.Delete: \"{0}\"", zipPath); } Zip(portableDir + "\\*.*", zipPath); - Console.WriteLine("Zip: \"{0}\"", zipPath); + //Console.WriteLine("Zip: \"{0}\"", zipPath); if (Directory.Exists(portableDir)) { Directory.Delete(portableDir, true); - Console.WriteLine("Directory.Delete: \"{0}\"", portableDir); + //Console.WriteLine("Directory.Delete: \"{0}\"", portableDir); } - Process.Start("explorer.exe", outputDir); - Console.WriteLine("Done."); - //Console.Read(); + Console.WriteLine("Portable created."); } private static void Zip(string source, string target) diff --git a/ShareXPortable/Properties/AssemblyInfo.cs b/ShareX_Setup/Properties/AssemblyInfo.cs similarity index 93% rename from ShareXPortable/Properties/AssemblyInfo.cs rename to ShareX_Setup/Properties/AssemblyInfo.cs index 6a50e7220..186938009 100644 --- a/ShareXPortable/Properties/AssemblyInfo.cs +++ b/ShareX_Setup/Properties/AssemblyInfo.cs @@ -4,11 +4,11 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("ShareXPortable")] +[assembly: AssemblyTitle("ShareX")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("ShareX Developers")] -[assembly: AssemblyProduct("ShareXPortable")] +[assembly: AssemblyProduct("ShareX")] [assembly: AssemblyCopyright("Copyright (C) 2007-2014 ShareX Developers")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/ShareXPortable/ShareXPortable.csproj b/ShareX_Setup/ShareX_Setup.csproj similarity index 95% rename from ShareXPortable/ShareXPortable.csproj rename to ShareX_Setup/ShareX_Setup.csproj index fd6ac15a7..95418ae48 100644 --- a/ShareXPortable/ShareXPortable.csproj +++ b/ShareX_Setup/ShareX_Setup.csproj @@ -7,8 +7,8 @@ {3D19A94A-7A58-4451-A686-EE70B471C206} Exe Properties - ShareXPortable - ShareXPortable + ShareX + ShareX v4.0 512 diff --git a/ShareXPortable/app.config b/ShareX_Setup/app.config similarity index 100% rename from ShareXPortable/app.config rename to ShareX_Setup/app.config