public static bool BASS_WMA_EncodeSetTag(int handle, string tag, IntPtr value, int length) { if (handle == 0) { return(false); } if (tag == null && value == IntPtr.Zero) { return(BassWma.BASS_WMA_EncodeSetTag(handle, IntPtr.Zero, IntPtr.Zero, BASSWMATag.BASS_WMA_TAG_UNICODE)); } if (tag == null) { tag = string.Empty; } BASSWMATag type = (BASSWMATag)(1 | Utils.MakeLong(256, length)); return(BassWma.BASS_WMA_EncodeSetTagUnicode(handle, tag, value, type)); }
public unsafe static bool BASS_WMA_EncodeSetTag(int handle, string tag, string value, BASSWMATag type) { if (handle == 0) { return(false); } if (tag == null && value == null) { return(BassWma.BASS_WMA_EncodeSetTag(handle, IntPtr.Zero, IntPtr.Zero, type)); } if (tag == null) { tag = string.Empty; } else if (value == null) { value = string.Empty; } if (type == BASSWMATag.BASS_WMA_TAG_ANSI) { type = BASSWMATag.BASS_WMA_TAG_UNICODE; } if (type == BASSWMATag.BASS_WMA_TAG_UNICODE) { return(BassWma.BASS_WMA_EncodeSetTagUnicode(handle, tag, value, type)); } UTF8Encoding utf8Encoding = new UTF8Encoding(); byte[] bytes = utf8Encoding.GetBytes(tag); byte[] bytes2 = utf8Encoding.GetBytes(value); bool result; fixed(byte *ptr = bytes) { byte[] array = bytes2; byte * ptr2; if (bytes2 == null || array.Length == 0) { ptr2 = null; } else { ptr2 = (byte *)array[0]; //fixed (byte* ptr2 = &array[0]) { } } result = BassWma.BASS_WMA_EncodeSetTag(handle, (IntPtr)((void *)ptr), (IntPtr)((void *)ptr2), type); ptr2 = null; } return(result); }
private static extern bool BASS_WMA_EncodeSetTagUnicode(int handle, [MarshalAs(UnmanagedType.LPWStr)][In] string tag, IntPtr value, BASSWMATag type);
public static extern bool BASS_WMA_EncodeSetTag(int handle, IntPtr tag, IntPtr value, BASSWMATag type);