public IntPtr Open(string fileName) { if (_handle == IntPtr.Zero) { return(IntPtr.Zero); } if (_mustUseAnsi) { IntPtr result; using (var fileNameMemory = GlobalMemory.StringToGlobalAnsi(fileName)) { result = NativeMethods.MediaInfoA_Open(_handle, fileNameMemory.Handle); } return(result); } return(NativeMethods.MediaInfo_Open(_handle, fileName)); }
public string Option(string option, string value) { if (_handle == IntPtr.Zero) { return("Unable to load MediaInfo library"); } if (_mustUseAnsi) { string result; using (var optionPtr = GlobalMemory.StringToGlobalAnsi(option)) using (var valuePtr = GlobalMemory.StringToGlobalAnsi(value)) { result = Marshal.PtrToStringAnsi(NativeMethods.MediaInfoA_Option(_handle, optionPtr.Handle, valuePtr.Handle)); } return(result); } return(Marshal.PtrToStringUni(NativeMethods.MediaInfo_Option(_handle, option, value))); }
public string Get(StreamKind streamKind, int streamNumber, string parameter, InfoKind kindOfInfo, InfoKind kindOfSearch) { if (_handle == IntPtr.Zero) { return("Unable to load MediaInfo library"); } if (_mustUseAnsi) { string result; using (var parameterPtr = GlobalMemory.StringToGlobalAnsi(parameter)) { result = Marshal.PtrToStringAnsi( NativeMethods.MediaInfoA_Get( _handle, (IntPtr)streamKind, (IntPtr)streamNumber, parameterPtr.Handle, (IntPtr)kindOfInfo, (IntPtr)kindOfSearch)); } return(result); } return (Marshal.PtrToStringUni( NativeMethods.MediaInfo_Get( _handle, (IntPtr)streamKind, (IntPtr)streamNumber, parameter, (IntPtr)kindOfInfo, (IntPtr)kindOfSearch))); }