Added functionality for API based version checking, authentication, file verification and game token launching

This commit is contained in:
Resaec 2023-08-01 17:08:31 +02:00
parent a915df802e
commit 823819847b
14 changed files with 947 additions and 404 deletions

2
.gitignore vendored
View file

@ -1 +1,3 @@
.vs/
packages/

Binary file not shown.

View file

@ -1,34 +1,46 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
# Visual Studio Version 16
VisualStudioVersion = 16.0.32901.82
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PSLauncher", "PSLauncher\PSLauncher.csproj", "{0D6A691E-95FE-4056-8979-190A9A35BDC7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
LiveSupport|Any CPU = LiveSupport|Any CPU
LiveSupport|x64 = LiveSupport|x64
LiveSupport|x86 = LiveSupport|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.Debug|x64.ActiveCfg = Debug|x64
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.Debug|x64.Build.0 = Debug|x64
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.Debug|x86.ActiveCfg = Debug|x86
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.Debug|x86.Build.0 = Debug|x86
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.LiveSupport|Any CPU.ActiveCfg = LiveSupport|Any CPU
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.LiveSupport|Any CPU.Build.0 = LiveSupport|Any CPU
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.LiveSupport|x64.ActiveCfg = LiveSupport|x64
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.LiveSupport|x64.Build.0 = LiveSupport|x64
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.LiveSupport|x86.ActiveCfg = LiveSupport|x86
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.LiveSupport|x86.Build.0 = LiveSupport|x86
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.Release|Any CPU.Build.0 = Release|Any CPU
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.Release|x64.ActiveCfg = Release|x64
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.Release|x64.Build.0 = Release|x64
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.Release|x86.ActiveCfg = Release|x86
{0D6A691E-95FE-4056-8979-190A9A35BDC7}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {92FA1014-24E9-4E6D-A263-B80A2AD72F3C}
EndGlobalSection
EndGlobal

View file

@ -187,7 +187,7 @@
this.launchGame.TabIndex = 2;
this.launchGame.Text = "Launch";
this.launchGame.UseVisualStyleBackColor = false;
this.launchGame.Click += new System.EventHandler(this.button2_Click);
this.launchGame.Click += new System.EventHandler(this.launchGame_Click);
//
// launchMessage
//
@ -204,7 +204,7 @@
//
this.spinner.Enabled = false;
this.spinner.Image = ((System.Drawing.Image)(resources.GetObject("spinner.Image")));
this.spinner.Location = new System.Drawing.Point(114, 67);
this.spinner.Location = new System.Drawing.Point(22, 66);
this.spinner.Name = "spinner";
this.spinner.Size = new System.Drawing.Size(26, 24);
this.spinner.TabIndex = 24;
@ -232,13 +232,13 @@
this.copy,
this.saveToFile});
this.outputRightClick.Name = "outputRightClick";
this.outputRightClick.Size = new System.Drawing.Size(165, 70);
this.outputRightClick.Size = new System.Drawing.Size(167, 70);
//
// selectAll
//
this.selectAll.Name = "selectAll";
this.selectAll.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
this.selectAll.Size = new System.Drawing.Size(164, 22);
this.selectAll.Size = new System.Drawing.Size(166, 22);
this.selectAll.Text = "Select All";
this.selectAll.Click += new System.EventHandler(this.selectAll_Click);
//
@ -247,14 +247,14 @@
this.copy.Name = "copy";
this.copy.ShortcutKeyDisplayString = "";
this.copy.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
this.copy.Size = new System.Drawing.Size(164, 22);
this.copy.Size = new System.Drawing.Size(166, 22);
this.copy.Text = "Copy";
this.copy.Click += new System.EventHandler(this.copy_Click);
//
// saveToFile
//
this.saveToFile.Name = "saveToFile";
this.saveToFile.Size = new System.Drawing.Size(164, 22);
this.saveToFile.Size = new System.Drawing.Size(166, 22);
this.saveToFile.Text = "Save to file ...";
this.saveToFile.Click += new System.EventHandler(this.saveToFile_Click);
//

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@ -10,8 +10,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PSLauncher</RootNamespace>
<AssemblyName>PSForever_Launcher</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<NuGetPackageImportStamp>
@ -27,7 +28,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.0</ApplicationVersion>
<ApplicationVersion>1.3.0.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
@ -37,19 +38,21 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'LiveSupport|x86'">
<OutputPath>bin\x86\LiveSupport\</OutputPath>
@ -66,6 +69,7 @@
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
@ -82,11 +86,11 @@
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>
</DefineConstants>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>none</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
@ -100,12 +104,13 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<UseVSHostingProcess>false</UseVSHostingProcess>
<WarningLevel>0</WarningLevel>
<WarningLevel>4</WarningLevel>
<CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'LiveSupport|AnyCPU'">
<OutputPath>bin\LiveSupport\</OutputPath>
<DefineConstants>HACKS</DefineConstants>
<DefineConstants>TRACE;HACKS</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
@ -118,6 +123,7 @@
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>793DD622BA49EF7D3494640F6D9646D8D289304B</ManifestCertificateThumbprint>
@ -144,14 +150,80 @@
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'LiveSupport|x64'">
<OutputPath>bin\x64\LiveSupport\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<StartupObject>PSLauncher.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Json, Version=7.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.Json.7.0.1\lib\net462\System.Net.Http.Json.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Text.Encodings.Web, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=7.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.7.0.3\lib\net462\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@ -213,6 +285,7 @@
<DependentUpon>SettingsForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@ -225,9 +298,9 @@
</Compile>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<ProductName>Microsoft .NET Framework 4.8 %28x86 und x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
@ -247,6 +320,88 @@
<ItemGroup>
<Content Include="Resources\icon.ico" />
</ItemGroup>
<ItemGroup>
<PublishFile Include="Microsoft.Bcl.AsyncInterfaces">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Assembly</FileType>
</PublishFile>
<PublishFile Include="System.Buffers">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Assembly</FileType>
</PublishFile>
<PublishFile Include="System.Memory">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Assembly</FileType>
</PublishFile>
<PublishFile Include="System.Numerics.Vectors">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Assembly</FileType>
</PublishFile>
<PublishFile Include="System.Runtime.CompilerServices.Unsafe">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Assembly</FileType>
</PublishFile>
<PublishFile Include="System.Text.Encodings.Web">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Assembly</FileType>
</PublishFile>
<PublishFile Include="System.Threading.Tasks.Extensions">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Assembly</FileType>
</PublishFile>
<PublishFile Include="System.ValueTuple">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Assembly</FileType>
</PublishFile>
</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.

View file

@ -1,25 +1,53 @@
using PSLauncher.Properties;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
using System.Reflection;
using System.Windows.Forms;
namespace PSLauncher
{
public enum EHashingAlgoType
{
MD5,
SHA1,
SHA256,
SHA384,
SHA512
}
static class Program
{
public static string launcherVersion;
public static string launcherHash;
public static EHashingAlgoType hashingAlgoType = EHashingAlgoType.SHA1;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
static void Main(string[] args)
{
// prepare launcher info
{
var assemblyLocation = Assembly.GetExecutingAssembly().Location;
launcherVersion = FileVersionInfo.GetVersionInfo(assemblyLocation).FileVersion;
launcherHash = Util.CalculateFileHash(assemblyLocation);
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Settings.Default.PropertyChanged += Default_PropertyChanged;
Application.Run(new LauncherForm());
// check if the launcher was called from the URI psf://
if (args.Length == 2 && args[0] == "--")
{
MessageBox.Show(args[1], args[0]);
}
}
static void Default_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)

View file

@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@ -32,8 +31,8 @@ using System.Runtime.InteropServices;
// 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.2.0.1")]
[assembly: AssemblyFileVersion("1.2.0.1")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
// Stamp
// [assembly: AssemblyInformationalVersion("%version% [ %branch% @ %shorthash%%haschanges% ]")]

View file

@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
@ -13,13 +13,13 @@ namespace PSLauncher.Properties {
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// 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", "4.0.0.0")]
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@ -33,7 +33,7 @@ namespace PSLauncher.Properties {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
@ -47,8 +47,8 @@ namespace PSLauncher.Properties {
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
@ -61,7 +61,7 @@ namespace PSLauncher.Properties {
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap vector_logo_psforever {
get {

View file

@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
@ -12,7 +12,7 @@ namespace PSLauncher.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -61,7 +61,7 @@ namespace PSLauncher.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool SkipLauncher {
get {
return ((bool)(this["SkipLauncher"]));
@ -95,20 +95,6 @@ namespace PSLauncher.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<ArrayOfString xmlns:xsi=\"http://www.w3." +
"org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <s" +
"tring>PSForever,play.psforever.net,51000</string>\r\n</ArrayOfString>")]
public global::System.Collections.Specialized.StringCollection ServerList {
get {
return ((global::System.Collections.Specialized.StringCollection)(this["ServerList"]));
}
set {
this["ServerList"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
@ -132,5 +118,19 @@ namespace PSLauncher.Properties {
this["ServerSelection"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<ArrayOfString xmlns:xsi=\"http://www.w3." +
"org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <s" +
"tring>PSForever,play.psforever.net,51000</string>\r\n</ArrayOfString>")]
public global::System.Collections.Specialized.StringCollection ServerList {
get {
return ((global::System.Collections.Specialized.StringCollection)(this["ServerList"]));
}
set {
this["ServerList"] = value;
}
}
}
}

View file

@ -12,7 +12,7 @@
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="SkipLauncher" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="ClearOutputOnLaunch" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
@ -20,17 +20,17 @@
<Setting Name="CoreCombat" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="ServerList" Type="System.Collections.Specialized.StringCollection" Scope="User">
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;string&gt;PSForever,play.psforever.net,51000&lt;/string&gt;
&lt;/ArrayOfString&gt;</Value>
</Setting>
<Setting Name="GenerateClientINI" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="ServerSelection" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="ServerList" Type="System.Collections.Specialized.StringCollection" Scope="User">
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;string&gt;PSForever,play.psforever.net,51000&lt;/string&gt;
&lt;/ArrayOfString&gt;</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -8,6 +8,7 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
namespace PSLauncher
{
@ -165,6 +166,58 @@ namespace PSLauncher
return Environment.GetEnvironmentVariable("ProgramFiles");
}
public static string CalculateFileHash(string _filePath)
{
using (var hashingAlgorithm = HashAlgorithm.Create(Program.hashingAlgoType.ToString()))
{
using (var fileHandle = File.OpenRead(_filePath))
{
return CalculateFileHash(hashingAlgorithm, fileHandle);
}
}
}
public static string CalculateFileHash(FileStream _fileHandle)
{
using (var hashingAlgorithm = HashAlgorithm.Create(Program.hashingAlgoType.ToString()))
{
return CalculateFileHash(hashingAlgorithm, _fileHandle);
}
}
private static string CalculateFileHash(HashAlgorithm _hashingAlgorithm, FileStream _fileHandle)
{
const int bufferSize = 1 * 1000 * 1000; // 1MB
// read file in bigger buffer to improve hashing performance (slightly)
using (var stream2 = new BufferedStream(_fileHandle, bufferSize))
{
return BitConverter.ToString(_hashingAlgorithm.ComputeHash(stream2)).Replace("-", "").ToLower();
}
}
public static string CalculateStringHash(string _string)
{
using (var hashingAlgorithm = HashAlgorithm.Create(Program.hashingAlgoType.ToString()))
{
return CalculateStringHash(hashingAlgorithm, _string);
}
}
public static string CalculateStringHash(EHashingAlgoType _algoType, string _string)
{
using (var hashingAlgorithm = HashAlgorithm.Create(_algoType.ToString()))
{
return CalculateStringHash(hashingAlgorithm, _string);
}
}
private static string CalculateStringHash(HashAlgorithm _hashAlgorithm, string _string)
{
byte[] stringBytes = System.Text.Encoding.ASCII.GetBytes(_string);
return BitConverter.ToString(_hashAlgorithm.ComputeHash(stringBytes)).Replace("-", "").ToLower();
}
// from https://stackoverflow.com/questions/18726852/redirecting-console-writeline-to-textbox
public class ControlWriter : TextWriter
{
@ -189,5 +242,15 @@ namespace PSLauncher
get { return Encoding.ASCII; }
}
}
// https://stackoverflow.com/a/250400
public static DateTime UnixTimestampToDateTime( double unixTimestmap )
{
// Unix timestamp is seconds past epoch
DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
dateTime = dateTime.AddSeconds(unixTimestmap).ToLocalTime();
return dateTime;
}
}
}

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="PSLauncher.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
@ -17,7 +17,7 @@
<value>False</value>
</setting>
<setting name="SkipLauncher" serializeAs="String">
<value>False</value>
<value>True</value>
</setting>
<setting name="ClearOutputOnLaunch" serializeAs="String">
<value>True</value>
@ -25,6 +25,12 @@
<setting name="CoreCombat" serializeAs="String">
<value>True</value>
</setting>
<setting name="GenerateClientINI" serializeAs="String">
<value>True</value>
</setting>
<setting name="ServerSelection" serializeAs="String">
<value>0</value>
</setting>
<setting name="ServerList" serializeAs="Xml">
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@ -33,12 +39,19 @@
</ArrayOfString>
</value>
</setting>
<setting name="GenerateClientINI" serializeAs="String">
<value>True</value>
</setting>
<setting name="ServerSelection" serializeAs="String">
<value>0</value>
</setting>
</PSLauncher.Properties.Settings>
</userSettings>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.3" newVersion="7.0.0.3" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
<package id="System.Net.Http.Json" version="7.0.1" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
<package id="System.Text.Encodings.Web" version="7.0.0" targetFramework="net48" />
<package id="System.Text.Json" version="7.0.3" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
</packages>