public static Task OpenHexEditorAsync(SM64Lib.Script.ICommand cmd) { var t = new Task(() => OpenHexEditor(cmd)); t.Start(); return(t); }
private void EditHex() { var po = PaintingControl1.SelectedObjects.FirstOrDefault(); if (po is object) { SM64Lib.Script.ICommand cmd = dicCommands[po.Name]; General.OpenHexEditor(cmd); po.Text = cmd.ToString(); PaintingControl1.Refresh(); } }
public static void OpenHexEditor(SM64Lib.Script.ICommand cmd) { BinaryData data = (BinaryData)cmd; // Copy content of command to a buffer var buffer = new byte[(int)(data.Length - 1) + 1]; data.Position = 0; data.Read(buffer); // Let edit the buffer OpenHexEditor(ref buffer); // Copy content of buffer back to command data.SetLength(buffer.Length); data.Position = 0; data.Write(buffer); }