Mosa.FileSystem.FAT.FatFileSystem.ExtractFileName C# (CSharp) Метод

ExtractFileName() статический приватный Метод

Extracts the name of the file.
static private ExtractFileName ( byte directory, uint index ) : string
directory byte The directory.
index uint The index.
Результат string
        internal static string ExtractFileName(byte[] directory, uint index)
        {
            // rewrite to use string
            var entry = new BinaryFormat(directory);

            var name = new char[12];

            for (uint i = 0; i < 8; i++)
                name[i] = (char)entry.GetByte(index + i + Entry.DOSName);

            int len = 8;

            for (int i = 7; i > 0; i--)
                if (name[i] == ' ')
                    len--;
                else
                    break;

            // special case where real character is same as the delete
            if ((len >= 1) && (name[0] == (char)FileNameAttribute.Escape))
                name[0] = (char)FileNameAttribute.Deleted;

            name[len] = '.';

            len++;

            for (uint i = 0; i < 3; i++)
                name[len + i] = (char)entry.GetByte(index + i + Entry.DOSExtension);

            len = len + 3;

            int spaces = 0;
            for (int i = len - 1; i >= 0; i--)
                if (name[i] == ' ')
                    spaces++;
                else
                    break;

            if (spaces == 3)
                spaces = 4;

            len = len - spaces;

            // FIXME
            string str = string.Empty;

            for (uint i = 0; i < len; i++)
                str = str + name[i];

            return str;
        }