mirror of
https://github.com/recroom2016/OpenRec.git
synced 2026-04-22 21:25:51 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c8063a058 | ||
|
|
46ff9f37d3 |
17
APIServer.cs
17
APIServer.cs
@@ -170,10 +170,18 @@ namespace server
|
||||
CachedPlayerID = ulong.Parse(text.Remove(0, 32));
|
||||
CachedPlatformID = ulong.Parse(text.Remove(0, 22));
|
||||
}
|
||||
if (Url == "platformlogin/v1/logincached")
|
||||
if (Url == "platformlogin/v1/loginaccount")
|
||||
{
|
||||
s = logincached.loginCache(CachedPlayerID, CachedPlatformID);
|
||||
}
|
||||
if (Url == "platformlogin/v1/createaccount")
|
||||
{
|
||||
s = logincached.loginCache(CachedPlayerID, CachedPlatformID);
|
||||
}
|
||||
if (Url == "platformlogin/v1/logincached")
|
||||
{
|
||||
s = logincached.loginCache(CachedPlayerID, CachedPlatformID);
|
||||
}
|
||||
if (Url == "relationships/v1/bulkignoreplatformusers")
|
||||
{
|
||||
s = BlankResponse;
|
||||
@@ -210,6 +218,10 @@ namespace server
|
||||
{
|
||||
s = File.ReadAllText("SaveData\\settings.txt");
|
||||
}
|
||||
if (Url == "settings/v2/set")
|
||||
{
|
||||
Settings.SetPlayerSettings(text);
|
||||
}
|
||||
if (Url == "avatar/v3/items")
|
||||
{
|
||||
s = File.ReadAllText("SaveData\\avataritems.txt");
|
||||
@@ -242,10 +254,9 @@ namespace server
|
||||
{
|
||||
s = JsonConvert.SerializeObject(new Objective2018());
|
||||
}
|
||||
|
||||
if (Url == "rooms/v1/myrooms")
|
||||
{
|
||||
s = BracketResponse;
|
||||
s = File.ReadAllText("SaveData\\myrooms.txt");
|
||||
}
|
||||
if (Url == "rooms/v1/mybookmarkedrooms")
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace api2018
|
||||
// Token: 0x0600033C RID: 828 RVA: 0x00008F30 File Offset: 0x00007130
|
||||
public static string GetDebugLogin(ulong userid, ulong platformid)
|
||||
{
|
||||
int level = int.Parse(File.ReadAllText("SaveData\\Profile\\level.txt"));
|
||||
string name = File.ReadAllText("SaveData\\Profile\\username.txt");
|
||||
return JsonConvert.SerializeObject(new List<getcachedlogins>
|
||||
{
|
||||
@@ -21,7 +22,7 @@ namespace api2018
|
||||
Username = name,
|
||||
DisplayName = name,
|
||||
XP = 9999,
|
||||
Level = 10,
|
||||
Level = level,
|
||||
RegistrationStatus = 2,
|
||||
Developer = true,
|
||||
CanReceiveInvites = false,
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace api2018
|
||||
// Token: 0x0600036A RID: 874 RVA: 0x00009044 File Offset: 0x00007244
|
||||
public static string loginCache(ulong userid, ulong platformid)
|
||||
{
|
||||
int level = int.Parse(File.ReadAllText("SaveData\\Profile\\level.txt"));
|
||||
string name = File.ReadAllText("SaveData\\Profile\\username.txt");
|
||||
return JsonConvert.SerializeObject(new logincached
|
||||
{
|
||||
@@ -51,7 +52,7 @@ namespace api2018
|
||||
Username = name,
|
||||
DisplayName = name,
|
||||
XP = 9999,
|
||||
Level = 10,
|
||||
Level = level,
|
||||
RegistrationStatus = 2,
|
||||
Developer = true,
|
||||
CanReceiveInvites = false,
|
||||
|
||||
88
Program.cs
88
Program.cs
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using ws;
|
||||
using api;
|
||||
using System.Net;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace start
|
||||
{
|
||||
@@ -27,10 +28,10 @@ namespace start
|
||||
string readline = Console.ReadLine();
|
||||
if (readline == "1")
|
||||
{
|
||||
goto TrueFalse;
|
||||
|
||||
TrueFalse:
|
||||
Console.Clear();
|
||||
goto Settings;
|
||||
|
||||
Settings:
|
||||
Console.WriteLine("1) Sandbox Mode: " + File.ReadAllText("SaveData\\App\\sandbox.txt") + Environment.NewLine + "2) Go Back");
|
||||
string readline4 = Console.ReadLine();
|
||||
if (readline4 == "1")
|
||||
@@ -43,31 +44,94 @@ namespace start
|
||||
{
|
||||
File.WriteAllText("SaveData\\App\\sandbox.txt", "Disabled");
|
||||
}
|
||||
goto TrueFalse;
|
||||
Console.Clear();
|
||||
Console.WriteLine("Success!");
|
||||
goto Settings;
|
||||
}
|
||||
if (readline4 == "2")
|
||||
else if (readline4 == "2")
|
||||
{
|
||||
Console.Clear();
|
||||
goto Start;
|
||||
}
|
||||
|
||||
}
|
||||
if (readline == "2")
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine("1) Change Username" + Environment.NewLine + "2) Go Back");
|
||||
goto Profile;
|
||||
|
||||
Profile:
|
||||
Console.WriteLine("1) Change Username" + Environment.NewLine+ "2) Change Profile Image" + Environment.NewLine + "3) Change Level" + Environment.NewLine + "4) Go Back");
|
||||
string readline3 = Console.ReadLine();
|
||||
if (readline3 == "1")
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine("Current Username: " + File.ReadAllText("SaveData\\Profile\\username.txt"));
|
||||
Console.WriteLine("New Username: ");
|
||||
string newusername = Console.ReadLine();
|
||||
File.WriteAllText("SaveData\\Profile\\username.txt", newusername);
|
||||
Console.Clear();
|
||||
Console.WriteLine("Success!");
|
||||
goto Start;
|
||||
}
|
||||
if (readline3 == "2")
|
||||
else if (readline3 == "2")
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine("1) Upload Media Link" + Environment.NewLine + "2) Drag Image onto this window" + Environment.NewLine + "3) Go Back");
|
||||
string readline4 = Console.ReadLine();
|
||||
if (readline4 == "1")
|
||||
{
|
||||
Console.WriteLine("Paste Media Link: ");
|
||||
string medialink = Console.ReadLine();
|
||||
try
|
||||
{
|
||||
File.WriteAllBytes("SaveData\\profileimage.png", new WebClient().DownloadData(medialink));
|
||||
}
|
||||
catch (Exception ex4)
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine("Invalid Media Link");
|
||||
goto Profile;
|
||||
}
|
||||
Console.Clear();
|
||||
Console.WriteLine("Success!");
|
||||
goto Start;
|
||||
}
|
||||
else if (readline4 == "2")
|
||||
{
|
||||
Console.WriteLine("Drag any image onto this window and press enter: ");
|
||||
string imagedir = Console.ReadLine();
|
||||
try
|
||||
{
|
||||
byte[] imagefile = File.ReadAllBytes(imagedir);
|
||||
File.Replace(imagedir, "SaveData\\profileimage.png", "backupfilename.png");
|
||||
File.WriteAllBytes(imagedir, imagefile);
|
||||
}
|
||||
catch (Exception ex4)
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine("Invalid Image (Make sure its on the same drive as OpenRec)");
|
||||
goto Profile;
|
||||
}
|
||||
Console.Clear();
|
||||
Console.WriteLine("Success!");
|
||||
goto Start;
|
||||
}
|
||||
else if (readline4 == "3")
|
||||
{
|
||||
Console.Clear();
|
||||
goto Start;
|
||||
}
|
||||
}
|
||||
else if (readline3 == "3")
|
||||
{
|
||||
Console.WriteLine("Current Level: " + File.ReadAllText("SaveData\\Profile\\level.txt"));
|
||||
Console.WriteLine("New Level: ");
|
||||
string newlevel = Console.ReadLine();
|
||||
File.WriteAllText("SaveData\\Profile\\level.txt", newlevel);
|
||||
Console.Clear();
|
||||
Console.WriteLine("Success!");
|
||||
goto Start;
|
||||
}
|
||||
else if (readline3 == "4")
|
||||
{
|
||||
Console.Clear();
|
||||
goto Start;
|
||||
@@ -85,7 +149,7 @@ namespace start
|
||||
new APIServer();
|
||||
new WebSocket();
|
||||
}
|
||||
if (readline2 == "2017")
|
||||
else if (readline2 == "2017")
|
||||
{
|
||||
version = "2017";
|
||||
Console.Clear();
|
||||
@@ -93,7 +157,7 @@ namespace start
|
||||
new APIServer();
|
||||
new WebSocket();
|
||||
}
|
||||
if (readline2 == "2018")
|
||||
else if (readline2 == "2018")
|
||||
{
|
||||
version = "2018";
|
||||
Console.Clear();
|
||||
@@ -106,7 +170,7 @@ namespace start
|
||||
}
|
||||
}
|
||||
|
||||
public static string version = "0.2";
|
||||
public static string version = "0.3";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
80
Settings.cs
80
Settings.cs
@@ -5,42 +5,22 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace api
|
||||
{
|
||||
// Token: 0x0200003C RID: 60
|
||||
internal class Settings
|
||||
{
|
||||
// Token: 0x060001C1 RID: 449 RVA: 0x00002D10 File Offset: 0x00000F10
|
||||
public static string GetPlayerSettings()
|
||||
{
|
||||
if (Settings.playerSettings == null)
|
||||
{
|
||||
if (File.Exists(Settings.SettingsPath))
|
||||
{
|
||||
Settings.playerSettings = Settings.LoadSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings.playerSettings = Settings.CreateDefaultSettings();
|
||||
}
|
||||
}
|
||||
return JsonConvert.SerializeObject(Settings.playerSettings);
|
||||
}
|
||||
|
||||
// Token: 0x060001C2 RID: 450 RVA: 0x000061FC File Offset: 0x000043FC
|
||||
public static void SetPlayerSettings(string jsonData)
|
||||
{
|
||||
if (jsonData == "")
|
||||
{
|
||||
Console.WriteLine("[Settings][Set] Json Data is empty.");
|
||||
{
|
||||
return;
|
||||
}
|
||||
Setting setting = JsonConvert.DeserializeObject<Setting>(jsonData);
|
||||
for (int i = 0; i < Settings.playerSettings.Count; i++)
|
||||
Settings.playerSettings = Settings.LoadSettings();
|
||||
foreach (Setting setting2 in Settings.playerSettings)
|
||||
{
|
||||
if (Settings.playerSettings[i].Key == setting.Key)
|
||||
if (setting2.Key == setting.Key)
|
||||
{
|
||||
Settings.playerSettings[i].Value = setting.Value;
|
||||
setting2.Value = setting.Value;
|
||||
Settings.SaveSettings(Settings.playerSettings);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Settings.playerSettings.Add(new Setting
|
||||
@@ -50,8 +30,15 @@ namespace api
|
||||
});
|
||||
Settings.SaveSettings(Settings.playerSettings);
|
||||
}
|
||||
|
||||
// Token: 0x060001C3 RID: 451 RVA: 0x000062AC File Offset: 0x000044AC
|
||||
public static List<Setting> LoadSettings()
|
||||
{
|
||||
return JsonConvert.DeserializeObject<List<Setting>>(File.ReadAllText(Environment.CurrentDirectory + Settings.SettingsPath));
|
||||
}
|
||||
public static void SaveSettings(List<Setting> settings)
|
||||
{
|
||||
File.WriteAllText(Environment.CurrentDirectory + Settings.SettingsPath, JsonConvert.SerializeObject(settings));
|
||||
}
|
||||
|
||||
public static List<Setting> CreateDefaultSettings()
|
||||
{
|
||||
return new List<Setting>
|
||||
@@ -138,43 +125,10 @@ namespace api
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Token: 0x060001C4 RID: 452 RVA: 0x00006548 File Offset: 0x00004748
|
||||
public static List<Setting> LoadSettings()
|
||||
{
|
||||
List<Setting> list = new List<Setting>();
|
||||
using (BinaryReader binaryReader = new BinaryReader(File.Open(Settings.SettingsPath, FileMode.Open)))
|
||||
{
|
||||
while (binaryReader.BaseStream.Position != binaryReader.BaseStream.Length)
|
||||
{
|
||||
Setting item = new Setting
|
||||
{
|
||||
Key = binaryReader.ReadString(),
|
||||
Value = binaryReader.ReadString()
|
||||
};
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// Token: 0x060001C5 RID: 453 RVA: 0x000065C8 File Offset: 0x000047C8
|
||||
public static void SaveSettings(List<Setting> settings)
|
||||
{
|
||||
using (BinaryWriter binaryWriter = new BinaryWriter(File.Create("SaveData\\")))
|
||||
{
|
||||
foreach (Setting setting in settings)
|
||||
{
|
||||
binaryWriter.Write(setting.Key);
|
||||
binaryWriter.Write(setting.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000F0 RID: 240
|
||||
|
||||
private static List<Setting> playerSettings;
|
||||
|
||||
// Token: 0x040000F1 RID: 241
|
||||
public static string SettingsPath = "SaveData\\settings.txt";
|
||||
|
||||
public static string SettingsPath = "\\SaveData\\settings.txt";
|
||||
}
|
||||
}
|
||||
|
||||
8
Setup.cs
8
Setup.cs
@@ -37,6 +37,14 @@ namespace start
|
||||
{
|
||||
File.WriteAllText("SaveData\\Profile\\username.txt", "DefaultUsername");
|
||||
}
|
||||
if (!(File.Exists("SaveData\\Profile\\level.txt")))
|
||||
{
|
||||
File.WriteAllText("SaveData\\Profile\\level.txt", "10");
|
||||
}
|
||||
if (!(File.Exists("SaveData\\myrooms.txt")))
|
||||
{
|
||||
File.WriteAllText("SaveData\\myrooms.txt", "[]");
|
||||
}
|
||||
if (!(File.Exists("SaveData\\settings.txt")))
|
||||
{
|
||||
File.WriteAllText("SaveData\\settings.txt", Newtonsoft.Json.JsonConvert.SerializeObject(api.Settings.CreateDefaultSettings()));
|
||||
|
||||
Reference in New Issue
Block a user