本文整理汇总了C#中FiresecAPI.Models.Device.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Device.Clone方法的具体用法?C# Device.Clone怎么用?C# Device.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FiresecAPI.Models.Device
的用法示例。
在下文中一共展示了Device.Clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTempDeviceConfiguration
public static DeviceConfiguration CreateTempDeviceConfiguration(Device device)
{
var deviceConfiguration = new DeviceConfiguration();
deviceConfiguration.RootDevice = new Device();
deviceConfiguration.RootDevice.Driver = ConfigurationManager.Drivers.FirstOrDefault(x => x.DriverType == DriverType.Computer);
deviceConfiguration.RootDevice.DriverUID = deviceConfiguration.RootDevice.Driver.UID;
Device usbDevice = (Device)device.Clone();
var driverType = DriverTypeToUSBDriverType(device.Driver.DriverType);
usbDevice.Driver = ConfigurationManager.Drivers.FirstOrDefault(x => x.DriverType == driverType);
usbDevice.DriverUID = deviceConfiguration.RootDevice.Driver.UID;
deviceConfiguration.RootDevice.Children.Add(usbDevice);
usbDevice.Parent = deviceConfiguration.RootDevice;
return deviceConfiguration;
}
示例2: GetDeviceConfiguration
public DeviceConfiguration GetDeviceConfiguration(Device panelDevice)
{
PanelDevice = (Device)panelDevice.Clone();
shleifCount = PanelDevice.Driver.ShleifCount;
PanelDevice.Children = new List<Device>();
Zones = new List<Zone>();
remoteDeviceConfiguration = new DeviceConfiguration();
remoteDeviceConfiguration.RootDevice = PanelDevice;
remoteDeviceConfiguration.Devices.Add(PanelDevice);
var panelDatabaseReader = new ReadPanelDatabaseOperationHelper(PanelDevice, CheckMonitoringSuspend);
panelDatabaseReader.RomDBFirstIndex = panelDatabaseReader.GetRomFirstIndex(PanelDevice);
if (panelDatabaseReader.RomDBFirstIndex == -1)
return null;
panelDatabaseReader.FlashDBLastIndex = panelDatabaseReader.GetFlashLastIndex(PanelDevice);
if (panelDatabaseReader.FlashDBLastIndex == -1)
return null;
DeviceRom = panelDatabaseReader.GetRomDBBytes(PanelDevice);
if (DeviceRom == null)
return null;
DeviceFlash = panelDatabaseReader.GetFlashDBBytes(PanelDevice);
if (DeviceFlash == null)
return null;
zonePanelRelationsInfo = new ZonePanelRelationsInfo();
ParseZonesRom(1542, panelDatabaseReader.RomDBFirstIndex);
outZonesBegin = DeviceRom[1548] * 256 * 256 + DeviceRom[1549] * 256 + DeviceRom[1550];
outZonesCount = DeviceRom[1552] * 256 + DeviceRom[1553];
outZonesEnd = outZonesBegin + outZonesCount * 9;
ParseUIDevicesRom(DriverType.MDU);
ParseNoUIDevicesRom(DriverType.AM1_T);
ParseUIDevicesRom(DriverType.RM_1);
ParseUIDevicesRom(DriverType.MPT);
ParseUIDevicesRom(DriverType.MRO);
ParseUIDevicesRom(DriverType.MRO_2);
ParseUIDevicesRom(DriverType.Exit);
ParseNoUIDevicesRom(DriverType.SmokeDetector);
ParseNoUIDevicesRom(DriverType.HeatDetector);
ParseNoUIDevicesRom(DriverType.CombinedDetector);
ParseNoUIDevicesRom(DriverType.HandDetector);
ParseNoUIDevicesRom(DriverType.AM_1);
ParseNoUIDevicesRom(DriverType.AMP_4);
ParseNoUIDevicesRom(DriverType.AM1_O);
ParseNoUIDevicesRom(DriverType.RadioHandDetector);
ParseNoUIDevicesRom(DriverType.RadioSmokeDetector);
ParseUIDevicesRom(DriverType.Valve);
foreach (var childDevice in PanelDevice.Children)
{
childDevice.Parent = PanelDevice;
remoteDeviceConfiguration.Devices.Add(childDevice);
}
foreach (var device in remoteDeviceConfiguration.Devices)
{
GetCurrentDeviceState(device);
}
return remoteDeviceConfiguration;
}