public void DiscoveryRequest(string Line) { //1: Break down the sentence by each word [Declare the Action (Exception Avoidence Purposes)] Action Request; string[] words = SystemUse.BreakDownSentence(Line); /*foreach (string a in words) * { * Console.WriteLine("." + a + "."); Just Incase Things F**k Up. Because that is always possible when I'm coding * }*/ //2: Figure out the Objective referenced in the sentence string objective = SystemUse.FindObjective(words); Objective wa; handler.Williams_Objects.TryGetValue(objective, out wa); //3: Test if you even got one if (wa == null) { handler.WilliamsOutput("Sorry, I couldn't find what you were trying to access."); return; } //4: Now that you have found the users objective, figure out what Action of that objective the user wants to use Request = SystemUse.FindAction(words, wa.GetActions()); //5: Test if you found an Action if (Request == null) { handler.WilliamsOutput("Sorry, I couldn't find the action you wanted to use in that objective"); return; } //6: Last but not least, execute the action and hope something doesn't f**k it self Request(); }
public void AddGreeting() { try { WilliamsAspects wa; Handler.Inst.Williams_Aspects.TryGetValue("my reference", out wa); MyReference mr = (MyReference)wa; Handler.Inst.WilliamsOutput("Type in the new greeting:"); Console.Write(" > "); string greeting = Console.ReadLine(); mr.AcceptedGreetings = SystemUse.AddString(mr.AcceptedGreetings, greeting); mr.Save(); Handler.Inst.WilliamsOutput("Greeting Added Successfully"); } catch (Exception e) { Console.WriteLine(e.StackTrace); } }