private void LoadOnvifCameras() { string cameraIdsConcatString = GetValue(OnvifCameraIds, string.Empty); var cameraIds = cameraIdsConcatString.Split(idsSeparator); foreach (var cameraId in cameraIds) { if (string.IsNullOrWhiteSpace(cameraId)) { continue; } try { onvifCameras.Add(cameraId, new OnvifCameraSetting(cameraId, GetValue(nameof(OnvifCameraSetting.Name), string.Empty, cameraId), GetValue(nameof(OnvifCameraSetting.CameraHost), string.Empty, cameraId), GetValue(nameof(OnvifCameraSetting.Login), string.Empty, cameraId), HS.DecryptString(GetValue(nameof(OnvifCameraSetting.Password), string.Empty, cameraId), nameof(HikCameraSetting.Password)), GetTimeSpanValue(nameof(OnvifCameraSetting.AlarmCancelInterval), TimeSpan.Zero, cameraId), GetValue(nameof(OnvifCameraSetting.SnapshotDownloadDirectory), string.Empty, cameraId))); } catch (Exception ex) { Trace.TraceError(Invariant($"Failed to read config for {cameraId} with {ExceptionHelper.GetFullMessage(ex)}")); } } }
private void LoadHikvisionIsapiCameras() { string cameraIdsConcatString = GetValue(HikvisionIsapiCameraIds, string.Empty); var cameraIds = cameraIdsConcatString.Split(idsSeparator); var periodicFetchedProperties = hikvisionIsapiCameraProperties.ToImmutableDictionary(); foreach (var cameraId in cameraIds) { if (string.IsNullOrWhiteSpace(cameraId)) { continue; } try { hikvisionIsapiCameras.Add(cameraId, new HikCameraSetting(cameraId, GetValue(nameof(HikCameraSetting.Name), string.Empty, cameraId), GetValue(nameof(HikCameraSetting.CameraHost), string.Empty, cameraId), GetValue(nameof(HikCameraSetting.Login), string.Empty, cameraId), HS.DecryptString(GetValue(nameof(HikCameraSetting.Password), string.Empty, cameraId), nameof(HikCameraSetting.Password)), GetTimeSpanValue(nameof(HikCameraSetting.AlarmCancelInterval), TimeSpan.Zero, cameraId), periodicFetchedProperties, GetTimeSpanValue(nameof(HikCameraSetting.CameraPropertiesRefreshInterval), TimeSpan.Zero, cameraId), GetValue(nameof(HikCameraSetting.SnapshotDownloadDirectory), string.Empty, cameraId), GetValue(nameof(HikCameraSetting.VideoDownloadDirectory), string.Empty, cameraId))); } catch (Exception ex) { Trace.TraceError(Invariant($"Failed to read config for {cameraId} with {ExceptionHelper.GetFullMessage(ex)}")); } } }