使用C#将扩展属性写入MKV文件

时间:2019-03-01 08:59:30

标签: c# windows mkv

我无法将扩展属性标题写入mkv文件。

我正在使用Windows API Code Pack 1.1


C#

来源:https://stackoverflow.com/a/37987288/6806643

using Microsoft.WindowsAPICodePack.Shell;
using Microsoft.WindowsAPICodePack.Shell.PropertySystem;

// Get File
var file = ShellFile.FromFilePath(@"C:\Path\To\File.mkv");

// Write Extended Properties
ShellPropertyWriter propertyWriter = file.Properties.GetPropertyWriter();
propertyWriter.WriteProperty(SystemProperties.System.Title, new string[] { "New Title" });
propertyWriter.Close();

错误:

  

“无法获得此属性的可写属性存储。”


在Windows 10上手动安装

我尝试通过以下方式更改mkv属性:

  1. 右键单击文件
  2. 属性
  3. “详细信息”标签
  4. 删除属性和个人信息链接
  5. 以管理员身份继续

错误:

  

“并非所有个人财产都被清除。
  Windows无法删除所选文件的属性。”

     

“您需要权限才能执行此操作”


我知道MKVToolNix之类的程序可以复用一个新文件的副本并更改属性,但是我试图使用仅具有C#的Windows功能来编辑现有文件。

我在Microsoft论坛上发现了这个线程,解释了类似的问题:

https://answers.microsoft.com/en-us/windows/forum/all/you-need-permission-to-perform-this-action-when/b8e0e58f-577a-4db7-a302-dde58bbb57c8?page=1

0 个答案:

没有答案
相关问题