public void LogError(string message, string detail_message = "") { //if (!Config.PrintError) return; var msg = $"[{Name}] {message}"; PluginLog.LogError(detail_message == "" ? msg : detail_message); ChatGui.PrintError(msg); }
public void LogError(string message) { if (!Config.PrintError) { return; } var msg = $"[{Name}] {message}"; PluginLog.LogError(msg); ChatGui.PrintError(msg); }
public Plugin( [RequiredVersion("1.0")] DalamudPluginInterface pluginInterface, [RequiredVersion("1.0")] CommandManager commandManager, ClientState clientState, SigScanner sigScanner, ChatGui chatGui) { PluginInterface = pluginInterface; CommandManager = commandManager; Configuration = PluginInterface.GetPluginConfig() as Configuration ?? new Configuration(); Interface = new Interface(); Commands.Add((s, t) => Interface.Show(), "/customize", "Opens the customize plus window"); PluginInterface.UiBuilder.Draw += Interface.Draw; PluginInterface.UiBuilder.OpenConfigUi += Interface.Show; this.clientState = clientState; try { // "Render::Manager::Render" renderManagerHook = new Hook <RenderDelegate>(sigScanner.ScanText("40 53 55 57 41 56 41 57 48 83 EC 60"), manager => { // if this gets disposed while running we crash calling Original's getter, so get it at start var original = renderManagerHook.Original; try { if (!updateFailed) { Update(); } } catch (Exception e) { chatGui.PrintError("Failed to run CustomizePlus render hook, disabling."); PluginLog.Error($"Error in CustomizePlus render hook {e}"); updateFailed = true; } return(original(manager)); }); // Because scales all get set to 0 below, the character will be very messed up renderManagerHook.Enable(); } catch (Exception e) { PluginLog.Error($"Failed to hook Render::Manager::Render {e}"); } }
public void ExecuteCommand(string command) { try { var bytes = System.Text.Encoding.UTF8.GetBytes(command); var mem1 = Marshal.AllocHGlobal(400); var mem2 = Marshal.AllocHGlobal(bytes.Length + 30); Marshal.Copy(bytes, 0, mem2, bytes.Length); Marshal.WriteByte(mem2 + bytes.Length, 0); Marshal.WriteInt64(mem1, mem2.ToInt64()); Marshal.WriteInt64(mem1 + 8, 64); Marshal.WriteInt64(mem1 + 8 + 8, bytes.Length + 1); Marshal.WriteInt64(mem1 + 8 + 8 + 8, 0); ProcessChatBox(uiModule, mem1, IntPtr.Zero, 0); Marshal.FreeHGlobal(mem1); Marshal.FreeHGlobal(mem2); } catch (Exception err) { chat.PrintError(err.Message); } }