This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Represents all Service types. | |
/// </summary> | |
public class ServiceType | |
{ | |
#region Values | |
/// <remarks/> | |
public static readonly ServiceType AlarmArrayConfiguration = "urn:schemas-pelco-com:service:AlarmArrayConfiguration:1"; | |
/// <remarks/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Gets the next available open port for use with RTP Video Streams. Range is evenly numbered UDP ports between 9000 and 9999. | |
/// </summary> | |
/// <param name="localAddress">The local address.</param> | |
/// <returns></returns> | |
public static int GetOpenPort(IPAddress localAddress) | |
{ | |
return GetOpenPort(localAddress, 9000, 9999, 2, true, true); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net.Sockets; | |
using System.Text; | |
using System.Net; | |
using System.Threading; | |
using System.IO; | |
using PelcoAPI.Integration.Common; | |
using PelcoAPI.Integration.Threading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private readonly object _rviewLock = new object(); | |
public bool ValidateCredentials(string user, string pass) | |
{ | |
return DoReadTask(() => | |
{ | |
var authenticated = RViewConnectionTask(con => con.IsConnected, user, pass, true, "ValidateCredentials"); | |
return authenticated; | |
}, _rviewLock); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class XmlFileManager<T> where T : class, IXmlSerializable<T>, new() | |
{ | |
private static readonly Dictionary<XmlFileId<T>, XmlFileSet<T>> FileSets = new Dictionary<XmlFileId<T>, XmlFileSet<T>>(); | |
private static readonly TimeSpan SaveCacheInterval = TimeSpan.FromSeconds(3); | |
private static readonly TimeoutDispatcher Dispatcher = new TimeoutDispatcher(); | |
static XmlFileManager() | |
{ | |
Dispatcher.AddRepeating(SaveAllCached, EventLogger.LogException, SaveCacheInterval); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal static class AuthSessionManager | |
{ | |
private static readonly TimeSpan DefaultRenewInterval = TimeSpan.FromSeconds(300); | |
private static readonly int AuthCheckMultiplier = 3; | |
private static readonly TimeoutDispatcher _dispatcher = new TimeoutDispatcher(); | |
private static readonly Dictionary<string, AuthSession> _sessions = new Dictionary<string, AuthSession>(); | |
private static readonly object LoginLock = new object(); | |
private const int DefaultTokenValue = 1000; | |
private static readonly Dictionary<int, bool> TokenTable = new Dictionary<int, bool>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Reflection | |
{ | |
public static ConstructorInfo GetDefaultConstructor(this Type type) | |
{ | |
return type.GetConstructor(Type.EmptyTypes); | |
} | |
public static T CreateInstance<T>(this Type type, params object[] args) where T : class | |
{ | |
return CreateInstance(type, args) as T; |