private void SetParam(MetadataEditorAttr attr, string value) { if (_isFileReadOnly) { throw new InvalidOperationException("The media file is read-only."); } Interop.MetadataEditor.SetMetadata(Handle, attr, value).ThrowIfError("Failed to set value"); }
private string GetParam(MetadataEditorAttr attr) { IntPtr val = IntPtr.Zero; try { Interop.MetadataEditor.GetMetadata(Handle, attr, out val) .ThrowIfError("Failed to get metadata"); return(Marshal.PtrToStringAnsi(val)); } finally { Interop.Libc.Free(val); } }
internal static extern MetadataEditorError SetMetadata(IntPtr handle, MetadataEditorAttr attribute, string value);
internal static extern MetadataEditorError GetMetadata(IntPtr handle, MetadataEditorAttr attribute, out IntPtr value);