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(); }
public void RemoveOnSendCommand(string cmd, SendCommandDelegate func) { if (allCommand.ContainsKey(cmd)) { allCommand[cmd].Remove(func); } }
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); }
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."); } }
public void RemoveOnFailedCommand(SendCommandDelegate func) { OnFailedCommand -= func; }
public void AddOnFailedCommand(SendCommandDelegate func) { OnFailedCommand += func; }
public void RemoveOnSucessedCommand(SendCommandDelegate func) { OnSucessedCommand -= func; }
public void AddOnSucessedCommand(SendCommandDelegate func) { OnSucessedCommand += func; }
public void RemoveOnWriteCommand(SendCommandDelegate func) { OnWriteCommand -= func; }
public void AddOnWriteCommand(SendCommandDelegate func) { OnWriteCommand += func; }