Пример #1
0
        public static bool loadFromXml(string _path, ref List<UpdateAssemblyInfo> _assemblyList, ProxySettings _proxySettings)
        {
            try
            {
                XmlTextReader reader;
                if (_proxySettings.isProxyEnable)
                {
                    WebProxy wp = new WebProxy(_proxySettings.proxyServer, _proxySettings.proxyPort);
                    wp.Credentials = new NetworkCredential(_proxySettings.proxyUser, _proxySettings.proxyPassword);
                    WebClient wc = new WebClient();
                    wc.Proxy = wp;

                    MemoryStream ms = new MemoryStream(wc.DownloadData(_path));
                    reader = new XmlTextReader(ms);
                }
                else
                {
                    reader = new XmlTextReader(_path);
                }

                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name)
                        {
                            case "module":
                                UpdateAssemblyInfo someInfo = new UpdateAssemblyInfo();
                                someInfo.md5 = reader["md5"];
                                someInfo.name = reader["name"];
                                _assemblyList.Add(someInfo);
                                break;
                        }
                    }
                }
                reader.Close();
            }
            catch(Exception e)
            {
                Console.WriteLine(e.Message);
                return false;
            }
            return true;
        }
Пример #2
0
 public UpdateAssemblyInfo(UpdateAssemblyInfo other)
 {
     name = other.name;
     md5 = other.md5;
 }