////////////////////////////////////////////////// ///// STRUCTORS ////////////////////////////////// public ClientSession(string puid, string clientAddress, double lifeSpan) { if (puid == null) { throw new ArgumentNullException("UID cannot be null"); } if (clientAddress == null) { throw new ArgumentNullException("Address cannot be null"); } if (lifeSpan < 1) { lifeSpan = 1; } PUID = puid; ClientAddress = clientAddress; CreationDate = DateTime.Now; ExpirationDate = CreationDate.AddMinutes(lifeSpan); }
/// <summary> /// Constructs a process entry. /// </summary> /// <param name="id">Process ID.</param> /// <param name="parentId">Process ID of the parent process.</param> /// <param name="creationDate"> /// String date in format 'yyyyMMddHHmmss.ffffff', or if empty then current time used. /// </param> /// <param name="commandLine">Command line arguments to the process.</param> /// <param name="name">Process name.</param> public ProcessInfo(uint id, uint parentId, string creationDate, string commandLine, string name) { if (string.IsNullOrEmpty(creationDate)) { // If creationDate string is empty, then use the current timestamp. CreationDate = DateTime.UtcNow; } else { // Example creationDate: "20120622150149.843021-420". CreationDate = DateTime.ParseExact( creationDate.Substring(0, 21), "yyyyMMddHHmmss.ffffff", CultureInfo.InvariantCulture); long timeZoneMinutes = long.Parse(creationDate.Substring(21)); CreationDate = CreationDate.AddMinutes(-timeZoneMinutes); } ID = id; ParentID = parentId; CommandLine = commandLine; Name = name; }