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(); }
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; }
public void AddServer(Server s) { if(s.IsValid()) servers.Add(s); RefreshServerList(); }
public void EditServer(int index, Server s) { servers[index] = s; RefreshServerList(); }
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(); }