Exemplo n.º 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();
        }
Exemplo n.º 2
0
 private static bool RemoveClientFromConverter(SLHClient client)
 {
     return(Converter.RemoveClient(client));
 }
Exemplo n.º 3
0
 private static void AddClientToConverter(SLHClient client)
 {
     Converter.AddClient(client);
 }
Exemplo n.º 4
0
 public bool RemoveClient(SLHClient client)
 {
     lock (_Clients)
         return(_Clients.Remove(client));
 }
Exemplo n.º 5
0
 public void AddClient(SLHClient client)
 {
     lock (_Clients)
         _Clients.Add(client);
 }
Exemplo n.º 6
0
 public TextureWebAPIController(IHttpContext context, SLHClient client) : base(context)
 {
     Client = client;
 }