public static void ThrowOnError(this AfcError value, string message) { if ((value != AfcError.Success)) { throw new AfcException(value, message); } }
public static AfcError afc_get_device_info_key(AfcClientHandle client, string key, out string value) { System.Runtime.InteropServices.ICustomMarshaler valueMarshaler = NativeStringMarshaler.GetInstance(null); System.IntPtr valueNative = System.IntPtr.Zero; AfcError returnValue = AfcNativeMethods.afc_get_device_info_key(client, key, out valueNative); value = ((string)valueMarshaler.MarshalNativeToManaged(valueNative)); valueMarshaler.CleanUpNativeData(valueNative); return(returnValue); }
public static AfcError afc_get_file_info(AfcClientHandle client, string filename, out System.Collections.ObjectModel.ReadOnlyCollection <string> fileInformation) { System.Runtime.InteropServices.ICustomMarshaler fileInformationMarshaler = AfcDictionaryMarshaler.GetInstance(null); System.IntPtr fileInformationNative = System.IntPtr.Zero; AfcError returnValue = AfcNativeMethods.afc_get_file_info(client, filename, out fileInformationNative); fileInformation = ((System.Collections.ObjectModel.ReadOnlyCollection <string>)fileInformationMarshaler.MarshalNativeToManaged(fileInformationNative)); fileInformationMarshaler.CleanUpNativeData(fileInformationNative); return(returnValue); }
public static AfcError afc_read_directory(AfcClientHandle client, string path, out System.Collections.ObjectModel.ReadOnlyCollection <string> directoryInformation) { System.Runtime.InteropServices.ICustomMarshaler directoryInformationMarshaler = AfcDictionaryMarshaler.GetInstance(null); System.IntPtr directoryInformationNative = System.IntPtr.Zero; AfcError returnValue = AfcNativeMethods.afc_read_directory(client, path, out directoryInformationNative); directoryInformation = ((System.Collections.ObjectModel.ReadOnlyCollection <string>)directoryInformationMarshaler.MarshalNativeToManaged(directoryInformationNative)); directoryInformationMarshaler.CleanUpNativeData(directoryInformationNative); return(returnValue); }
public static bool IsError(this AfcError value) { return(value != AfcError.Success); }
/// <summary> /// Initializes a new instance of the <see cref="AfcException"/> 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 AfcException(AfcError error, string message) : base(string.Format("An Afc error occurred. {1}. The error code was {0}", error, message)) { this.errorCode = error; }
/// <summary> /// Initializes a new instance of the <see cref="AfcException"/> class with a specified error code. /// <summary> /// <param name="error"> /// The error code of the error that occurred. /// </param> public AfcException(AfcError error) : base(string.Format("An Afc error occurred. The error code was {0}", error)) { this.errorCode = error; }