1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync// 7zUpdate.h
2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
3baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifndef __7Z_UPDATE_H
4baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define __7Z_UPDATE_H
5baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
6cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky#include "../IArchive.h"
7cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
8cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky// #include "../../Common/UniqBlocks.h"
9cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
10baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "7zCompressionMode.h"
11baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "7zIn.h"
12baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "7zOut.h"
13baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
14baa3858d3f5d128a5c8466b700098109edcad5f2repo syncnamespace NArchive {
15baa3858d3f5d128a5c8466b700098109edcad5f2repo syncnamespace N7z {
16baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
17cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky/*
18cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbeckystruct CTreeFolder
19cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky{
20cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  UString Name;
21cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  int Parent;
22cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  CIntVector SubFolders;
23cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  int UpdateItemIndex;
24cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  int SortIndex;
25cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  int SortIndexEnd;
26cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
27cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  CTreeFolder(): UpdateItemIndex(-1) {}
28cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky};
29cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky*/
30cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
31baa3858d3f5d128a5c8466b700098109edcad5f2repo syncstruct CUpdateItem
32baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
33baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  int IndexInArchive;
34baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  int IndexInClient;
35baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
36baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 CTime;
37baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 ATime;
38baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 MTime;
39baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
40baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 Size;
41baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UString Name;
42cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  /*
43cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  bool IsAltStream;
44cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  int ParentFolderIndex;
45cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  int TreeFolderIndex;
46cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  */
47cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
48cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  // that code is not used in 9.26
49cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  // int ParentSortIndex;
50cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  // int ParentSortIndexEnd;
51baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
52baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt32 Attrib;
53baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
54baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool NewData;
55baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool NewProps;
56baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
57baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool IsAnti;
58baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool IsDir;
59baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
60baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool AttribDefined;
61baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool CTimeDefined;
62baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool ATimeDefined;
63baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool MTimeDefined;
64baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
65cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  // int SecureIndex; // 0 means (no_security)
66cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
67baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool HasStream() const { return !IsDir && !IsAnti && Size != 0; }
68baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
69baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CUpdateItem():
70cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky      // ParentSortIndex(-1),
71cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky      // IsAltStream(false),
72baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      IsAnti(false),
73baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      IsDir(false),
74baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      AttribDefined(false),
75baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      CTimeDefined(false),
76baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      ATimeDefined(false),
77baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      MTimeDefined(false)
78cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky      // SecureIndex(0)
79baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      {}
80baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  void SetDirStatusFromAttrib() { IsDir = ((Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0); };
81baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
82baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  int GetExtensionPos() const;
83baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UString GetExtension() const;
84baa3858d3f5d128a5c8466b700098109edcad5f2repo sync};
85baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
86baa3858d3f5d128a5c8466b700098109edcad5f2repo syncstruct CUpdateOptions
87baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
88baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  const CCompressionMethodMode *Method;
89baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  const CCompressionMethodMode *HeaderMethod;
90baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool UseFilters;
91baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool MaxFilter;
92baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
93baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CHeaderOptions HeaderOptions;
94baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
95baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 NumSolidFiles;
96baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 NumSolidBytes;
97baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool SolidExtension;
98baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool RemoveSfxBlock;
99baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool VolumeMode;
100baa3858d3f5d128a5c8466b700098109edcad5f2repo sync};
101baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
102baa3858d3f5d128a5c8466b700098109edcad5f2repo syncHRESULT Update(
103baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    DECL_EXTERNAL_CODECS_LOC_VARS
104baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    IInStream *inStream,
105cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky    const CDbEx *db,
106baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    const CObjectVector<CUpdateItem> &updateItems,
107cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky    // const CObjectVector<CTreeFolder> &treeFolders, // treeFolders[0] is root
108cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky    // const CUniqBlocks &secureBlocks,
109baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    COutArchive &archive,
110cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky    CArchiveDatabaseOut &newDatabase,
111baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    ISequentialOutStream *seqOutStream,
112baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    IArchiveUpdateCallback *updateCallback,
113baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    const CUpdateOptions &options
114baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    #ifndef _NO_CRYPTO
115baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    , ICryptoGetTextPassword *getDecoderPassword
116baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    #endif
117baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    );
118baa3858d3f5d128a5c8466b700098109edcad5f2repo sync}}
119baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
120baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif
121