/// <summary>
        /// Creates a new <see cref="DebugServerCommandHandle"/> from a <see cref="IntPtr"/>.
        /// </summary>
        /// <param name="unsafeHandle">
        /// The underlying <see cref="IntPtr"/>
        /// </param>
        /// <param name="ownsHandle">
        /// <see langword="true"/> to reliably release the handle during the finalization phase; <see langword="false"/> to prevent reliable release (not recommended).
        /// </param>
        /// <returns>
        /// </returns>
        public static DebugServerCommandHandle DangerousCreate(System.IntPtr unsafeHandle, bool ownsHandle)
        {
            DebugServerCommandHandle safeHandle = new DebugServerCommandHandle(ownsHandle);

            safeHandle.SetHandle(unsafeHandle);
            return(safeHandle);
        }
 public static extern DebugServerError debugserver_command_new([System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string name, int argc, System.IntPtr argv, out DebugServerCommandHandle command);
 public static extern DebugServerError debugserver_client_send_command(DebugServerClientHandle client, DebugServerCommandHandle command, out System.IntPtr response);
예제 #4
0
 public object MarshalNativeToManaged(System.IntPtr nativeData)
 {
     return(DebugServerCommandHandle.DangerousCreate(nativeData, false));
 }
예제 #5
0
        /// <summary>
        /// Creates and initializes a new command object.
        /// </summary>
        /// <param name="name">
        /// The name of the command which is sent in plain text
        /// </param>
        /// <param name="argv">
        /// Array of tokens for the command ment to be encoded
        /// </param>
        /// <param name="argc">
        /// Number of items in the token array
        /// </param>
        /// <param name="command">
        /// New command object
        /// </param>
        /// <returns>
        /// DEBUGSERVER_E_SUCCESS on success,
        /// DEBUGSERVER_E_INVALID_ARG when name or command is NULL
        /// </returns>
        public virtual DebugServerError debugserver_command_new(string name, int argc, System.Collections.ObjectModel.ReadOnlyCollection <string> argv, out DebugServerCommandHandle command)
        {
            DebugServerError returnValue;

            returnValue = DebugServerNativeMethods.debugserver_command_new(name, argc, argv, out command);
            command.Api = this.Parent;
            return(returnValue);
        }
예제 #6
0
 /// <summary>
 /// Sends a command to the debugserver service.
 /// </summary>
 /// <param name="client">
 /// The debugserver client
 /// </param>
 /// <param name="command">
 /// Command to process and send
 /// </param>
 /// <param name="response">
 /// Response received for the command (can be NULL to ignore)
 /// </param>
 /// <returns>
 /// DEBUGSERVER_E_SUCCESS on success,
 /// DEBUGSERVER_E_INVALID_ARG when client or command is NULL
 /// </returns>
 public virtual DebugServerError debugserver_client_send_command(DebugServerClientHandle client, DebugServerCommandHandle command, out string response)
 {
     return(DebugServerNativeMethods.debugserver_client_send_command(client, command, out response));
 }
 /// <summary>
 /// Creates a new <see cref="DebugServerCommandHandle"/> from a <see cref="IntPtr"/>.
 /// </summary>
 /// <param name="unsafeHandle">
 /// The underlying <see cref="IntPtr"/>
 /// </param>
 /// <returns>
 /// </returns>
 public static DebugServerCommandHandle DangerousCreate(System.IntPtr unsafeHandle)
 {
     return(DebugServerCommandHandle.DangerousCreate(unsafeHandle, true));
 }
예제 #8
0
        public static DebugServerError debugserver_command_new(string name, int argc, System.Collections.ObjectModel.ReadOnlyCollection <string> argv, out DebugServerCommandHandle command)
        {
            System.Runtime.InteropServices.ICustomMarshaler argvMarshaler = NativeStringArrayMarshaler.GetInstance(null);
            System.IntPtr    argvNative  = argvMarshaler.MarshalManagedToNative(argv);
            DebugServerError returnValue = DebugServerNativeMethods.debugserver_command_new(name, argc, argvNative, out command);

            return(returnValue);
        }
예제 #9
0
        public static DebugServerError debugserver_client_send_command(DebugServerClientHandle client, DebugServerCommandHandle command, out string response)
        {
            System.Runtime.InteropServices.ICustomMarshaler responseMarshaler = NativeStringMarshaler.GetInstance(null);
            System.IntPtr    responseNative = System.IntPtr.Zero;
            DebugServerError returnValue    = DebugServerNativeMethods.debugserver_client_send_command(client, command, out responseNative);

            response = ((string)responseMarshaler.MarshalNativeToManaged(responseNative));
            responseMarshaler.CleanUpNativeData(responseNative);
            return(returnValue);
        }