AddDelegate() public method

public AddDelegate ( PacketType packetType, Direction direction, PacketDelegate packetDelegate ) : void
packetType PacketType
direction Direction
packetDelegate PacketDelegate
return void
Ejemplo n.º 1
0
 public ProfileFunPlugin(PubComb plug)
 {
     plugin = plug;
     form = new SimpleProfForm1(this);
     this.frame = plug.frame;
     shared = plugin.SharedInfo;
     this.proxy = plug.proxy;
     proxy.AddDelegate(PacketType.AvatarPropertiesReply, Direction.Incoming, new PacketDelegate(inAvatar));
     RefreshDownloadsTimer.Elapsed += new System.Timers.ElapsedEventHandler(RefreshDownloadsTimer_Elapsed);
     RefreshDownloadsTimer.Start();
     proxy.AddDelegate(PacketType.AgentMovementComplete, Direction.Incoming, delegate(Packet packet, IPEndPoint sim)
     {
         shared.RegionHandle = ((AgentMovementCompletePacket)packet).Data.RegionHandle;
         return packet;
     });
     proxy.AddDelegate(PacketType.AgentUpdate, Direction.Outgoing, delegate(Packet packet, IPEndPoint sim)
     {
         AgentUpdatePacket.AgentDataBlock p = ((AgentUpdatePacket)packet).AgentData;
         shared.CameraPosition = p.CameraCenter;
         shared.CameraAtAxis = p.CameraAtAxis;
         shared.CameraLeftAxis = p.CameraLeftAxis;
         shared.CameraUpAxis = p.CameraUpAxis;
         shared.Far = p.Far;
         shared.ip = sim.Address;
         shared.port = sim.Port;
         return packet;
     });
 }
Ejemplo n.º 2
0
Archivo: Lyra.cs Proyecto: zadark/par
 public LyraPlugin(PubComb plug)
 {
     //formthread = new Thread(new ThreadStart(delegate()
     //{
     //    form = new LyraForm1(this);
     //    Application.Run(form);
     //}));
     //formthread.SetApartmentState(ApartmentState.STA);
     //formthread.Start();
     plugin = plug;
     form = new LyraForm1(this);
     //plug.tabform.addATab(form, "LYRA");
     this.frame = plug.frame;
     this.proxy = plug.proxy;
     // this.brand = "Lyra";
     proxy.AddDelegate(PacketType.ChatFromViewer, Direction.Outgoing, new PacketDelegate(SimChat));
     proxy.AddDelegate(PacketType.AgentUpdate, Direction.Outgoing, new PacketDelegate(Age));
 }
Ejemplo n.º 3
0
 public SitBlockPlugin(PubComb plug)
 {
     plugin = plug;
     form = new SitBlockForm1(this);
     this.frame = plug.frame;
     this.proxy = plug.proxy;
     this.brand = "SitBlock";
     proxy.AddDelegate(PacketType.AgentRequestSit, Direction.Outgoing, new PacketDelegate(sitp));
 }
Ejemplo n.º 4
0
Archivo: Penny.cs Proyecto: zadark/par
        public PennyPlugin(PubComb plug)
        {
            plugin = plug;
            //formthread = new Thread(new ThreadStart(delegate()
            //{
                form = new PennyForm1(this);
             //   Application.Run(form);
            //}));
            //formthread.SetApartmentState(ApartmentState.STA);
            //formthread.Start();

            this.frame = plugin.frame;
            this.proxy = plugin.proxy;
            //this.brand = "Penny";
            proxy.AddDelegate(PacketType.AgentSetAppearance, Direction.Outgoing,new PacketDelegate(ApHand));
        }
Ejemplo n.º 5
0
        private void Init(string[] args, ProxyConfig proxyConfig)
        {
            //bool externalPlugin = false;
            this.args = args;

            if (proxyConfig == null)
            {
                proxyConfig = new ProxyConfig("GridProxy", "Austin Jennings / Andrew Ortman", args);
            }
            proxy = new Proxy(proxyConfig);

            // add delegates for login
            proxy.AddLoginRequestDelegate(new XmlRpcRequestDelegate(LoginRequest));
            proxy.AddLoginResponseDelegate(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);

                        Logger.Log("arg '" + sw + "' val '" + val + "'", Helpers.LogLevel.Debug);

                        if (sw == "--load")
                        {
                            //externalPlugin = true;
                            LoadPlugin(val);
                        }
                    }
                }

            commandDelegates["/load"] = new CommandDelegate(CmdLoad);
       }
        public SetFollowCamPropertiestForm()
        {
            string file = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;

            string port = "8080";
            //string listenIP = "138.251.194.192";
            string listenIP = "127.0.0.1";
            string loginURI = "http://apollo.cs.st-andrews.ac.uk:8002";

            string portArg = "--proxy-login-port="+port;
            string listenIPArg = "--proxy-client-facing-address="+listenIP;
            string loginURIArg = "--proxy-remote-login-uri="+loginURI;
            string[] args = { portArg, listenIPArg, loginURIArg };
            ProxyConfig config = new ProxyConfig("Routing God", "*****@*****.**", args);
            mProxy = new Proxy(config);
            mProxy.AddLoginResponseDelegate(response => {
                mLoggedIn = true;
                return response;
            });
            mProxy.AddDelegate(PacketType.ObjectUpdate, Direction.Incoming, (p, ep) => {
                ObjectUpdatePacket packet = (ObjectUpdatePacket) p;
                foreach (var block in packet.ObjectData) {
                    if (block.PCode == (byte) PCode.Avatar) {
                        string name = Utils.BytesToString(block.NameValue);
                        name = name.Replace("STRING RW SV ", "");
                        string[] tokens = name.Split(' ', '\n');
                        string firstName = tokens[1];
                        string lastName = tokens[3];
                        string title = tokens.Length > 5 ? tokens[5] : "";

                        //avatarsListBox.DataSource = avatarsBindingSource;
                        avatarsBindingSource.Add(new Avatar(firstName, lastName, block.ID, block.FullID));

                        Console.WriteLine("\n\n Added " + firstName + " " + lastName + ".\n\n");
                    }
                }
                //"FirstName STRING RW SV Routing\nLastName STRING RW SV God\nTitle STRING RW SV "
                return packet;
            });

            InitializeComponent();

            focusRotationPanel.Vector = Vector3.UnitX;
        }
        public void Connect(string masterAddress, string listeningAddress, int masterXmlRpcPort, int port, int xmlRpcPort)
        {
            //socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            //socket.Bind(new IPEndPoint(IPAddress.Parse(listeningIP), port));
            //socket.BeginReceiveFrom(receiveBuffer, 0, receiveBuffer.Length, SocketFlags.None, ref remoteEndPoint, new AsyncCallback(ProcessPacket), null);

            IMasterProxy master = XmlRpcProxyGen.Create<IMasterProxy>();
            master.Url = "http://"+masterAddress+":"+masterXmlRpcPort+"/Master.rem";

            new Thread(() => {
                int masterPort = master.Register(name, listeningAddress, port, xmlRpcPort);

                IPAddress masterIP = GetAddress(masterAddress);
                IPAddress listenIP = GetAddress(listeningAddress);

                string serverListenIPArg = "--proxy-remote-facing-address=" + listenIP.ToString();
                string serverListenPortArg = "--proxy-remote-facing-port=" + port;
                string clientLoginPortArg = "--proxy-login-port=0"; //Never going to be used. No one will ever connect to this proxy.
                string loginURIArg = "--proxy-remote-login-uri=http://http://localhost:9000";
                string[] args = { serverListenIPArg, serverListenPortArg, clientLoginPortArg, loginURIArg };
                ProxyConfig config = new ProxyConfig("Routing God", "*****@*****.**", args);
                proxy = new Proxy(config);
                proxy.ActiveCircuit = new IPEndPoint(masterIP, masterPort);

                foreach (PacketType pt in Enum.GetValues(typeof(PacketType)))
                    proxy.AddDelegate(pt, Direction.Incoming, ProcessPacket);

                proxy.Start();

            }).Start();
        }
        public bool Start()
        {
            if (mConfig == null)
                throw new ArgumentException("Unable to start proxy. No configuration specified.");
            try {
                mLoggedIn = false;
                mLastUpdatePacket = DateTime.UtcNow;
                mProxy = new Proxy(mConfig);
                mProxy.AddLoginResponseDelegate(mProxy_LoginResponse);
                mProxy.AddDelegate(PacketType.AgentUpdate, Direction.Outgoing, mProxy_AgentUpdatePacketReceived);
                if (mViewerConfig.GetLocalID) {
                    mLocalID = 0;
                    mProxy.AddDelegate(PacketType.ObjectUpdate, Direction.Incoming, mObjectUpdateListener);
                }

                ThisLogger.Info("Proxying " + mConfig.remoteLoginUri);
                mProxy.Start();

                if (pPositionChanged != null)
                    mProxy.AddDelegate(PacketType.AgentUpdate, Direction.Outgoing, mAgentUpdateListener);

                if (ProxyStarted != null)
                    ProxyStarted();

                stopping = false;
                mCanncelTockenSource = new CancellationTokenSource();

                new Thread(() =>
                {
                    AgentUpdatePacket packet;
                    while (!stopping)
                    {
                        try
                        {
                            packet = agentUpdatePacketQueue.Take(mCanncelTockenSource.Token);
                        }
                        catch (OperationCanceledException)
                        {
                            return;
                        }

                        Vector3 pos = packet.AgentData.CameraCenter;

                        if (mFrame.Core.ControlMode == ControlMode.Absolute)
                        {
                            //new Thread(() => {
                            if (mViewerConfig.CheckForPause)
                            {
                                string key = MakeKey(pos);
                                lock (mUnackedUpdates)
                                {
                                    if (mUnackedUpdates.ContainsKey(key))
                                        mUnackedUpdates.Remove(key);
                                }

                                CheckForPause();
                            }
                            //}).Start();
                        }

                        if (pPositionChanged != null)
                            pPositionChanged(pos, new Rotation(packet.AgentData.CameraAtAxis));
                    }
                }).Start();

                new Thread(() =>
                {
                    ImprovedTerseObjectUpdatePacket packet;
                    while (!stopping)
                    {
                        try
                        {
                            packet = objectUpdatePacketQueue.Take(mCanncelTockenSource.Token);
                        }
                        catch (OperationCanceledException)
                        {
                            return;
                        }

                        foreach (var block in packet.ObjectData)
                        {
                            uint localid = Utils.BytesToUInt(block.Data, 0);

                            if (block.Data[0x5] != 0 && localid == mLocalID)
                            {
                                mAvatarPosition = new Vector3(block.Data, 0x16);
                                mPositionOffset = mAvatarPosition - mFrame.Core.Position;
                                Quaternion rotation = Quaternion.Identity;

                                // Rotation (theta)
                                rotation = new Quaternion(
                                    Utils.UInt16ToFloat(block.Data, 0x2E, -1.0f, 1.0f),
                                    Utils.UInt16ToFloat(block.Data, 0x2E + 2, -1.0f, 1.0f),
                                    Utils.UInt16ToFloat(block.Data, 0x2E + 4, -1.0f, 1.0f),
                                    Utils.UInt16ToFloat(block.Data, 0x2E + 6, -1.0f, 1.0f));

                                mAvatarOrientation = new Rotation(rotation);
                                //mAvatarOrientation = Frame.Core.Orientation;
                            }
                        }
                    }
                }).Start();
            } catch (NullReferenceException e) {
                //Logger.Info("Unable to start proxy. " + e.Message);
                mProxy = null;
                return false;
            }

            return true;
        }
Ejemplo n.º 9
0
 public IMLocatePlugin(PubComb plug)
 {
     form = new IMHistForm1(this);
     //    Application.Run(form);
     //}));
     //formthread.SetApartmentState(ApartmentState.STA);
     //formthread.Start();
     plugin = plug;
     this.frame = plug.frame;
     this.proxy = plug.proxy;
     //this.brand = "IMLocate";
     proxy.AddDelegate(PacketType.ImprovedInstantMessage, Direction.Incoming, new PacketDelegate(IMs));
 }
Ejemplo n.º 10
0
Archivo: CliInt.cs Proyecto: zadark/par
 public CliIntPlugin(PubComb plug)
 {
     plugin = plug;
     form = new CliIntForm1(this);
     //plug.tabform.addATab(form, "CliInt");
     this.frame = plug.frame;
     this.proxy = plug.proxy;
     proxy.AddDelegate(PacketType.AlertMessage, Direction.Incoming, new PacketDelegate(this.InAlertMessageHandler));
     proxy.AddDelegate(PacketType.ObjectUpdate, Direction.Incoming, new PacketDelegate(this.UpdateHandler));
     proxy.AddDelegate(PacketType.ImprovedTerseObjectUpdate, Direction.Incoming, new PacketDelegate(this.TerseUpdateHandler));
     interceptor.Name = "idontexist";
 }