/// <summary> /// Open file for writing /// </summary> private void Begin() { string filePath = AppSettings.MedianFile; Console.WriteLine ("Writing medians to " + filePath); Console.WriteLine (); tw = new TweetWriter (); tw.OpenFile (filePath); }
/// <summary> /// Outputs the words to the output file /// </summary> public static void OutputWords(string filePath) { string[] sortedKeys = new string[uniqueWords.Count]; uniqueWords.Keys.CopyTo (sortedKeys, 0); // we need to sort the keys first Array.Sort (sortedKeys); // open the output file and write to it line by line TweetWriter tw = new TweetWriter (); tw.OpenFile (filePath); for (int i = 0; i < sortedKeys.Length; i++) { string key = sortedKeys [i]; string line = key.PadRight(30) + uniqueWords [key]; tw.WriteLine (line); } tw.CloseFile (); }