Beispiel #1
0
        public SLH(SLHClient client, SLHWebSocketServer server)
        {
            Client = client;
            Server = server;

            Server.ReceivedMessage += HandleReceivedMessage;

            Client.Network.LoginProgress += HandleLoginProgress;
            Client.Network.LoggedOut     += HandleLoggedOut;

            SessionId = new Guid().ToString();

            // Important step
            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                //Converters = new[] { JSONConverter }, // Pass the shared (static) converter
                Converters = new[] { new SLHJSONConverter() },
                Error      = delegate(object sender, ErrorEventArgs args)
                {
                    // SERIALIZE ALL THE THINGS!
                    args.ErrorContext.Handled = true;
                },
            };

            // Bind this class to the JSON-RPC server
            ServiceBinder.BindService(SessionId, this);

            // Set up the JSON-RPC client serializer
            JSONRPCSerializer = new JsonRpcSerializer();
        }
Beispiel #2
0
 private static bool RemoveClientFromConverter(SLHClient client)
 {
     return(Converter.RemoveClient(client));
 }
Beispiel #3
0
 private static void AddClientToConverter(SLHClient client)
 {
     Converter.AddClient(client);
 }
Beispiel #4
0
 public bool RemoveClient(SLHClient client)
 {
     lock (_Clients)
         return(_Clients.Remove(client));
 }
Beispiel #5
0
 public void AddClient(SLHClient client)
 {
     lock (_Clients)
         _Clients.Add(client);
 }
Beispiel #6
0
 public TextureWebAPIController(IHttpContext context, SLHClient client) : base(context)
 {
     Client = client;
 }