OPENREC 7

This commit is contained in:
recroom2016tutorial
2022-07-21 23:49:29 -04:00
parent 696feb3887
commit 869f5ff80b
5 changed files with 68 additions and 44 deletions

View File

@@ -681,7 +681,7 @@ namespace server
response.ContentLength64 = (long)bytes.Length; response.ContentLength64 = (long)bytes.Length;
Stream outputStream = response.OutputStream; Stream outputStream = response.OutputStream;
outputStream.Write(bytes, 0, bytes.Length); outputStream.Write(bytes, 0, bytes.Length);
Thread.Sleep(20); Thread.Sleep(400);
outputStream.Close(); outputStream.Close();
this.listener.Stop(); this.listener.Stop();

View File

@@ -54,6 +54,7 @@ namespace api2018
} }
} }
} }
}); });
} }

View File

@@ -51,13 +51,11 @@ namespace api2017
ForceJuniorImages = false, ForceJuniorImages = false,
HasBirthday = true HasBirthday = true
} }
}); });
} }
// Token: 0x06000199 RID: 409 RVA: 0x00002BBE File Offset: 0x00000DBE // Token: 0x06000199 RID: 409 RVA: 0x00002BBE File Offset: 0x00000DBE
public static string playerName()
{
return File.ReadAllText("playerNameConfig.txt");
}
} }
} }

View File

@@ -19,7 +19,8 @@ namespace server
{ {
Console.WriteLine("[NameServer.cs] has started."); Console.WriteLine("[NameServer.cs] has started.");
new Thread(new ThreadStart(this.StartListen)).Start(); new Thread(new ThreadStart(this.StartListen)).Start();
} new Thread(new ThreadStart(this.StartListen2)).Start();
}
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("An Exception Occurred while Listening :" + ex.ToString()); Console.WriteLine("An Exception Occurred while Listening :" + ex.ToString());
@@ -31,33 +32,64 @@ namespace server
{ {
//nameserver is ONLY for 2018 //nameserver is ONLY for 2018
this.listener.Prefixes.Add("http://localhost:20181/"); this.listener.Prefixes.Add("http://localhost:20181/");
for (; ; ) for (; ; )
{ {
this.listener.Start(); this.listener.Start();
Console.WriteLine("[NameServer.cs] is listening."); Console.WriteLine("[NameServer.cs] is listening.");
HttpListenerContext context = this.listener.GetContext(); HttpListenerContext context = this.listener.GetContext();
HttpListenerRequest request = context.Request; HttpListenerRequest request = context.Request;
HttpListenerResponse response = context.Response; HttpListenerResponse response = context.Response;
string rawUrl = request.RawUrl; string rawUrl = request.RawUrl;
string s = ""; string s = "";
NSData data = new NSData() NSData data = new NSData()
{ {
API = "http://localhost:2018", API = "http://localhost:2018",
Notifications = "http://localhost:20161", Notifications = "http://localhost:20161",
Images = "http://localhost:20182" Images = "http://localhost:20182"
}; };
s = JsonConvert.SerializeObject(data); s = JsonConvert.SerializeObject(data);
Console.WriteLine("API Response: " + s); Console.WriteLine("API Response: " + s);
byte[] bytes = Encoding.UTF8.GetBytes(s); byte[] bytes = Encoding.UTF8.GetBytes(s);
response.ContentLength64 = (long)bytes.Length; response.ContentLength64 = (long)bytes.Length;
Stream outputStream = response.OutputStream; Stream outputStream = response.OutputStream;
outputStream.Write(bytes, 0, bytes.Length); outputStream.Write(bytes, 0, bytes.Length);
Thread.Sleep(1); Thread.Sleep(400);
outputStream.Close(); outputStream.Close();
this.listener.Stop(); this.listener.Stop();
} }
} }
public static string VersionCheckResponse = "{\"ValidVersion\":true}";
private void StartListen2()
{
//nameserver is ONLY for 2018
this.listener2.Prefixes.Add("http://localhost:56/");
for (; ; )
{
this.listener2.Start();
Console.WriteLine("[NameServer2.cs] is listening.");
HttpListenerContext context = this.listener2.GetContext();
HttpListenerRequest request = context.Request;
HttpListenerResponse response = context.Response;
string rawUrl = request.RawUrl;
string s = "";
NSData data = new NSData()
{
API = "http://localhost:2018",
Notifications = "http://localhost:20161",
Images = "http://localhost:20182"
};
s = JsonConvert.SerializeObject(data);
Console.WriteLine("API Response: " + s);
byte[] bytes = Encoding.UTF8.GetBytes(s);
response.ContentLength64 = (long)bytes.Length;
Stream outputStream = response.OutputStream;
outputStream.Write(bytes, 0, bytes.Length);
Thread.Sleep(500);
outputStream.Close();
this.listener2.Stop();
}
}
public static string VersionCheckResponse = "{\"ValidVersion\":true}";
public static string BlankResponse = ""; public static string BlankResponse = "";
public class NSData public class NSData
{ {
@@ -69,5 +101,7 @@ namespace server
// Token: 0x04000192 RID: 402 // Token: 0x04000192 RID: 402
private HttpListener listener = new HttpListener(); private HttpListener listener = new HttpListener();
private HttpListener listener2 = new HttpListener();
} }
} }

View File

@@ -73,16 +73,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("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"));
} }
if (File.Exists("SaveData\\Profile\\userid.txt"))
{
if (new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Update/banned.txt").Contains(File.ReadAllText("SaveData\\Profile\\userid.txt")))
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("You are banned. Using this version of OpenRec will not work, please download OpenRec 0.4.2 or prior.");
Console.ForegroundColor = ConsoleColor.Green;
bannedflag = true;
}
}
Console.WriteLine("//Custom Room Downloader has been moved to the settings tab!" + Environment.NewLine); Console.WriteLine("//Custom Room Downloader has been moved to the settings tab!" + Environment.NewLine);
Console.WriteLine("(1) What's New" + Environment.NewLine +"(2) Change Settings" + Environment.NewLine + "(3) Modify Profile" + Environment.NewLine + "(4) Build Download Links" + Environment.NewLine + "(5) Start Server"); Console.WriteLine("(1) What's New" + Environment.NewLine +"(2) Change Settings" + Environment.NewLine + "(3) Modify Profile" + Environment.NewLine + "(4) Build Download Links" + Environment.NewLine + "(5) Start Server");
string readline = Console.ReadLine(); string readline = Console.ReadLine();
@@ -367,7 +358,7 @@ namespace start
} }
else if (readline2 == "2018") else if (readline2 == "2018")
{ {
Console.WriteLine("May, July or September (Beta) 2018: (M, J, S)"); Console.WriteLine("May, July or September (SEPTEMBER MIGHT NOT WORK) 2018: (M, J, S)");
string readline3 = Console.ReadLine(); string readline3 = Console.ReadLine();
if ((readline3 == "M") || (readline3 == "m")) if ((readline3 == "M") || (readline3 == "m"))
{ {