Пример #1
0
 void InitSocket(IWebSocketConnection socket)
 {
     socket.OnOpen = delegate()
     {
         // Immediately reject connections with unexpected origins
         if (!ValidateOrigin(socket.ConnectionInfo.Origin))
         {
             if (KeePassRPCPlugin.logger != null)
             {
                 try
                 {
                     KeePassRPCPlugin.logger.WriteLine(socket.ConnectionInfo.Origin + " is not permitted to access KeePassRPC.");
                 }
                 catch (Exception)
                 {
                     // Don't care
                 }
             }
         }
         else
         {
             KeePassRPCPlugin.AddRPCClientConnection(socket);
         }
     };
     socket.OnClose = delegate()
     {
         KeePassRPCPlugin.RemoveRPCClientConnection(socket);
     };
     socket.OnMessage = delegate(string message)
     {
         KeePassRPCPlugin.MessageRPCClientConnection(socket, message, Service);
     };
 }
Пример #2
0
 void InitSocket(IWebSocketConnection socket)
 {
     socket.OnOpen = delegate()
     {
         KeePassRPCPlugin.AddRPCClientConnection(socket);
     };
     socket.OnClose = delegate()
     {
         KeePassRPCPlugin.RemoveRPCClientConnection(socket);
     };
     socket.OnMessage = delegate(string message)
     {
         KeePassRPCPlugin.MessageRPCClientConnection(socket, message, Service);
     };
 }