diff --git a/OpenRecNet.cs b/OpenRecNet.cs index 2b44bef..20e7297 100644 --- a/OpenRecNet.cs +++ b/OpenRecNet.cs @@ -1,6 +1,7 @@ using System; using System.Net; using System.IO; +using System.Threading; namespace start { @@ -14,17 +15,91 @@ namespace start { Console.ForegroundColor = ConsoleColor.Blue; Console.Clear(); - goto ChatStart; + if ((File.ReadAllText("SaveData\\App\\showopenrecinfo.txt")) == "Enabled") + { + goto ChatStart; + } + else + { + goto SkipStart; + } ChatStart: Console.WriteLine("Welcome to OpenRecNet!"); - Console.WriteLine("You are logged in as " + File.ReadAllText("SaveData\\Profile\\username.txt")); - Console.WriteLine("Your UserID is " + File.ReadAllText("SaveData\\Profile\\userid.txt")); + Console.WriteLine("You are logged in as " + File.ReadAllText("SaveData\\Profile\\username.txt" + ".")); + Console.WriteLine("Your UserID is " + File.ReadAllText("SaveData\\Profile\\userid.txt" + ".")); Console.WriteLine("In the future, show this message?"); - Console.WriteLine("1) Yes" + Environment.NewLine + "1) No"); - + Console.WriteLine("1) Yes" + Environment.NewLine + "2) No"); + string readline = Console.ReadLine(); + if (readline == "1") + { + File.WriteAllText("SaveData\\App\\showopenrecinfo.txt", "Enabled"); + justjoined = false; + goto SkipStart; + } + if (readline == "2") + { + File.WriteAllText("SaveData\\App\\showopenrecinfo.txt", "Disabled"); + justjoined = false; + goto SkipStart; + } + SkipStart: + for (; ; ) + { + Console.Clear(); + string refresh = new WebClient + { + Headers = + { + { + "username", + File.ReadAllText("SaveData\\Profile\\username.txt") + }, + { + "justjoined", + Convert.ToString(justjoined) + } + } + }.DownloadString("https://openrecchat.loca.lt/refresh"); + Console.WriteLine(refresh); + Console.WriteLine(Environment.NewLine + "Commands: /r -Refresh /e -Exit"); + Console.WriteLine("Type your message below: "); + justjoined = false; + goto Send; + } + Send: + string send = Console.ReadLine(); + if (send == "/r") + { + goto SkipStart; + } + else if (send == "/e") + { + Environment.Exit(0); + } + else if (send == "") + { + goto SkipStart; + } + new WebClient + { + Headers = + { + { + "userid", + File.ReadAllText("SaveData\\Profile\\userid.txt") + }, + { + "username", + File.ReadAllText("SaveData\\Profile\\username.txt") + } + } + }.UploadString("https://openrecchat.loca.lt/sendmessage", send); + goto SkipStart; } + + public static bool justjoined = false; } } diff --git a/Program.cs b/Program.cs index fd7b975..a96b5b2 100644 --- a/Program.cs +++ b/Program.cs @@ -25,7 +25,7 @@ namespace start { Console.WriteLine("This version of OpenRec is outdated. We recommend you install the latest version, OpenRec " + new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/version.txt")); } - Console.WriteLine("1) Changelog" + Environment.NewLine +"2) Change Settings" + Environment.NewLine + "3) Modify Profile" + Environment.NewLine + "4) Start Server"); + Console.WriteLine("1) Changelog" + Environment.NewLine +"2) Change Settings" + Environment.NewLine + "3) Modify Profile" + Environment.NewLine + "4) OpenRecNet" + Environment.NewLine + "5) Start Server"); string readline = Console.ReadLine(); if (readline == "1") { @@ -41,8 +41,8 @@ namespace start Console.Clear(); goto Settings; - Settings: //SaveData\\App\\privatedorm.txt - Console.WriteLine("1) Sandbox Mode: " + File.ReadAllText("SaveData\\App\\sandbox.txt") + Environment.NewLine + "2) Private Dorm: " + File.ReadAllText("SaveData\\App\\privatedorm.txt") + Environment.NewLine + "3) Go Back"); + Settings: + Console.WriteLine("1) Sandbox Mode: " + File.ReadAllText("SaveData\\App\\sandbox.txt") + Environment.NewLine + "2) Private Dorm: " + File.ReadAllText("SaveData\\App\\privatedorm.txt") + Environment.NewLine + "3) OpenRecNet Info Tab: " + File.ReadAllText("SaveData\\App\\showopenrecinfo.txt") + Environment.NewLine + "4) Go Back"); string readline4 = Console.ReadLine(); if (readline4 == "1") { @@ -73,6 +73,20 @@ namespace start goto Settings; } else if (readline4 == "3") + { + if (File.ReadAllText("SaveData\\App\\showopenrecinfo.txt") == "Disabled") + { + File.WriteAllText("SaveData\\App\\showopenrecinfo.txt", "Enabled"); + } + else + { + File.WriteAllText("SaveData\\App\\showopenrecinfo.txt", "Disabled"); + } + Console.Clear(); + Console.WriteLine("Success!"); + goto Settings; + } + else if (readline4 == "4") { Console.Clear(); goto Start; diff --git a/Setup.cs b/Setup.cs index 4a23ae9..11a93dd 100644 --- a/Setup.cs +++ b/Setup.cs @@ -62,6 +62,10 @@ namespace start { File.WriteAllText("SaveData\\App\\privatedorm.txt", "Disabled"); } + if (!(File.Exists("SaveData\\App\\showopenrecinfo.txt"))) + { + File.WriteAllText("SaveData\\App\\showopenrecinfo.txt", "Enabled"); + } if (!(File.Exists("SaveData\\Images\\count.txt"))) { File.WriteAllText("SaveData\\Images\\count.txt", "0");