public static DialogResult ShowUpdateView(GUI owner, string url, string desc,
     UpdateFileURL[] versions, bool backup)
 {
     if (LyraUpdateView.update == null)
     {
         LyraUpdateView.update = new LyraUpdateView(url, desc, versions, backup);
     }
     return LyraUpdateView.update.ShowDialog(owner);
 }
        private LyraUpdateView(string url, string desc, UpdateFileURL[] versions, bool backup)
        {
            InitializeComponent();

            this.label4.Text = url;
            this.label5.Text = desc;
            foreach (UpdateFileURL v in versions)
            {
                this.comboBox1.Items.Add(v);
            }
            this.comboBox1.SelectedIndex = 0;
            this.backup = backup;
        }
Esempio n. 3
0
        // get download-url
        private void doUpdate()
        {
            XmlDocument doc = new XmlDocument();
            try
            {
                WebRequest request = WebRequest.Create(this.textBox1.Text + "/updatedesc.xml");
                HttpWebResponse response = (HttpWebResponse) request.GetResponse();
                Stream stream = response.GetResponseStream();
                doc.Load(stream);

                XmlNodeList versions = doc.GetElementsByTagName("lyraXML");
                UpdateFileURL[] ver = new UpdateFileURL[versions.Count];
                int i = 0;
                foreach (XmlNode curVers in versions)
                {
                    string listurl = "";
                    if (curVers.ChildNodes.Count != 0)
                    {
                        listurl = curVers.ChildNodes[0].Attributes["url"].InnerText;
                    }
                    ver[i++] = new UpdateFileURL(curVers.Attributes["url"].InnerText, curVers.Attributes["name"].InnerText,
                                                 curVers.Attributes["ver"].InnerText, listurl);
                }

                XmlNode server = doc.GetElementsByTagName("serverdetails")[0];
                string desc = server.ChildNodes[0].InnerText + " [" +
                    server.ChildNodes[1].InnerText + "]";
                string serverurl = server.ChildNodes[2].InnerText;

                this.DialogResult = LyraUpdateView.ShowUpdateView((GUI) this.Owner,
                                                                  serverurl, desc, ver, this.checkBox1.Checked);

                stream.Close();
                response.Close();
            }
            catch (Exception exp)
            {
                Util.MBoxError("Update fehlgeschlagen!", exp);
            }
        }
        // change list-content
        private void selectVersion(UpdateFileURL ver)
        {
            this.checkedListBox1.Items.Clear();
            if (ver.List != "")
            {
                XmlDocument doc = new XmlDocument();
                try
                {
                    WebRequest request = WebRequest.Create(ver.List);
                    HttpWebResponse response = (HttpWebResponse) request.GetResponse();
                    Stream stream = response.GetResponseStream();
                    doc.Load(stream);

                    XmlNodeList lists = doc.GetElementsByTagName("List");
                    foreach (XmlNode curList in lists)
                    {
                        string name = curList.ChildNodes[0].InnerText + "  [" +
                            curList.ChildNodes[2].InnerText + "]";
                        this.checkedListBox1.Items.Add(new XMLWrapperObject(curList, name));
                    }
                    stream.Close();
                    response.Close();
                }
                catch (Exception exp)
                {
                    Util.MBoxError("Update fehlgeschlagen!", exp);
                }
            }
        }