本文整理汇总了C#中RubezhAPI.GK.GKDevice.GetGKIpAddress方法的典型用法代码示例。如果您正苦于以下问题:C# GKDevice.GetGKIpAddress方法的具体用法?C# GKDevice.GetGKIpAddress怎么用?C# GKDevice.GetGKIpAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RubezhAPI.GK.GKDevice
的用法示例。
在下文中一共展示了GKDevice.GetGKIpAddress方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: JournalViewModel
public JournalViewModel(GKDevice device)
{
Title = "Журнал событий ГК " + device.GetGKIpAddress();
ReadCommand = new RelayCommand(OnRead);
SaveToFileCommand = new RelayCommand(OnSaveToFile);
JournalItems = new ObservableCollection<JournalItemViewModel>();
Device = device;
GKManager.UpdateConfiguration();
GKManager.CreateStates();
DescriptorsManager.Create();
}
示例2: ReadConfiguration
override public bool ReadConfiguration(GKDevice gkControllerDevice, Guid clientUID)
{
var progressCallback = GKProcessorManager.StartProgress("Чтение конфигурации " + gkControllerDevice.PresentationName, "Проверка связи", 2, true, GKProgressClientType.Administrator, clientUID);
var result = DeviceBytesHelper.Ping(gkControllerDevice);
if (result.HasError)
{
Error = "Устройство " + gkControllerDevice.PresentationName + " недоступно";
return false;
}
IpAddress = gkControllerDevice.GetGKIpAddress();
ControllerDevices = new Dictionary<ushort, GKDevice>();
DeviceConfiguration = new GKDeviceConfiguration();
var rootDriver = GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.System);
DeviceConfiguration.RootDevice = new GKDevice
{
Driver = rootDriver,
DriverUID = rootDriver.UID
};
GKProcessorManager.DoProgress("Перевод ГК в технологический режим", progressCallback, clientUID);
if (!DeviceBytesHelper.GoToTechnologicalRegime(gkControllerDevice, progressCallback, clientUID))
{
Error = "Не удалось перевести " + gkControllerDevice.PresentationName + " в технологический режим\n" +
"Устройство не доступно, либо вашего " +
"IP адреса нет в списке разрешенного адреса ГК";
GKProcessorManager.StopProgress(progressCallback, clientUID);
return false;
}
ReadConfiguration(gkControllerDevice, progressCallback, clientUID);
GKProcessorManager.DoProgress("Перевод ГК в рабочий режим", progressCallback, clientUID);
if (!DeviceBytesHelper.GoToWorkingRegime(gkControllerDevice, progressCallback, clientUID))
{
Error = "Не удалось перевести устройство в рабочий режим в заданное время";
}
GKProcessorManager.StopProgress(progressCallback, clientUID);
if (Error != null)
return false;
DeviceConfiguration.Update();
return true;
}
示例3: GetIpAddress
public static string GetIpAddress(GKDevice device)
{
GKDevice gkControllerDevice = null;
switch (device.DriverType)
{
case GKDriverType.GK:
gkControllerDevice = device;
break;
case GKDriverType.RSR2_KAU:
case GKDriverType.GKMirror:
gkControllerDevice = device.Parent;
break;
default:
{
Logger.Error("GKManager.GetIpAddress Получить IP адрес можно только у ГК или в КАУ или в ПМФ");
throw new Exception("Получить IP адрес можно только у ГК или в КАУ или в ПМФ");
}
}
var ipAddress = gkControllerDevice.GetGKIpAddress();
return ipAddress;
}
示例4: IsValidIpAddress
public static bool IsValidIpAddress(GKDevice device)
{
if (device.DriverType == GKDriverType.GK)
{
const string pattern = @"^([01]\d\d?|[01]?[1-9]\d?|2[0-4]\d|25[0-3])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])$";
var address = device.GetGKIpAddress();
if (string.IsNullOrEmpty(address) || !Regex.IsMatch(address, pattern))
{
return false;
}
}
return true;
}
示例5: RemoveAllUsers
public static bool RemoveAllUsers(GKDevice device, int usersCount, GKProgressCallback progressCallback, Guid clientUID)
{
var removeAllUsersInternalResult = RemoveAllUsersInternal(device, usersCount, progressCallback);
if (removeAllUsersInternalResult.HasError)
return false;
var cardsCount = removeAllUsersInternalResult.Result;
if (cardsCount == 0)
return false;
using (var skdDatabaseService = new RubezhDAL.DataClasses.DbService())
{
GKProcessorManager.DoProgress("Удаление пользователей прибора из БД", progressCallback, clientUID);
skdDatabaseService.GKCardTranslator.RemoveAll(device.GetGKIpAddress(), cardsCount);
}
return true;
}
示例6: RemoveCard
public static OperationResult<bool> RemoveCard(GKDevice device, SKDCard card, RubezhDAL.DataClasses.DbService dbService = null)
{
var no = 1;
if (dbService == null)
{
using (var skdDatabaseService = new RubezhDAL.DataClasses.DbService())
{
no = skdDatabaseService.GKCardTranslator.GetGKNoByCardNo(device.GetGKIpAddress(), card.Number);
}
}
else
no = dbService.GKCardTranslator.GetGKNoByCardNo(device.GetGKIpAddress(), card.Number);
if (no == -1)
{
return OperationResult<bool>.FromError("По номеру карты не найдена порядковая запись");
}
var bytes = new List<byte>();
bytes.Add(0);
bytes.AddRange(BytesHelper.ShortToBytes((ushort)(no)));
bytes.Add(0);
bytes.Add(1);
var nameBytes = BytesHelper.StringDescriptionToBytes("-");
bytes.AddRange(nameBytes);
bytes.AddRange(BytesHelper.IntToBytes(-1));
bytes.Add(0);
bytes.Add(0);
for (int i = 0; i < 256 - 42; i++)
{
bytes.Add(0);
}
var sendResult = SendManager.Send(device, (ushort)(bytes.Count), 26, 0, bytes);
if (sendResult.HasError)
{
return OperationResult<bool>.FromError(sendResult.Error);
}
using (var skdDatabaseService = new RubezhDAL.DataClasses.DbService())
{
skdDatabaseService.GKCardTranslator.Remove(device.GetGKIpAddress(), no, card.Number);
}
return new OperationResult<bool>(true);
}
示例7: JournalParser
//.........这里部分代码省略.........
bytes1.AddRange(bytes2);
JournalItem.UserName = Encoding.Default.GetString(bytes1.ToArray(), 0, bytes1.Count);
JournalItem.JournalObjectType = JournalObjectType.GKDevice;
break;
case 12:
JournalItem.JournalEventNameType = JournalEventNameType.Произведена_настройка_сети;
break;
case 13:
JournalItem.JournalEventNameType = JournalEventNameType.Проход_пользователя_разрешен;
var gkCardNo = BytesHelper.SubstructInt(bytes, 32 + 24);
JournalItem.CardNo = gkCardNo;
var door = GKManager.Doors.FirstOrDefault(x => x.GKDescriptorNo == GKObjectNo && x.GkDatabaseParent.GKParent == gkControllerDevice);
if (door != null)
{
var readerDevice = GKManager.Devices.FirstOrDefault(x => x.GKDescriptorNo == kauObjectNo && x.GkDatabaseParent.GKParent == gkControllerDevice);
if (readerDevice != null)
{
if (door.EnterDeviceUID == readerDevice.UID)
{
JournalItem.JournalEventDescriptionType = JournalEventDescriptionType.Вход_Глобал;
}
else if (door.ExitDeviceUID == readerDevice.UID)
{
JournalItem.JournalEventDescriptionType = JournalEventDescriptionType.Выход_Глобал;
}
}
}
using (var databaseService = new RubezhDAL.DataClasses.DbService())
{
var cardNo = databaseService.GKCardTranslator.GetCardNoByGKNo(gkControllerDevice.GetGKIpAddress(), (int)gkCardNo);
var operationResult = databaseService.CardTranslator.GetEmployeeByCardNo(cardNo);
if (!operationResult.HasError)
{
var employeeUID = operationResult.Result;
JournalItem.EmployeeUID = employeeUID;
if (employeeUID != Guid.Empty)
{
var employee = databaseService.EmployeeTranslator.GetSingle(employeeUID);
if (employee != null)
{
JournalItem.UserName = employee.Result.Name;
}
}
}
}
break;
case 14:
JournalItem.JournalEventNameType = JournalEventNameType.Рабочий_график;
var scheduleNo = (uint)BytesHelper.SubstructInt(bytes, 32 + 24);
bytes1 = bytes.GetRange(6, 31 - 6 + 1);
bytes2 = bytes.GetRange(48, 53 - 48 + 1);
bytes1.AddRange(bytes2);
var scheduleName = Encoding.Default.GetString(bytes1.ToArray(), 0, bytes1.Count).TrimEnd(' ');
if (string.IsNullOrEmpty(scheduleName))
scheduleName = scheduleNo.ToString();
JournalItem.DescriptionText = scheduleName;
break;
case 15:
JournalItem.JournalEventNameType = JournalEventNameType.Проход_пользователя_запрещен;