Skip to content

Commit 055eb6a

Browse files
committed
massive update
1 parent ae74ab0 commit 055eb6a

29 files changed

Lines changed: 4607 additions & 43 deletions

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ set(SOURCES
5454
src/workers/dllpatchworker.cpp
5555
src/workers/restartworker.cpp
5656
src/utils/paths.cpp
57+
src/utils/luaparser.cpp
5758
src/utils/colors.cpp
5859
src/terminaldialog.cpp
5960
)
@@ -70,6 +71,7 @@ set(HEADERS
7071
src/workers/dllpatchworker.h
7172
src/workers/restartworker.h
7273
src/utils/paths.h
74+
src/utils/luaparser.h
7375
src/utils/colors.h
7476
src/config.h
7577
src/terminaldialog.h
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Created by https://www.gitignore.io/api/visualstudiocode
2+
# Edit at https://www.gitignore.io/?templates=visualstudiocode
3+
4+
### VisualStudioCode ###
5+
.vscode/*
6+
7+
### VisualStudioCode Patch ###
8+
# Ignore all local history of files
9+
.history
10+
11+
# End of https://www.gitignore.io/api/visualstudiocode
12+
13+
*.spec
14+
*.bat
15+
*.log
16+
*.pyc
17+
dist/*
18+
build/*
19+
__pycache__/
20+
env/
21+
22+
# GLMUpdater
23+
GLMUpdater/.vs
24+
GLMUpdater/bin
25+
GLMUpdater/obj
26+
GLMUpdater/packages
27+
GLMUpdater/*.csproj.user
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5+
</startup>
6+
</configuration>
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{8A2401D7-EE59-48EC-A6D8-069EF807C82A}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>GLMUpdater</RootNamespace>
10+
<AssemblyName>GL2020 Updater</AssemblyName>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
<IsWebBootstrapper>false</IsWebBootstrapper>
16+
<PublishUrl>publish\</PublishUrl>
17+
<Install>true</Install>
18+
<InstallFrom>Disk</InstallFrom>
19+
<UpdateEnabled>false</UpdateEnabled>
20+
<UpdateMode>Foreground</UpdateMode>
21+
<UpdateInterval>7</UpdateInterval>
22+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
23+
<UpdatePeriodically>false</UpdatePeriodically>
24+
<UpdateRequired>false</UpdateRequired>
25+
<MapFileExtensions>true</MapFileExtensions>
26+
<AutorunEnabled>true</AutorunEnabled>
27+
<ApplicationRevision>1</ApplicationRevision>
28+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
29+
<UseApplicationTrust>false</UseApplicationTrust>
30+
<PublishWizardCompleted>true</PublishWizardCompleted>
31+
<BootstrapperEnabled>true</BootstrapperEnabled>
32+
</PropertyGroup>
33+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
34+
<PlatformTarget>AnyCPU</PlatformTarget>
35+
<DebugSymbols>true</DebugSymbols>
36+
<DebugType>full</DebugType>
37+
<Optimize>false</Optimize>
38+
<OutputPath>bin\Debug\</OutputPath>
39+
<DefineConstants>DEBUG;TRACE</DefineConstants>
40+
<ErrorReport>prompt</ErrorReport>
41+
<WarningLevel>4</WarningLevel>
42+
</PropertyGroup>
43+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
44+
<PlatformTarget>AnyCPU</PlatformTarget>
45+
<DebugType>pdbonly</DebugType>
46+
<Optimize>true</Optimize>
47+
<OutputPath>bin\Release\</OutputPath>
48+
<DefineConstants>TRACE</DefineConstants>
49+
<ErrorReport>prompt</ErrorReport>
50+
<WarningLevel>4</WarningLevel>
51+
</PropertyGroup>
52+
<PropertyGroup>
53+
<ManifestCertificateThumbprint>79505D8EC9DC2A5471E43CC5753D82A08BBB8468</ManifestCertificateThumbprint>
54+
</PropertyGroup>
55+
<PropertyGroup>
56+
<ManifestKeyFile>GL2020 Updater_TemporaryKey.pfx</ManifestKeyFile>
57+
</PropertyGroup>
58+
<PropertyGroup>
59+
<GenerateManifests>true</GenerateManifests>
60+
</PropertyGroup>
61+
<PropertyGroup>
62+
<SignManifests>true</SignManifests>
63+
</PropertyGroup>
64+
<ItemGroup>
65+
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
66+
<HintPath>packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
67+
</Reference>
68+
<Reference Include="System" />
69+
<Reference Include="System.Core" />
70+
<Reference Include="System.IO.Compression" />
71+
<Reference Include="System.IO.Compression.FileSystem" />
72+
<Reference Include="System.Xml.Linq" />
73+
<Reference Include="System.Data.DataSetExtensions" />
74+
<Reference Include="Microsoft.CSharp" />
75+
<Reference Include="System.Data" />
76+
<Reference Include="System.Net.Http" />
77+
<Reference Include="System.Xml" />
78+
</ItemGroup>
79+
<ItemGroup>
80+
<Compile Include="Program.cs" />
81+
<Compile Include="Properties\AssemblyInfo.cs" />
82+
<Compile Include="Updater.cs" />
83+
<Compile Include="Utils.cs" />
84+
</ItemGroup>
85+
<ItemGroup>
86+
<None Include="App.config" />
87+
<None Include="packages.config" />
88+
</ItemGroup>
89+
<ItemGroup>
90+
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
91+
<Visible>False</Visible>
92+
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
93+
<Install>true</Install>
94+
</BootstrapperPackage>
95+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
96+
<Visible>False</Visible>
97+
<ProductName>.NET Framework 3.5 SP1</ProductName>
98+
<Install>false</Install>
99+
</BootstrapperPackage>
100+
</ItemGroup>
101+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
102+
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.9.34728.123
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GLMUpdater", "GLMUpdater.csproj", "{8A2401D7-EE59-48EC-A6D8-069EF807C82A}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{8A2401D7-EE59-48EC-A6D8-069EF807C82A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{8A2401D7-EE59-48EC-A6D8-069EF807C82A}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{8A2401D7-EE59-48EC-A6D8-069EF807C82A}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{8A2401D7-EE59-48EC-A6D8-069EF807C82A}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {4DFAD43A-BE16-44E0-B5B0-4FF3DC8DC199}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace GLMUpdater
2+
{
3+
static class Program
4+
{
5+
static void Main(string[] args)
6+
{
7+
Updater updater = new Updater();
8+
updater.IsUpdated().Wait();
9+
}
10+
}
11+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
4+
// General Information about an assembly is controlled through the following
5+
// set of attributes. Change these attribute values to modify the information
6+
// associated with an assembly.
7+
[assembly: AssemblyTitle("GreenLuma Manager Updater")]
8+
[assembly: AssemblyDescription("")]
9+
[assembly: AssemblyConfiguration("")]
10+
[assembly: AssemblyCompany("")]
11+
[assembly: AssemblyProduct("GreenLuma Manager Updater")]
12+
[assembly: AssemblyCopyright("Copyright © 2024")]
13+
[assembly: AssemblyTrademark("")]
14+
[assembly: AssemblyCulture("")]
15+
16+
// Setting ComVisible to false makes the types in this assembly not visible
17+
// to COM components. If you need to access a type in this assembly from
18+
// COM, set the ComVisible attribute to true on that type.
19+
[assembly: ComVisible(false)]
20+
21+
// The following GUID is for the ID of the typelib if this project is exposed to COM
22+
[assembly: Guid("8a2401d7-ee59-48ec-a6d8-069ef807c82a")]
23+
24+
// Version information for an assembly consists of the following four values:
25+
//
26+
// Major Version
27+
// Minor Version
28+
// Build Number
29+
// Revision
30+
//
31+
// You can specify all the values or you can default the Build and Revision Numbers
32+
// by using the '*' as shown below:
33+
// [assembly: AssemblyVersion("1.0.*")]
34+
[assembly: AssemblyVersion("1.0.0.0")]
35+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using System.IO;
4+
using System.Net;
5+
using System.Diagnostics;
6+
using Newtonsoft.Json.Linq;
7+
8+
namespace GLMUpdater
9+
{
10+
class Updater
11+
{
12+
private readonly string dataPath = Environment.ExpandEnvironmentVariables("%localappdata%/GLR_Manager/");
13+
private readonly string downloadURL = "https://github.com/BlueAmulet/GreenLuma-2024-Manager/releases/download/v{0}/GreenLuma.2020.Manager.zip";
14+
private string latestVersionString;
15+
private string currentVersionString;
16+
private readonly StreamWriter logger = Utils.CreateLogger();
17+
public async Task IsUpdated()
18+
{
19+
try
20+
{
21+
latestVersionString = await Utils.GetLatest();
22+
}
23+
catch (Exception e)
24+
{
25+
PrintError(e.StackTrace, "Error while trying to get the last version.");
26+
return;
27+
}
28+
29+
try
30+
{
31+
string configJSON = File.ReadAllText(dataPath + "config.json");
32+
currentVersionString = (string)JObject.Parse(configJSON)["version"];
33+
}
34+
catch (Exception)
35+
{
36+
return;
37+
}
38+
39+
Version currentVersion = new Version(currentVersionString);
40+
Version latestVersion = new Version(latestVersionString);
41+
42+
if (currentVersion.CompareTo(latestVersion) < 0)
43+
{
44+
Console.WriteLine("Outdated");
45+
46+
foreach (Process process in Process.GetProcessesByName("GreenLuma 2020 Manager"))
47+
{
48+
if (!process.HasExited)
49+
{
50+
process.Kill();
51+
}
52+
}
53+
54+
while (Process.GetProcessesByName("GreenLuma 2020 Manager").Length > 0)
55+
{
56+
System.Threading.Thread.Sleep(500);
57+
}
58+
59+
try
60+
{
61+
Console.WriteLine("Downloading Latest Version...");
62+
await Utils.DownloadAndExtractFile(string.Format(downloadURL, latestVersionString));
63+
}
64+
catch (WebException e)
65+
{
66+
PrintError(e.StackTrace, "Error while downloading.");
67+
}
68+
catch (Exception e)
69+
{
70+
PrintError(e.StackTrace, "Error while extracting.");
71+
}
72+
}
73+
else
74+
{
75+
Console.WriteLine("The Program is Up to date");
76+
}
77+
}
78+
79+
private void PrintError(string stack, string mesage)
80+
{
81+
Console.WriteLine(mesage);
82+
logger.WriteLine(stack);
83+
84+
Console.WriteLine("Press any key to close...");
85+
Console.ReadLine();
86+
}
87+
}
88+
89+
}

0 commit comments

Comments
 (0)