/// <summary> /// Read the fields from the tagged output of a user command /// </summary> /// <param name="objectInfo">Tagged output from the 'user' command</param> /// <param name="offset">Date processing</param> /// <param name="dst_mismatch">DST for date</param> public void FromUserCmdTaggedOutput(TaggedObject objectInfo, string offset, bool dst_mismatch) { _baseForm = new FormBase(); _baseForm.SetValues(objectInfo); if (objectInfo.ContainsKey("User")) { Id = objectInfo["User"]; } if (objectInfo.ContainsKey("Email")) { EmailAddress = objectInfo["Email"]; } if (objectInfo.ContainsKey("Update")) { DateTime d; if (DateTime.TryParse(objectInfo["Update"] as string, out d)) { Updated = d; } else { long unixTime = 0; if (Int64.TryParse(objectInfo["Update"], out unixTime)) { DateTime UTC = FormBase.ConvertUnixTime(unixTime); DateTime GMT = new DateTime(UTC.Year, UTC.Month, UTC.Day, UTC.Hour, UTC.Minute, UTC.Second, DateTimeKind.Unspecified); Updated = FormBase.ConvertFromUTC(GMT, offset, dst_mismatch); } } } if (objectInfo.ContainsKey("Access")) { DateTime d; if (DateTime.TryParse(objectInfo["Access"] as string, out d)) { Updated = d; } else { long unixTime = 0; if (Int64.TryParse(objectInfo["Access"], out unixTime)) { DateTime UTC = FormBase.ConvertUnixTime(unixTime); DateTime GMT = new DateTime(UTC.Year, UTC.Month, UTC.Day, UTC.Hour, UTC.Minute, UTC.Second, DateTimeKind.Unspecified); Accessed = FormBase.ConvertFromUTC(GMT, offset, dst_mismatch); } } } if (objectInfo.ContainsKey("FullName")) { FullName = objectInfo["FullName"]; } if (objectInfo.ContainsKey("JobView")) { JobView = objectInfo["JobView"]; } String key = "Reviews0"; int idx = 0; Reviews = new StringList(); while (objectInfo.ContainsKey((key = String.Format("Reviews{0}", idx)))) { idx++; Reviews.Add(objectInfo[key]); } if (objectInfo.ContainsKey("Password")) { Password = objectInfo["Password"]; } if (objectInfo.ContainsKey("Type")) { _type = objectInfo["Type"]; } }
/// <summary> /// Read the fields from the tagged output of a group command /// </summary> /// <param name="objectInfo">Tagged output from the 'user' command</param> public void FromGroupCmdTaggedOutput(TaggedObject objectInfo) { _baseForm = new FormBase(); _baseForm.SetValues(objectInfo); if (objectInfo.ContainsKey("Group")) { Id = objectInfo["Group"]; } if (objectInfo.ContainsKey("MaxResults")) { int v = -1; int.TryParse(objectInfo["MaxResults"], out v); MaxResults = v; } if (objectInfo.ContainsKey("MaxScanRows")) { int v = -1; int.TryParse(objectInfo["MaxScanRows"], out v); MaxScanRows = v; } if (objectInfo.ContainsKey("MaxLockTime")) { int v = -1; int.TryParse(objectInfo["MaxLockTime"], out v); MaxLockTime = v; } if (objectInfo.ContainsKey("MaxOpenFiles")) { int v = -1; int.TryParse(objectInfo["MaxOpenFiles"], out v); MaxOpenFiles = v; } if (objectInfo.ContainsKey("Timeout")) { int v = -1; int.TryParse(objectInfo["Timeout"], out v); TimeOut = v; } if (objectInfo.ContainsKey("PasswordTimeout")) { int v = -1; int.TryParse(objectInfo["PasswordTimeout"], out v); PasswordTimeout = v; } String key = "Users0"; if (objectInfo.ContainsKey(key)) { int idx = 1; UserNames = new StringList(); while (objectInfo.ContainsKey(key)) { UserNames.Add(objectInfo[key]); key = String.Format("Users{0}", idx++); } } key = "Owners0"; if (objectInfo.ContainsKey(key)) { int idx = 1; OwnerNames = new StringList(); while (objectInfo.ContainsKey(key)) { OwnerNames.Add(objectInfo[key]); key = String.Format("Owners{0}", idx++); } } key = "Subgroups0"; if (objectInfo.ContainsKey(key)) { int idx = 1; SubGroups = new StringList(); while (objectInfo.ContainsKey(key)) { SubGroups.Add(objectInfo[key]); key = String.Format("Subgroups{0}", idx++); } } }