本文整理汇总了C#中FiresecAPI.Models.DeviceConfiguration类的典型用法代码示例。如果您正苦于以下问题:C# DeviceConfiguration类的具体用法?C# DeviceConfiguration怎么用?C# DeviceConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeviceConfiguration类属于FiresecAPI.Models命名空间,在下文中一共展示了DeviceConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ConvertBack
public void ConvertBack(DeviceConfiguration deviceConfiguration, bool includeSecurity)
{
DeviceConfiguration = deviceConfiguration;
DeviceConfiguration.Update();
foreach (var device in DeviceConfiguration.Devices)
{
device.Driver = ConfigurationCash.DriversConfiguration.Drivers.FirstOrDefault(x => x.UID == device.DriverUID);
}
if (includeSecurity)
{
FiresecConfiguration = FiresecSerializedClient.GetCoreConfig().Result;
FiresecConfiguration.part = null;
}
else
{
FiresecConfiguration = new Firesec.CoreConfiguration.config();
}
Gid = 0;
ConvertZonesBack();
ConvertDevicesBack();
ConvertDirectionsBack();
ConvertGuardUsersBack();
}
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:26,代码来源:ConfigurationConverter.cs
示例2: ConvertDevicesAndZones
public DeviceConfiguration ConvertDevicesAndZones(Models.CoreConfiguration.config coreConfig)
{
var deviceConfiguration = new DeviceConfiguration();
ConvertZones(deviceConfiguration, coreConfig);
ConvertDevices(deviceConfiguration, coreConfig);
return deviceConfiguration;
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:7,代码来源:ConfigurationConverter.cs
示例3: ReadItem
public static FS2JournalItem ReadItem(DeviceConfiguration deviceConfiguration, Device device, int i, byte journalType)
{
for (int j = 0; j < 15; j++)
{
var response = USBManager.Send(device, "Чтение конкретной записи в журнале", 0x01, 0x20, journalType, BitConverter.GetBytes(i).Reverse());
if (response != null)
{
lock (Locker)
{
var journalParser = new JournalParser();
try
{
var fsJournalItem = journalParser.Parce(deviceConfiguration, device, response.Bytes, journalType);
if (fsJournalItem != null)
{
return fsJournalItem;
}
}
catch
{
return null;
}
}
}
}
return null;
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:27,代码来源:JournalHelper.cs
示例4: SetTempDeviceConfiguration
public static Device SetTempDeviceConfiguration(Device device)
{
CurrentDeviceConfiguration = ConfigurationManager.DeviceConfiguration;
ConfigurationManager.DeviceConfiguration = CreateTempDeviceConfiguration(device);
USBManager.Initialize();
return ConfigurationManager.DeviceConfiguration.RootDevice.Children.FirstOrDefault();
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:7,代码来源:USBConfigHelper.cs
示例5: AutoSearchViewModel
public AutoSearchViewModel(DeviceConfiguration autodetectedDeviceConfiguration)
{
Title = "Добавление устройств";
ContinueCommand = new RelayCommand(OnContinue);
allDevices = new List<AutoSearchDeviceViewModel>();
Devices = new List<AutoSearchDeviceViewModel>();
Devices.Add(AddDevice(autodetectedDeviceConfiguration.RootDevice, null));
}
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:9,代码来源:AutoSearchViewModel.cs
示例6: FullConfiguration
public FullConfiguration()
{
DeviceConfiguration = new DeviceConfiguration();
LibraryConfiguration = new LibraryConfiguration();
PlansConfiguration = new PlansConfiguration();
SecurityConfiguration = new SecurityConfiguration();
SystemConfiguration = new SystemConfiguration();
XDeviceConfiguration = new XDeviceConfiguration();
}
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:9,代码来源:FullConfiguration.cs
示例7: ConvertPlans
public OperationResult<PlansConfiguration> ConvertPlans(DeviceConfiguration deviceConfiguration)
{
var result = FiresecSerializedClient.GetPlans();
if (result.HasError)
{
return new OperationResult<PlansConfiguration>(result.Error);
}
var plans = result.Result;
if (plans == null)
return new OperationResult<PlansConfiguration>();
var plansConfiguration = ConvertPlans(plans, deviceConfiguration);
return new OperationResult<PlansConfiguration>() { Result = plansConfiguration };
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:13,代码来源:ConfigurationConverter.cs
示例8: CopyOneBranch
public DeviceConfiguration CopyOneBranch(Device device, bool isUsb)
{
var deviceConfiguration = new DeviceConfiguration();
Device currentDevice = device;
Device copyChildDevice = null;
while (true)
{
var copyDevice = new Device();
//{
// UID = currentDevice.UID,
// DriverUID = currentDevice.DriverUID,
// IntAddress = currentDevice.IntAddress,
// Description = currentDevice.Description,
// ZoneUID = currentDevice.ZoneUID,
// Properties = new List<Property>(currentDevice.Properties),
// SystemAUProperties = new List<Property>(currentDevice.SystemAUProperties),
// DeviceAUProperties = new List<Property>(currentDevice.DeviceAUProperties)
//};
copyDevice.UID = currentDevice.UID;
copyDevice.DriverUID = currentDevice.DriverUID;
copyDevice.IntAddress = currentDevice.IntAddress;
copyDevice.Description = currentDevice.Description;
copyDevice.ZoneUID = currentDevice.ZoneUID;
copyDevice.Properties = new List<Property>(currentDevice.Properties);
if (currentDevice.SystemAUProperties != null)
copyDevice.SystemAUProperties = new List<Property>(currentDevice.SystemAUProperties);
if (currentDevice.DeviceAUProperties != null)
copyDevice.DeviceAUProperties = new List<Property>(currentDevice.DeviceAUProperties);
if ((currentDevice.UID == device.UID))
{
copyDevice.IsAltInterface = isUsb;
}
if (copyChildDevice != null)
copyDevice.Children.Add(copyChildDevice);
if (currentDevice.Parent == null)
{
currentDevice = copyDevice;
break;
}
copyChildDevice = copyDevice;
currentDevice = currentDevice.Parent;
}
deviceConfiguration.RootDevice = currentDevice;
return deviceConfiguration;
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:51,代码来源:DeviceConfiguration.cs
示例9: DeviceTreeViewModel
public DeviceTreeViewModel(Device rootDevice, DeviceConfiguration deviceConfiguration)
{
Title = "Сравнение конфигураций";
RootDevice = rootDevice;
DeviceConfiguration = deviceConfiguration;
DeviceConfiguration.Reorder();
BuildTree(rootDevice);
if (Devices.Count > 0)
{
//CollapseChild(Devices[0]);
ExpandChild(Devices[0]);
SelectedDevice = Devices[0];
}
}
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:15,代码来源:DeviceTreeViewModel.cs
示例10: Convert
public void Convert()
{
FiresecConfiguration = FiresecSerializedClient.GetCoreConfig().Result;
DeviceConfiguration = new DeviceConfiguration();
ConvertZones();
ConvertDirections();
ConvertGuardUsers();
ConvertDevices();
Update();
ConfigurationCash.DeviceConfiguration = DeviceConfiguration;
ConfigurationFileManager.SetDeviceConfiguration(DeviceConfiguration);
var plans = FiresecSerializedClient.GetPlans().Result;
ConfigurationCash.PlansConfiguration = ConvertPlans(plans);
ConfigurationFileManager.SetPlansConfiguration(ConfigurationCash.PlansConfiguration);
}
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:17,代码来源:ConfigurationConverter.cs
示例11: ConvertDevices
void ConvertDevices(DeviceConfiguration deviceConfiguration, Firesec.Models.CoreConfiguration.config coreConfig)
{
deviceConfiguration.Devices = new List<Device>();
if (coreConfig == null || coreConfig.dev == null || coreConfig.dev.Count() == 0 || coreConfig.drv == null)
{
Logger.Error("ConfigurationConverter.ConvertDevices coreConfig.dev = null");
LoadingErrorManager.Add("Пустая коллекция устройств или драйверов при конвертации конфигурации");
return;
}
var rootInnerDevice = coreConfig.dev[0];
var rootDevice = SetInnerDevice(rootInnerDevice, null, deviceConfiguration, coreConfig);
deviceConfiguration.Devices.Add(rootDevice);
AddDevice(rootInnerDevice, rootDevice, deviceConfiguration, coreConfig);
deviceConfiguration.RootDevice = rootDevice;
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:17,代码来源:ConfigurationConverter.DevicesConverter.cs
示例12: 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
示例13: AddDevice
void AddDevice(devType parentInnerDevice, Device parentDevice, DeviceConfiguration deviceConfiguration, Firesec.Models.CoreConfiguration.config coreConfig)
{
if (parentInnerDevice.dev == null)
return;
parentDevice.Children = new List<Device>();
foreach (var innerDevice in parentInnerDevice.dev)
{
var device = SetInnerDevice(innerDevice, parentDevice, deviceConfiguration, coreConfig);
if (device != null)
{
parentDevice.Children.Add(device);
deviceConfiguration.Devices.Add(device);
AddDevice(innerDevice, device, deviceConfiguration, coreConfig);
}
}
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:17,代码来源:ConfigurationConverter.DevicesConverter.cs
示例14: DeviceConfigurationViewModel
public DeviceConfigurationViewModel(Guid deviceUID, DeviceConfiguration deviceConfiguration)
{
Title = "Сравнение конфигураций";
ReplaceCommand = new RelayCommand(OnReplace);
_deviceUID = deviceUID;
_deviceConfiguration = deviceConfiguration;
_deviceConfiguration.Update();
foreach (var device in _deviceConfiguration.Devices)
{
device.Driver = FiresecManager.FiresecConfiguration.Drivers.FirstOrDefault(x => x.UID == device.DriverUID);
}
LocalRootDevice = FiresecManager.Devices.FirstOrDefault(x => x.UID == _deviceUID);
RemoteRootDevice = _deviceConfiguration.Devices.FirstOrDefault(x => x.UID == _deviceUID);
LocalDevices = new DeviceTreeViewModel(LocalRootDevice, FiresecManager.FiresecConfiguration.DeviceConfiguration);
RemoteDevices = new DeviceTreeViewModel(RemoteRootDevice, _deviceConfiguration);
}
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:17,代码来源:DeviceConfigurationViewModel.cs
示例15: Convert
public static IndicatorLogic Convert(DeviceConfiguration deviceConfiguration, LEDProperties lEDProperties)
{
var indicatorLogic = new IndicatorLogic();
switch (lEDProperties.type)
{
case "0":
indicatorLogic.IndicatorLogicType = IndicatorLogicType.Zone;
break;
case "1":
indicatorLogic.IndicatorLogicType = IndicatorLogicType.Device;
break;
}
if (lEDProperties.zone != null)
{
foreach (var item in lEDProperties.zone)
{
if (string.IsNullOrWhiteSpace(item) == false)
{
int zoneNo = int.Parse(item);
var zone = deviceConfiguration.Zones.FirstOrDefault(x => x.No == zoneNo);
if (zone != null)
{
indicatorLogic.ZoneUIDs.Add(zone.UID);
}
}
}
}
if (lEDProperties.device != null && lEDProperties.device.Count() > 0)
{
var indicatorDevice = lEDProperties.device[0];
indicatorLogic.DeviceUID = GuidHelper.ToGuid(indicatorDevice.UID);
indicatorLogic.OnColor = StringToIndicatorColorType(indicatorDevice.state1);
indicatorLogic.OffColor = StringToIndicatorColorType(indicatorDevice.state2);
indicatorLogic.FailureColor = StringToIndicatorColorType(indicatorDevice.state3);
indicatorLogic.ConnectionColor = StringToIndicatorColorType(indicatorDevice.state4);
}
return indicatorLogic;
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:43,代码来源:IndicatorLogicConverter.cs
示例16: ConvertDirections
void ConvertDirections(DeviceConfiguration deviceConfiguration, Firesec.Models.CoreConfiguration.config coreConfig)
{
deviceConfiguration.Directions = new List<Direction>();
if (coreConfig.part != null)
{
foreach (var innerDirection in coreConfig.part)
{
if (innerDirection.type == "direction")
{
var direction = new Direction()
{
Id = int.Parse(innerDirection.id),
Name = innerDirection.name,
Description = innerDirection.desc
};
if (innerDirection.PinZ != null)
{
foreach (var item in innerDirection.PinZ)
{
if (string.IsNullOrWhiteSpace(item.pidz) == false)
{
var zoneNo = int.Parse(item.pidz);
var zone = deviceConfiguration.Zones.FirstOrDefault(x=>x.No == zoneNo);
direction.ZoneUIDs.Add(zone.UID);
}
}
}
if (innerDirection.param != null)
{
var rmParameter = innerDirection.param.FirstOrDefault(x => x.name == "Device_RM");
direction.DeviceRm = GuidHelper.ToGuid(rmParameter.value);
var buttonParameter = innerDirection.param.FirstOrDefault(x => x.name == "Device_AM");
direction.DeviceButton = GuidHelper.ToGuid(buttonParameter.value);
}
deviceConfiguration.Directions.Add(direction);
}
}
}
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:43,代码来源:ConfigurationConverter.DirectionsConverter.cs
示例17: ConvertCoreConfig
public OperationResult<DeviceConfiguration> ConvertCoreConfig()
{
var result = FiresecSerializedClient.GetCoreConfig();
if (result.HasError)
{
return new OperationResult<DeviceConfiguration>(result.Error);
}
var coreConfig = result.Result;
if (coreConfig == null)
return null;
var deviceConfiguration = new DeviceConfiguration();
ConvertZones(deviceConfiguration, coreConfig);
ConvertDirections(deviceConfiguration, coreConfig);
ConvertGuardUsers(deviceConfiguration, coreConfig);
ConvertDevices(deviceConfiguration, coreConfig);
Update(deviceConfiguration);
return new OperationResult<DeviceConfiguration>() { Result = deviceConfiguration };
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:19,代码来源:ConfigurationConverter.cs
示例18: ReadConfigurationAndUpdateStates
public bool ReadConfigurationAndUpdateStates(Device panelDevice)
{
var getConfigurationOperationHelper = new GetConfigurationOperationHelper(true);
RemoteDeviceConfiguration = getConfigurationOperationHelper.GetDeviceConfiguration(panelDevice);
if (RemoteDeviceConfiguration == null)
return false;
RemoteDeviceConfiguration.Update();
var isDBMissmatch = !ConfigurationCompareHelper.Compare(panelDevice, RemoteDeviceConfiguration);
if (panelDevice.DeviceState.IsDBMissmatch != isDBMissmatch)
{
panelDevice.DeviceState.IsDBMissmatch = isDBMissmatch;
ForseUpdateDeviceStates(panelDevice);
}
var remoteRealChildren = RemoteDeviceConfiguration.RootDevice.GetRealChildren();
var localRealChildren = panelDevice.GetRealChildren();
foreach (var remoteDevice in remoteRealChildren)
{
var device = localRealChildren.FirstOrDefault(x => x.IntAddress == remoteDevice.IntAddress);
if (device != null)
{
device.StateWordOffset = remoteDevice.StateWordOffset;
device.StateWordBytes = remoteDevice.StateWordBytes;
device.RawParametersOffset = remoteDevice.RawParametersOffset;
device.RawParametersBytes = remoteDevice.RawParametersBytes;
ParseDeviceState(device);
}
}
foreach (var remoteZone in RemoteDeviceConfiguration.Zones)
{
var zone = ConfigurationManager.Zones.FirstOrDefault(x => x.No == remoteZone.No);
if (zone != null)
{
zone.LocalDeviceNo = remoteZone.LocalDeviceNo;
}
}
return true;
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:42,代码来源:DeviceStatesManager.cs
示例19: ConvertPlansBack
surfaces ConvertPlansBack(PlansConfiguration plansConfiguration, DeviceConfiguration deviceConfiguration)
{
surfaces result = new surfaces();
var innerPlans = new List<surfacesSurface>();
foreach (var plan in plansConfiguration.AllPlans)
{
var innerPlan = new surfacesSurface();
innerPlans.Add(innerPlan);
innerPlan.caption = plan.Caption;
innerPlan.height = (plan.Height / 10).ToString();
innerPlan.width = (plan.Width / 10).ToString();
var layers = new List<surfacesSurfaceLayer>();
var layer = new surfacesSurfaceLayer();
layer.name = "Зоны";
layers.Add(layer);
innerPlan.layer = layers.ToArray();
var elements = new List<surfacesSurfaceLayerElementsElement>();
foreach (var elementRectangle in plan.ElementRectangles)
{
var element = new surfacesSurfaceLayerElementsElement();
elements.Add(element);
[email protected] = "TSCDeRectangle";
element.rect = new surfacesSurfaceLayerElementsElementRect[1]{new surfacesSurfaceLayerElementsElementRect()};
element.rect[0].left = elementRectangle.Left.ToString();
element.rect[0].top = elementRectangle.Top.ToString();
element.rect[0].bottom = (elementRectangle.Top + elementRectangle.Height).ToString();
element.rect[0].right = (elementRectangle.Left + elementRectangle.Width).ToString();
element.rect[0].left = elementRectangle.Top.ToString();
}
layer.elements = elements.ToArray();
}
result.surface = innerPlans.ToArray();
return result;
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:41,代码来源:ConfigurationConverter.PlansBackConverter.cs
示例20: DeviceAutoDetectChildren
public OperationResult<DeviceConfiguration> DeviceAutoDetectChildren(DeviceConfiguration deviceConfiguration, Guid deviceUID, bool fastSearch)
{
var firesecConfiguration = FiresecManager.ConvertBack(deviceConfiguration, false);
var device = deviceConfiguration.Devices.FirstOrDefault(x => x.UID == deviceUID);
var result = FiresecSerializedClient.DeviceAutoDetectChildren(firesecConfiguration, device.GetPlaceInTree(), fastSearch);
var operationResult = new OperationResult<DeviceConfiguration>()
{
HasError = result.HasError,
Error = result.ErrorString
};
if (operationResult.HasError)
return operationResult;
if (result.Result == null)
return new OperationResult<DeviceConfiguration>("Ошибка. Получена пустая конфигурация");
var configurationManager = new ConfigurationConverter();
operationResult.Result = configurationManager.ConvertOnlyDevices(result.Result);
return operationResult;
}
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:21,代码来源:FiresecService.Devices.cs
注:本文中的FiresecAPI.Models.DeviceConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论