예제 #1
0
        public GriderProxyFrame(string[] args)
        {
            //bool externalPlugin = false;
            this.args = args;

            GriderProxyConfig proxyConfig = new GriderProxyConfig("GridSurferProxy", "Crista Lopes / Diva", args);
            proxy = new GriderProxy(proxyConfig);

            // add delegates for login
            proxy.SetLoginRequestDelegate(new XmlRpcRequestDelegate(LoginRequest));
            proxy.SetLoginResponseDelegate(new XmlRpcResponseDelegate(LoginResponse));

            // add a delegate for outgoing chat
            proxy.AddDelegate(PacketType.ChatFromViewer, Direction.Outgoing, new PacketDelegate(ChatFromViewerOut));

            //  handle command line arguments
            foreach (string arg in args)
                if (arg == "--log-login")
                    logLogin = true;
                else if (arg.Substring(0, 2) == "--")
                {
                    int ipos = arg.IndexOf("=");
                    if (ipos != -1)
                    {
                        string sw = arg.Substring(0, ipos);
                        string val = arg.Substring(ipos + 1);
                        Console.WriteLine("arg '" + sw + "' val '" + val + "'");
                        if (sw == "--load")
                        {
                            //externalPlugin = true;
                            LoadPlugin(val);
                        }
                    }
                }

            commandDelegates["/load"] = new CommandDelegate(CmdLoad);
        }
예제 #2
0
파일: GriderProxy.cs 프로젝트: diva/Grider
        /*
         * Proxy Management
         */
        // Proxy: construct a proxy server with the given configuration
        public GriderProxy(GriderProxyConfig proxyConfig)
        {
            this.proxyConfig = proxyConfig;

            InitializeLoginProxy();

            InitializeSimProxy();
            InitializeCaps();
        }
예제 #3
0
파일: GriderProxy.cs 프로젝트: diva/Grider
 // SimProxy: construct a proxy for a single simulator
 public SimProxy(GriderProxyConfig proxyConfig, IPEndPoint simEndPoint, GriderProxy proxy)
 {
     //this.proxyConfig = proxyConfig;
     remoteEndPoint = new IPEndPoint(simEndPoint.Address, simEndPoint.Port);
     this.proxy = proxy;
     socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
     socket.Bind(new IPEndPoint(proxyConfig.clientFacingAddress, 0));
     proxy.AddHandler(remoteEndPoint, this);
     Reset();
 }