public void SendCommand(string EndPoint, object Command, SendCommandDelegate Done)
        {
            // host:port



            Action TrySend =
                delegate
            {
                var TargetUri = "http://" + EndPoint + this.PathPrefix + "/" + CommandToString(Command);

                Console.WriteLine("<< " + TargetUri);

                var Target = new Uri(TargetUri);

                var r = new TrivialWebRequest
                {
                    Port            = Target.Port,
                    Referer         = "http://example.com",
                    Target          = Target,
                    ContentExpected = true
                };

                r.Invoke();

                Done(r.Content);
            };

            TrySend.TryInvokeInBackground();
        }
Exemplo n.º 2
0
 public void RemoveOnSendCommand(string cmd, SendCommandDelegate func)
 {
     if (allCommand.ContainsKey(cmd))
     {
         allCommand[cmd].Remove(func);
     }
 }
Exemplo n.º 3
0
        public void AddOnSendCommand(string cmd, SendCommandDelegate func)
        {
            if (string.IsNullOrEmpty(cmd))
            {
                return;
            }

            if (!allCommand.ContainsKey(cmd) || allCommand[cmd] == null)
            {
                allCommand.Add(cmd, new List <SendCommandDelegate>());
            }
            allCommand[cmd].Add(func);
        }
Exemplo n.º 4
0
        private void InitDelegates(DalamudPluginInterface plugin)
        {
            var scanner     = plugin.TargetModuleScanner;
            var sendCmdAddr = scanner.ScanText("48895C24??48896C24??48897424??574881EC????????488B05????????4833C448898424????????8BE9418BD9488B0D????????418BF88BF2");

            if (sendCmdAddr != IntPtr.Zero)
            {
                _sendCommand = Marshal.GetDelegateForFunctionPointer <SendCommandDelegate>(sendCmdAddr);
            }
            else
            {
                _plugin.LogError("sendCmdAddr is null.");
            }

            var getLocationsAddr = scanner.ScanText("48895C24??5557415441554156488DAC24????????4881EC");

            if (getLocationsAddr != IntPtr.Zero)
            {
                _getAvalibleLocationList = Marshal.GetDelegateForFunctionPointer <GetAvalibleLocationListDelegate>(getLocationsAddr);
            }
            else
            {
                _plugin.LogError("getLocationsAddr is null.");
            }

            var tryTicketTpAddr = scanner.ScanText("48895C24??48897424??574883EC??8079??00410FB6F88BF2");

            if (tryTicketTpAddr != IntPtr.Zero)
            {
                _tryTeleportWithTicket = Marshal.GetDelegateForFunctionPointer <TryTeleportWithTicketDelegate>(tryTicketTpAddr);
                _tpTicketHook          = new Hook <TryTeleportWithTicketDelegate>(tryTicketTpAddr, new TryTeleportWithTicketDelegate(TicketTpHook));
                _tpTicketHook.Enable();
            }
            else
            {
                _plugin.LogError("tryTicketTpAddr is null.");
            }

            var getItemCountAddr = scanner.ScanText("48895C24??48896C24??48897424??48897C24??4154415641574883EC??33??8D");

            if (getItemCountAddr != IntPtr.Zero)
            {
                _getItemCount = Marshal.GetDelegateForFunctionPointer <GetItemCountDelegate>(getItemCountAddr);
            }
            else
            {
                _plugin.LogError("getItemCountAddr is null.");
            }
        }
Exemplo n.º 5
0
 public void RemoveOnFailedCommand(SendCommandDelegate func)
 {
     OnFailedCommand -= func;
 }
Exemplo n.º 6
0
 public void AddOnFailedCommand(SendCommandDelegate func)
 {
     OnFailedCommand += func;
 }
Exemplo n.º 7
0
 public void RemoveOnSucessedCommand(SendCommandDelegate func)
 {
     OnSucessedCommand -= func;
 }
Exemplo n.º 8
0
 public void AddOnSucessedCommand(SendCommandDelegate func)
 {
     OnSucessedCommand += func;
 }
Exemplo n.º 9
0
 public void RemoveOnWriteCommand(SendCommandDelegate func)
 {
     OnWriteCommand -= func;
 }
Exemplo n.º 10
0
 public void AddOnWriteCommand(SendCommandDelegate func)
 {
     OnWriteCommand += func;
 }
		public void SendCommand(string EndPoint, object Command, SendCommandDelegate Done)
		{
			// host:port



			Action TrySend =
				delegate
				{


					var TargetUri = "http://" + EndPoint + this.PathPrefix + "/" + CommandToString(Command);

					Console.WriteLine("<< " + TargetUri);

					var Target = new Uri(TargetUri);

					var r = new TrivialWebRequest
					{
						Port = Target.Port,
						Referer = "http://example.com",
						Target = Target,
						ContentExpected = true
					};
					
					r.Invoke();

					Done(r.Content);
				};

			TrySend.TryInvokeInBackground();
		}