/// <summary> /// load all devices in data folder /// </summary> /// <returns></returns> public bool Load() { try { DeviceConfig config = new DeviceConfig(); config.Load("Temp.xml"); config.Commands = new DeviceCommandsGroup(); config.Commands.Name = "Init"; config.Commands.Description = "Initial device"; config.Commands.Commands = new DeviceCommand[1]; DeviceCommand cmd = new DeviceCommand(); config.Commands.Commands[0] = cmd; config.Commands.Commands[0].Name = "test"; config.Commands.Commands[0].Description = "test des"; cmd.Data = new byte[] { 22, 33 }; cmd.ReadDataLength = 2; config.Save("test.xml"); //DeviceConfig.SaveAsTemp(); } catch (Exception e) { Debug.Print("Fail to load configure file."); } return false; }
/// <summary> /// load all devices in data folder /// </summary> /// <returns></returns> public bool Load() { try { DeviceConfig config = new DeviceConfig(); config.Load("Temp.xml"); config.Commands = new DeviceCommandsGroup(); config.Commands.Name = "Init"; config.Commands.Description = "Initial device"; config.Commands.Commands = new DeviceCommand[1]; DeviceCommand cmd = new DeviceCommand(); config.Commands.Commands[0] = cmd; config.Commands.Commands[0].Name = "test"; config.Commands.Commands[0].Description = "test des"; cmd.Data = new byte[] { 22, 33 }; cmd.ReadDataLength = 2; config.Save("test.xml"); //DeviceConfig.SaveAsTemp(); } catch (Exception e) { Debug.Print("Fail to load configure file."); } return(false); }
static public void SaveAsTemp(string filename) { DeviceConfig config = new DeviceConfig(); config.Name = "DemoI2C"; config.path = filename; config.Type = "AD"; config.Manufactory = "HoneyWell"; config.Address = 22; config.AddressCollection = new byte[] { 22, 33 }; config.Commands = new DeviceCommandsGroup(); config.Save(filename); }