Esempio n. 1
0
 public void LoadServer(Server s)
 {
     txtServerName.Text = s.Name;
     txtThreshhold.Text = s.Space.ToString();
     cbThreshholdUnits.SelectedIndex = (int) s.spaceType;
     foreach (Folder f in s.Folders)
     {
         folders.Add(f);
     }
     RefreshFolderList();
 }
Esempio n. 2
0
        private Server CreateServer()
        {
            Server s = new Server();
            s.Name = txtServerName.Text;
            s.Space = Convert.ToDouble(txtThreshhold.Text);
            s.spaceType = (SpaceType)cbThreshholdUnits.SelectedIndex;
            foreach (Folder f in folders)
            {
                s.AddFolder(f);
            }

            return s;
        }
Esempio n. 3
0
 public void AddServer(Server s)
 {
     if(s.IsValid())
         servers.Add(s);
     RefreshServerList();
 }
Esempio n. 4
0
 public void EditServer(int index, Server s)
 {
     servers[index] = s;
     RefreshServerList();
 }
Esempio n. 5
0
        public void LoadConfiguration(string path = @"config.xml")
        {
            if(!File.Exists(path)) return;

            var settings = new XmlReaderSettings {IgnoreComments = true, IgnoreWhitespace = true};

            XmlReader r = XmlReader.Create(path, settings);

            r.ReadToDescendant("Mail");
            defaultMail = (r["default"] != "") ? r["default"] : "*****@*****.**";
            MailString = r["recipients"].Replace(",", ", ");

            r.ReadToFollowing("FileTypes");
            FileTypes = (r["patterns"] != "") ? r["patterns"] : "*.tib, *.bak";

            r.ReadToFollowing("Servers");
            r.ReadToDescendant("Server");
            do
            {
                var server = new Server
                    {
                        Name = r["name"],
                        Space = Convert.ToDouble(r["spaceValue"]),
                        spaceType = (SpaceType) Convert.ToInt16(r["spaceType"])
                    };

                //folders loop

                r.ReadToDescendant("Folder");
                do
                {
                    var folder = new Folder(r["path"], Convert.ToBoolean(Convert.ToInt16(r["recurse"])));
                    server.AddFolder(folder);
                } while (r.ReadToNextSibling("Folder"));

               AddServer(server);
            } while (r.ReadToNextSibling("Server"));

            r.Close();
        }