Skip to content

Commit

Permalink
Make useCache local
Browse files Browse the repository at this point in the history
Really only needed for a few lines in ProcessPatch()
  • Loading branch information
blowfishpro committed Mar 24, 2018
1 parent 86b892f commit e7977d1
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions ModuleManager/MMPatchLoader.cs
Expand Up @@ -55,8 +55,6 @@ public class MMPatchLoader : LoadingSystem
private string configSha;
private Dictionary<string, string> filesSha = new Dictionary<string, string>();

private bool useCache = false;

private static readonly List<ModuleManagerPostPatchCallback> postPatchCallbacks = new List<ModuleManagerPostPatchCallback>();

private const float yieldInterval = 1f/30f; // Patch at ~30fps
Expand Down Expand Up @@ -127,15 +125,15 @@ private IEnumerator ProcessPatch()
status = "Checking Cache";
logger.Info(status);
yield return null;


bool useCache = false;
try
{
IsCacheUpToDate();
useCache = IsCacheUpToDate();
}
catch (Exception ex)
{
logger.Exception("Exception in IsCacheUpToDate", ex);
useCache = false;
}

#if DEBUG
Expand Down Expand Up @@ -422,7 +420,7 @@ private void SaveModdedPhysics()
configs[0].config.Save(physicsPath);
}

private void IsCacheUpToDate()
private bool IsCacheUpToDate()
{
Stopwatch sw = new Stopwatch();
sw.Start();
Expand Down Expand Up @@ -472,7 +470,7 @@ private void IsCacheUpToDate()
logger.Info("SHA generated in " + ((float)sw.ElapsedMilliseconds / 1000).ToString("F3") + "s");
logger.Info(" SHA = " + configSha);

useCache = false;
bool useCache = false;
if (File.Exists(shaPath))
{
ConfigNode shaConfigNode = ConfigNode.Load(shaPath);
Expand All @@ -493,6 +491,7 @@ private void IsCacheUpToDate()
logger.Info("useCache = " + useCache);
}
}
return useCache;
}

private bool CheckFilesChange(UrlDir.UrlFile[] files, ConfigNode shaConfigNode)
Expand Down

0 comments on commit e7977d1

Please sign in to comment.