示例#1
0
        /// <summary>
        /// Request data for the given sources.
        /// </summary>
        /// <param name="client">
        /// The connected file_relay client.
        /// </param>
        /// <param name="sources">
        /// A NULL-terminated list of sources to retrieve.
        /// Valid sources are:
        /// - AppleSupport
        /// - Network
        /// - VPN
        /// - WiFi
        /// - UserDatabases
        /// - CrashReporter
        /// - tmp
        /// - SystemConfiguration
        /// </param>
        /// <param name="connection">
        /// The connection that has to be used for receiving the
        /// data using idevice_connection_receive(). The connection will be closed
        /// automatically by the device, but use file_relay_client_free() to clean
        /// up properly.
        /// </param>
        /// <param name="timeout">
        /// Maximum time in milliseconds to wait for data.
        /// </param>
        /// <returns>
        /// FILE_RELAY_E_SUCCESS on succes, FILE_RELAY_E_INVALID_ARG when one or
        /// more parameters are invalid, FILE_RELAY_E_MUX_ERROR if a communication
        /// error occurs, FILE_RELAY_E_PLIST_ERROR when the received result is NULL
        /// or is not a valid plist, FILE_RELAY_E_INVALID_SOURCE if one or more
        /// sources are invalid, FILE_RELAY_E_STAGING_EMPTY if no data is available
        /// for the given sources, or FILE_RELAY_E_UNKNOWN_ERROR otherwise.
        /// </returns>
        /// <remarks>
        /// WARNING: Don't call this function without reading the data afterwards.
        /// A directory mobile_file_relay.XXXX used for creating the archive will
        /// remain in the /tmp directory otherwise.
        /// </remarks>
        public virtual FileRelayError file_relay_request_sources(FileRelayClientHandle client, out string sources, out iDeviceConnectionHandle connection)
        {
            FileRelayError returnValue;

            returnValue    = FileRelayNativeMethods.file_relay_request_sources(client, out sources, out connection);
            connection.Api = this.Parent;
            return(returnValue);
        }
        public static FileRelayError file_relay_request_sources(FileRelayClientHandle client, out string sources, out iDeviceConnectionHandle connection)
        {
            System.Runtime.InteropServices.ICustomMarshaler sourcesMarshaler = NativeStringMarshaler.GetInstance(null);
            System.IntPtr  sourcesNative = System.IntPtr.Zero;
            FileRelayError returnValue   = FileRelayNativeMethods.file_relay_request_sources(client, out sourcesNative, out connection);

            sources = ((string)sourcesMarshaler.MarshalNativeToManaged(sourcesNative));
            sourcesMarshaler.CleanUpNativeData(sourcesNative);
            return(returnValue);
        }