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