mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-16 22:11:49 -06:00
9.34
This commit is contained in:
committed by
Kornel Lesiński
parent
83f8ddcc5b
commit
f08f4dcc3c
129
CPP/7zip/UI/Common/Update.h
Executable file → Normal file
129
CPP/7zip/UI/Common/Update.h
Executable file → Normal file
@@ -3,14 +3,22 @@
|
||||
#ifndef __COMMON_UPDATE_H
|
||||
#define __COMMON_UPDATE_H
|
||||
|
||||
#include "Common/Wildcard.h"
|
||||
#include "../../../Common/Wildcard.h"
|
||||
|
||||
#include "ArchiveOpenCallback.h"
|
||||
#include "LoadCodecs.h"
|
||||
#include "OpenArchive.h"
|
||||
#include "Property.h"
|
||||
#include "UpdateAction.h"
|
||||
#include "UpdateCallback.h"
|
||||
|
||||
enum EArcNameMode
|
||||
{
|
||||
k_ArcNameMode_Smart,
|
||||
k_ArcNameMode_Exact,
|
||||
k_ArcNameMode_Add,
|
||||
};
|
||||
|
||||
struct CArchivePath
|
||||
{
|
||||
UString OriginalPath;
|
||||
@@ -26,52 +34,11 @@ struct CArchivePath
|
||||
|
||||
CArchivePath(): Temp(false) {};
|
||||
|
||||
void ParseFromPath(const UString &path)
|
||||
{
|
||||
OriginalPath = path;
|
||||
|
||||
SplitPathToParts(path, Prefix, Name);
|
||||
int dotPos = Name.ReverseFind(L'.');
|
||||
if (dotPos < 0)
|
||||
return;
|
||||
if (dotPos == Name.Length() - 1)
|
||||
{
|
||||
Name = Name.Left(dotPos);
|
||||
BaseExtension.Empty();
|
||||
return;
|
||||
}
|
||||
if (BaseExtension.CompareNoCase(Name.Mid(dotPos + 1)) == 0)
|
||||
{
|
||||
BaseExtension = Name.Mid(dotPos + 1);
|
||||
Name = Name.Left(dotPos);
|
||||
}
|
||||
else
|
||||
BaseExtension.Empty();
|
||||
}
|
||||
|
||||
UString GetPathWithoutExt() const
|
||||
{
|
||||
return Prefix + Name;
|
||||
}
|
||||
|
||||
UString GetFinalPath() const
|
||||
{
|
||||
UString path = GetPathWithoutExt();
|
||||
if (!BaseExtension.IsEmpty())
|
||||
path += UString(L'.') + BaseExtension;
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
FString GetTempPath() const
|
||||
{
|
||||
FString path = TempPrefix + us2fs(Name);
|
||||
if (!BaseExtension.IsEmpty())
|
||||
path += FString(FTEXT('.')) + us2fs(BaseExtension);
|
||||
path += FTEXT(".tmp");
|
||||
path += TempPostfix;
|
||||
return path;
|
||||
}
|
||||
void ParseFromPath(const UString &path, EArcNameMode mode);
|
||||
UString GetPathWithoutExt() const { return Prefix + Name; }
|
||||
UString GetFinalPath() const;
|
||||
UString GetFinalVolPath() const;
|
||||
FString GetTempPath() const;
|
||||
};
|
||||
|
||||
struct CUpdateArchiveCommand
|
||||
@@ -83,9 +50,31 @@ struct CUpdateArchiveCommand
|
||||
|
||||
struct CCompressionMethodMode
|
||||
{
|
||||
int FormatIndex;
|
||||
bool Type_Defined;
|
||||
COpenType Type;
|
||||
CObjectVector<CProperty> Properties;
|
||||
CCompressionMethodMode(): FormatIndex(-1) {}
|
||||
|
||||
CCompressionMethodMode(): Type_Defined(false) {}
|
||||
};
|
||||
|
||||
namespace NRecursedType { enum EEnum
|
||||
{
|
||||
kRecursed,
|
||||
kWildcardOnlyRecursed,
|
||||
kNonRecursed
|
||||
};}
|
||||
|
||||
struct CRenamePair
|
||||
{
|
||||
UString OldName;
|
||||
UString NewName;
|
||||
bool WildcardParsing;
|
||||
NRecursedType::EEnum RecursedType;
|
||||
|
||||
CRenamePair(): WildcardParsing(true), RecursedType(NRecursedType::kNonRecursed) {}
|
||||
|
||||
bool Prepare();
|
||||
bool GetNewPath(bool isFolder, const UString &src, UString &dest) const;
|
||||
};
|
||||
|
||||
struct CUpdateOptions
|
||||
@@ -95,7 +84,8 @@ struct CUpdateOptions
|
||||
CObjectVector<CUpdateArchiveCommand> Commands;
|
||||
bool UpdateArchiveItself;
|
||||
CArchivePath ArchivePath;
|
||||
|
||||
EArcNameMode ArcNameMode;
|
||||
|
||||
bool SfxMode;
|
||||
FString SfxModule;
|
||||
|
||||
@@ -110,8 +100,22 @@ struct CUpdateOptions
|
||||
UString EMailAddress;
|
||||
|
||||
FString WorkingDir;
|
||||
NWildcard::ECensorPathMode PathMode;
|
||||
UString AddPathPrefix;
|
||||
|
||||
bool Init(const CCodecs *codecs, const CIntVector &formatIndices, const UString &arcPath);
|
||||
CBoolPair NtSecurity;
|
||||
CBoolPair AltStreams;
|
||||
CBoolPair HardLinks;
|
||||
CBoolPair SymLinks;
|
||||
|
||||
bool DeleteAfterCompressing;
|
||||
|
||||
bool SetArcMTime;
|
||||
|
||||
CObjectVector<CRenamePair> RenamePairs;
|
||||
|
||||
bool InitFormatIndex(const CCodecs *codecs, const CObjectVector<COpenType> &types, const UString &arcPath);
|
||||
bool SetArcPath(const CCodecs *codecs, const UString &arcPath);
|
||||
|
||||
CUpdateOptions():
|
||||
UpdateArchiveItself(true),
|
||||
@@ -120,14 +124,20 @@ struct CUpdateOptions
|
||||
StdOutMode(false),
|
||||
EMailMode(false),
|
||||
EMailRemoveAfter(false),
|
||||
OpenShareForWrite(false)
|
||||
OpenShareForWrite(false),
|
||||
ArcNameMode(k_ArcNameMode_Smart),
|
||||
PathMode(NWildcard::k_RelatPath),
|
||||
|
||||
DeleteAfterCompressing(false),
|
||||
SetArcMTime(false)
|
||||
|
||||
{};
|
||||
|
||||
void SetAddActionCommand()
|
||||
void SetActionCommand_Add()
|
||||
{
|
||||
Commands.Clear();
|
||||
CUpdateArchiveCommand c;
|
||||
c.ActionSet = NUpdateArchive::kAddActionSet;
|
||||
c.ActionSet = NUpdateArchive::k_ActionSet_Add;
|
||||
Commands.Add(c);
|
||||
}
|
||||
|
||||
@@ -151,9 +161,9 @@ struct CUpdateErrorInfo: public CErrorInfo
|
||||
|
||||
#define INTERFACE_IUpdateCallbackUI2(x) \
|
||||
INTERFACE_IUpdateCallbackUI(x) \
|
||||
virtual HRESULT OpenResult(const wchar_t *name, HRESULT result) x; \
|
||||
virtual HRESULT OpenResult(const wchar_t *name, HRESULT result, const wchar_t *errorArcType) x; \
|
||||
virtual HRESULT StartScanning() x; \
|
||||
virtual HRESULT ScanProgress(UInt64 numFolders, UInt64 numFiles, const wchar_t *path) x; \
|
||||
virtual HRESULT ScanProgress(UInt64 numFolders, UInt64 numFiles, UInt64 totalSize, const wchar_t *path, bool isDir) x; \
|
||||
virtual HRESULT CanNotFindError(const wchar_t *name, DWORD systemError) x; \
|
||||
virtual HRESULT FinishScanning() x; \
|
||||
virtual HRESULT StartArchive(const wchar_t *name, bool updating) x; \
|
||||
@@ -166,10 +176,13 @@ struct IUpdateCallbackUI2: public IUpdateCallbackUI
|
||||
|
||||
HRESULT UpdateArchive(
|
||||
CCodecs *codecs,
|
||||
const NWildcard::CCensor &censor,
|
||||
const CObjectVector<COpenType> &types,
|
||||
const UString &cmdArcPath2,
|
||||
NWildcard::CCensor &censor,
|
||||
CUpdateOptions &options,
|
||||
CUpdateErrorInfo &errorInfo,
|
||||
IOpenCallbackUI *openCallback,
|
||||
IUpdateCallbackUI2 *callback);
|
||||
IUpdateCallbackUI2 *callback,
|
||||
bool needSetPath);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user