private void fillConfigData(ConfigData configData) { lstDevices = configData.Devices; cbo_devices.DataSource = lstDevices; cbo_devices.DisplayMember = "IP"; txtDeviceIP.Text = configData.Devices[0].IP; txtDeviceName.Text = configData.Devices[0].Name; txtDeviceCell.Text = configData.Devices[0].Cell; lblBackupDate.Text= configData.Devices[0].Date.ToString("MM/dd/yyyy HH:mm"); }
public ConfigData readFile() { XmlDocument doc = new XmlDocument(); doc.Load(configPath); XmlNodeList settings = doc.GetElementsByTagName("settings"); ConfigData configData = new ConfigData(); configData.UserNameFTP= settings[0]["userNameFTP"].InnerText; configData.PasswordFTP = settings[0]["passwordFTP"].InnerText; configData.BackUpPath = settings[0]["backUpPath"].InnerText; return configData; }
public void doBackUp(Device device, DateTime date) { string cell = device.Cell.CellNr.ToString(); string robot = device.Name; //Config configDate = new XMLConfigFile().readFile(); //DATA_C950R201/BAK20120917/1400 configDate.BackUpPath += "DATA_C" + cell + robot + "/BAK" + date.ToString("yyyyMMdd") + "/" + date.ToString("HHmm") + "/"; System.IO.Directory.CreateDirectory(configDate.BackUpPath); Console.Out.WriteLine("Download files from " + device.IP + "/" + device.Cell.CellNr + "/" + device.Name); DownloadFiles(device,""); }
public ConfigData readFile() { ConfigData configData = new ConfigData(); List<Device> lstDevices = new List<Device>(); XmlDocument doc = new XmlDocument(); doc.Load(configPath); XmlNodeList devices = doc.GetElementsByTagName("device"); foreach (XmlNode nodeDevice in devices) { Device device = new Device(); device.Date = DateTime.Parse(nodeDevice.Attributes.GetNamedItem("date").Value); device.Cell = nodeDevice["cell"].InnerText; device.Name = nodeDevice["name"].InnerText; device.IP = nodeDevice["ip"].InnerText; lstDevices.Add(device); } //configData.Devices = lstDevices; return configData; }