本文整理汇总了C#中FiresecAPI.Models.Device.GetPlaceInTree方法的典型用法代码示例。如果您正苦于以下问题:C# Device.GetPlaceInTree方法的具体用法?C# Device.GetPlaceInTree怎么用?C# Device.GetPlaceInTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FiresecAPI.Models.Device
的用法示例。
在下文中一共展示了Device.GetPlaceInTree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetInnerDevice
Device SetInnerDevice(devType innerDevice, Device parentDevice, DeviceConfiguration deviceConfiguration, Firesec.Models.CoreConfiguration.config coreConfig)
{
var device = new Device()
{
Parent = parentDevice
};
var drvType = coreConfig.drv.FirstOrDefault(x => x.idx == innerDevice.drv);
if(drvType == null)
{
Logger.Error("ConfigurationConverter.SetInnerDevice drvType = null " + innerDevice.drv.ToString());
LoadingErrorManager.Add("Ошибка сопоставления при конвертации конфигурации");
return null;
}
var driverUID = new Guid(drvType.id);
device.DriverUID = driverUID;
device.Driver = ConfigurationCash.DriversConfiguration.Drivers.FirstOrDefault(x => x.UID == driverUID);
if (device.Driver == null)
{
Logger.Error("ConvertDevices.SetInnerDevice driver = null " + driverUID.ToString());
LoadingErrorManager.Add("Неизвестный драйвер устройства " + driverUID.ToString());
return null;
}
device.IntAddress = int.Parse(innerDevice.addr);
if ((device.Parent != null) && (device.Parent.Driver.IsChildAddressReservedRange))
device.IntAddress += device.Parent.IntAddress;
if ((innerDevice.disabled != null) && (innerDevice.disabled == "1"))
device.IsMonitoringDisabled = true;
if (innerDevice.param != null)
{
var DatabaseIdParam = innerDevice.param.FirstOrDefault(x => x.name == "DB$IDDevices");
if (DatabaseIdParam != null)
device.DatabaseId = DatabaseIdParam.value;
var UIDParam = innerDevice.param.FirstOrDefault(x => x.name == "INT$DEV_GUID");
if (UIDParam != null)
device.UID = GuidHelper.ToGuid(UIDParam.value);
else
device.UID = Guid.NewGuid();
}
if (innerDevice.dev_param != null)
{
var AltInterfaceParam = innerDevice.dev_param.FirstOrDefault(x => x.name == "SYS$Alt_Interface");
if (AltInterfaceParam != null)
device.IsAltInterface = true;
else
device.IsAltInterface = false;
}
device.Properties = new List<Property>();
if (innerDevice.prop != null)
{
foreach (var innerProperty in innerDevice.prop)
{
if (innerProperty.name == "IsAlarmDevice")
{
device.IsRmAlarmDevice = true;
continue;
}
if (innerProperty.name == "NotUsed")
{
device.IsNotUsed = true;
continue;
}
device.Properties.Add(new Property()
{
Name = innerProperty.name,
Value = innerProperty.value
});
}
}
var description = innerDevice.name;
if (description != null)
description = description.Replace('¹', '№');
device.Description = description;
SetZone(device, innerDevice, deviceConfiguration, coreConfig);
device.ShapeIds = new List<string>();
if (innerDevice.shape != null)
{
foreach (var shape in innerDevice.shape)
{
device.ShapeIds.Add(shape.id);
}
}
device.PlaceInTree = device.GetPlaceInTree();
return device;
}