コード例 #1
0
        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);
            }
        }
コード例 #2
0
ファイル: PluginsManager.cs プロジェクト: romal22/Ginger
        public string CreatePluginPackageInfo(string id, string version)
        {
            PluginPackageInfo pluginPackageInfo = new PluginPackageInfo()
            {
                Id = id, Version = version
            };
            string txt = JsonConvert.SerializeObject(pluginPackageInfo);

            return(txt);
        }
コード例 #3
0
        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));
        }