mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 17:15:00 -06:00
4.59 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
3901bf0ab8
commit
173c07e166
@@ -35,19 +35,19 @@ struct CFolder
|
||||
CObjectVector<CCoderInfo> Coders;
|
||||
CRecordVector<CBindPair> BindPairs;
|
||||
CRecordVector<CNum> PackStreams;
|
||||
CRecordVector<UInt64> UnPackSizes;
|
||||
UInt32 UnPackCRC;
|
||||
bool UnPackCRCDefined;
|
||||
CRecordVector<UInt64> UnpackSizes;
|
||||
UInt32 UnpackCRC;
|
||||
bool UnpackCRCDefined;
|
||||
|
||||
CFolder(): UnPackCRCDefined(false) {}
|
||||
CFolder(): UnpackCRCDefined(false) {}
|
||||
|
||||
UInt64 GetUnPackSize() const // test it
|
||||
{
|
||||
if (UnPackSizes.IsEmpty())
|
||||
UInt64 GetUnpackSize() const // test it
|
||||
{
|
||||
if (UnpackSizes.IsEmpty())
|
||||
return 0;
|
||||
for (int i = UnPackSizes.Size() - 1; i >= 0; i--)
|
||||
for (int i = UnpackSizes.Size() - 1; i >= 0; i--)
|
||||
if (FindBindPairForOutStream(i) < 0)
|
||||
return UnPackSizes[i];
|
||||
return UnpackSizes[i];
|
||||
throw 1;
|
||||
}
|
||||
|
||||
@@ -82,101 +82,171 @@ struct CFolder
|
||||
}
|
||||
};
|
||||
|
||||
typedef FILETIME CArchiveFileTime;
|
||||
|
||||
class CFileItem
|
||||
struct CUInt64DefVector
|
||||
{
|
||||
public:
|
||||
CArchiveFileTime CreationTime;
|
||||
CArchiveFileTime LastWriteTime;
|
||||
CArchiveFileTime LastAccessTime;
|
||||
UInt64 UnPackSize;
|
||||
UInt64 StartPos;
|
||||
UInt32 Attributes;
|
||||
UInt32 FileCRC;
|
||||
CRecordVector<UInt64> Values;
|
||||
CRecordVector<bool> Defined;
|
||||
|
||||
void Clear()
|
||||
{
|
||||
Values.Clear();
|
||||
Defined.Clear();
|
||||
}
|
||||
|
||||
void ReserveDown()
|
||||
{
|
||||
Values.ReserveDown();
|
||||
Values.ReserveDown();
|
||||
}
|
||||
|
||||
bool GetItem(int index, UInt64 &value) const
|
||||
{
|
||||
if (index < Defined.Size() && Defined[index])
|
||||
{
|
||||
value = Values[index];
|
||||
return true;
|
||||
}
|
||||
value = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
void SetItem(int index, bool defined, UInt64 value)
|
||||
{
|
||||
while (index >= Defined.Size())
|
||||
Defined.Add(false);
|
||||
Defined[index] = defined;
|
||||
if (!defined)
|
||||
return;
|
||||
while (index >= Values.Size())
|
||||
Values.Add(0);
|
||||
Values[index] = value;
|
||||
}
|
||||
|
||||
bool CheckSize(int size) const { return Defined.Size() == size || Defined.Size() == 0; }
|
||||
};
|
||||
|
||||
struct CFileItem
|
||||
{
|
||||
UInt64 Size;
|
||||
UInt32 Attrib;
|
||||
UInt32 Crc;
|
||||
UString Name;
|
||||
|
||||
bool HasStream; // Test it !!! it means that there is
|
||||
bool HasStream; // Test it !!! it means that there is
|
||||
// stream in some folder. It can be empty stream
|
||||
bool IsDirectory;
|
||||
bool IsAnti;
|
||||
bool IsFileCRCDefined;
|
||||
bool AreAttributesDefined;
|
||||
bool IsCreationTimeDefined;
|
||||
bool IsLastWriteTimeDefined;
|
||||
bool IsLastAccessTimeDefined;
|
||||
bool IsStartPosDefined;
|
||||
bool IsDir;
|
||||
bool CrcDefined;
|
||||
bool AttribDefined;
|
||||
|
||||
/*
|
||||
const bool HasStream() const {
|
||||
return !IsDirectory && !IsAnti && UnPackSize != 0; }
|
||||
*/
|
||||
CFileItem():
|
||||
CFileItem():
|
||||
HasStream(true),
|
||||
IsDirectory(false),
|
||||
IsAnti(false),
|
||||
IsFileCRCDefined(false),
|
||||
AreAttributesDefined(false),
|
||||
IsCreationTimeDefined(false),
|
||||
IsLastWriteTimeDefined(false),
|
||||
IsLastAccessTimeDefined(false),
|
||||
IsStartPosDefined(false)
|
||||
IsDir(false),
|
||||
CrcDefined(false),
|
||||
AttribDefined(false)
|
||||
{}
|
||||
void SetAttributes(UInt32 attributes)
|
||||
{
|
||||
AreAttributesDefined = true;
|
||||
Attributes = attributes;
|
||||
}
|
||||
void SetCreationTime(const CArchiveFileTime &creationTime)
|
||||
{
|
||||
IsCreationTimeDefined = true;
|
||||
CreationTime = creationTime;
|
||||
}
|
||||
void SetLastWriteTime(const CArchiveFileTime &lastWriteTime)
|
||||
void SetAttrib(UInt32 attrib)
|
||||
{
|
||||
IsLastWriteTimeDefined = true;
|
||||
LastWriteTime = lastWriteTime;
|
||||
}
|
||||
void SetLastAccessTime(const CArchiveFileTime &lastAccessTime)
|
||||
{
|
||||
IsLastAccessTimeDefined = true;
|
||||
LastAccessTime = lastAccessTime;
|
||||
AttribDefined = true;
|
||||
Attrib = attrib;
|
||||
}
|
||||
};
|
||||
|
||||
struct CFileItem2
|
||||
{
|
||||
UInt64 CTime;
|
||||
UInt64 ATime;
|
||||
UInt64 MTime;
|
||||
UInt64 StartPos;
|
||||
bool CTimeDefined;
|
||||
bool ATimeDefined;
|
||||
bool MTimeDefined;
|
||||
bool StartPosDefined;
|
||||
bool IsAnti;
|
||||
};
|
||||
|
||||
struct CArchiveDatabase
|
||||
{
|
||||
CRecordVector<UInt64> PackSizes;
|
||||
CRecordVector<bool> PackCRCsDefined;
|
||||
CRecordVector<UInt32> PackCRCs;
|
||||
CObjectVector<CFolder> Folders;
|
||||
CRecordVector<CNum> NumUnPackStreamsVector;
|
||||
CRecordVector<CNum> NumUnpackStreamsVector;
|
||||
CObjectVector<CFileItem> Files;
|
||||
|
||||
CUInt64DefVector CTime;
|
||||
CUInt64DefVector ATime;
|
||||
CUInt64DefVector MTime;
|
||||
CUInt64DefVector StartPos;
|
||||
CRecordVector<bool> IsAnti;
|
||||
|
||||
void Clear()
|
||||
{
|
||||
PackSizes.Clear();
|
||||
PackCRCsDefined.Clear();
|
||||
PackCRCs.Clear();
|
||||
Folders.Clear();
|
||||
NumUnPackStreamsVector.Clear();
|
||||
NumUnpackStreamsVector.Clear();
|
||||
Files.Clear();
|
||||
CTime.Clear();
|
||||
ATime.Clear();
|
||||
MTime.Clear();
|
||||
StartPos.Clear();
|
||||
IsAnti.Clear();
|
||||
}
|
||||
|
||||
void ReserveDown()
|
||||
{
|
||||
PackSizes.ReserveDown();
|
||||
PackCRCsDefined.ReserveDown();
|
||||
PackCRCs.ReserveDown();
|
||||
Folders.ReserveDown();
|
||||
NumUnpackStreamsVector.ReserveDown();
|
||||
Files.ReserveDown();
|
||||
CTime.ReserveDown();
|
||||
ATime.ReserveDown();
|
||||
MTime.ReserveDown();
|
||||
StartPos.ReserveDown();
|
||||
IsAnti.ReserveDown();
|
||||
}
|
||||
|
||||
bool IsEmpty() const
|
||||
{
|
||||
return (PackSizes.IsEmpty() &&
|
||||
PackCRCsDefined.IsEmpty() &&
|
||||
PackCRCs.IsEmpty() &&
|
||||
Folders.IsEmpty() &&
|
||||
NumUnPackStreamsVector.IsEmpty() &&
|
||||
return (PackSizes.IsEmpty() &&
|
||||
PackCRCsDefined.IsEmpty() &&
|
||||
PackCRCs.IsEmpty() &&
|
||||
Folders.IsEmpty() &&
|
||||
NumUnpackStreamsVector.IsEmpty() &&
|
||||
Files.IsEmpty());
|
||||
}
|
||||
|
||||
bool CheckNumFiles() const
|
||||
{
|
||||
int size = Files.Size();
|
||||
return (
|
||||
CTime.CheckSize(size) &&
|
||||
ATime.CheckSize(size) &&
|
||||
MTime.CheckSize(size) &&
|
||||
StartPos.CheckSize(size) &&
|
||||
(size == IsAnti.Size() || IsAnti.Size() == 0));
|
||||
}
|
||||
|
||||
bool IsSolid() const
|
||||
{
|
||||
for (int i = 0; i < NumUnPackStreamsVector.Size(); i++)
|
||||
if (NumUnPackStreamsVector[i] > 1)
|
||||
for (int i = 0; i < NumUnpackStreamsVector.Size(); i++)
|
||||
if (NumUnpackStreamsVector[i] > 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
bool IsItemAnti(int index) const { return (index < IsAnti.Size() && IsAnti[index]); }
|
||||
void SetItemAnti(int index, bool isAnti)
|
||||
{
|
||||
while (index >= IsAnti.Size())
|
||||
IsAnti.Add(false);
|
||||
IsAnti[index] = isAnti;
|
||||
}
|
||||
|
||||
void GetFile(int index, CFileItem &file, CFileItem2 &file2) const;
|
||||
void AddFile(const CFileItem &file, const CFileItem2 &file2);
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user