public string NextCommand() { SafeCommandHandle command = null; try { uint length; IntPtr ptr; ErrorCode result = NativeMethods.windower_next_command(this.handle, out command); if (result == ErrorCode.OutOfRange) { return(null); } WindowerException.Check(result); WindowerException.Check(NativeMethods.windower_command_length(command, out length)); WindowerException.Check(NativeMethods.windower_command_string(command, out ptr)); byte[] buffer = new byte[length]; Marshal.Copy(ptr, buffer, 0, (int)length); return(UTF8.GetString(buffer)); } finally { if (command != null) { command.Dispose(); } } }
internal static extern ErrorCode windower_command_length(SafeCommandHandle handle, out uint result);
internal static extern ErrorCode windower_command_string(SafeCommandHandle handle, out IntPtr result);
internal static extern ErrorCode windower_next_command(SafeInstanceHandle handle, out SafeCommandHandle result);