Esempio n. 1
0
        /// <summary>
        /// Creates a new <see cref="MobileSyncAnchorsHandle"/> 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 MobileSyncAnchorsHandle DangerousCreate(System.IntPtr unsafeHandle, bool ownsHandle)
        {
            MobileSyncAnchorsHandle safeHandle = new MobileSyncAnchorsHandle(ownsHandle);

            safeHandle.SetHandle(unsafeHandle);
            return(safeHandle);
        }
Esempio n. 2
0
 /// <summary>
 /// Creates a new <see cref="MobileSyncAnchorsHandle"/> from a <see cref="IntPtr"/>.
 /// </summary>
 /// <param name="unsafeHandle">
 /// The underlying <see cref="IntPtr"/>
 /// </param>
 /// <returns>
 /// </returns>
 public static MobileSyncAnchorsHandle DangerousCreate(System.IntPtr unsafeHandle)
 {
     return(MobileSyncAnchorsHandle.DangerousCreate(unsafeHandle, true));
 }
Esempio n. 3
0
        public static MobileSyncError mobilesync_start(MobileSyncClientHandle client, byte[] dataClass, MobileSyncAnchorsHandle anchors, ulong computerDataClassVersion, ref MobileSyncSyncType syncType, ref ulong deviceDataClassVersion, out string errorDescription)
        {
            System.Runtime.InteropServices.ICustomMarshaler errorDescriptionMarshaler = NativeStringMarshaler.GetInstance(null);
            System.IntPtr   errorDescriptionNative = System.IntPtr.Zero;
            MobileSyncError returnValue            = MobileSyncNativeMethods.mobilesync_start(client, dataClass, anchors, computerDataClassVersion, ref syncType, ref deviceDataClassVersion, out errorDescriptionNative);

            errorDescription = ((string)errorDescriptionMarshaler.MarshalNativeToManaged(errorDescriptionNative));
            errorDescriptionMarshaler.CleanUpNativeData(errorDescriptionNative);
            return(returnValue);
        }
 public static extern MobileSyncError mobilesync_anchors_new([System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string deviceAnchor, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string computerAnchor, out MobileSyncAnchorsHandle anchor);
 public static extern MobileSyncError mobilesync_start(MobileSyncClientHandle client, byte[] dataClass, MobileSyncAnchorsHandle anchors, ulong computerDataClassVersion, ref MobileSyncSyncType syncType, ref ulong deviceDataClassVersion, out System.IntPtr errorDescription);
        /// <summary>
        /// Allocates memory for a new anchors struct initialized with the passed anchors.
        /// MOBILESYNC_E_SUCCESS on success
        /// </summary>
        /// <param name="device_anchor">
        /// An anchor the device reported the last time or NULL
        /// if none is known yet which for instance is true on first synchronization.
        /// </param>
        /// <param name="computer_anchor">
        /// An arbitrary string to use as anchor for the computer.
        /// </param>
        /// <param name="client">
        /// Pointer that will be set to a newly allocated
        /// #mobilesync_anchors_t struct. Must be freed using mobilesync_anchors_free().
        /// </param>
        public virtual MobileSyncError mobilesync_anchors_new(string deviceAnchor, string computerAnchor, out MobileSyncAnchorsHandle anchor)
        {
            MobileSyncError returnValue;

            returnValue = MobileSyncNativeMethods.mobilesync_anchors_new(deviceAnchor, computerAnchor, out anchor);
            anchor.Api  = this.Parent;
            return(returnValue);
        }
 /// <summary>
 /// Requests starting synchronization of a data class with the device
 /// MOBILESYNC_E_SUCCESS on success
 /// MOBILESYNC_E_INVALID_ARG if one of the parameters is invalid
 /// MOBILESYNC_E_PLIST_ERROR if the received plist is not of valid form
 /// MOBILESYNC_E_SYNC_REFUSED if the device refused to sync
 /// MOBILESYNC_E_CANCELLED if the device explicitly cancelled the
 /// sync request
 /// </summary>
 /// <param name="client">
 /// The mobilesync client
 /// </param>
 /// <param name="data_class">
 /// The data class identifier to sync
 /// </param>
 /// <param name="anchors">
 /// The anchors required to exchange with the device. The anchors
 /// allow the device to tell if the synchronization information on the computer
 /// and device are consistent to determine what sync type is required.
 /// </param>
 /// <param name="computer_data_class_version">
 /// The version of the data class storage on the computer
 /// </param>
 /// <param name="sync_type">
 /// A pointer to store the sync type reported by the device_anchor
 /// </param>
 /// <param name="device_data_class_version">
 /// The version of the data class storage on the device
 /// </param>
 /// <param name="error_description">
 /// A pointer to store an error message if reported by the device
 /// </param>
 public virtual MobileSyncError mobilesync_start(MobileSyncClientHandle client, byte[] dataClass, MobileSyncAnchorsHandle anchors, ulong computerDataClassVersion, ref MobileSyncSyncType syncType, ref ulong deviceDataClassVersion, out string errorDescription)
 {
     return(MobileSyncNativeMethods.mobilesync_start(client, dataClass, anchors, computerDataClassVersion, ref syncType, ref deviceDataClassVersion, out errorDescription));
 }
Esempio n. 8
0
 public object MarshalNativeToManaged(System.IntPtr nativeData)
 {
     return(MobileSyncAnchorsHandle.DangerousCreate(nativeData, false));
 }