diff --git a/.github/workflows/nightly-build.yaml b/.github/workflows/nightly-build.yaml index 46916df..26952fd 100644 --- a/.github/workflows/nightly-build.yaml +++ b/.github/workflows/nightly-build.yaml @@ -27,12 +27,13 @@ jobs: - name: Build client run: dotnet build RageCoop.Client/RageCoop.Client.csproj --configuration Release -o bin/Release/Client/RageCoop - name: Build server win-x64 - run: dotnet publish RageCoop.Server/RageCoop.Server.csproj --self-contained -p:PublishSingleFile=true -p:PublishTrimmed=false -r win-x64 -o RageCoop.Server/bin/win-x64 -c Release + run: dotnet publish RageCoop.Server/RageCoop.Server.csproj --self-contained -p:PublishSingleFile=true -p:PublishTrimmed=false -r win-x64 -o bin/Release/Server/win-x64 -c Release - name: Build server linux-x64 - run: dotnet publish RageCoop.Server/RageCoop.Server.csproj --self-contained -p:PublishSingleFile=true -p:PublishTrimmed=false -r linux-x64 -o RageCoop.Server/bin/linux-x64 -c Release + run: dotnet publish RageCoop.Server/RageCoop.Server.csproj --self-contained -p:PublishSingleFile=true -p:PublishTrimmed=false -r linux-x64 -o bin/Release/Server/linux-x64 -c Release - name: Build server linux-arm - run: dotnet publish RageCoop.Server/RageCoop.Server.csproj --self-contained -p:PublishSingleFile=true -p:PublishTrimmed=false -r linux-arm -o RageCoop.Server/bin/linux-arm -c Release - + run: dotnet publish RageCoop.Server/RageCoop.Server.csproj --self-contained -p:PublishSingleFile=true -p:PublishTrimmed=false -r linux-arm -o bin/Release/Server/linux-arm -c Release + - name: Build installer + run: dotnet build RageCoop.Client.Installer/RageCoop.Client.Installer.csproj --configuration Release -o bin/Release/Client - uses: vimtor/action-zip@v1 with: files: bin/Release/Client @@ -40,17 +41,17 @@ jobs: - uses: vimtor/action-zip@v1 with: - files: RageCoop.Server/bin/win-x64 + files: bin/Release/Server/win-x64 dest: RageCoop.Server-win-x64.zip - uses: vimtor/action-zip@v1 with: - files: RageCoop.Server/bin/linux-x64 + files: bin/Release/Server/linux-x64 dest: RageCoop.Server-linux-x64.zip - uses: vimtor/action-zip@v1 with: - files: RageCoop.Server/bin/linux-arm + files: bin/Release/Server/linux-arm dest: RageCoop.Server-linux-arm.zip - uses: WebFreak001/deploy-nightly@v1.1.0 diff --git a/RageCoop-V.sln b/RageCoop-V.sln index 10be393..1506517 100644 --- a/RageCoop-V.sln +++ b/RageCoop-V.sln @@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RageCoop.Core", "RageCoop.C EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RageCoop.Client", "RageCoop.Client\RageCoop.Client.csproj", "{EF56D109-1F22-43E0-9DFF-CFCFB94E0681}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RageCoop.Client.Installer", "RageCoop.Client.Installer\RageCoop.Client.Installer.csproj", "{576D8610-0C28-4B60-BE2B-8657EA7CEE1B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -41,6 +43,14 @@ Global {EF56D109-1F22-43E0-9DFF-CFCFB94E0681}.Release|Any CPU.Build.0 = Release|Any CPU {EF56D109-1F22-43E0-9DFF-CFCFB94E0681}.Release|x64.ActiveCfg = Release|Any CPU {EF56D109-1F22-43E0-9DFF-CFCFB94E0681}.Release|x64.Build.0 = Release|Any CPU + {576D8610-0C28-4B60-BE2B-8657EA7CEE1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {576D8610-0C28-4B60-BE2B-8657EA7CEE1B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {576D8610-0C28-4B60-BE2B-8657EA7CEE1B}.Debug|x64.ActiveCfg = Debug|Any CPU + {576D8610-0C28-4B60-BE2B-8657EA7CEE1B}.Debug|x64.Build.0 = Debug|Any CPU + {576D8610-0C28-4B60-BE2B-8657EA7CEE1B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {576D8610-0C28-4B60-BE2B-8657EA7CEE1B}.Release|Any CPU.Build.0 = Release|Any CPU + {576D8610-0C28-4B60-BE2B-8657EA7CEE1B}.Release|x64.ActiveCfg = Release|Any CPU + {576D8610-0C28-4B60-BE2B-8657EA7CEE1B}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/RageCoop.Client.Installer/App.xaml b/RageCoop.Client.Installer/App.xaml new file mode 100644 index 0000000..829b86f --- /dev/null +++ b/RageCoop.Client.Installer/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/RageCoop.Client.Installer/App.xaml.cs b/RageCoop.Client.Installer/App.xaml.cs new file mode 100644 index 0000000..e75602a --- /dev/null +++ b/RageCoop.Client.Installer/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace RageCoop.Client.Installer +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/RageCoop.Client.Installer/FodyWeavers.xml b/RageCoop.Client.Installer/FodyWeavers.xml new file mode 100644 index 0000000..a5dcf04 --- /dev/null +++ b/RageCoop.Client.Installer/FodyWeavers.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/RageCoop.Client.Installer/FodyWeavers.xsd b/RageCoop.Client.Installer/FodyWeavers.xsd new file mode 100644 index 0000000..05e92c1 --- /dev/null +++ b/RageCoop.Client.Installer/FodyWeavers.xsd @@ -0,0 +1,141 @@ + + + + + + + + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with line breaks. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with line breaks. + + + + + The order of preloaded assemblies, delimited with line breaks. + + + + + + This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. + + + + + Controls if .pdbs for reference assemblies are also embedded. + + + + + Controls if runtime assemblies are also embedded. + + + + + Controls whether the runtime assemblies are embedded with their full path or only with their assembly name. + + + + + Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. + + + + + As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. + + + + + Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. + + + + + Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with |. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with |. + + + + + The order of preloaded assemblies, delimited with |. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/RageCoop.Client.Installer/MainWindow.xaml b/RageCoop.Client.Installer/MainWindow.xaml new file mode 100644 index 0000000..5f52632 --- /dev/null +++ b/RageCoop.Client.Installer/MainWindow.xaml @@ -0,0 +1,15 @@ + + + + + + + diff --git a/RageCoop.Client.Installer/MainWindow.xaml.cs b/RageCoop.Client.Installer/MainWindow.xaml.cs new file mode 100644 index 0000000..d069a6e --- /dev/null +++ b/RageCoop.Client.Installer/MainWindow.xaml.cs @@ -0,0 +1,153 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Microsoft.Win32; +using System.IO; +using Path = System.IO.Path; +using System.Diagnostics; +using System.Reflection; +using RageCoop.Core; +using System.Net; +using ICSharpCode.SharpZipLib.Zip; + +namespace RageCoop.Client.Installer +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + Choose(); + } + + private void Choose() + { + var od = new OpenFileDialog() + { + Filter = "GTA 5 executable |GTA5.exe;PlayGTAV.exe", + Title="Select you GTAV executable" + }; + if (od.ShowDialog() ?? false==true) + { + Task.Run(() => Install(Directory.GetParent(od.FileName).FullName)); + } + else + { + Environment.Exit(0); + } + } + void Install(string root) + { + UpdateStatus("Checking requirements"); + var shvPath = Path.Combine(root, "ScriptHookV.dll"); + var shvdnPath = Path.Combine(root, "ScriptHookVDotNet3.dll"); + var scriptsPath = Path.Combine(root, "Scripts"); + var lemonPath = Path.Combine(scriptsPath, "LemonUI.SHVDN3.dll"); + var installPath = Path.Combine(scriptsPath, "RageCoop"); + Directory.CreateDirectory(installPath); + if (!File.Exists(shvPath)) + { + MessageBox.Show("Please install ScriptHookV first!"); + Environment.Exit(1); + } + if (!File.Exists(shvdnPath)) + { + MessageBox.Show("Please install ScriptHookVDotNet first!"); + Environment.Exit(1); + } + var shvdnVer = GetVer(shvdnPath); + if (shvdnVer UpdateStatus($"Downloading {e1.ProgressPercentage}%"); + client.DownloadFileCompleted += (s, e2) => + { + + UpdateStatus("Installing..."); + Directory.CreateDirectory(installPath); + new FastZip().ExtractZip(downloadPath, scriptsPath, FastZip.Overwrite.Always, null, null, null, true); + UpdateStatus("Completed!"); + MessageBox.Show("Installation sucessful!"); + Environment.Exit(0); + }; + client.DownloadFileAsync(new Uri("https://github.com/RAGECOOP/RAGECOOP-V/releases/download/nightly/RageCoop.Client.zip"), downloadPath); + } + } + void UpdateStatus(string status) + { + Dispatcher.BeginInvoke(new Action(() => Status.Content = status)); + } + Version GetVer(string location) + { + return Version.Parse(FileVersionInfo.GetVersionInfo(location).FileVersion); + } + byte[] getLemon() + { + return (byte[])Resource.ResourceManager.GetObject("LemonUI_SHVDN3"); + } + public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target) + { + foreach (DirectoryInfo dir in source.GetDirectories()) + CopyFilesRecursively(dir, target.CreateSubdirectory(dir.Name)); + foreach (FileInfo file in source.GetFiles()) + file.CopyTo(Path.Combine(target.FullName, file.Name)); + } + } +} diff --git a/RageCoop.Client.Installer/RageCoop.Client.Installer.csproj b/RageCoop.Client.Installer/RageCoop.Client.Installer.csproj new file mode 100644 index 0000000..628eebe --- /dev/null +++ b/RageCoop.Client.Installer/RageCoop.Client.Installer.csproj @@ -0,0 +1,57 @@ + + + + WinExe + net48 + true + + + ..\bin\Debug\Installer + + + ..\bin\Release\Installer + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + True + True + Resource.resx + + + + + + ResXFileCodeGenerator + Resource.Designer.cs + + + + diff --git a/RageCoop.Client.Installer/Resource.Designer.cs b/RageCoop.Client.Installer/Resource.Designer.cs new file mode 100644 index 0000000..6b21ddd --- /dev/null +++ b/RageCoop.Client.Installer/Resource.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace RageCoop.Client.Installer { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resource { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resource() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RageCoop.Client.Installer.Resource", typeof(Resource).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] LemonUI_SHVDN3 { + get { + object obj = ResourceManager.GetObject("LemonUI_SHVDN3", resourceCulture); + return ((byte[])(obj)); + } + } + } +} diff --git a/RageCoop.Client.Installer/Resource.resx b/RageCoop.Client.Installer/Resource.resx new file mode 100644 index 0000000..f3ceacb --- /dev/null +++ b/RageCoop.Client.Installer/Resource.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + Resources\LemonUI.SHVDN3.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RageCoop.Client.Installer/Resources/LemonUI.SHVDN3.dll b/RageCoop.Client.Installer/Resources/LemonUI.SHVDN3.dll new file mode 100644 index 0000000..c998d32 Binary files /dev/null and b/RageCoop.Client.Installer/Resources/LemonUI.SHVDN3.dll differ diff --git a/RageCoop.Client.Installer/bg.png b/RageCoop.Client.Installer/bg.png new file mode 100644 index 0000000..181640a Binary files /dev/null and b/RageCoop.Client.Installer/bg.png differ diff --git a/RageCoop.Client/Menus/Sub/UpdateMenu.cs b/RageCoop.Client/Menus/Sub/UpdateMenu.cs index c5bfd45..598e071 100644 --- a/RageCoop.Client/Menus/Sub/UpdateMenu.cs +++ b/RageCoop.Client/Menus/Sub/UpdateMenu.cs @@ -71,6 +71,8 @@ namespace RageCoop.Client.Menus catch { } } new FastZip().ExtractZip(_downloadPath, "Scripts", FastZip.Overwrite.Always, null, null, null, true); + try { File.Delete(_downloadPath); } catch { } + try { File.Delete(Path.Combine("Scripts","RageCoop.Client.Installer.exe")); } catch { } Main.QueueAction(() => { Util.Reload(); diff --git a/RageCoop.Client/Properties/AssemblyInfo.cs b/RageCoop.Client/Properties/AssemblyInfo.cs index bbcd818..d543118 100644 --- a/RageCoop.Client/Properties/AssemblyInfo.cs +++ b/RageCoop.Client/Properties/AssemblyInfo.cs @@ -16,7 +16,7 @@ using System.Resources; // Version informationr( -[assembly: AssemblyVersion("1.5.1.14")] -[assembly: AssemblyFileVersion("1.5.1.14")] +[assembly: AssemblyVersion("1.5.1.21")] +[assembly: AssemblyFileVersion("1.5.1.21")] [assembly: NeutralResourcesLanguageAttribute( "en-US" )] diff --git a/RageCoop.Core/CoreUtils.cs b/RageCoop.Core/CoreUtils.cs index 57b4512..34c7f05 100644 --- a/RageCoop.Core/CoreUtils.cs +++ b/RageCoop.Core/CoreUtils.cs @@ -15,6 +15,7 @@ using Newtonsoft.Json; [assembly: InternalsVisibleTo("RageCoop.Server")] [assembly: InternalsVisibleTo("RageCoop.Client")] +[assembly: InternalsVisibleTo("RageCoop.Client.Installer")] namespace RageCoop.Core { internal static class CoreUtils diff --git a/RageCoop.Server/Properties/AssemblyInfo.cs b/RageCoop.Server/Properties/AssemblyInfo.cs index 0508d16..f88f97e 100644 --- a/RageCoop.Server/Properties/AssemblyInfo.cs +++ b/RageCoop.Server/Properties/AssemblyInfo.cs @@ -15,7 +15,7 @@ using System.Resources; [assembly: AssemblyCulture("")] // Version informationr( -[assembly: AssemblyVersion("1.5.1.13")] -[assembly: AssemblyFileVersion("1.5.1.13")] +[assembly: AssemblyVersion("1.5.1.20")] +[assembly: AssemblyFileVersion("1.5.1.20")] [assembly: NeutralResourcesLanguageAttribute( "en-US" )]