Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.
/ ModManager Public archive

Commit

Permalink
version 5.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
MatuxGG committed Mar 10, 2022
1 parent 608641f commit 8999abe
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 96 deletions.
2 changes: 1 addition & 1 deletion MakeExecutable.iss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "D:\visualstudio\ModManager5\Installer\CodeDependencies.iss"

#define MyAppName "ModManager"
#define MyAppVersion "5.0.5"
#define MyAppVersion "5.0.6"
#define MyAppPublisher "Matux"
#define MyAppURL "https://matux.fr"
#define MyAppExeName "ModManager5.exe"
Expand Down
5 changes: 4 additions & 1 deletion ModManager5/Classes/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ namespace ModManager5.Classes
{
public class Config
{
public string ModManagerVersion;
public List<InstalledMod> installedMods;
public List<InstalledVanilla> installedVanilla;
public string currentGameVersion;
public string amongUsPath;
public string lastMod;

public Config(List<InstalledMod> installedMods, List<InstalledVanilla> installedVanilla, string currentGameVersion, string amongUsPath, string lastMod)
public Config(string modManagerVersion, List<InstalledMod> installedMods, List<InstalledVanilla> installedVanilla, string currentGameVersion, string amongUsPath, string lastMod)
{
this.ModManagerVersion = modManagerVersion;
this.installedMods = installedMods;
this.installedVanilla = installedVanilla;
this.currentGameVersion = currentGameVersion;
Expand All @@ -26,6 +28,7 @@ public Config(List<InstalledMod> installedMods, List<InstalledVanilla> installed

public Config()
{
this.ModManagerVersion = ModManager.visibleVersion;
string version = ServerConfig.get("gameVersion").value;
this.installedMods = new List<InstalledMod>() { };
this.installedVanilla = new List<InstalledVanilla>() { };
Expand Down
28 changes: 4 additions & 24 deletions ModManager5/Classes/Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,17 @@ public class Mod
public string id { get; set; }
public string name { get; set; }
public string category { get; set; }
public string type { get; set; }
public string gameVersion { get; set; }
public List<string> dependencies { get; set; }
public string type { get; set; }

public string compType { get; set; }
public string author { get; set; }
public string github { get; set; }
public string githubLink { get; set; }
public List<string> folders { get; set; }
public string ignoredPattern { get; set; }
public List<string> data { get; set; }

public List<string> excludeFiles { get; set; }
public string worksOnSteam { get; set; }
public string worksOnEGS { get; set; }

public Release release { get; set; }

public Mod(string id, string name, string category, string type, string compType, string gameVersion, List<string> dependencies, string author, string github, string githubLink, List<string> folders, List<string> data, List<string> excludeFiles, string worksOnSteam, string worksOnEGS)
public Mod(string id, string name, string category, string type, string gameVersion, List<string> dependencies, string author, string github, string githubLink, string ignoredPattern, List<string> data)
{
this.id = id;
this.name = name;
Expand All @@ -39,34 +32,21 @@ public Mod(string id, string name, string category, string type, string compType
this.author = author;
this.github = github;
this.githubLink = githubLink;
this.ignoredPattern = ignoredPattern;
this.type = type;
this.compType = compType;
this.release = null;
this.folders = folders;
this.data = data;
this.excludeFiles = excludeFiles;
this.worksOnSteam = worksOnSteam;
this.worksOnEGS = worksOnEGS;

if (this.dependencies == null)
{
this.dependencies = new List<string>() { };
}

if (this.folders == null)
{
this.folders = new List<string>() { };
}

if (this.data == null)
{
this.data = new List<string>() { };
}

if (this.excludeFiles == null)
{
this.excludeFiles = new List<string>() { };
}
}

public async Task getGithubRelease()
Expand Down
55 changes: 12 additions & 43 deletions ModManager5/Classes/ModManagerUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ public static void refreshModForm(Form f)
{
mods.AddRange(ModList.localMods);
int nextId = ModList.localMods.Count();
mods.Add(new Mod("LocalMod" + nextId, "NewMod" + nextId, "local", "local", "any", ServerConfig.get("gameVersion").value, new List<string>() { DependencyList.dependencies.Find(d => d.id.Contains("BepInEx")).id }, "", "", "0", new List<string>() { }, new List<string>() { }, new List<string>() { }, "1", "1"));
mods.Add(new Mod("LocalMod" + nextId, "NewMod" + nextId, "local", "local", ServerConfig.get("gameVersion").value, new List<string>() { DependencyList.dependencies.Find(d => d.id.Contains("BepInEx")).id }, "", "", "0", "", new List<string>() { }));

} else
{
Expand All @@ -676,14 +676,13 @@ public static void refreshModForm(Form f)

if (cat.id == "local")
{
ModPanel.ColumnCount = 7;
ModPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 15F));
ModPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 15F));
ModPanel.ColumnCount = 6;
ModPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
ModPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
ModPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 24F));
ModPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 7F));
ModPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 7F));
ModPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 7F));
ModPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
ModPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10F));
ModPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10F));
ModPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10F));
} else
{
ModPanel.ColumnCount = 7;
Expand Down Expand Up @@ -1000,31 +999,7 @@ public static void refreshModForm(Form f)
}


ModPanel.Controls.Add(FileButton, 3, line);

MMListBox ModDependencies = new MMListBox();
ModDependencies.Dock = DockStyle.Fill;
int i = 0;
foreach (Dependency d in DependencyList.dependencies)
{
ModDependencies.Items.Add(d.id);
if (m.dependencies.Contains(d.id))
{
ModDependencies.SetSelected(i, true);
}
i++;
}

if (!last)
{
ModDependencies.SelectedValueChanged += new EventHandler((object sender, EventArgs e) => {
ModValidPic.Show();
});
}


ModPanel.Controls.Add(ModDependencies, 2, line);

ModPanel.Controls.Add(FileButton, 2, line);

MMComboBox ModVersion = new MMComboBox();
ModVersion.Margin = new Padding(12, 25, 0, 25);
Expand Down Expand Up @@ -1097,7 +1072,7 @@ public static void refreshModForm(Form f)
tempPath = ModWorker.getBepInExInsideRec(tempPath);
Utils.DirectoryCopy(tempPath, newPath, true);
Mod newLocalMod = new Mod(ModTitle.Name, ModTitle.Text, "local", "local", "any", ModVersion.Text, ModDependencies.SelectedItems.Cast<string>().ToList(), "", @"localMods\"+ModTitle.Text, "0", new List<string>() { }, new List<string>() { }, new List<string>() { }, "1", "1") ;
Mod newLocalMod = new Mod(ModTitle.Name, ModTitle.Text, "local", "local", ModVersion.Text, new List<string>() { }, "", @"localMods\"+ModTitle.Text, "0", "", new List<string>() { }) ;
ModList.localMods.Add(newLocalMod);
Expand Down Expand Up @@ -1133,7 +1108,7 @@ public static void refreshModForm(Form f)
});
}
allocatedControls.Add(ModRemovedPic);
ModPanel.Controls.Add(ModRemovedPic, 6, line);
ModPanel.Controls.Add(ModRemovedPic, 5, line);

if (!last)
{
Expand All @@ -1153,7 +1128,7 @@ public static void refreshModForm(Form f)
ModWorker.startMod(m);
});

ModPanel.Controls.Add(ModStartPic, 4, line);
ModPanel.Controls.Add(ModStartPic, 3, line);

ModValidPic.Image = global::ModManager5.Properties.Resources.valid;
ModValidPic.Name = "ModValidPic=" + m.id;
Expand Down Expand Up @@ -1188,12 +1163,6 @@ public static void refreshModForm(Form f)
m.gameVersion = ModVersion.Text;
}
List<string> deps = ModDependencies.SelectedItems.Cast<string>().ToList();
if (m.dependencies != deps)
{
m.dependencies = deps;
}
if (FileButton.Text != "" && FileButton.Text != Translator.get("Change file"))
{
string newPath = ModManager.appDataPath + @"\localMods\" + m.name;
Expand All @@ -1217,7 +1186,7 @@ public static void refreshModForm(Form f)
allocatedControls.Add(ModStartPic);
allocatedControls.Add(ModValidPic);

ModPanel.Controls.Add(ModValidPic, 5, line);
ModPanel.Controls.Add(ModValidPic, 4, line);
}
}

Expand Down
28 changes: 22 additions & 6 deletions ModManager5/Classes/ModWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public static void startSteam()
backgroundWorkerSteam.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorkerSteam_RunWorkerCompleted);
backgroundWorkerSteam.ProgressChanged += new ProgressChangedEventHandler(backgroundWorkerSteam_ProgressChanged);
backgroundWorkerSteam.RunWorkerAsync();

}

private static void backgroundWorkerSteam_DoWork(object sender, DoWorkEventArgs e)
Expand Down Expand Up @@ -112,15 +111,21 @@ public static void startMod(Mod m)

if (m.id == "Skeld")
{
if (!ModManager.silent)
ModManagerUI.StatusLabel.Text = Translator.get("MODNAME started.").Replace("MODNAME", m.name);
Process.Start("explorer", ModManager.appDataPath + @"\mods\" + m.id + @"\Skeld.exe");
}
else if (m.id == "BetterCrewlink")
{
object o = Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\03ceac78-9166-585d-b33a-90982f435933", "InstallLocation", null);
if (!ModManager.silent)
ModManagerUI.StatusLabel.Text = Translator.get("MODNAME started.").Replace("MODNAME", m.name);
Process.Start("explorer", o.ToString() + @"\Better-CrewLink.exe");
}
else if (m.id == "Challenger" || m.id == "ChallengerBeta")
{
if (!ModManager.silent)
ModManagerUI.StatusLabel.Text = Translator.get("MODNAME started.").Replace("MODNAME", m.name);
Process.Start("explorer", ModManager.appDataPath + @"\mods\" + m.id + @"\Among Us.exe");
} else
{
Expand All @@ -132,13 +137,18 @@ public static void startMod(Mod m)

string dirPath = (m.type != "local" ? ModManager.appDataPath + @"\mods\" + m.id : ModManager.appDataPath + @"\localMods\" + m.name);

if (!ModManager.silent)
ModManagerUI.StatusLabel.Text = Translator.get("Starting MODNAME ... Please wait...").Replace("MODNAME", m.name);

if (m.gameVersion == ServerConfig.get("gameVersion").value)
{
string amongUsPath = ConfigManager.config.amongUsPath;
cleanGame(amongUsPath);
Utils.DirectoryCopy(dirPath, amongUsPath, true);
ConfigManager.config.lastMod = m.id;
ConfigManager.update();
if (!ModManager.silent)
ModManagerUI.StatusLabel.Text = Translator.get("MODNAME started.").Replace("MODNAME", m.name);
startGame(false);
} else
{
Expand All @@ -147,14 +157,14 @@ public static void startMod(Mod m)
Utils.DirectoryCopy(dirPath, amongUsPath, true);
ConfigManager.config.lastMod = m.id;
ConfigManager.update();
if (!ModManager.silent)
ModManagerUI.StatusLabel.Text = Translator.get("MODNAME started.").Replace("MODNAME", m.name);
Process.Start("explorer", amongUsPath + @"\Among Us.exe");
}

}
}



private static void cleanGame(string amongUsPath)
{
Utils.log("[ModWorker] Cleaning game");
Expand All @@ -173,14 +183,15 @@ public static void saveData(string amongUsPath)
Mod mod = ModList.getModById(ConfigManager.config.lastMod);
if (mod != null)
{
foreach (string data in mod.data)
List<string> tdata = mod.data;
tdata.Add("BepInEx/config");
foreach (string data in tdata)
{
string path = amongUsPath + @"\" + data;
string destPath = ModManager.appDataPath + @"\mods\" + mod.id + @"\" + data;
if (Directory.Exists(path))
{
Utils.DirectoryCopy(path, destPath, true);

}
if (File.Exists(path))
{
Expand All @@ -205,7 +216,12 @@ public static Boolean isGameOpen()
public static void startGame(Boolean vanilla)
{
if (vanilla)
{
Utils.log("[ModWorker] Starting game");
if (!ModManager.silent)
ModManagerUI.StatusLabel.Text = Translator.get("MODNAME started.").Replace("MODNAME", "Vanilla Among Us");
}

Boolean vanillaOpen = (vanilla && isGameOpen());
if (vanillaOpen)
{
Expand Down Expand Up @@ -676,7 +692,7 @@ public static Boolean installFiles(Mod m)
foreach (ReleaseAsset tab in m.release.Assets)
{
string fileName = tab.Name;
if (fileName.Contains(".zip") && !fileName.Contains("Old")) // Temporary fix for TownOfUsR, API update inc
if (fileName.Contains(".zip") && (m.ignoredPattern == "" || !fileName.Contains(m.ignoredPattern)))
{
return installZip(m, tab);
}
Expand Down
27 changes: 7 additions & 20 deletions ModManager5/Classes/Visuals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,14 +414,13 @@ public static TableLayoutPanel LocalModsOverlay()
panel.Dock = DockStyle.Top;
panel.BackColor = ThemeList.theme.AppOverlayColor;

panel.ColumnCount = 7;
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 15F));
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 15F));
panel.ColumnCount = 6;
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 24F));
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 7F));
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 7F));
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 7F));
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10F));
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10F));
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10F));

panel.RowCount = 1;
panel.Size = new System.Drawing.Size(100, 50);
Expand All @@ -438,19 +437,7 @@ public static TableLayoutPanel LocalModsOverlay()
ModTitlePath.Padding = new Padding(12, 0, 0, 0);
ModTitlePath.Size = new System.Drawing.Size(700, 50);
ModTitlePath.Text = Translator.get("Path");
panel.Controls.Add(ModTitlePath, 3, 0);

System.Windows.Forms.Label ModTitleDependencies = new System.Windows.Forms.Label();
ModTitleDependencies.Font = new System.Drawing.Font(ThemeList.theme.XLFont, ThemeList.theme.XLSize, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
ModTitleDependencies.BackColor = Color.Transparent;
ModTitleDependencies.ForeColor = SystemColors.Control;
ModTitleDependencies.TextAlign = ContentAlignment.MiddleLeft;
ModTitleDependencies.Dock = DockStyle.Left;
ModTitleDependencies.Name = "ModTitleDependencies";
ModTitleDependencies.Padding = new Padding(12, 0, 0, 0);
ModTitleDependencies.Size = new System.Drawing.Size(150, 50);
ModTitleDependencies.Text = Translator.get("Dependencies");
panel.Controls.Add(ModTitleDependencies, 2, 0);
panel.Controls.Add(ModTitlePath, 2, 0);

System.Windows.Forms.Label ModTitleGameVersion = new System.Windows.Forms.Label();
ModTitleGameVersion.Font = new System.Drawing.Font(ThemeList.theme.XLFont, ThemeList.theme.XLSize, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
Expand Down
2 changes: 1 addition & 1 deletion ModManager5/ModManager5.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFramework>net5.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>modmanager.ico</ApplicationIcon>
<AssemblyVersion>5.0.5.0</AssemblyVersion>
<AssemblyVersion>5.0.6.0</AssemblyVersion>
<FileVersion>5.0.5.0</FileVersion>
</PropertyGroup>

Expand Down

0 comments on commit 8999abe

Please sign in to comment.