Exemplo n.º 1
0
        private void okbtn_Click(object sender, EventArgs e)
        {
            SMD.Properties.Settings.Default.OutputFile = output_location.Text;
            SMD.Properties.Settings.Default.OutFormat = formatbox.Text;
            SMD.Properties.Settings.Default.RefeshRate = (int)numericRefrsh.Value;
            SMD.Properties.Settings.Default.Save();

            NewList = new PlayerList();
            NewList.Players = new List<Player>();
            foreach (var Item in disabledList.Items)
            {
                string ItemName = Item.ToString();
                foreach (Player Plr in Plist.Players)
                {
                    if (ItemName == Plr.Name)
                    {
                        Player i = new Player();
                        i.Name = Plr.Name;
                        i.Type = Plr.Type;
                        i.Enabled = false;
                        
                        NewList.Players.Add(i);
                    }
                }
            }

            foreach (var Item in enabledList.Items)
            {
                string ItemName = Item.ToString();
                foreach (Player Plr in Plist.Players)
                {
                    if (ItemName == Plr.Name)
                    {
                        Player i = new Player();
                        i.Name = Plr.Name;
                        i.Type = Plr.Type;
                        i.Enabled = true;

                        NewList.Players.Add(i);
                    }
                }
            }

            File.Delete("Players.xml");
            using (Stream s = File.Create("Players.xml"))
            {
                XmlSerializer Serializer = new XmlSerializer(typeof(PlayerList));
                Serializer.Serialize(s, NewList);
            }

            this.Close();
        }
Exemplo n.º 2
0
        private void Options_Load(object sender, EventArgs e)
        {
            output_location.Text = SMD.Properties.Settings.Default.OutputFile;
            formatbox.Text = SMD.Properties.Settings.Default.OutFormat;
            numericRefrsh.Value = SMD.Properties.Settings.Default.RefeshRate;

            using (Stream s = File.OpenRead("Players.xml"))
            {
                Plist = (PlayerList)new XmlSerializer(typeof(PlayerList)).Deserialize(s);
            }

            foreach (Player p in Plist.Players)
            {
                if(p.Enabled)
                    enabledList.Items.Add(p.Name);
                else
                    disabledList.Items.Add(p.Name);
            }

        }
Exemplo n.º 3
0
        private void UpdateList()
        {
            Plist = null;
            using (Stream s = File.OpenRead("Players.xml"))
            {
                Plist = (PlayerList)new XmlSerializer(typeof(PlayerList)).Deserialize(s);
            }

            PlayerSelect.Items.Clear();

            foreach (Player p in Plist.Players)
            {
                if(p.Enabled)
                PlayerSelect.Items.Add(p.Name);
            }
        }