private static Activity CreateActivity(RegistriesList activityRegistries) { Activity activity = new Activity() { Name = activityRegistries.First.WindowTitle.NormalizeToMaxLength255() ?? "NULL" }; activity.Measurements.Add(new Measurement() { Name = "From", Type = "DateTime", Value = activityRegistries.First.Time }); activity.Measurements.Add(new Measurement() { Name = "Until", Type = "DateTime", Value = activityRegistries.EndTime }); activity.Measurements.Add(new Measurement() { Name = "Duration", Type = "TimeSpan", Value = activityRegistries.Duration }); activity.Measurements.Add(new Measurement() { Name = "Executable Path", Type = "String", Value = activityRegistries.First.ExeModulePath.NormalizeToMaxLength255() ?? "NULL" }); activity.Measurements.Add(new Measurement() { Name = "IP address", Type = "String", Value = activityRegistries.First.IpAddress.Value.NormalizeToMaxLength255() ?? "NULL" }); activity.Measurements.Add(new Measurement() { Name = "MAC address", Type = "String", Value = activityRegistries.First.MacAddress.Value.NormalizeToMaxLength255() ?? "NULL" }); activity.Measurements.Add(new Measurement() { Name = "User", Type = "String", Value = activityRegistries.First.Username1.Value }); if (activityRegistries.Any(r => r.Url != null)) { activity.Measurements.Add(new Measurement() { Name = "URL", Type = "String", Value = activityRegistries.FirstOrDefault(r => r.Url != null)?.Url.NormalizeToMaxLength255() ?? "NULL" }); } return(activity); }
protected static Activity CreateActivity(RegistriesList activityRegistries) { Activity activity = new Activity() { Name = activityRegistries.First.WindowTitle, }; activity.Measurements.Add(new Measurement() { Name = "From", Type = "DateTime", Value = activityRegistries.First.Time }); activity.Measurements.Add(new Measurement() { Name = "Until", Type = "DateTime", Value = activityRegistries.EndTime }); activity.Measurements.Add(new Measurement() { Name = "Duration", Type = "TimeSpan", Value = activityRegistries.Duration }); activity.Measurements.Add(new Measurement() { Name = "Executable Path", Type = "String", Value = activityRegistries.First.ExeModulePath }); activity.Measurements.Add(new Measurement() { Name = "IP address", Type = "String", Value = activityRegistries.First.IpAddress.Value }); activity.Measurements.Add(new Measurement() { Name = "MAC address", Type = "String", Value = activityRegistries.First.MacAddress.Value }); activity.Measurements.Add(new Measurement() { Name = "User", Type = "String", Value = activityRegistries.First.Username1.Value }); if (activityRegistries.Any(r => r.Url != null)) { activity.Measurements.Add(new Measurement() { Name = "URL", Type = "String", Value = activityRegistries.First(r => r.Url != null).Url }); } return(activity); }