public WordList writeFile(String file) { TextWriter tw = new StreamWriter(file); WordList OrigWordList = new WordList(); OrigWordList.AddItem(new Words(new List<string> { "hai", "hullo", "ello", "halo", "hallo" }, new List<string> { "greetings", "hi", "hello" })); OrigWordList.AddItem(new Words(new List<string> { "em" }, new List<string> { "am" })); OrigWordList.AddItem(new Words(new List<string> { "y", "wy", "wai" }, new List<string> { "why" })); OrigWordList.AddItem(new Words(new List<string> { "pooter", "comptooter", "comp", "putter", "macintosh", "compooter", "cpu" }, new List<string> { "computer" })); OrigWordList.AddItem(new Words(new List<string> { "r" }, new List<string> { "are" })); OrigWordList.AddItem(new Words(new List<string> { "teh", "tuh", "duh", "d", "de", "le" }, new List<string> { "the" })); OrigWordList.AddItem(new Words(new List<string> { "donot", "dont", "dnt" }, new List<string> { "don't" })); OrigWordList.AddItem(new Words(new List<string> { "yea", "yep", "yeh", "yuh", "yah", "ya" }, new List<string> { "yes" })); OrigWordList.AddItem(new Words(new List<string> { "wut", "wat", "whut", "wt" }, new List<string> { "what" })); OrigWordList.AddItem(new Words(new List<string> { "wuts", "wats", "whuts", "wts", "whats" }, new List<string> { "what's" })); OrigWordList.AddItem(new Words(new List<string> { "dis" }, new List<string> { "this" })); OrigWordList.AddItem(new Words(new List<string> { "meh" }, new List<string> { "me" })); OrigWordList.AddItem(new Words(new List<string> { "mah" }, new List<string> { "my" })); tw.Write(JsonConvert.SerializeObject(OrigWordList, Formatting.Indented)); tw.Close(); return OrigWordList; }
public static void OnInitialize() { Commands.ChatCommands.Add(new Command("smartize", Smartize, "smartize")); save = Path.Combine(TShock.SavePath, @"SmarterFingers\WordsList.json"); perma = Path.Combine(TShock.SavePath, @"SmarterFingers\People.txt"); WordReader reader = new WordReader(); if (File.Exists(save)) { try { readWordsList = reader.readFile(save); Console.ForegroundColor = ConsoleColor.Yellow; if (readWordsList.SmarterFingers.Count != 0) { Console.WriteLine(readWordsList.SmarterFingers.Count + " SmarterFingers changes have been loaded."); } else { readWordsList = reader.writeFile(save); Console.WriteLine("Original SmarterFingers word list created."); } Console.ResetColor(); } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error in SmarterFingers \"WordsList.json\" file! Check log for more details."); Console.WriteLine(e.Message); Console.ResetColor(); Log.Error("------- Config Exception in SmarterFingers Config file (WordsList.json) -------"); Log.Error(e.Message); Log.Error("---------------------------------- Error End ----------------------------------"); } } else { Directory.CreateDirectory(Path.Combine(TShock.SavePath, "SmarterFingers")); readWordsList = reader.writeFile(save); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Original SmarterFingers word list created."); Console.ResetColor(); Log.Info("Original SmarterFingers word list created."); } }
public static void OnInitialize() { Commands.ChatCommands.Add(new Command("smartize", Smartize, "smartize")); save = Path.Combine(TShock.SavePath, @"SmarterFingers\WordsList.json"); perma = Path.Combine(TShock.SavePath, @"SmarterFingers\People.txt"); WordReader reader = new WordReader(); if (File.Exists(save)) { try { readWordsList = reader.readFile(save); Console.ForegroundColor = ConsoleColor.Yellow; if (readWordsList.SmarterFingers.Count != 0) Console.WriteLine(readWordsList.SmarterFingers.Count + " SmarterFingers changes have been loaded."); else { readWordsList = reader.writeFile(save); Console.WriteLine("Original SmarterFingers word list created."); } Console.ResetColor(); } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error in SmarterFingers \"WordsList.json\" file! Check log for more details."); Console.WriteLine(e.Message); Console.ResetColor(); Log.Error("------- Config Exception in SmarterFingers Config file (WordsList.json) -------"); Log.Error(e.Message); Log.Error("---------------------------------- Error End ----------------------------------"); } } else { Directory.CreateDirectory(Path.Combine(TShock.SavePath, "SmarterFingers")); readWordsList = reader.writeFile(save); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Original SmarterFingers word list created."); Console.ResetColor(); Log.Info("Original SmarterFingers word list created."); } }
public WordList writeFile(String file) { TextWriter tw = new StreamWriter(file); WordList OrigWordList = new WordList(); OrigWordList.AddItem(new Words(new List <string> { "hai", "hullo", "ello", "halo", "hallo" }, new List <string> { "greetings", "hi", "hello" })); OrigWordList.AddItem(new Words(new List <string> { "em" }, new List <string> { "am" })); OrigWordList.AddItem(new Words(new List <string> { "y", "wy", "wai" }, new List <string> { "why" })); OrigWordList.AddItem(new Words(new List <string> { "pooter", "comptooter", "comp", "putter", "macintosh", "compooter", "cpu" }, new List <string> { "computer" })); OrigWordList.AddItem(new Words(new List <string> { "r" }, new List <string> { "are" })); OrigWordList.AddItem(new Words(new List <string> { "teh", "tuh", "duh", "d", "de", "le" }, new List <string> { "the" })); OrigWordList.AddItem(new Words(new List <string> { "donot", "dont", "dnt" }, new List <string> { "don't" })); OrigWordList.AddItem(new Words(new List <string> { "yea", "yep", "yeh", "yuh", "yah", "ya" }, new List <string> { "yes" })); OrigWordList.AddItem(new Words(new List <string> { "wut", "wat", "whut", "wt" }, new List <string> { "what" })); OrigWordList.AddItem(new Words(new List <string> { "wuts", "wats", "whuts", "wts", "whats" }, new List <string> { "what's" })); OrigWordList.AddItem(new Words(new List <string> { "dis" }, new List <string> { "this" })); OrigWordList.AddItem(new Words(new List <string> { "meh" }, new List <string> { "me" })); OrigWordList.AddItem(new Words(new List <string> { "mah" }, new List <string> { "my" })); tw.Write(JsonConvert.SerializeObject(OrigWordList, Formatting.Indented)); tw.Close(); return(OrigWordList); }