예제 #1
0
        public static Task OpenHexEditorAsync(SM64Lib.Script.ICommand cmd)
        {
            var t = new Task(() => OpenHexEditor(cmd));

            t.Start();
            return(t);
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
        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);
        }