Skip to content

Commit

Permalink
Broke up a method that did two things
Browse files Browse the repository at this point in the history
  • Loading branch information
OSA413 committed Oct 1, 2023
1 parent a33eb8e commit cc61b4f
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions Sonic4_ModLoader/OneClickModInstaller/ModInstallationInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public enum ModInstallationStatus
Downloaded,
Extracted,
Scanned,
FoundRoots,
Installed,
}

Expand Down Expand Up @@ -74,8 +75,9 @@ public void ContinueInstallation()
ModInstallationStatus.Beginning => Prepare(),
ModInstallationStatus.Downloading => Download(),
ModInstallationStatus.Downloaded => ExtractMod(),
ModInstallationStatus.Extracted => FindRoots(),
ModInstallationStatus.Scanned => InstallFromModRoots(),
ModInstallationStatus.Extracted => CheckFiles(),
ModInstallationStatus.Scanned => FindRoots(),
ModInstallationStatus.FoundRoots => InstallFromModRoots(),
ModInstallationStatus.ServerError => false,
ModInstallationStatus.Installed => false,
_ => false,
Expand Down Expand Up @@ -131,21 +133,24 @@ public bool ExtractMod()
return true;
}

public bool FindRoots()
public bool CheckFiles()
{
var continuee = ModArchive.CheckFiles(ModDirectory);
var result = ModArchive.CheckFiles(ModDirectory);

if (!continuee)
if (!result)
{
if (!initialInfo.FromDir)
MyDirectory.DeleteRecursively(ModDirectory);
Cancelled = true;
return false;
}

var FoundRootDirs = ModArchive.FindRoot(ModDirectory);
Status = ModInstallationStatus.Scanned;
return result;
}

ModRoots = FoundRootDirs;
public bool FindRoots()
{
ModRoots = ModArchive.FindRoot(ModDirectory);

if (ModRoots.Length > 1)
{
Expand All @@ -154,7 +159,7 @@ public bool FindRoots()
ModRoots = tmm.mods;
}

Status = ModInstallationStatus.Scanned;
Status = ModInstallationStatus.FoundRoots;
return true;
}

Expand Down

0 comments on commit cc61b4f

Please sign in to comment.