Skip to content

Commit

Permalink
Better status updates in post patch
Browse files Browse the repository at this point in the history
Each step can take a while, so explicitly say what's going on
  • Loading branch information
blowfishpro committed Feb 2, 2019
1 parent 6cbce49 commit 9d98087
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ModuleManager/PostPatchLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class PostPatchLoader : LoadingSystem

private bool ready = false;

private string progressTitle = "ModuleManager: Post patch";

public static void AddPostPatchCallback(ModuleManagerPostPatchCallback callback)
{
if (!postPatchCallbacks.Contains(callback))
Expand All @@ -48,7 +50,7 @@ private void Awake()

public override float ProgressFraction() => 1;

public override string ProgressTitle() => "ModuleManager : post patch";
public override string ProgressTitle() => progressTitle;

public override void StartLoad()
{
Expand All @@ -61,6 +63,8 @@ private IEnumerator Run()
Stopwatch waitTimer = new Stopwatch();
waitTimer.Start();

progressTitle = "ModuleManager: Waiting for patching to finish";

while (databaseConfigs == null) yield return null;

waitTimer.Stop();
Expand All @@ -69,6 +73,7 @@ private IEnumerator Run()
Stopwatch postPatchTimer = new Stopwatch();
postPatchTimer.Start();

progressTitle = "ModuleManager: Applying patched game database";
logger.Info("Applying patched game database");

foreach (UrlDir.UrlFile file in GameDatabase.Instance.root.AllConfigFiles)
Expand All @@ -87,6 +92,7 @@ private IEnumerator Run()

if (File.Exists(logPath))
{
progressTitle = "ModuleManager: Dumping log to KSP log";
logger.Info("Dumping ModuleManager log to main log");
logger.Info("\n#### BEGIN MODULEMANAGER LOG ####\n\n\n" + File.ReadAllText(logPath) + "\n\n\n#### END MODULEMANAGER LOG ####");
}
Expand All @@ -104,6 +110,8 @@ private IEnumerator Run()

yield return null;

progressTitle = "ModuleManager: Reloading things";

logger.Info("Reloading resources definitions");
PartResourceLibrary.Instance.LoadDefinitions();

Expand All @@ -115,6 +123,7 @@ private IEnumerator Run()

yield return null;

progressTitle = "ModuleManager: Running post patch callbacks";
logger.Info("Running post patch callbacks");

foreach (ModuleManagerPostPatchCallback callback in postPatchCallbacks)
Expand Down

0 comments on commit 9d98087

Please sign in to comment.