public static int CheckMod(string modName, string singleModVersion, ModInfo modInfo, MetadataCache metadataCache)
 {
     CacheInfo ci = new CacheInfo();
     ci.version = modInfo.version;
     ci.state = "fail-install";
     CleanKSP();
     if (!InstallMod(modName, singleModVersion))
     {
         metadataCache.AddCacheData(modName, ci);
         return -1;
     }
     if (!FilesOK(modName, modInfo))
     {
         ci.state = "fail-files";
         metadataCache.AddCacheData(modName, ci);
         return -2;
     }
     ci.state = "ok";
     metadataCache.AddCacheData(modName, ci);
     if (File.Exists("errors/" + modName + ".txt"))
     {
         File.Delete("errors/" + modName + ".txt");
     }
     return 0;
 }
 public Dictionary<string, CacheInfo> GetCacheData()
 {
     Dictionary<string,CacheInfo> cacheData = new Dictionary<string, CacheInfo>();
     foreach (JProperty mod in ((JObject)rootNode["mods"]).Properties())
     {
         CacheInfo ci = new CacheInfo();
         ci.version = (string)mod.Value["version"];
         ci.state = (string)mod.Value["state"];
         cacheData.Add(mod.Name, ci);
     }
     return cacheData;
 }
 public void AddCacheData(string modName, CacheInfo cacheData)
 {
     JProperty stateProperty = new JProperty("state", cacheData.state);
     JProperty versionProperty = new JProperty("version", cacheData.version);
     JObject cacheDataObject = new JObject(stateProperty, versionProperty);
     if (rootNode["mods"][modName] == null)
     {
         ((JObject)rootNode["mods"]).Add(new JProperty(modName, cacheDataObject));
     }
     else
     {
         JObject modObject = (JObject)rootNode["mods"];
         JProperty modProperty = modObject.Property(modName);
         modProperty.Value = cacheDataObject;
     }
     Save();
 }