summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Program.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2016-10-31 20:46:23 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2016-10-31 20:46:23 -0400
commit605c99ba7074c3dbfeb441f608d77a2bc50e4629 (patch)
tree9ea5c18872201e280075008abbe375a2b87f6a2d /src/StardewModdingAPI/Program.cs
parent9d461bb05bfa25c20cba46651f2ecf86028f1a1a (diff)
downloadSMAPI-605c99ba7074c3dbfeb441f608d77a2bc50e4629.tar.gz
SMAPI-605c99ba7074c3dbfeb441f608d77a2bc50e4629.tar.bz2
SMAPI-605c99ba7074c3dbfeb441f608d77a2bc50e4629.zip
format & document config code
Diffstat (limited to 'src/StardewModdingAPI/Program.cs')
-rw-r--r--src/StardewModdingAPI/Program.cs30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 0099b045..b08d17c2 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -38,7 +38,7 @@ namespace StardewModdingAPI
public static Texture2D DebugPixel { get; private set; }
// ReSharper disable once PossibleNullReferenceException
- public static int BuildType => (int) StardewProgramType.GetField("buildType", BindingFlags.Public | BindingFlags.Static).GetValue(null);
+ public static int BuildType => (int)StardewProgramType.GetField("buildType", BindingFlags.Public | BindingFlags.Static).GetValue(null);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -215,35 +215,39 @@ namespace StardewModdingAPI
Log.AsyncY("LOADING MODS");
foreach (string directory in Directory.GetDirectories(ModPath))
{
- foreach (string manifestFile in Directory.GetFiles(directory, "manifest.json"))
+ foreach (string manifestPath in Directory.GetFiles(directory, "manifest.json"))
{
- if (manifestFile.Contains("StardewInjector"))
+ if (manifestPath.Contains("StardewInjector"))
continue;
- Log.AsyncG("Found Manifest: " + manifestFile);
- var manifest = new Manifest();
+
+ // read manifest
+ Log.AsyncG($"Found Manifest: {manifestPath}");
+ Manifest manifest = new Manifest();
try
{
- string t = File.ReadAllText(manifestFile);
- if (string.IsNullOrEmpty(t))
+ // read manifest text
+ string json = File.ReadAllText(manifestPath);
+ if (string.IsNullOrEmpty(json))
{
- Log.AsyncR($"Failed to read mod manifest '{manifestFile}'. Manifest is empty!");
+ Log.AsyncR($"Failed to read mod manifest '{manifestPath}'. Manifest is empty!");
continue;
}
- manifest = manifest.InitializeConfig(manifestFile);
-
+ // deserialise manifest
+ manifest = manifest.InitializeConfig(manifestPath);
if (string.IsNullOrEmpty(manifest.EntryDll))
{
- Log.AsyncR($"Failed to read mod manifest '{manifestFile}'. EntryDll is empty!");
+ Log.AsyncR($"Failed to read mod manifest '{manifestPath}'. EntryDll is empty!");
continue;
}
}
catch (Exception ex)
{
- Log.AsyncR($"Failed to read mod manifest '{manifestFile}'. Exception details:\n" + ex);
+ Log.AsyncR($"Failed to read mod manifest '{manifestPath}'. Exception details:\n" + ex);
continue;
}
- string targDir = Path.GetDirectoryName(manifestFile);
+
+ string targDir = Path.GetDirectoryName(manifestPath);
string psDir = Path.Combine(targDir, "psconfigs");
Log.AsyncY($"Created psconfigs directory @{psDir}");
try