示例#1
0
        private dynamic IsPluginInstalled(EsPluginData plug)
        {
            string file = Path.GetFileName(plug.PluginPath);

            if (File.Exists(
                    Application.StartupPath + "/plugins/" + file))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        private dynamic IsPluginDifferent(EsPluginData plug)
        {
            string file    = Path.GetFileName(plug.PluginPath);
            string oldHash =
                System.Convert.ToString(ExtremeCore.Classes.GeneralFunctions.GetFileHash(Application.StartupPath + "/plugins/" + file));

            if (oldHash == plug.PluginSha)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
示例#3
0
        private void EsPluginsForm_Load(object sender, EventArgs e)
        {
            _plugins.Clear();

            if (ExtremeCore.Classes.GeneralFunctions.IsNetAvailable()) //Download latest from internet if there is internet.
            {
                WebClient   webClient = new WebClient();
                XmlDocument xmlFile   = new XmlDocument();
                string      fileText  =
                    System.Convert.ToString(
                        webClient.DownloadString("http://ahmad45123.github.io/esfiles/esplugins.xml"));
                xmlFile.LoadXml(fileText);

                foreach (XmlNode cs in xmlFile.SelectNodes("xml/plugin"))
                {
                    EsPluginData plug = new EsPluginData();
                    plug.PluginName = System.Convert.ToString(cs["name"].InnerText.Trim());
                    plug.PluginDesc = System.Convert.ToString(cs["desc"].InnerText.Trim());
                    plug.PluginPath = System.Convert.ToString(cs["download"].InnerText.Trim());
                    plug.PluginSha  = System.Convert.ToString(cs["hash"].InnerText.Trim());
                    _plugins.Add(plug);
                }
            }
            else
            {
                _isThereInteret = false;
                foreach (var file in Directory.GetFiles(Application.StartupPath + "/plugins", "*.dll"))
                {
                    _plugins.Add(new EsPluginData()
                    {
                        PluginName = Path.GetFileName(System.Convert.ToString(file))
                    });
                }
            }

            RefreshList();
        }