internal PacketAnswerFileInfo(PacketAnswer answer, string name)
 {
     if (!Init((UInt16)CommandType.File_GetFileInfo, answer))
     {
         throw WrongTypeException;
     }
     FI = new SdCardDirectoryFileInfo()
     {
         FileDirectorySize = BitConverter.ToInt32(answer.Data, 0),
         CreationTime      = new DateTime(
             HelpMethods.GetNumber(answer.Data[9], answer.Data[10]),
             answer.Data[8],
             answer.Data[7],
             answer.Data[4],
             answer.Data[5],
             answer.Data[6]
             ),
         IsHidden    = answer.Data[11] == 1,
         IsLFN       = answer.Data[12] == 1,
         IsReadOnly  = answer.Data[13] == 1,
         IsSystem    = answer.Data[14] == 1,
         IsDirectory = answer.Data[15] == 1,
         Name        = name
     };
 }
 protected bool Init(UInt16 defType, PacketAnswer answer)
 {
     Command    = defType;
     BaseAnswer = answer;
     IsEmpty    = !answer.IsEmpty && answer.Command == defType && answer.Status != AnswerStatus.Error;
     return(IsEmpty);
 }
 internal PacketAnswerCardInfo(PacketAnswer answer)
 {
     if (!Init((UInt16)CommandType.GetSDInfo, answer))
     {
         throw WrongTypeException;
     }
     CI = new CardInfo()
     {
         ManufacturerID = answer.Data[0],
         OEMID          = new string(new char[] {
             (char)answer.Data[1],
             (char)answer.Data[2]
         }),
         ProductVersion = new byte[5] {
             answer.Data[3],
             answer.Data[4],
             answer.Data[5],
             answer.Data[6],
             answer.Data[7],
         },
         MajorVersion           = answer.Data[8],
         MinorVersion           = answer.Data[9],
         SerialNumber           = BitConverter.ToUInt32(answer.Data, 10),
         ManufacturingDateMonth = answer.Data[14],
         ManufacturingDateYear  = (short)(BitConverter.ToInt16(answer.Data, 15) + 2000),
         CardSize         = BitConverter.ToUInt32(answer.Data, 17),
         FlashEraseSize   = answer.Data[21],
         EraseSingleBlock = answer.Data[22] == 1,
         FatType          = (SdCardFatType)answer.Data[23],
         BlocksPerCluster = answer.Data[24],
         ClusterCount     = BitConverter.ToUInt32(answer.Data, 25),
         FreeClusters     = BitConverter.ToUInt32(answer.Data, 29),
         FreeSpace        = BitConverter.ToUInt32(answer.Data, 33),
         FatStartBlock    = BitConverter.ToUInt32(answer.Data, 37),
         FatCount         = answer.Data[41],
         BlocksPerFat     = BitConverter.ToUInt32(answer.Data, 42),
         RootDirStart     = BitConverter.ToUInt32(answer.Data, 46),
         DataStartBlock   = BitConverter.ToUInt32(answer.Data, 50),
         Type             = (CardType)answer.Data[54],
     };
 }
 internal PacketAnswerTotalInfo(PacketAnswer answer)
 {
     if (!Init((UInt16)CommandType.GetInfo, answer))
     {
         throw WrongTypeException;
     }
     DI = new DeviceInfo()
     {
         Board               = (Board)(answer.Data[0]),
         BoardArchitecture   = (BoardArchitecture)(answer.Data[1]),
         StackFreeMemory     = BitConverter.ToUInt32(answer.Data, 2),
         CPU_F               = BitConverter.ToInt64(answer.Data, 6),
         GCC_verison         = BitConverter.ToUInt32(answer.Data, 14),
         ARD_version         = BitConverter.ToUInt32(answer.Data, 18),
         DTP_version         = BitConverter.ToUInt32(answer.Data, 22),
         IsConnectSDModule   = answer.Data[26] == 1,
         IsConnectTimeModule = answer.Data[27] == 1,
         FlashMemorySize     = BitConverter.ToUInt32(answer.Data, 28),
         SRAMMemorySize      = BitConverter.ToUInt32(answer.Data, 32)
     };
 }