private void LoadInfoFromJSON() { //TODO: compare saved plugin id and version with the info file on folder if (!Directory.Exists(mFolder)) { // TODO: auto download and restore , or show user a message to restore throw new Exception("Plugin folder not found: " + mFolder); } string pluginInfoFile = Path.Combine(mFolder, PluginPackageInfo.cInfoFile); if (!System.IO.File.Exists(pluginInfoFile)) { throw new Exception("Plugin info file not found: " + pluginInfoFile); } // load info string txt = System.IO.File.ReadAllText(pluginInfoFile); mPluginPackageInfo = (PluginPackageInfo)JsonConvert.DeserializeObject(txt, typeof(PluginPackageInfo)); if (mPluginPackageInfo.Version.ToLower().StartsWith("v")) { mPluginPackageInfo.Version = mPluginPackageInfo.Version.Substring(1); } }
public string CreatePluginPackageInfo(string id, string version) { PluginPackageInfo pluginPackageInfo = new PluginPackageInfo() { Id = id, Version = version }; string txt = JsonConvert.SerializeObject(pluginPackageInfo); return(txt); }
private void LoadInfo() { //TODO: compare saved plugin id and version with the info file on folder string pluginInfoFile = Path.Combine(mFolder, PluginPackageInfo.cInfoFile); if (!System.IO.File.Exists(pluginInfoFile)) { throw new Exception("Plugin info file not found: " + pluginInfoFile); } // load info string txt = System.IO.File.ReadAllText(pluginInfoFile); mPluginPackageInfo = (PluginPackageInfo)JsonConvert.DeserializeObject(txt, typeof(PluginPackageInfo)); }