From 3e63ccbd31b5cc2cf7ed6efcf7f8ff7d84f87738 Mon Sep 17 00:00:00 2001 From: CreepyCrafter24 <33260128+CreepyCrafter24@users.noreply.github.com> Date: Sun, 8 Mar 2020 09:05:19 +0100 Subject: [PATCH] Add package build tools --- .gitignore | 103 ++++++++++++++++++- UpTool build tool/Program.cs | 70 +++++++++++++ UpTool build tool/Properties/AssemblyInfo.cs | 35 +++++++ UpTool build tool/UpTool build tool.csproj | 56 ++++++++++ UpTool2.sln | 7 ++ UpTool2.sln.DotSettings | 2 + UpTool2/MainForm.Designer.cs | 6 +- 7 files changed, 272 insertions(+), 7 deletions(-) create mode 100644 UpTool build tool/Program.cs create mode 100644 UpTool build tool/Properties/AssemblyInfo.cs create mode 100644 UpTool build tool/UpTool build tool.csproj create mode 100644 UpTool2.sln.DotSettings diff --git a/.gitignore b/.gitignore index 4a4d13c..8c7b58d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -# Created by https://www.gitignore.io/api/csharp,visualstudio -# Edit at https://www.gitignore.io/?templates=csharp,visualstudio +# Created by https://www.gitignore.io/api/rider,csharp,windows,visualstudio +# Edit at https://www.gitignore.io/?templates=rider,csharp,windows,visualstudio ### Csharp ### ## Ignore Visual Studio temporary files, build results, and @@ -73,7 +73,6 @@ StyleCopReport.xml *_p.c *_h.h *.ilk -*.meta *.obj *.iobj *.pch @@ -353,6 +352,102 @@ healthchecksdb # Backup folder for Package Reference Convert tool in Visual Studio 2017 MigrationBackup/ +### Rider ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + ### VisualStudio ### # User-specific files @@ -509,4 +604,4 @@ MigrationBackup/ # Backup folder for Package Reference Convert tool in Visual Studio 2017 -# End of https://www.gitignore.io/api/csharp,visualstudio +# End of https://www.gitignore.io/api/rider,csharp,windows,visualstudio diff --git a/UpTool build tool/Program.cs b/UpTool build tool/Program.cs new file mode 100644 index 0000000..5c203ac --- /dev/null +++ b/UpTool build tool/Program.cs @@ -0,0 +1,70 @@ +using System; +using System.IO; +using System.IO.Compression; +using System.Linq; + +namespace UpTool_build_tool +{ + internal static class Program + { + public static void Main(string[] args) + { + Console.WriteLine("-------------------------------"); + Console.WriteLine("| UpTool2 package build tools |"); + Console.WriteLine("-------------------------------"); + Console.WriteLine(); + if (args == null || args.Length == 0) + args = new[] { "help" }; + args[0] = args[0].TrimStart('-', '/'); + switch (args[0]) + { + case "build": + Console.WriteLine("Parsing arguments..."); + string targetDir = args[1]; + string targetFileName = args[2]; + string packageFile = args.Length > 3 ? args[3] : Path.Combine(targetDir, "package.zip"); + string tempPath = Path.Combine(args.Length > 4 ? args[4] : Path.GetTempPath(), "UpTool2Pkg"); + string quote = "\""; + Console.WriteLine("Removing previous files..."); + if (File.Exists(packageFile)) + File.Delete(packageFile); + if (Directory.Exists(tempPath)) + Directory.Delete(tempPath, true); + Directory.CreateDirectory(tempPath); + Console.WriteLine("Copying binary dir..."); + ZipFile.CreateFromDirectory(targetDir, Path.Combine(tempPath, "dataDir.zip")); + Directory.CreateDirectory(Path.Combine(tempPath, "Data")); + ZipFile.ExtractToDirectory(Path.Combine(tempPath, "dataDir.zip"), Path.Combine(tempPath, "Data")); + File.Delete(Path.Combine(tempPath, "dataDir.zip")); + Console.WriteLine("Cleaning up .xml and .pdb files..."); + Directory.GetFiles(Path.Combine(tempPath, "Data")) + .Where(s => new[] { ".xml", ".pdb" }.Contains(Path.GetExtension(s))) + .ToList().ForEach(File.Delete); + Console.WriteLine("Creating batch scripts..."); + string programName = Path.GetFileNameWithoutExtension(targetFileName); + File.WriteAllText(Path.Combine(tempPath, "Install.bat"), + $"@echo off\r\necho INSTALL\r\npowershell \"$s=(New-Object -COM WScript.Shell).CreateShortcut('%appdata%\\Microsoft\\Windows\\Start Menu\\Programs\\{programName}.lnk');$s.TargetPath='%cd%\\{programName}.exe';$s.Save()\"\r\ntimeout /t 1"); + File.WriteAllText(Path.Combine(tempPath, "Remove.bat"), + $"@echo off\r\necho REMOVE\r\ndel \"%appdata%\\Microsoft\\Windows\\Start Menu\\Programs\\{programName}.lnk\"\r\ntaskkill /f /im \"{programName}.exe\"\r\ntimeout /t 1"); + Console.WriteLine("Packaging..."); + ZipFile.CreateFromDirectory(tempPath, packageFile); + Console.WriteLine("Cleaning up temp path..."); + Directory.Delete(tempPath, true); + break; + default: + Console.WriteLine("Usage:"); + Console.WriteLine(" pkgtool.exe [arguments...]"); + Console.WriteLine(); + Console.WriteLine("Commands:"); + Console.WriteLine("- help"); + Console.WriteLine(" Prints this message"); + Console.WriteLine("- build"); + Console.WriteLine(" Builds a generic package with shortcuts from a directory"); + Console.WriteLine(" Arguments:"); + Console.WriteLine(" pkgtool.exe build
[package file] [temp path]"); + Console.WriteLine(); + break; + } + } + } +} \ No newline at end of file diff --git a/UpTool build tool/Properties/AssemblyInfo.cs b/UpTool build tool/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9fe75b4 --- /dev/null +++ b/UpTool build tool/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// 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("UpTool_build_tool")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("UpTool_build_tool")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("AAB8D6BA-3A43-4DC4-95EE-6757482B77FD")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/UpTool build tool/UpTool build tool.csproj b/UpTool build tool/UpTool build tool.csproj new file mode 100644 index 0000000..1695f99 --- /dev/null +++ b/UpTool build tool/UpTool build tool.csproj @@ -0,0 +1,56 @@ + + + + + Debug + AnyCPU + {AAB8D6BA-3A43-4DC4-95EE-6757482B77FD} + Exe + Properties + UpTool_build_tool + pkgtool + v4.8 + 512 + 8 + enable + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + diff --git a/UpTool2.sln b/UpTool2.sln index 1d0edd1..9e38be8 100644 --- a/UpTool2.sln +++ b/UpTool2.sln @@ -13,8 +13,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md Repo.xml = Repo.xml ToDo and Notes.txt = ToDo and Notes.txt + .gitignore = .gitignore EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpTool build tool", "UpTool build tool\UpTool build tool.csproj", "{AAB8D6BA-3A43-4DC4-95EE-6757482B77FD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -25,6 +28,10 @@ Global {C0C1E002-9E13-4E8F-A035-DBDC5128E00E}.Debug|Any CPU.Build.0 = Debug|Any CPU {C0C1E002-9E13-4E8F-A035-DBDC5128E00E}.Release|Any CPU.ActiveCfg = Release|Any CPU {C0C1E002-9E13-4E8F-A035-DBDC5128E00E}.Release|Any CPU.Build.0 = Release|Any CPU + {AAB8D6BA-3A43-4DC4-95EE-6757482B77FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AAB8D6BA-3A43-4DC4-95EE-6757482B77FD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AAB8D6BA-3A43-4DC4-95EE-6757482B77FD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AAB8D6BA-3A43-4DC4-95EE-6757482B77FD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/UpTool2.sln.DotSettings b/UpTool2.sln.DotSettings new file mode 100644 index 0000000..f26c705 --- /dev/null +++ b/UpTool2.sln.DotSettings @@ -0,0 +1,2 @@ + + True \ No newline at end of file diff --git a/UpTool2/MainForm.Designer.cs b/UpTool2/MainForm.Designer.cs index 3b24511..ee09aa7 100644 --- a/UpTool2/MainForm.Designer.cs +++ b/UpTool2/MainForm.Designer.cs @@ -190,7 +190,7 @@ this.controls_upload.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.controls_upload.Location = new System.Drawing.Point(282, 6); + this.controls_upload.Location = new System.Drawing.Point(283, 6); this.controls_upload.Name = "controls_upload"; this.controls_upload.Size = new System.Drawing.Size(27, 27); this.controls_upload.TabIndex = 4; @@ -208,7 +208,7 @@ this.filterBox.FormattingEnabled = true; this.filterBox.Location = new System.Drawing.Point(68, 7); this.filterBox.Name = "filterBox"; - this.filterBox.Size = new System.Drawing.Size(207, 23); + this.filterBox.Size = new System.Drawing.Size(208, 23); this.filterBox.TabIndex = 3; this.filterBox.SelectedIndexChanged += new System.EventHandler(this.UpdateSidebarV); // @@ -220,7 +220,7 @@ System.Windows.Forms.AnchorStyles.Right))); this.searchBox.Location = new System.Drawing.Point(3, 38); this.searchBox.Name = "searchBox"; - this.searchBox.Size = new System.Drawing.Size(305, 23); + this.searchBox.Size = new System.Drawing.Size(306, 23); this.searchBox.TabIndex = 2; this.searchBox.TextChanged += new System.EventHandler(this.UpdateSidebarV); //