/// <summary> /// Read block header. /// </summary> protected void ReadData(CBackupStream Reader) { StartPosition = Reader.BaseStream.Position; Streams = new System.Collections.Generic.List <CDataStream>(); BlockType = (EBlockType)Reader.ReadUInt32(); Attributes = (EBlockAttributes)Reader.ReadUInt32(); OffsetToFirstEvent = Reader.ReadUInt16(); OSID = (EOSID)Reader.ReadByte(); OSVersion = Reader.ReadByte(); DisplayableSize = Reader.ReadUInt64(); FormatLogicalAddress = Reader.ReadUInt64(); ReservedMBC = Reader.ReadUInt16(); Reserved1 = Reader.ReadUInt16(); Reserved2 = Reader.ReadUInt16(); Reserved3 = Reader.ReadUInt16(); ControlBlock = Reader.ReadUInt32(); Reserved4 = Reader.ReadUInt32(); OsSpecificData = Reader.ReadOsSpecificData(StartPosition, OSID, OSVersion, BlockType); StringType = (EStringType)Reader.ReadByte(); Reserved5 = Reader.ReadByte(); HeaderChecksum = Reader.ReadUInt16(); }
/// <summary> /// Reads OS specific data. It is assumed that a MTF_MEDIA_ADDRESS structure is next in the stream. /// </summary> public COSSpecificData ReadOsSpecificData(long StartPosition, EOSID OSID, byte OSVersion, EBlockType Type) { long oldpos = BaseStream.Position; ushort sz = ReadUInt16(); ushort off = ReadUInt16(); BaseStream.Seek(StartPosition + off, System.IO.SeekOrigin.Begin); if ((OSID == EOSID.NetWare) && (OSVersion == 0)) { if (Type == EBlockType.MTF_DIRB) { return(new CNetwareDirB(this)); } if (Type == EBlockType.MTF_FILE) { return(new CNetwareFile(this)); } } if ((OSID == EOSID.NetWare_SMS) && (OSVersion == 1)) { if (Type == EBlockType.MTF_DIRB) { return(new CNetwareSMSDirB(this)); } if (Type == EBlockType.MTF_FILE) { return(new CNetwareSMSFile(this)); } } if ((OSID == EOSID.NetWare_SMS) && (OSVersion == 2)) { if (Type == EBlockType.MTF_DIRB) { return(new CNetwareSMEDirB(this)); } if (Type == EBlockType.MTF_FILE) { return(new CNetwareSMEFile(this)); } } if ((OSID == EOSID.Windows_NT) && (OSVersion == 0)) { if (Type == EBlockType.MTF_DIRB) { return(new CWindowsNT0DirB(this)); } if (Type == EBlockType.MTF_FILE) { return(new CWindowsNT0File(this)); } } if ((OSID == EOSID.Windows_NT) && (OSVersion == 1)) { if (Type == EBlockType.MTF_VOLB) { return(new CWindowsNT1VolB(this)); } if (Type == EBlockType.MTF_DIRB) { return(new CWindowsNT1DirB(this)); } if (Type == EBlockType.MTF_FILE) { return(new CWindowsNT1File(this)); } } if ((OSID == EOSID.OS_2) && (OSVersion == 0)) { if (Type == EBlockType.MTF_DIRB) { return(new COS2DirB(this)); } if (Type == EBlockType.MTF_FILE) { return(new COS2File(this)); } } if ((OSID == EOSID.Windows_95) && (OSVersion == 0)) { if (Type == EBlockType.MTF_DIRB) { return(new CWindows95DirB(this)); } if (Type == EBlockType.MTF_FILE) { return(new CWindows95File(this)); } } if ((OSID == EOSID.Macintosh) && (OSVersion == 0)) { if (Type == EBlockType.MTF_VOLB) { return(new CMacintoshVolB(this)); } if (Type == EBlockType.MTF_DIRB) { return(new CMacintoshDirB(this)); } if (Type == EBlockType.MTF_FILE) { return(new CMacintoshFile(this)); } } BaseStream.Seek(oldpos + 4, System.IO.SeekOrigin.Begin); return(new COSSpecificData()); }
/// <summary> /// Read block header. /// </summary> protected void ReadData(CBackupStream Reader) { StartPosition = Reader.BaseStream.Position; Streams = new System.Collections.Generic.List<CDataStream>(); BlockType = (EBlockType)Reader.ReadUInt32(); Attributes = (EBlockAttributes)Reader.ReadUInt32(); OffsetToFirstEvent = Reader.ReadUInt16(); OSID = (EOSID)Reader.ReadByte(); OSVersion = Reader.ReadByte(); DisplayableSize = Reader.ReadUInt64(); FormatLogicalAddress = Reader.ReadUInt64(); ReservedMBC = Reader.ReadUInt16(); Reserved1 = Reader.ReadUInt16(); Reserved2 = Reader.ReadUInt16(); Reserved3 = Reader.ReadUInt16(); ControlBlock = Reader.ReadUInt32(); Reserved4 = Reader.ReadUInt32(); OsSpecificData = Reader.ReadOsSpecificData(StartPosition, OSID, OSVersion, BlockType); StringType = (EStringType)Reader.ReadByte(); Reserved5 = Reader.ReadByte(); HeaderChecksum = Reader.ReadUInt16(); }
/// <summary> /// Reads OS specific data. It is assumed that a MTF_MEDIA_ADDRESS structure is next in the stream. /// </summary> public COSSpecificData ReadOsSpecificData(long StartPosition, EOSID OSID, byte OSVersion, EBlockType Type) { long oldpos = BaseStream.Position; ushort sz = ReadUInt16(); ushort off = ReadUInt16(); BaseStream.Seek(StartPosition + off, System.IO.SeekOrigin.Begin); if ((OSID == EOSID.NetWare) && (OSVersion == 0)) { if (Type == EBlockType.MTF_DIRB) return new CNetwareDirB(this); if (Type == EBlockType.MTF_FILE) return new CNetwareFile(this); } if ((OSID == EOSID.NetWare_SMS) && (OSVersion == 1)) { if (Type == EBlockType.MTF_DIRB) return new CNetwareSMSDirB(this); if (Type == EBlockType.MTF_FILE) return new CNetwareSMSFile(this); } if ((OSID == EOSID.NetWare_SMS) && (OSVersion == 2)) { if (Type == EBlockType.MTF_DIRB) return new CNetwareSMEDirB(this); if (Type == EBlockType.MTF_FILE) return new CNetwareSMEFile(this); } if ((OSID == EOSID.Windows_NT) && (OSVersion == 0)) { if (Type == EBlockType.MTF_DIRB) return new CWindowsNT0DirB(this); if (Type == EBlockType.MTF_FILE) return new CWindowsNT0File(this); } if ((OSID == EOSID.Windows_NT) && (OSVersion == 1)) { if (Type == EBlockType.MTF_VOLB) return new CWindowsNT1VolB(this); if (Type == EBlockType.MTF_DIRB) return new CWindowsNT1DirB(this); if (Type == EBlockType.MTF_FILE) return new CWindowsNT1File(this); } if ((OSID == EOSID.OS_2) && (OSVersion == 0)) { if (Type == EBlockType.MTF_DIRB) return new COS2DirB(this); if (Type == EBlockType.MTF_FILE) return new COS2File(this); } if ((OSID == EOSID.Windows_95) && (OSVersion == 0)) { if (Type == EBlockType.MTF_DIRB) return new CWindows95DirB(this); if (Type == EBlockType.MTF_FILE) return new CWindows95File(this); } if ((OSID == EOSID.Macintosh) && (OSVersion == 0)) { if (Type == EBlockType.MTF_VOLB) return new CMacintoshVolB(this); if (Type == EBlockType.MTF_DIRB) return new CMacintoshDirB(this); if (Type == EBlockType.MTF_FILE) return new CMacintoshFile(this); } BaseStream.Seek(oldpos + 4, System.IO.SeekOrigin.Begin); return new COSSpecificData(); }