public void setConfig(DeviceModel device)
 {
     if (!Directory.Exists(path))//不存在path文件夹
     {
         Directory.CreateDirectory(path);//新建文件夹
     }
     XmlSerializer xmlSerializer = new XmlSerializer(typeof(DeviceModel));
     Stream stream = new FileStream(path + fname, FileMode.Create, FileAccess.Write, FileShare.ReadWrite);
     xmlSerializer.Serialize(stream, device);
     stream.Close();
 }
        public DeviceModel getConfig()
        {
            DeviceModel device = new DeviceModel();

            if (File.Exists(path + fname))
            {
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(DeviceModel));
                Stream stream = new FileStream(path + fname, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                device = (DeviceModel)xmlSerializer.Deserialize(stream);
            }

            return device;
        }
 public void setConfig(DeviceModel device) 
 {
     dd.setConfig(device);
 }