/// <summary> /// Begins the IO process. /// </summary> public static void Begin() { Console.OutputEncoding = Encoding.UTF8; DisplayInitialMessage(); PromptUserForInput(true); GetData(); WriteFile(WishData.GetPath(), WishData.GetData(), ConnectionManager.GetWebClient()); AlphabetizeFile(); DisplayOutput(WishData.GetAllData()); }
/// <summary> /// Attempts to establish a connection with the client. If successful, sets the data to be parsed. /// </summary> private static void GetData() { bool successfulConnection = false; while (!successfulConnection) { try { WishData.SetData(ConnectionManager.GetWebClient().DownloadString(SteamApiAccess.GetApiUrl())); successfulConnection = true; } catch { PromptUserForInput(false); } } }
/// <summary> /// Sorts the output file alphabetically. /// </summary> private static void AlphabetizeFile() { WishData.SetAllData(File.ReadAllLines(WishData.GetPath())); Array.Sort(WishData.GetAllData()); File.WriteAllText(WishData.GetPath(), string.Join("\n", WishData.GetAllData())); }