Пример #1
0
        public static LaServerList LoadServerList(string filename)
        {
            // retrun an emtpy object
            if (!File.Exists(filename))
            {
                return(new LaServerList());
            }

            // Create an instance of the XmlSerializer class;
            // specify the type of object to be deserialized.
            XmlSerializer serializer = new XmlSerializer(typeof(LaServerList));

            /* If the XML document has been altered with unknown
             * nodes or attributes, handle them with the
             * UnknownNode and UnknownAttribute events.*/
            serializer.UnknownNode      += new XmlNodeEventHandler(serializer_UnknownNode);
            serializer.UnknownAttribute += new XmlAttributeEventHandler(serializer_UnknownAttribute);

            // A FileStream is needed to read the XML document.
            FileStream fs = new FileStream(filename, FileMode.Open);

            /* Use the Deserialize method to restore the object's state with
             * data from the XML document. */
            LaServerList serverList = (LaServerList)serializer.Deserialize(fs);

            fs.Close();
            return(serverList);
        }
Пример #2
0
 public Form1()
 {
     InitializeComponent();
     this.serverList = LaServerList.LoadServerList(this.xmlPath);
     this.updateListBox();
     if (this.comboBoxServerlist.Items.Count > 0)
         this.comboBoxServerlist.SelectedIndex = this.selectedIndex;
     this.buildServerSubmenu();
     this.checkBoxStartWithWin.Checked = this.isInAutostart();
 }
Пример #3
0
 public Form1()
 {
     InitializeComponent();
     this.serverList = LaServerList.LoadServerList(this.xmlPath);
     this.updateListBox();
     if (this.comboBoxServerlist.Items.Count > 0)
     {
         this.comboBoxServerlist.SelectedIndex = this.selectedIndex;
     }
     this.buildServerSubmenu();
     this.checkBoxStartWithWin.Checked = this.isInAutostart();
 }