using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Diagnostics;namespace mgen_simglefileinfo{ class FileVersionHelper { static Dictionary<string, string> names; static FileVersionHelper() { names = new Dictionary<string, string>() { {"注释", "Comments"}, {"公司名称", "CompanyName"}, {"文件名称", "FileName"}, {"文件版本", "FileVersion"}, {"内部名称", "InternalName"}, {"调试版本", "IsDebug"}, {"补丁版本", "IsPatched"}, {"语言", "Language"}, {"版权", "LegalCopyright"}, {"商标", "LegalTrademarks"}, {"原始文件名称", "OriginalFilename"}, {"产品名称", "ProductName"}, {"产品版本", "ProductVersion"} }; } public static Tuple<string, object>[] GetInfo(string file) { var info = FileVersionInfo.GetVersionInfo(file); return names.Select(n => new Tuple<string, object>( n.Key, typeof(FileVersionInfo).GetProperty(n.Value).GetValue(info, null) ?? (object)"无")).ToArray(); } }}
评论