当前位置: 首页>>代码示例>>C#>>正文


C# Device.Clone方法代码示例

本文整理汇总了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;
		}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:17,代码来源:USBConfigHelper.cs

示例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;
		}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:61,代码来源:GetConfigurationOperationHelper.cs


注:本文中的FiresecAPI.Models.Device.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。