public void ResetSession() { string fileName = storyService.FileName; storyService.CloseStory(); storyService.OpenStory(fileName); }
public bool HandleArguments(StartupEventArgs arguments) { var parameters = new Dictionary <string, string>(); var flags = new Dictionary <string, bool?>(); flags["autorun"] = null; flags["help"] = null; var singleArguments = new List <string>(); string currentKey = null; foreach (var currentArg in arguments.Args) { if (currentArg.StartsWith("--")) { currentKey = currentArg.Substring(2).ToLower(); if (flags.ContainsKey(currentKey)) { flags[currentKey] = true; currentKey = null; } else { if (!parameters.ContainsKey(currentKey)) { Console.WriteLine("Unknown parameter: " + currentKey); return(false); } } } else { if (currentKey != null) { parameters[currentKey] = currentArg; } else { singleArguments.Add(currentArg); } } } if (flags["help"].GetValueOrDefault(false)) { PrintUsage(); return(false); } if (singleArguments.Count == 1) { if (flags["autorun"].GetValueOrDefault(false)) { storyService.StoryOpened += StoryService_StoryOpened; } storyService.OpenStory(singleArguments[0]); } return(true); }