This repository was archived by the owner on Apr 2, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathVault2018WS.cs
More file actions
108 lines (94 loc) · 2.85 KB
/
Vault2018WS.cs
File metadata and controls
108 lines (94 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using Newtonsoft.Json;
using start;
using WebSocketSharp;
using WebSocketSharp.Server;
using ws;
namespace vaultgamesesh
{
public class Late2018WebSock
{
public Late2018WebSock()
{
Late2018WebSock.instance = this;
this.WebSock.AddWebSocketService<Late2018WebSock.NotificationWS>("/api/notification/v2");
this.WebSock.AddWebSocketService<Late2018WebSock.HubWS>("/hub/v1");
this.WebSock.Start();
Console.WriteLine("[LateWebSocket.cs] has started.");
Console.WriteLine("[LateWebSocket.cs] is listening.");
}
public void Broadcast(Notification.Reponse res)
{
Console.WriteLine(string.Concat(new string[]
{
"Broadcasting ",
JsonConvert.SerializeObject(res),
" to ",
this.WebSock.WebSocketServices["/api/notification/v2"].Sessions.Count.ToString(),
" clients."
}));
WebSock.WebSocketServices["/api/notification/v2"].Sessions.Broadcast(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(res)));
}
public static Late2018WebSock instance;
public WebSocketServer WebSock = new WebSocketServer("ws://localhost:20161/");
public class HubWS : WebSocketBehavior
{
protected override void OnMessage(MessageEventArgs e)
{
Console.WriteLine("LateWebSocket.cs Hub Requested.");
base.Send(JsonConvert.SerializeObject(new Late2018WebSock.Hub()));
}
public HubWS()
{
}
}
public class Hub : WebSocketBehavior
{
public Hub()
{
this.accessToken = "AccessDeezNuts";
this.SupportedTransports = new List<string>();
this.negotiateVersion = 0;
this.url = new Uri(string.Format("http://localhost:{0}/", "2018"));
}
public Uri url { get; set; }
public string accessToken { get; set; }
public List<string> SupportedTransports { get; set; }
public int negotiateVersion { get; set; }
}
public class NotificationWS : WebSocketBehavior
{
protected override void OnMessage(MessageEventArgs p0)
{
bool flag = new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Update/banned.txt").Contains(File.ReadAllText("SaveData\\Profile\\userid.txt"));
if (flag)
{
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;
Program.bannedflag = true;
Late2018WebSock.instance.Broadcast(Notification.Reponse.createBannedResponse());
}
Console.WriteLine("LateWebSocket.cs Notif Requested.");
bool flag2 = p0.Data == null;
bool flag3 = flag2;
bool flag4 = flag3;
if (flag4)
{
base.Send(string.Empty);
}
else
{
base.Send(Notification2018.ProcessRequest(p0.Data));
}
}
public NotificationWS()
{
}
}
}
}