Advertisement
Phe0n1x

Discord Game Changer

Sep 16th, 2016
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. using System;
  2. using System.Diagnostics;
  3. using System.IO;
  4. using System.Reflection;
  5. using System.Text;
  6.  
  7. namespace DiscordGameChanger
  8. {
  9. class Program
  10. {
  11. static void Main()
  12. {
  13. string filename = "settings.txt";
  14. checkFileExists(filename);
  15. getTitle(filename);
  16. }
  17.  
  18. private static void checkFileExists(string filename)
  19. {
  20. if (!File.Exists(filename))
  21. {
  22. using (TextWriter TW = new StreamWriter(filename))
  23. {
  24. TW.WriteLine("Your Title Here");
  25. }
  26. }
  27. }
  28.  
  29. private static void getTitle(string filename)
  30. {
  31. using (TextReader TR = new StreamReader(filename))
  32. {
  33. Console.Title = TR.ReadLine();
  34. Console.WriteLine("Set title to: " + Console.Title);
  35. }
  36. setTitle(filename);
  37. }
  38.  
  39. private static void setTitle(string filename)
  40. {
  41. Console.WriteLine("Please input you desired title:");
  42. string newFN = Console.ReadLine();
  43. using (TextWriter TW = new StreamWriter(filename))
  44. {
  45. TW.WriteLine(newFN);
  46. }
  47. Restart();
  48. }
  49.  
  50. private static void Restart()
  51. {
  52. Process.Start(Assembly.GetExecutingAssembly().Location);
  53. Environment.Exit(0);
  54. }
  55.  
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement