Add package build tools

This commit is contained in:
CreepyCrafter24 2020-03-08 09:05:19 +01:00
parent 44bf5ff322
commit 3e63ccbd31
7 changed files with 272 additions and 7 deletions

103
.gitignore vendored
View File

@ -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

View File

@ -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 <command> [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 <binary dir> <main binary> [package file] [temp path]");
Console.WriteLine();
break;
}
}
}
}

View File

@ -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")]

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AAB8D6BA-3A43-4DC4-95EE-6757482B77FD}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UpTool_build_tool</RootNamespace>
<AssemblyName>pkgtool</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<LangVersion>8</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -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

2
UpTool2.sln.DotSettings Normal file
View File

@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=pkgtool/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -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);
//