/// <summary>Initializes a new instance of the <see cref="FileDescriptor" /> class.</summary>
        /// <param name="fileDescriptorByte">The file descriptor byte that shall be parsed.</param>
        public FileDescriptor(byte fileDescriptorByte)
        {
            Descriptor = fileDescriptorByte;

            Type = Descriptor.IsSet(FILE_TYPE_MASK, FILE_TYPE_DF)
                ? FileType.Dedicated
                : FileType.Elementary;

            // ExtendedType
            if (Descriptor.IsSet(FILE_TYPE_MASK, FILE_TYPE_DF))
            {
                ExtendedType = ExtendedFileType.Dedicated;
            }
            else if (Descriptor.IsSet(FILE_TYPE_MASK, FILE_TYPE_WORKING_EF))
            {
                ExtendedType = ExtendedFileType.WorkingElementary;
            }
            else if (Descriptor.IsSet(FILE_TYPE_MASK, FILE_TYPE_INTERNAL_EF))
            {
                ExtendedType = ExtendedFileType.InternalElementary;
            }
            else
            {
                ExtendedType = ExtendedFileType.Proprietary;
            }

            ShareMode = Descriptor.IsSet(FILE_SHARE_MODE_MASK, FILE_SHARE_MODE_SHAREABLE)
                ? FileShareMode.Shareable
                : FileShareMode.NotShareable;

            _fileStructureInfoCache = null;
        }
Ejemplo n.º 2
0
        protected void UpdateFileInfo()
        {
            // Type
            if (SCardHelper.IsSet(filedescriptor, FILE_TYPE_MASK, FILE_TYPE_DF))
                _type = FileType.Dedicated;
            else
                _type = FileType.Elementary;

            // ExtendedType
            if (SCardHelper.IsSet(filedescriptor, FILE_TYPE_MASK, FILE_TYPE_DF))
                _extendedtype = ExtendedFileType.Dedicated;
            else if (SCardHelper.IsSet(filedescriptor, FILE_TYPE_MASK, FILE_TYPE_WORKING_EF))
                _extendedtype = ExtendedFileType.WorkingElementary;
            else if (SCardHelper.IsSet(filedescriptor, FILE_TYPE_MASK, FILE_TYPE_INTERNAL_EF))
                _extendedtype = ExtendedFileType.InternalElementary;
            else _extendedtype = ExtendedFileType.Proprietary;

            // ShareMode
            if (SCardHelper.IsSet(filedescriptor, FILE_SHARE_MODE_MASK, FILE_SHARE_MODE_SHAREABLE))
                _sharemode = FileShareMode.Shareable;
            else
                _sharemode = FileShareMode.NotShareable;

            _filestructureinfo = null;
        }