public static void ExportEvent(string newName, string oldName, GumEventTypes eventType) { if (!string.IsNullOrWhiteSpace(EventExportDirectory)) { var exportedEvent = new ExportedEvent(); exportedEvent.NewName = newName; exportedEvent.OldName = oldName; exportedEvent.EventType = eventType; var serialized = JsonConvert.SerializeObject(exportedEvent); var file = new FilePath(EventExportDirectory + Environment.UserName + "_" + DateTime.UtcNow.Ticks + ".json"); GumCommands.Self.TryMultipleTimes( () => { var directoryName = file.GetDirectoryContainingThis().FullPath; // make the directory System.IO.Directory.CreateDirectory(directoryName); System.IO.File.WriteAllText(file.FullPath, serialized); }); } }
public static void ExportEvent(string newName, string oldName, GumEventTypes eventType, string elementType) { if (!string.IsNullOrWhiteSpace(EventExportDirectory)) { var exportedEvent = new ExportedEvent(); var username = Environment.UserName; exportedEvent.NewName = newName; exportedEvent.OldName = oldName; exportedEvent.ElementType = elementType; exportedEvent.EventType = eventType; exportedEvent.TimestampUtc = DateTime.UtcNow; if (!Events.UserEvents.ContainsKey(username)) { Events.UserEvents[username] = new List <ExportedEvent>(); } Events.UserEvents[username].Add(exportedEvent); SaveEventCollection(); } }