Windows XP Значение ключевого слова свойства файла чтения с использованием c# - PullRequest
0 голосов
/ 19 июня 2020

Необходимо получить значения сводки свойств файла (заголовок, автор, ключевые слова ..)

с приведенным ниже кодом с использованием «Microsoft Shell Controls and Automation» (shell32.dll), я должен получить большинство значений метаданных, кроме ключевых слов

                // Creating a ShellClass Object from the Shell32
                ShellClass sh = new ShellClass();
                // Creating a Folder Object from Folder that inculdes the File
                Folder dir = sh.NameSpace( Path.GetDirectoryName( sFile ) );
                // Creating a new FolderItem from Folder that includes the File
                FolderItem item = dir.ParseName( Path.GetFileName( sFile ) );
                // loop throw the Folder Items
                for( int i = 0; i < 30; i++ ) {
                    // read the current detail Info from the FolderItem Object
                    //(Retrieves details about an item in a folder. For example, its size, type, or the time of its last modification.)
                    // some examples:
                    // 0 Retrieves the name of the item. 
                    // 1 Retrieves the size of the item. 
                    // 2 Retrieves the type of the item. 
                    // 3 Retrieves the date and time that the item was last modified. 
                    // 4 Retrieves the attributes of the item. 
                    // -1 Retrieves the info tip information for the item. 

                    string det = dir.GetDetailsOf( item, i );
                    // Create a helper Object for holding the current Information
                    // an put it into a ArrayList
                    DetailedFileInfo oFileInfo = new DetailedFileInfo(i,det);
                    aReturn.Add(oFileInfo);
                }

Также пробовал : Здесь класс ShellFile не поддерживается на машине Windows XP.

var shellFile = ShellFile.FromFilePath(sFPath);

            var tags = (string[])shellFile.Properties.System.Keywords.ValueAsObject;
            tags = tags ?? new string[0];

            if (tags.Length != 0)
            {
                foreach (string str in tags)
                {
                    // code here
                }
            }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...