/// <summary>
        /// 获得FAT类型;
        /// </summary>
        /// <param name="stream"></param>
        /// <returns></returns>
        private static FATPartType?GetFatType(Stream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            var unManagedManager = UnMgdBasicDeviceManagerFactory.Create(stream);

            if (unManagedManager == null)
            {
                return(null);
            }

            try {
                if (unManagedManager.BasicDevicePtr == IntPtr.Zero)
                {
                    return(null);
                }
                if (Partition_B_Fat(unManagedManager.BasicDevicePtr))
                {
                    return(FATPartType.FAT32);
                }
                else if (Partition_B_Fat16(unManagedManager.BasicDevicePtr))
                {
                    return(FATPartType.FAT16);
                }
            }
            catch (Exception ex) {
                LoggerService.WriteCallerLine(ex.Message);
            }
            return(null);
        }
        /// <summary>
        /// 获取分区表类型;
        /// </summary>
        /// <param name="stream">流</param>
        /// <returns></returns>
        private static InnerPartsType?GetPartsType(Stream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            InnerPartsType?pType = null;
            IUnmanagedBasicDeviceManager unManagedManager = null;

            try {
                unManagedManager = UnMgdBasicDeviceManagerFactory.Create(stream);
            }
            catch (Exception ex) {
                LoggerService.WriteCallerLine(ex.Message);
            }

            if (unManagedManager == null)
            {
                LoggerService.WriteCallerLine($"{nameof(unManagedManager)} can't be null.");
                pType = null;
            }

            //判断是否是符合"签名";
            try {
                if (unManagedManager.BasicDevicePtr == IntPtr.Zero)
                {
                    LoggerService.WriteCallerLine($"{nameof(unManagedManager.BasicDevicePtr)} can't be nullptr.");
                }
                else if (Partition_B_Dos(unManagedManager.BasicDevicePtr))
                {
                    pType = InnerPartsType.DOS;
                }
                else if (Partition_B_Gpt(unManagedManager.BasicDevicePtr))
                {
                    pType = InnerPartsType.GPT;
                }
            }
            catch (Exception ex) {
                LoggerService.WriteCallerLine(ex.Message);
            }

            unManagedManager?.Dispose();

            return(pType);
        }
        public IFile ParseStream(Stream stream, string name, IProgressReporter reporter)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            var pType = GetPartsType(stream);

            if (pType == null)
            {
                throw new InvalidOperationException($"The {nameof(stream)} is not a valid base device stream.");
            }

            IDevice      device       = null;
            DeviceStoken deviceStoken = null;
            var          unEntity     = UnMgdBasicDeviceManagerFactory.Create(stream);

            //编辑Stoken;
            void EditStoken()
            {
                if (deviceStoken == null)
                {
                    throw new InvalidOperationException($"{nameof(deviceStoken)} can't be null.");
                }

                deviceStoken.BaseStream = stream;
                deviceStoken.BlockSize  = 512;
                deviceStoken.Name       = name;
                deviceStoken.Size       = stream.Length;
            }

            switch (pType.Value)
            {
            case InnerPartsType.DOS:
                device       = FileFactory.CreateDevice(Constants.DeviceKey_DOS);
                deviceStoken = device.GetStoken(Constants.DeviceKey_DOS);
                EditStoken();
                EditStokenOnDos(deviceStoken, unEntity);
                break;

            case InnerPartsType.GPT:
                device       = FileFactory.CreateDevice(Constants.DeviceKey_GPT);
                deviceStoken = device.GetStoken(Constants.DeviceKey_GPT);
                EditStoken();
                EditStokenOnGpt(deviceStoken, unEntity);
                break;

            default:
                break;
            }

            if (device != null)
            {
                //加载分区;
                device.FillParts(reporter);
                device.Disposing += OnDeviceDisposing;
            }


            return(device);
        }