public static void ThrowOnError(this MobileBackup2Error value, string message)
 {
     if ((value != MobileBackup2Error.Success))
     {
         throw new MobileBackup2Exception(value, message);
     }
 }
Пример #2
0
        public static MobileBackup2Error mobilebackup2_receive_message(MobileBackup2ClientHandle client, out PlistHandle msgPlist, out string dlmessage)
        {
            System.Runtime.InteropServices.ICustomMarshaler dlmessageMarshaler = NativeStringMarshaler.GetInstance(null);
            System.IntPtr      dlmessageNative = System.IntPtr.Zero;
            MobileBackup2Error returnValue     = MobileBackup2NativeMethods.mobilebackup2_receive_message(client, out msgPlist, out dlmessageNative);

            dlmessage = ((string)dlmessageMarshaler.MarshalNativeToManaged(dlmessageNative));
            dlmessageMarshaler.CleanUpNativeData(dlmessageNative);
            return(returnValue);
        }
 public static bool IsError(this MobileBackup2Error value)
 {
     return(value != MobileBackup2Error.Success);
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MobileBackup2Exception"/> class with a specified error code and error message.
 /// <summary>
 /// <param name="error">
 /// The error code of the error that occurred.
 /// </param>
 /// <param name="message">
 /// A message which describes the error.
 /// </param>
 public MobileBackup2Exception(MobileBackup2Error error, string message) :
     base(string.Format("An MobileBackup2 error occurred. {1}. The error code was {0}", error, message))
 {
     this.errorCode = error;
 }