Skip to content
This repository was archived by the owner on Sep 24, 2024. It is now read-only.

Commit f3b383d

Browse files
committed
Version 5.0.8
1 parent 3a28de8 commit f3b383d

21 files changed

+315
-76
lines changed

MakeExecutable.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "D:\visualstudio\ModManager5\Installer\CodeDependencies.iss"
66

77
#define MyAppName "ModManager"
8-
#define MyAppVersion "5.0.7"
8+
#define MyAppVersion "5.0.8"
99
#define MyAppPublisher "Matux"
1010
#define MyAppURL "https://matux.fr"
1111
#define MyAppExeName "ModManager5.exe"

ModManager5/Classes/CategoryManager.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public static class CategoryManager
1414

1515
public static void load()
1616
{
17+
Utils.log("Load START", "CategoryManager");
1718
if (!ModManager.silent)
1819
ModManagerUI.StatusLabel.Text = "Loading Mod Categories...";
1920
string catlistURL = ModManager.apiURL + "/category/list";
@@ -27,6 +28,7 @@ public static void load()
2728
}
2829
catch
2930
{
31+
Utils.logE("Load connection FAIL", "CategoryManager");
3032
MessageBox.Show("Mod Manager's server is unreacheable.\n" +
3133
"\n" +
3234
"There are many possible reasons for this :\n" +
@@ -38,6 +40,7 @@ public static void load()
3840
Environment.Exit(0);
3941
}
4042
categories = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Category>>(cat);
43+
Utils.log("Load END", "CategoryManager");
4144
}
4245

4346
public static Category getCategoryById(string id)

ModManager5/Classes/ConfigManager.cs

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.Win32;
1+
using Microsoft.VisualBasic.Devices;
2+
using Microsoft.Win32;
23
using Newtonsoft.Json;
34
using System;
45
using System.Collections.Generic;
@@ -20,118 +21,134 @@ public static class ConfigManager
2021

2122
public static void loadGlobalConfig()
2223
{
24+
Utils.log("Load global START", "ConfigManager");
2325
globalConfig = new GlobalConfig();
2426
if (File.Exists(globalPath))
2527
{
28+
Utils.log("Global config exists", "ConfigManager");
2629
string json = System.IO.File.ReadAllText(globalPath);
2730
globalConfig = Newtonsoft.Json.JsonConvert.DeserializeObject<GlobalConfig>(json);
2831

2932
if (globalConfig.lg == "English")
3033
{
34+
Utils.log("Global config update to EN", "ConfigManager");
3135
globalConfig.lg = "EN";
3236
updateGlobalConfig();
3337
}
34-
35-
return;
3638
}
3739
else
3840
{
3941
updateGlobalConfig();
4042
}
43+
Utils.log("Load global END", "ConfigManager");
4144
}
4245

4346
public static void load()
4447
{
48+
Utils.log("Load config START", "ConfigManager");
4549
if (!ModManager.silent)
4650
ModManagerUI.StatusLabel.Text = "Loading Local Config...";
4751
config = new Config();
48-
Utils.log("[ConfigManager] Starting config detection");
4952
if (File.Exists(path))
5053
{
51-
Utils.log("[ConfigManager] Config detected");
54+
Utils.log("Config exists", "ConfigManager");
5255
string json = System.IO.File.ReadAllText(path);
5356
config = Newtonsoft.Json.JsonConvert.DeserializeObject<Config>(json);
5457
if (ServerConfig.get("gameVersion").value != config.currentGameVersion)
5558
{
59+
Utils.log("New vanilla version", "ConfigManager");
5660
duplicateVanillaAmongUs();
5761
}
58-
return;
5962
} else
6063
{
61-
Utils.log("[ConfigManager] Config not detected");
64+
Utils.log("Config does not exist", "ConfigManager");
6265
// Config doesn't exist
6366
duplicateVanillaAmongUs();
6467
}
68+
Utils.log("Load config END", "ConfigManager");
6569
}
6670

6771
public static void duplicateVanillaAmongUs()
6872
{
69-
Utils.log("[ConfigManager] Creating new backup for vanilla Among Us");
73+
Utils.log("New backup for Vanilla START", "ConfigManager");
7074
string amongUsPath = null;
7175

7276
// Search for Among Us path
7377

7478
// Detection from Steam
75-
Utils.log("[ConfigManager] Starting detection from Steam");
79+
Utils.log("Steam detection START", "ConfigManager");
7680
RegistryKey myKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 945360", false);
7781

7882
if (myKey != null)
7983
{
84+
Utils.log("Steam detection YES", "ConfigManager");
8085
amongUsPath = (String)myKey.GetValue("InstallLocation");
8186
if (generateFolder(amongUsPath))
8287
{
88+
Utils.log("Steam detection CONFIRM", "ConfigManager");
8389
return;
8490
}
8591
}
8692
else
8793
{
88-
94+
Utils.log("Steam detection NO", "ConfigManager");
8995
}
96+
Utils.log("Steam detection END", "ConfigManager");
9097

9198
// Detection from Epic Games Store
92-
Utils.log("[ConfigManager] Starting detection from EGS");
99+
Utils.log("EGS detection START", "ConfigManager");
93100
foreach (DriveInfo d in DriveInfo.GetDrives())
94101
{
95102
amongUsPath = d.Name + @"Program Files\Epic Games\AmongUs";
96103
if (generateFolder(amongUsPath))
97104
{
105+
Utils.log("EGS detection YES", "ConfigManager");
106+
Utils.log("EGS detection END", "ConfigManager");
98107
return;
99108
}
100109
}
110+
Utils.log("EGS detection END", "ConfigManager");
111+
101112

102-
113+
Utils.log("Config detection START", "ConfigManager");
103114
if (config.amongUsPath != null && config.amongUsPath != "")
104115
{
105-
Utils.log("[ConfigManager] Among Us path detected in Config");
116+
Utils.log("Config detection YES", "ConfigManager");
106117
amongUsPath = config.amongUsPath;
107118
if (generateFolder(amongUsPath))
108119
{
120+
Utils.log("Config detection CONFIRM", "ConfigManager");
109121
return;
110122
}
111123
}
124+
Utils.log("Config detection END", "ConfigManager");
112125
// No Among Us found
113126

114-
Utils.log("[ConfigManager] Among Us path not detected, manual selection starts");
127+
Utils.log("Manual selection START", "ConfigManager");
115128
amongUsPath = null;
116129
while (amongUsPath == null || File.Exists(amongUsPath + @"\Among Us.exe") == false)
117130
{
118131
if (MessageBox.Show("Among Us not found ! Please, select the Among Us executable", "Among Us not found", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.Cancel)
119132
{
133+
Utils.log("Manual selection LEFT", "ConfigManager");
120134
Environment.Exit(0);
121135
}
122136
amongUsPath = selectFolderWorker();
123137
}
138+
Utils.log("Manual selection YES", "ConfigManager");
124139
if (generateFolder(amongUsPath))
125140
{
141+
Utils.log("Manual selection CONFIRM", "ConfigManager");
126142
return;
127143
}
128144
}
129145

130146
public static Boolean generateFolder(string path)
131147
{
148+
Utils.log("Vanilla creation START", "ConfigManager");
132149
if (File.Exists(path + @"\Among Us.exe"))
133150
{
134-
Utils.log("[ConfigManager] Among Us path validated");
151+
Utils.log("Vanilla creation YES", "ConfigManager");
135152
string latest = ServerConfig.get("gameVersion").value;
136153
string destPath = ModManager.appDataPath + @"\vanilla\" + latest;
137154
Directory.CreateDirectory(destPath);
@@ -141,13 +158,16 @@ public static Boolean generateFolder(string path)
141158
config.currentGameVersion = latest;
142159
config.amongUsPath = path;
143160
update();
161+
Utils.log("Vanilla creation CONFIRM", "ConfigManager");
144162
return true;
145163
}
164+
Utils.log("Vanilla creation NO", "ConfigManager");
146165
return false;
147166
}
148167

149168
public static string selectFolderWorker()
150169
{
170+
Utils.log("Select folder START", "ConfigManager");
151171
OpenFileDialog folderBrowser = new OpenFileDialog();
152172
folderBrowser.ValidateNames = false;
153173
folderBrowser.CheckFileExists = false;
@@ -159,21 +179,27 @@ public static string selectFolderWorker()
159179
if (folderBrowser.ShowDialog() == DialogResult.OK)
160180
{
161181
string folderPath = Path.GetDirectoryName(folderBrowser.FileName);
182+
Utils.log("Select folder YES", "ConfigManager");
162183
return folderPath;
163184
}
185+
Utils.log("Select folder NO", "ConfigManager");
164186
return null;
165187
}
166188

167189
public static void update()
168190
{
191+
Utils.log("Config update START", "ConfigManager");
169192
string json = JsonConvert.SerializeObject(config);
170193
File.WriteAllText(path, json);
194+
Utils.log("Config update END", "ConfigManager");
171195
}
172196

173197
public static void updateGlobalConfig()
174198
{
199+
Utils.log("Global config update START", "ConfigManager");
175200
string json = JsonConvert.SerializeObject(globalConfig);
176201
File.WriteAllText(globalPath, json);
202+
Utils.log("Global config update END", "ConfigManager");
177203
}
178204

179205
public static InstalledMod getInstalledModById(string id)
@@ -188,8 +214,24 @@ public static Boolean containsGameVersion(string version)
188214

189215
public static void logConfig()
190216
{
191-
string ret = "[ConfigManager] OS Version : " + System.Environment.OSVersion.ToString();
192-
Utils.log(ret);
217+
Utils.log("Computer information", "ConfigManager");
218+
ComputerInfo c = new ComputerInfo();
219+
decimal ram = c.TotalPhysicalMemory;
220+
ram = Math.Round(ram / (1024 * 1024 * 1024), 1);
221+
Utils.log("- OS Version: " + c.OSFullName, "ConfigManager");
222+
Utils.log("- OS Language: " + c.InstalledUICulture.Name, "ConfigManager");
223+
Utils.log("- Processor: " + System.Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER"), "ConfigManager");
224+
Utils.log("- RAM: " + ram.ToString() + "Go", "ConfigManager");
225+
Utils.log("- Drives:", "ConfigManager");
226+
foreach (DriveInfo d in DriveInfo.GetDrives())
227+
{
228+
decimal free = d.AvailableFreeSpace;
229+
decimal total = d.TotalSize;
230+
free = Math.Round(free / (1024 * 1024 * 1024), 1);
231+
total = Math.Round(total / (1024 * 1024 * 1024), 1);
232+
233+
Utils.log(" - Drive " + d.Name + ":" + free + "/" + total, "ConfigManager");
234+
}
193235
}
194236
}
195237

ModManager5/Classes/ContextMenu.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public static class ContextMenu
1515

1616
public static void init(ModManager modmanager)
1717
{
18+
Utils.log("Init START", "ContextMenu");
1819
modManager = modmanager;
1920
notifyIcon = new NotifyIcon();
2021
notifyIcon.Icon = global::ModManager5.Properties.Resources.modmanager;
@@ -23,10 +24,12 @@ public static void init(ModManager modmanager)
2324
notifyIcon.MouseClick += mouseEvent;
2425
modManager.Resize += new EventHandler(onResize);
2526
Application.ApplicationExit += new EventHandler(exit);
27+
Utils.log("Init END", "ContextMenu");
2628
}
2729

2830
public static void load()
2931
{
32+
Utils.log("Load START", "ContextMenu");
3033
notifyIcon.ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip();
3134
if (ServerConfig.get("enabled").value == "true")
3235
{
@@ -38,6 +41,7 @@ public static void load()
3841

3942
notifyIcon.ContextMenuStrip.Items.Add("Vanilla Among Us", null, startGame);
4043

44+
Utils.log("Loading " + im.Count() + " mods", "ContextMenu");
4145
foreach (InstalledMod i in im)
4246
{
4347
Mod m = ModList.getModById(i.id);
@@ -56,16 +60,21 @@ public static void load()
5660
}
5761

5862
notifyIcon.ContextMenuStrip.Items.Add("Exit", null, exit);
63+
Utils.log("Load END", "ContextMenu");
5964
}
6065
private static void mouseEvent(object Sender, MouseEventArgs e)
6166
{
67+
Utils.log("Click START", "ContextMenu");
6268
if (e.Button != MouseButtons.Right)
6369
{
70+
Utils.log("Click YES", "ContextMenu");
6471
if (modManager.WindowState == FormWindowState.Minimized)
6572
{
73+
Utils.log("Maximize window", "ContextMenu");
6674
modManager.WindowState = FormWindowState.Normal;
6775
}
6876
}
77+
Utils.log("Load END", "ContextMenu");
6978
}
7079

7180
public static void onResize(object sender, EventArgs e)
@@ -82,27 +91,34 @@ public static void onResize(object sender, EventArgs e)
8291

8392
private static void open(object sender, EventArgs e)
8493
{
94+
Utils.log("Open START", "ContextMenu");
8595
if (modManager.WindowState == FormWindowState.Minimized)
8696
modManager.WindowState = FormWindowState.Normal;
8797

8898
modManager.Activate();
99+
Utils.log("Open END", "ContextMenu");
89100
}
90101

91102
private static void startGame(object sender, EventArgs e)
92103
{
104+
Utils.log("Start Game START", "ContextMenu");
93105
ModWorker.startGame(true);
106+
Utils.log("Start Game END", "ContextMenu");
94107
}
95108

96109
private static void settings(object sender, EventArgs e)
97110
{
111+
Utils.log("Settings START", "ContextMenu");
98112
ModManagerUI.openForm(ModManagerUI.SettingsForm);
99113
if (modManager.WindowState == FormWindowState.Minimized)
100114
modManager.WindowState = FormWindowState.Normal;
101115
modManager.Activate();
116+
Utils.log("Start Game END", "ContextMenu");
102117
}
103118

104119
private static void exit(object sender, EventArgs e)
105120
{
121+
Utils.log("Exit", "ContextMenu");
106122
notifyIcon.Dispose();
107123
Application.Exit();
108124
}

ModManager5/Classes/DependencyList.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class DependencyList
1313
public static List<Dependency> dependencies;
1414
public static void load()
1515
{
16+
Utils.log("Load START", "DependencyList");
1617
if (!ModManager.silent)
1718
ModManagerUI.StatusLabel.Text = "Loading Dependencies...";
1819
string dependenciesURL = ModManager.apiURL + "/dependency/list";
@@ -26,6 +27,7 @@ public static void load()
2627
}
2728
catch
2829
{
30+
Utils.logE("Load connection FAIL", "DependencyList");
2931
MessageBox.Show("Mod Manager's server is unreacheable.\n" +
3032
"\n" +
3133
"There are many possible reasons for this :\n" +
@@ -37,6 +39,7 @@ public static void load()
3739
Environment.Exit(0);
3840
}
3941
dependencies = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dependency>>(dependencylist);
42+
Utils.log("Load END", "DependencyList");
4043
}
4144

4245
public static Dependency getDependencyById(string id)

ModManager5/Classes/DownloadWorker.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ public static class DownloadWorker
1818

1919
public static void load(ModManager modManager)
2020
{
21+
Utils.log("Load", "DownloadWorker");
2122
thisModManager = modManager;
2223
}
2324

2425
public static void download(string path, string destPath, string sentence)
2526
{
27+
Utils.log("Download START", "DownloadWorker");
2628
finished = false;
2729
thisSentence = sentence;
2830
thisModManager.Invoke((MethodInvoker)delegate
@@ -40,6 +42,7 @@ public static void download(string path, string destPath, string sentence)
4042
{
4143

4244
}
45+
Utils.log("Download END", "DownloadWorker");
4346
}
4447

4548
private static void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)

0 commit comments

Comments
 (0)