mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 18:07:07 -06:00
4.20
This commit is contained in:
committed by
Kornel Lesiński
parent
8c1b5c7b7e
commit
3c510ba80b
@@ -1,45 +1,67 @@
|
||||
// Archive/ZipItem.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __ARCHIVE_ZIP_ITEM_H
|
||||
#define __ARCHIVE_ZIP_ITEM_H
|
||||
|
||||
#include "Common/Types.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/Buffer.h"
|
||||
|
||||
#include "ZipHeader.h"
|
||||
|
||||
namespace NArchive {
|
||||
namespace NZip {
|
||||
|
||||
struct CVersion
|
||||
{
|
||||
BYTE Version;
|
||||
BYTE HostOS;
|
||||
Byte Version;
|
||||
Byte HostOS;
|
||||
};
|
||||
|
||||
bool operator==(const CVersion &v1, const CVersion &v2);
|
||||
bool operator!=(const CVersion &v1, const CVersion &v2);
|
||||
|
||||
struct CExtraSubBlock
|
||||
{
|
||||
UInt16 ID;
|
||||
CByteBuffer Data;
|
||||
};
|
||||
|
||||
struct CExtraBlock
|
||||
{
|
||||
CObjectVector<CExtraSubBlock> SubBlocks;
|
||||
void Clear() { SubBlocks.Clear(); }
|
||||
UInt32 GetSize() const
|
||||
{
|
||||
UInt32 res = 0;
|
||||
for (int i = 0; i < SubBlocks.Size(); i++)
|
||||
res += SubBlocks[i].Data.GetCapacity() + 2 + 2;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CItem
|
||||
{
|
||||
public:
|
||||
CVersion MadeByVersion;
|
||||
CVersion ExtractVersion;
|
||||
UINT16 Flags;
|
||||
UINT16 CompressionMethod;
|
||||
UINT32 Time;
|
||||
UINT32 FileCRC;
|
||||
UINT32 PackSize;
|
||||
UINT32 UnPackSize;
|
||||
UINT16 InternalAttributes;
|
||||
UINT32 ExternalAttributes;
|
||||
UInt16 Flags;
|
||||
UInt16 CompressionMethod;
|
||||
UInt32 Time;
|
||||
UInt32 FileCRC;
|
||||
UInt64 PackSize;
|
||||
UInt64 UnPackSize;
|
||||
UInt16 InternalAttributes;
|
||||
UInt32 ExternalAttributes;
|
||||
|
||||
AString Name;
|
||||
|
||||
UINT32 LocalHeaderPosition;
|
||||
UINT16 LocalExtraSize;
|
||||
UINT16 CentralExtraSize;
|
||||
UINT16 CommentSize;
|
||||
UInt64 LocalHeaderPosition;
|
||||
UInt16 LocalExtraSize;
|
||||
|
||||
CExtraBlock CentralExtra;
|
||||
CByteBuffer Comment;
|
||||
|
||||
bool IsEncrypted() const;
|
||||
|
||||
@@ -48,14 +70,16 @@ public:
|
||||
|
||||
bool IsDirectory() const;
|
||||
bool IgnoreItem() const { return false; }
|
||||
UINT32 GetWinAttributes() const;
|
||||
UInt32 GetWinAttributes() const;
|
||||
|
||||
bool HasDescriptor() const;
|
||||
|
||||
#ifdef WIN32
|
||||
WORD GetCodePage() const
|
||||
{ return (MadeByVersion.HostOS == NFileHeader::NHostOS::kFAT) ? CP_OEMCP : CP_ACP; }
|
||||
#endif
|
||||
{
|
||||
return (MadeByVersion.HostOS == NFileHeader::NHostOS::kFAT
|
||||
|| MadeByVersion.HostOS == NFileHeader::NHostOS::kNTFS
|
||||
) ? CP_OEMCP : CP_ACP;
|
||||
}
|
||||
|
||||
private:
|
||||
void SetFlagBits(int startBitNumber, int numBits, int value);
|
||||
|
||||
Reference in New Issue
Block a user