2007-03-27 17:47:10 +00:00
|
|
|
/*
|
|
|
|
* CiderPress
|
|
|
|
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved.
|
|
|
|
* See the file LICENSE for distribution terms.
|
|
|
|
*/
|
|
|
|
/*
|
2014-11-21 21:18:20 +00:00
|
|
|
* Generic Apple II archive handling. In the beginning we only handled
|
|
|
|
* NuFX archives, and the code continues to reflect that heritage.
|
2007-03-27 17:47:10 +00:00
|
|
|
*
|
|
|
|
* These are abstract base classes.
|
|
|
|
*/
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
#ifndef APP_GENERICARCHIVE_H
|
|
|
|
#define APP_GENERICARCHIVE_H
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
#include "Preferences.h"
|
|
|
|
#include "../util/UtilLib.h"
|
|
|
|
#include "../diskimg/DiskImg.h"
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
#include "../nufxlib/NufxLib.h"
|
2007-03-27 17:47:10 +00:00
|
|
|
#include "../reformat/Reformat.h"
|
|
|
|
#include <time.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
// this shouldn't be in a header file, but in here it's probably okay
|
|
|
|
using namespace DiskImgLib;
|
|
|
|
|
|
|
|
class ActionProgressDialog;
|
|
|
|
class AddFilesDialog;
|
|
|
|
class RecompressOptionsDialog;
|
|
|
|
class SelectionSet;
|
|
|
|
struct Win32dirent;
|
|
|
|
class GenericArchive;
|
|
|
|
|
|
|
|
const int kFileTypeTXT = 0x04;
|
|
|
|
const int kFileTypeBIN = 0x06;
|
|
|
|
const int kFileTypeSRC = 0xb0;
|
|
|
|
const int kFileTypeINT = 0xfa;
|
|
|
|
const int kFileTypeBAS = 0xfc;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set of data allowed in file property "set file info" calls.
|
|
|
|
*/
|
2015-01-12 00:11:44 +00:00
|
|
|
struct FileProps {
|
2014-11-21 21:18:20 +00:00
|
|
|
uint32_t fileType;
|
|
|
|
uint32_t auxType;
|
|
|
|
uint32_t access;
|
|
|
|
time_t createWhen;
|
|
|
|
time_t modWhen;
|
2015-01-12 00:11:44 +00:00
|
|
|
};
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Options for converting between file archives and disk archives.
|
|
|
|
*/
|
|
|
|
class XferFileOptions {
|
|
|
|
public:
|
2015-01-13 23:54:10 +00:00
|
|
|
XferFileOptions() :
|
2014-11-18 05:13:13 +00:00
|
|
|
fTarget(NULL), fPreserveEmptyFolders(false), fpTargetFS(NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
{}
|
2015-01-13 23:54:10 +00:00
|
|
|
~XferFileOptions() {}
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* where the stuff is going */
|
|
|
|
GenericArchive* fTarget;
|
|
|
|
|
|
|
|
/* these really only have meaning when converting disk to file */
|
|
|
|
//bool fConvDOSText;
|
|
|
|
//bool fConvPascalText;
|
|
|
|
bool fPreserveEmptyFolders;
|
|
|
|
|
|
|
|
/* only useful when converting files to a disk image */
|
|
|
|
//CString fStoragePrefix;
|
|
|
|
DiskImgLib::DiskFS* fpTargetFS;
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Generic description of an Apple II file.
|
|
|
|
*
|
|
|
|
* Everything returned by the basic "get" calls for display in the ContentList
|
|
|
|
* must be held in local storage (i.e. not just pointers into DiskFS data).
|
|
|
|
* Otherwise, we run the risk of doing some DiskFS updates and having weird
|
|
|
|
* things happen in the ContentList.
|
|
|
|
*/
|
|
|
|
class GenericEntry {
|
|
|
|
public:
|
2015-01-13 23:54:10 +00:00
|
|
|
GenericEntry();
|
|
|
|
virtual ~GenericEntry();
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* kinds of files found in archives */
|
|
|
|
enum RecordKind {
|
|
|
|
kRecordKindUnknown = 0,
|
|
|
|
kRecordKindDisk,
|
|
|
|
kRecordKindFile,
|
|
|
|
kRecordKindForkedFile,
|
|
|
|
kRecordKindDirectory,
|
|
|
|
kRecordKindVolumeDir,
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
* Threads we will view or extract (threadMask). This is no longer used
|
|
|
|
* for viewing files, but still plays a role when extracting.
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
// create one entry for each matching thread
|
|
|
|
kDataThread = 0x01,
|
|
|
|
kRsrcThread = 0x02,
|
|
|
|
kDiskImageThread = 0x04,
|
|
|
|
kCommentThread = 0x08,
|
|
|
|
|
|
|
|
// grab any of the above threads
|
|
|
|
kAnyThread = 0x10,
|
|
|
|
|
|
|
|
// set this if we allow matches on directory entries
|
|
|
|
kAllowDirectory = 0x20,
|
|
|
|
|
|
|
|
// and volume directory entries
|
|
|
|
kAllowVolumeDir = 0x40,
|
|
|
|
|
|
|
|
// set to include "damaged" files
|
|
|
|
kAllowDamaged = 0x80,
|
|
|
|
};
|
|
|
|
/* EOL conversion mode for threads being extracted */
|
2015-01-12 00:11:44 +00:00
|
|
|
enum ConvertEOL {
|
2014-11-04 00:26:53 +00:00
|
|
|
kConvertUnknown = 0, kConvertEOLOff, kConvertEOLOn, kConvertEOLAuto
|
2015-01-12 00:11:44 +00:00
|
|
|
};
|
|
|
|
enum EOLType {
|
2014-11-04 00:26:53 +00:00
|
|
|
kEOLUnknown = 0, kEOLCR, kEOLLF, kEOLCRLF
|
|
|
|
};
|
|
|
|
/* high ASCII conversion mode for threads being extracted */
|
2015-01-12 00:11:44 +00:00
|
|
|
enum ConvertHighASCII {
|
2014-11-04 00:26:53 +00:00
|
|
|
kConvertHAUnknown = 0, kConvertHAOff, kConvertHAOn, kConvertHAAuto
|
2015-01-12 00:11:44 +00:00
|
|
|
};
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* ProDOS access flags, used for all filesystems */
|
|
|
|
enum {
|
|
|
|
kAccessRead = 0x01,
|
|
|
|
kAccessWrite = 0x02,
|
|
|
|
kAccessInvisible = 0x04,
|
|
|
|
kAccessBackup = 0x20,
|
|
|
|
kAccessRename = 0x40,
|
|
|
|
kAccessDelete = 0x80
|
|
|
|
};
|
|
|
|
|
2015-01-12 00:11:44 +00:00
|
|
|
/*
|
|
|
|
* Features supported by underlying archive. Primarily of interest
|
|
|
|
* to EditPropsDialog, which needs to know what sort of attributes can
|
|
|
|
* be altered in the file type and access flags.
|
|
|
|
*/
|
|
|
|
enum Feature {
|
2014-11-04 00:26:53 +00:00
|
|
|
kFeatureCanChangeType,
|
|
|
|
kFeaturePascalTypes,
|
|
|
|
kFeatureDOSTypes,
|
|
|
|
kFeatureHFSTypes,
|
|
|
|
kFeatureHasFullAccess,
|
|
|
|
kFeatureHasSimpleAccess, // mutually exclusive with FullAccess
|
|
|
|
kFeatureHasInvisibleFlag,
|
2015-01-12 00:11:44 +00:00
|
|
|
};
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Extract data from an archive (NuFX, disk image, etc).
|
|
|
|
*
|
|
|
|
* If "*ppText" is non-NULL, the data will be read into the pointed-to buffer
|
|
|
|
* so long as it's shorter than *pLength bytes. The value in "*pLength"
|
|
|
|
* will be set to the actual length used.
|
|
|
|
*
|
|
|
|
* If "*ppText" is NULL, the uncompressed data will be placed into a buffer
|
|
|
|
* allocated with "new[]".
|
|
|
|
*
|
|
|
|
* Returns IDOK on success, IDCANCEL if the operation was cancelled by the
|
|
|
|
* user, and -1 value on failure. On failure, "*pErrMsg" holds an error
|
|
|
|
* message.
|
|
|
|
*
|
|
|
|
* "which" is an anonymous GenericArchive enum (e.g. "kDataThread").
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual int ExtractThreadToBuffer(int which, char** ppText, long* pLength,
|
|
|
|
CString* pErrMsg) const = 0;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Extract data from a thread or disk file to a Windows file. Since we're
|
|
|
|
* not copying to a buffer we can't assume that we're able to hold the
|
|
|
|
* entire file in memory all at once.
|
|
|
|
*
|
|
|
|
* Returns IDOK on success, IDCANCEL if the operation was cancelled by the
|
|
|
|
* user, and -1 value on failure. On failure, "*pMsg" holds an
|
|
|
|
* error message.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual int ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
|
|
|
|
ConvertHighASCII convHA, CString* pErrMsg) const = 0;
|
|
|
|
|
|
|
|
// This helps us retain the ContentList selection across a Reload(). Only
|
|
|
|
// necessary for read-write archives, since those are the only ones that
|
|
|
|
// ever need to be reloaded. Value must be nonzero to be used.
|
2015-01-13 23:54:10 +00:00
|
|
|
virtual long GetSelectionSerial() const = 0;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-12-19 01:25:46 +00:00
|
|
|
/* what operations are possible with this entry? */
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual bool GetFeatureFlag(Feature feature) const = 0;
|
|
|
|
|
2015-01-13 23:54:10 +00:00
|
|
|
long GetIndex() const { return fIndex; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetIndex(long idx) { fIndex = idx; }
|
|
|
|
|
2015-01-09 01:41:53 +00:00
|
|
|
/*
|
|
|
|
* Set the pathname. This comes from a file archive or disk image,
|
|
|
|
* so it's always in Mac OS Roman format.
|
|
|
|
*
|
|
|
|
* Calling this will invalidate any strings previously returned by
|
|
|
|
* GetPathName*(), GetFileName*(), and GetDisplayName().
|
|
|
|
*/
|
|
|
|
void SetPathNameMOR(const char* pathNameMOR);
|
|
|
|
|
2015-01-13 23:54:10 +00:00
|
|
|
const CStringA& GetPathNameMOR() const { return fPathNameMOR; }
|
|
|
|
const CString& GetPathNameUNI() const { return fPathNameUNI; }
|
|
|
|
const CString& GetFileName();
|
|
|
|
const CString& GetFileNameExtension(); // returns e.g. ".SHK"
|
|
|
|
const CStringA& GetFileNameExtensionMOR();
|
2015-01-09 01:41:53 +00:00
|
|
|
/*
|
|
|
|
* Returns the "display" name. This is a combination of the sub-volume
|
|
|
|
* name and the path name. This string is intended for display only,
|
|
|
|
* and may include characters that aren't legal on the filesystem.
|
|
|
|
*/
|
2015-01-13 23:54:10 +00:00
|
|
|
const CString& GetDisplayName() const;
|
2015-01-09 01:41:53 +00:00
|
|
|
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
void SetSubVolName(const WCHAR* name);
|
2015-01-13 23:54:10 +00:00
|
|
|
const CString& GetSubVolName() const { return fSubVolName; }
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2015-01-13 23:54:10 +00:00
|
|
|
char GetFssep() const { return fFssep; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetFssep(char fssep) { fFssep = fssep; }
|
2015-01-13 23:54:10 +00:00
|
|
|
uint32_t GetFileType() const { return fFileType; }
|
2015-01-05 02:20:59 +00:00
|
|
|
void SetFileType(uint32_t type) { fFileType = type; }
|
2015-01-13 23:54:10 +00:00
|
|
|
uint32_t GetAuxType() const { return fAuxType; }
|
2015-01-05 02:20:59 +00:00
|
|
|
void SetAuxType(uint32_t type) { fAuxType = type; }
|
2015-01-13 23:54:10 +00:00
|
|
|
uint32_t GetAccess() const { return fAccess; }
|
2015-01-05 02:20:59 +00:00
|
|
|
void SetAccess(uint32_t access) { fAccess = access; }
|
2015-01-13 23:54:10 +00:00
|
|
|
time_t GetCreateWhen() const { return fCreateWhen; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetCreateWhen(time_t when) { fCreateWhen = when; }
|
2015-01-13 23:54:10 +00:00
|
|
|
time_t GetModWhen() const { return fModWhen; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetModWhen(time_t when) { fModWhen = when; }
|
2015-01-13 23:54:10 +00:00
|
|
|
RecordKind GetRecordKind() const { return fRecordKind; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetRecordKind(RecordKind recordKind) { fRecordKind = recordKind; }
|
2015-01-13 23:54:10 +00:00
|
|
|
const WCHAR* GetFormatStr() const { return fFormatStr; }
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
void SetFormatStr(const WCHAR* str) { fFormatStr = str; } // arg not copied, must be static!
|
2015-01-13 23:54:10 +00:00
|
|
|
LONGLONG GetCompressedLen() const { return fCompressedLen; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetCompressedLen(LONGLONG len) { fCompressedLen = len; }
|
2015-01-13 23:54:10 +00:00
|
|
|
LONGLONG GetUncompressedLen() const {
|
2014-11-04 00:26:53 +00:00
|
|
|
return fDataForkLen + fRsrcForkLen;
|
|
|
|
}
|
2015-01-13 23:54:10 +00:00
|
|
|
LONGLONG GetDataForkLen() const { return fDataForkLen; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetDataForkLen(LONGLONG len) { fDataForkLen = len; }
|
2015-01-13 23:54:10 +00:00
|
|
|
LONGLONG GetRsrcForkLen() const { return fRsrcForkLen; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetRsrcForkLen(LONGLONG len) { fRsrcForkLen = len; }
|
|
|
|
|
2015-01-13 23:54:10 +00:00
|
|
|
DiskImg::FSFormat GetSourceFS() const { return fSourceFS; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetSourceFS(DiskImg::FSFormat fmt) { fSourceFS = fmt; }
|
|
|
|
|
2015-01-13 23:54:10 +00:00
|
|
|
bool GetHasDataFork() const { return fHasDataFork; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetHasDataFork(bool val) { fHasDataFork = val; }
|
2015-01-13 23:54:10 +00:00
|
|
|
bool GetHasRsrcFork() const { return fHasRsrcFork; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetHasRsrcFork(bool val) { fHasRsrcFork = val; }
|
2015-01-13 23:54:10 +00:00
|
|
|
bool GetHasDiskImage() const { return fHasDiskImage; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetHasDiskImage(bool val) { fHasDiskImage = val; }
|
2015-01-13 23:54:10 +00:00
|
|
|
bool GetHasComment() const { return fHasComment; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetHasComment(bool val) { fHasComment = val; }
|
2015-01-13 23:54:10 +00:00
|
|
|
bool GetHasNonEmptyComment() const { return fHasNonEmptyComment; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetHasNonEmptyComment(bool val) { fHasNonEmptyComment = val; }
|
|
|
|
|
2015-01-13 23:54:10 +00:00
|
|
|
bool GetDamaged() const { return fDamaged; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetDamaged(bool val) { fDamaged = val; }
|
2015-01-13 23:54:10 +00:00
|
|
|
bool GetSuspicious() const { return fSuspicious; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetSuspicious(bool val) { fSuspicious = val; }
|
|
|
|
|
2015-01-13 23:54:10 +00:00
|
|
|
GenericEntry* GetPrev() const { return fpPrev; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetPrev(GenericEntry* pEntry) { fpPrev = pEntry; }
|
2015-01-13 23:54:10 +00:00
|
|
|
GenericEntry* GetNext() const { return fpNext; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetNext(GenericEntry* pEntry) { fpNext = pEntry; }
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Get a string for this entry's filetype.
|
|
|
|
*/
|
2015-01-13 23:54:10 +00:00
|
|
|
const WCHAR* GetFileTypeString() const;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if this is a high-ASCII file.
|
|
|
|
*/
|
2015-01-05 05:04:01 +00:00
|
|
|
static bool CheckHighASCII(const uint8_t* buffer, size_t count);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Decide, based on the contents of the buffer, whether we should do an
|
|
|
|
* EOL conversion on the data.
|
|
|
|
*
|
|
|
|
* Returns kConvEOLOff or kConvEOLOn.
|
|
|
|
*/
|
2014-11-21 02:10:18 +00:00
|
|
|
static ConvertEOL DetermineConversion(const uint8_t* buffer,
|
2015-01-05 05:04:01 +00:00
|
|
|
size_t count, EOLType* pSourceType, ConvertHighASCII* pConvHA);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Write data to a file, possibly converting EOL markers to Windows CRLF
|
|
|
|
* and stripping high ASCII.
|
|
|
|
*
|
|
|
|
* If "*pConv" is kConvertEOLAuto, this will try to auto-detect whether
|
|
|
|
* the input is a text file or not by scanning the input buffer.
|
|
|
|
*
|
|
|
|
* Ditto for "*pConvHA".
|
|
|
|
*
|
|
|
|
* "fp" is the output file, "buf" is the input, "len" is the buffer length.
|
|
|
|
* "*pLastCR" should initially be "false", and carried across invocations.
|
|
|
|
*
|
|
|
|
* Returns 0 on success, or an errno value on error.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
static int GenericEntry::WriteConvert(FILE* fp, const char* buf,
|
|
|
|
size_t len, ConvertEOL* pConv, ConvertHighASCII* pConvHA,
|
|
|
|
bool* pLastCR);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2015-01-09 01:41:53 +00:00
|
|
|
private:
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Convert spaces to underscores, modifying the string.
|
|
|
|
*/
|
2015-01-09 01:41:53 +00:00
|
|
|
static void SpacesToUnderscores(CStringA* pStr);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
private:
|
2015-01-09 01:41:53 +00:00
|
|
|
/*
|
|
|
|
* This represents a file from an archive or disk image, so the Mac OS
|
|
|
|
* Roman representation is the "true" version. The Unicode version
|
|
|
|
* is how we will use it on Windows (e.g. for file extraction), so
|
|
|
|
* it will be a CP-1252 conversion until the various libraries
|
|
|
|
* support UTF-16 filenames.
|
|
|
|
*
|
|
|
|
* The "display name" is only used for display, and should do a proper
|
|
|
|
* MOR to Unicode conversion so the file name looks right.
|
|
|
|
*/
|
|
|
|
|
|
|
|
CStringA fPathNameMOR; // original path name, Mac OS Roman chars
|
|
|
|
CString fPathNameUNI; // Unicode conversion
|
|
|
|
CString fFileName; // filename component of fPathNameUNI
|
|
|
|
CString fFileNameExtension; // filename extension from fPathNameUNI
|
|
|
|
CStringA fFileNameExtensionMOR;
|
2014-11-04 00:26:53 +00:00
|
|
|
char fFssep;
|
2015-01-09 01:41:53 +00:00
|
|
|
CString fSubVolName; // sub-volume prefix, or NULL if none
|
|
|
|
mutable CString fDisplayName; // combination of sub-vol and path
|
2015-01-05 02:20:59 +00:00
|
|
|
uint32_t fFileType;
|
|
|
|
uint32_t fAuxType;
|
|
|
|
uint32_t fAccess;
|
2014-11-04 00:26:53 +00:00
|
|
|
time_t fCreateWhen;
|
|
|
|
time_t fModWhen;
|
|
|
|
RecordKind fRecordKind; // forked file, disk image, ??
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
const WCHAR* fFormatStr; // static str; compression or fs format
|
2014-11-04 00:26:53 +00:00
|
|
|
LONGLONG fDataForkLen; // also for disk images
|
|
|
|
LONGLONG fRsrcForkLen; // set to 0 when nonexistent
|
|
|
|
LONGLONG fCompressedLen; // data/disk + rsrc
|
|
|
|
|
|
|
|
DiskImg::FSFormat fSourceFS; // if DOS3.3, text files have funky format
|
|
|
|
|
|
|
|
bool fHasDataFork;
|
|
|
|
bool fHasRsrcFork;
|
|
|
|
bool fHasDiskImage;
|
|
|
|
bool fHasComment;
|
|
|
|
bool fHasNonEmptyComment; // set if fHasComment and it isn't empty
|
|
|
|
|
|
|
|
bool fDamaged; // if set, don't try to open file
|
|
|
|
bool fSuspicious; // if set, file *might* be damaged
|
|
|
|
|
|
|
|
long fIndex; // serial index, for sorting "unsorted" view
|
|
|
|
GenericEntry* fpPrev;
|
|
|
|
GenericEntry* fpNext;
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Generic representation of a collection of Apple II files.
|
|
|
|
*
|
|
|
|
* This raises the "reload" flag whenever its data is reloaded. Any code that
|
|
|
|
* keeps pointers to stuff (e.g. local copies of pointers to GenericEntry
|
|
|
|
* objects) needs to check the "reload" flag before dereferencing them.
|
|
|
|
*/
|
|
|
|
class GenericArchive {
|
|
|
|
public:
|
2015-01-13 23:54:10 +00:00
|
|
|
GenericArchive() {
|
2014-11-18 05:13:13 +00:00
|
|
|
fPathName = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
fNumEntries = 0;
|
2014-11-18 05:13:13 +00:00
|
|
|
fEntryHead = fEntryTail = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
fReloadFlag = true;
|
2014-11-18 05:13:13 +00:00
|
|
|
//fEntryIndex = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
2015-01-13 23:54:10 +00:00
|
|
|
virtual ~GenericArchive() {
|
2014-11-18 21:05:15 +00:00
|
|
|
//LOGI("Deleting GenericArchive");
|
2014-11-04 00:26:53 +00:00
|
|
|
DeleteEntries();
|
|
|
|
delete fPathName;
|
|
|
|
}
|
|
|
|
|
2015-01-13 23:54:10 +00:00
|
|
|
virtual GenericEntry* GetEntries() const {
|
2014-11-04 00:26:53 +00:00
|
|
|
return fEntryHead;
|
|
|
|
}
|
2015-01-13 23:54:10 +00:00
|
|
|
virtual long GetNumEntries() const {
|
2014-11-04 00:26:53 +00:00
|
|
|
return fNumEntries;
|
|
|
|
}
|
|
|
|
|
2015-01-12 00:11:44 +00:00
|
|
|
enum OpenResult {
|
2014-11-04 00:26:53 +00:00
|
|
|
kResultUnknown = 0,
|
|
|
|
kResultSuccess, // open succeeded
|
|
|
|
kResultFailure, // open failed
|
|
|
|
kResultCancel, // open was cancelled by user
|
|
|
|
kResultFileArchive, // found a file archive rather than disk image
|
2015-01-12 00:11:44 +00:00
|
|
|
};
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
// Open an archive and do fun things with the innards.
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
virtual OpenResult Open(const WCHAR* filename, bool readOnly,
|
2014-11-04 00:26:53 +00:00
|
|
|
CString* pErrMsg) = 0;
|
|
|
|
// Create a new archive with the specified name.
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
virtual CString New(const WCHAR* filename, const void* options) = 0;
|
2014-11-04 00:26:53 +00:00
|
|
|
// Flush any unwritten data to disk
|
2015-01-13 23:54:10 +00:00
|
|
|
virtual CString Flush() = 0;
|
2014-11-04 00:26:53 +00:00
|
|
|
// Force a re-read from the underlying storage.
|
2015-01-13 23:54:10 +00:00
|
|
|
virtual CString Reload() = 0;
|
2014-11-04 00:26:53 +00:00
|
|
|
// Do we allow modification?
|
2015-01-13 23:54:10 +00:00
|
|
|
virtual bool IsReadOnly() const = 0;
|
2014-11-04 00:26:53 +00:00
|
|
|
// Does the underlying storage have un-flushed modifications?
|
2015-01-13 23:54:10 +00:00
|
|
|
virtual bool IsModified() const = 0;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2015-01-13 23:54:10 +00:00
|
|
|
virtual bool GetReloadFlag() { return fReloadFlag; }
|
|
|
|
virtual void ClearReloadFlag() { fReloadFlag = false; }
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-12-05 01:05:48 +00:00
|
|
|
// One of these for every sub-class.
|
2015-01-12 00:11:44 +00:00
|
|
|
enum ArchiveKind {
|
2014-11-04 00:26:53 +00:00
|
|
|
kArchiveUnknown = 0,
|
|
|
|
kArchiveNuFX,
|
|
|
|
kArchiveBNY,
|
|
|
|
kArchiveACU,
|
2015-01-12 07:02:35 +00:00
|
|
|
kArchiveAppleSingle,
|
2014-11-04 00:26:53 +00:00
|
|
|
kArchiveDiskImage,
|
2015-01-12 00:11:44 +00:00
|
|
|
};
|
2014-12-05 01:05:48 +00:00
|
|
|
|
|
|
|
// Returns the kind of archive this is (disk image, NuFX, BNY, etc).
|
2015-01-13 23:54:10 +00:00
|
|
|
virtual ArchiveKind GetArchiveKind() = 0;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
// Get a nice description for the title bar.
|
2015-01-13 23:54:10 +00:00
|
|
|
virtual CString GetDescription() const = 0;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
// Do a bulk add.
|
|
|
|
virtual bool BulkAdd(ActionProgressDialog* pActionProgress,
|
|
|
|
const AddFilesDialog* pAddOpts) = 0;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
// Add a single disk to the archive.
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual bool AddDisk(ActionProgressDialog* pActionProgress,
|
|
|
|
const AddFilesDialog* pAddOpts) = 0;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
// Create a subdirectory with name newName in pParentEntry.
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual bool CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry,
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
const WCHAR* newName) = 0;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
// Test a set of files.
|
|
|
|
virtual bool TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) = 0;
|
|
|
|
|
|
|
|
// Delete a set of files.
|
|
|
|
virtual bool DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) = 0;
|
|
|
|
|
|
|
|
// Rename a set of files.
|
|
|
|
virtual bool RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) = 0;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
// Verify that a name is suitable. Called by RenameEntryDialog and
|
|
|
|
// CreateSubdirDialog.
|
|
|
|
//
|
|
|
|
// Tests for context-specific syntax and checks for duplicates.
|
|
|
|
//
|
|
|
|
// Returns an empty string on success, or an error message on failure.
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual CString TestPathName(const GenericEntry* pGenericEntry,
|
|
|
|
const CString& basePath, const CString& newName, char newFssep) const = 0;
|
|
|
|
|
|
|
|
// Rename a volume (or sub-volume)
|
|
|
|
virtual bool RenameVolume(CWnd* pMsgWnd, DiskFS* pDiskFS,
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
const WCHAR* newName) = 0;
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual CString TestVolumeName(const DiskFS* pDiskFS,
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
const WCHAR* newName) const = 0;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
// Recompress a set of files.
|
|
|
|
virtual bool RecompressSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
|
|
|
|
const RecompressOptionsDialog* pRecompOpts) = 0;
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
// return result from XferSelection()
|
2015-01-12 00:11:44 +00:00
|
|
|
enum XferStatus {
|
2014-11-04 00:26:53 +00:00
|
|
|
kXferOK = 0, kXferFailed = 1, kXferCancelled = 2, kXferOutOfSpace = 3
|
2015-01-12 00:11:44 +00:00
|
|
|
};
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
// Transfer selected files out of this archive and into another.
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual XferStatus XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
|
|
|
|
ActionProgressDialog* pActionProgress,
|
|
|
|
const XferFileOptions* pXferOpts) = 0;
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
// Extract a comment from the archive, converting line terminators to CRLF.
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual bool GetComment(CWnd* pMsgWnd, const GenericEntry* pEntry,
|
|
|
|
CString* pStr) = 0;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
// Set a comment on an entry.
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual bool SetComment(CWnd* pMsgWnd, GenericEntry* pEntry,
|
|
|
|
const CString& str) = 0;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
// Delete the comment from the entry.
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual bool DeleteComment(CWnd* pMsgWnd, GenericEntry* pEntry) = 0;
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
// Set ProDOS file properties (file type, aux type, access flags).
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual bool SetProps(CWnd* pMsgWnd, GenericEntry* pEntry,
|
|
|
|
const FileProps* pProps) = 0;
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
// Preferences have changed, update library state as needed. Also called
|
|
|
|
// the first time though.
|
2015-01-13 23:54:10 +00:00
|
|
|
virtual void PreferencesChanged() = 0;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
// Determine an archive's capabilities. This is specific to the object
|
|
|
|
// instance, so this must not be made a static function.
|
2015-01-12 00:11:44 +00:00
|
|
|
enum Capability {
|
2014-11-04 00:26:53 +00:00
|
|
|
kCapUnknown = 0,
|
|
|
|
|
|
|
|
kCapCanTest, // NuFX, BNY
|
|
|
|
kCapCanRenameFullPath, // NuFX, BNY
|
|
|
|
kCapCanRecompress, // NuFX, BNY
|
|
|
|
kCapCanEditComment, // NuFX
|
|
|
|
kCapCanAddDisk, // NuFX
|
|
|
|
kCapCanConvEOLOnAdd, // Disk
|
|
|
|
kCapCanCreateSubdir, // Disk
|
|
|
|
kCapCanRenameVolume, // Disk
|
2015-01-12 00:11:44 +00:00
|
|
|
};
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual long GetCapability(Capability cap) = 0;
|
|
|
|
|
|
|
|
// Get the pathname of the file we opened.
|
2015-01-13 23:54:10 +00:00
|
|
|
const WCHAR* GetPathName() const { return fPathName; }
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Generate a temp name from a file name.
|
|
|
|
*/
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
static CString GenDerivedTempName(const WCHAR* filename);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Do a strcasecmp-like comparison, taking equivalent fssep chars into
|
|
|
|
* account.
|
|
|
|
*
|
|
|
|
* The tricky part is with files like "foo:bar" ':' -- "foo:bar" '/'. The
|
|
|
|
* names appear to match, but the fssep chars are different, so they don't.
|
|
|
|
* If we just return (char1 - char2), though, we'll be returning 0 because
|
|
|
|
* the ASCII values match even if the character *meanings* don't.
|
|
|
|
*
|
|
|
|
* This assumes that the fssep char is not affected by tolower().
|
|
|
|
*
|
|
|
|
* [This may not sort correctly...haven't verified that I'm returning the
|
|
|
|
* right thing for ascending ASCII sort.]
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
static int ComparePaths(const CString& name1, char fssep1,
|
|
|
|
const CString& name2, char fssep2);
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Add a new entry to the end of the list.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
void AddEntry(GenericEntry* pEntry);
|
|
|
|
|
|
|
|
/*
|
2015-01-05 05:04:01 +00:00
|
|
|
* This class holds details about a file that we're adding from local disk.
|
2014-11-04 00:26:53 +00:00
|
|
|
*/
|
2015-01-05 05:04:01 +00:00
|
|
|
class LocalFileDetails {
|
2014-11-04 00:26:53 +00:00
|
|
|
public:
|
2015-01-13 23:54:10 +00:00
|
|
|
LocalFileDetails();
|
|
|
|
virtual ~LocalFileDetails() {}
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
2015-01-05 05:04:01 +00:00
|
|
|
* Set the various fields, based on the pathname and characteristics
|
|
|
|
* of the file.
|
2014-11-04 00:26:53 +00:00
|
|
|
*/
|
2015-01-05 05:04:01 +00:00
|
|
|
NuError SetFields(const AddFilesDialog* pAddOpts, const WCHAR* pathname,
|
|
|
|
struct _stat* psb);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* What kind of file this is. Files being added to NuFX from Windows
|
2015-01-05 05:04:01 +00:00
|
|
|
* can't be "BothForks" because the forks are stored in
|
2014-11-04 00:26:53 +00:00
|
|
|
* separate files. However, files being transferred from a NuFX
|
|
|
|
* archive, a disk image, or in from the clipboard can be both.
|
|
|
|
*
|
|
|
|
* (NOTE: this gets embedded into clipboard data. If you change
|
2015-01-05 05:04:01 +00:00
|
|
|
* these values, update the version number in Clipboard.cpp.)
|
2014-11-04 00:26:53 +00:00
|
|
|
*/
|
2015-01-05 05:04:01 +00:00
|
|
|
enum FileKind {
|
2014-11-04 00:26:53 +00:00
|
|
|
kFileKindUnknown = 0,
|
|
|
|
kFileKindDataFork,
|
|
|
|
kFileKindRsrcFork,
|
|
|
|
kFileKindDiskImage,
|
|
|
|
kFileKindBothForks,
|
|
|
|
kFileKindDirectory,
|
2015-01-05 05:04:01 +00:00
|
|
|
};
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/*
|
2015-01-05 05:04:01 +00:00
|
|
|
* Provide operator= and copy constructor.
|
2014-11-04 00:26:53 +00:00
|
|
|
*/
|
2015-01-05 05:04:01 +00:00
|
|
|
LocalFileDetails& operator=(const LocalFileDetails& src) {
|
|
|
|
if (&src != this)
|
|
|
|
CopyFields(this, &src);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
LocalFileDetails(const LocalFileDetails& src) {
|
|
|
|
CopyFields(this, &src);
|
|
|
|
}
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
|
2015-01-05 05:04:01 +00:00
|
|
|
/*
|
|
|
|
* Returns a reference to a NuFileDetails structure with the contents
|
|
|
|
* of the LocalFileDetails.
|
|
|
|
*
|
|
|
|
* The returned structure may not be used after the LocalFileDetails
|
|
|
|
* is modified or released.
|
|
|
|
*/
|
|
|
|
const NuFileDetails& GetNuFileDetails();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Returns a reference to a NuFileDetails structure with the contents
|
|
|
|
* of the LocalFileDetails.
|
|
|
|
*
|
|
|
|
* The returned structure may not be used after the LocalFileDetails
|
|
|
|
* is modified or released.
|
|
|
|
*/
|
|
|
|
const DiskFS::CreateParms& GetCreateParms();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Returns the "local" pathname, i.e. the name of a Windows file.
|
|
|
|
*/
|
|
|
|
const CString& GetLocalPathName() const {
|
|
|
|
return fLocalPathName;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetLocalPathName(const CString& newName) {
|
|
|
|
fLocalPathName = newName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the "local" pathname with any file type preservation
|
|
|
|
* strings removed.
|
|
|
|
*/
|
|
|
|
const CString& GetStrippedLocalPathName() const {
|
|
|
|
return fStrippedLocalPathName;
|
|
|
|
}
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
|
|
|
|
/*
|
2015-01-05 05:04:01 +00:00
|
|
|
* Sets the "stripped" local path name, and updates the MOR version.
|
|
|
|
* Does not alter the full local path name.
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
*/
|
2015-01-05 05:04:01 +00:00
|
|
|
void SetStrippedLocalPathName(const CString& newName) {
|
|
|
|
fStrippedLocalPathName = newName;
|
|
|
|
GenerateStoragePathName();
|
|
|
|
}
|
2014-11-04 00:26:53 +00:00
|
|
|
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
/*
|
2015-01-05 05:04:01 +00:00
|
|
|
* Returns a copy of the stripped local pathname that has been
|
|
|
|
* converted to Mac OS Roman.
|
2014-12-05 01:05:48 +00:00
|
|
|
*
|
2015-01-05 05:04:01 +00:00
|
|
|
* The returned string will be invalid if SetStrippedLocalPathName
|
|
|
|
* is subsequently called.
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
*/
|
2015-01-05 05:04:01 +00:00
|
|
|
const CStringA& GetStoragePathNameMOR() const {
|
|
|
|
return fStoragePathNameMOR;
|
|
|
|
}
|
|
|
|
|
|
|
|
FileKind GetEntryKind() const { return fEntryKind; }
|
|
|
|
void SetEntryKind(FileKind kind) { fEntryKind = kind; }
|
|
|
|
|
|
|
|
DiskImg::FSFormat GetFileSysFmt() const { return fFileSysFmt; }
|
|
|
|
void SetFileSysFmt(DiskImg::FSFormat fmt) { fFileSysFmt = fmt; }
|
|
|
|
|
|
|
|
char GetFssep() const { return fFssep; }
|
|
|
|
void SetFssep(char fssep) { fFssep = fssep; }
|
|
|
|
|
|
|
|
uint32_t GetFileType() const { return fFileType; }
|
|
|
|
void SetFileType(uint32_t type) { fFileType = type; }
|
|
|
|
|
|
|
|
uint32_t GetExtraType() const { return fExtraType; }
|
|
|
|
void SetExtraType(uint32_t type) { fExtraType = type; }
|
|
|
|
|
|
|
|
uint32_t GetAccess() const { return fAccess; }
|
|
|
|
void SetAccess(uint32_t access) { fAccess = access; }
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
|
2015-01-05 05:04:01 +00:00
|
|
|
uint16_t GetStorageType() const { return fStorageType; }
|
|
|
|
void SetStorageType(uint16_t type) { fStorageType = type; }
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2015-01-05 05:04:01 +00:00
|
|
|
const NuDateTime& GetArchiveWhen() const { return fArchiveWhen; }
|
|
|
|
void SetArchiveWhen(const NuDateTime& when) { fArchiveWhen = when; }
|
2014-12-05 01:05:48 +00:00
|
|
|
|
2015-01-05 05:04:01 +00:00
|
|
|
const NuDateTime& GetModWhen() const { return fModWhen; }
|
|
|
|
void SetModWhen(const NuDateTime& when) { fModWhen = when; }
|
|
|
|
|
|
|
|
const NuDateTime& GetCreateWhen() const { return fCreateWhen; }
|
|
|
|
void SetCreateWhen(const NuDateTime& when) { fCreateWhen = when; }
|
2014-12-05 01:05:48 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
private:
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
2015-01-05 05:04:01 +00:00
|
|
|
* Copy the contents of our object to a new object, field by field,
|
|
|
|
* so the CStrings copy correctly.
|
2014-11-21 21:18:20 +00:00
|
|
|
*
|
|
|
|
* Useful for operator= and copy construction.
|
|
|
|
*/
|
2015-01-05 05:04:01 +00:00
|
|
|
static void CopyFields(LocalFileDetails* pDst,
|
|
|
|
const LocalFileDetails* pSrc);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Generates fStoragePathNameMOR from fStrippedLocalPathName.
|
|
|
|
*/
|
|
|
|
void GenerateStoragePathName();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* These are the structs that the libraries want, so we provide calls
|
|
|
|
* that populate them and return a reference. These are "hairy"
|
|
|
|
* structures, so we have to place limitations on their lifetime.
|
|
|
|
*
|
|
|
|
* Ideally these would either be proper objects with destructors,
|
|
|
|
* so we could create them and not worry about who will free up the
|
|
|
|
* hairy bits, or we would omit the hairy bits from the structure and
|
|
|
|
* pass them separately.
|
|
|
|
*/
|
|
|
|
NuFileDetails fNuFileDetails;
|
|
|
|
DiskFS::CreateParms fCreateParms;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* What does this entry represent?
|
|
|
|
*/
|
|
|
|
FileKind fEntryKind;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Full pathname of the Windows file.
|
|
|
|
*/
|
|
|
|
CString fLocalPathName; // was origName
|
|
|
|
|
|
|
|
/*
|
|
|
|
* "Stripped" pathname. This is the full path with any of our
|
|
|
|
* added bits removed (e.g. file type & fork identifiers).
|
|
|
|
*
|
|
|
|
* This is generated by PathProposal::LocalToArchive().
|
|
|
|
*/
|
|
|
|
CString fStrippedLocalPathName; // was storageName
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The storage name, generated by converting strippedLocalPathName
|
|
|
|
* from Unicode to Mac OS Roman. This is what will be passed to
|
|
|
|
* DiskImg and NufxLib as the name of the file to create in the
|
|
|
|
* archive. For DiskImg there's an additional "normalization" pass
|
|
|
|
* make the filename suitable for use on the filesystem; that name
|
|
|
|
* is stored in a FileAddData object, not here.
|
|
|
|
*/
|
|
|
|
CStringA fStoragePathNameMOR;
|
|
|
|
|
|
|
|
DiskImg::FSFormat fFileSysFmt; // only set for xfers?
|
|
|
|
uint8_t fFssep;
|
|
|
|
uint32_t fFileType;
|
|
|
|
uint32_t fExtraType;
|
|
|
|
uint32_t fAccess;
|
|
|
|
uint16_t fStorageType; // "Unknown" or disk block size
|
|
|
|
NuDateTime fCreateWhen;
|
|
|
|
NuDateTime fModWhen;
|
|
|
|
NuDateTime fArchiveWhen;
|
2014-11-04 00:26:53 +00:00
|
|
|
};
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
// Prepare for file transfers.
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual void XferPrepare(const XferFileOptions* pXferOpts) = 0;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
// Transfer files, one at a time, into this archive from another. Called
|
|
|
|
// from XferSelection and clipboard "paste".
|
|
|
|
//
|
|
|
|
// "dataLen" and "rsrcLen" will be -1 if the corresponding fork doesn't exist.
|
|
|
|
// Returns 0 on success, nonzero on failure.
|
|
|
|
//
|
|
|
|
// On success, *pDataBuf and *pRsrcBuf are freed and set to NULL. (It's
|
|
|
|
// necessary for the interface to work this way because the NufxArchive
|
|
|
|
// version just tucks the pointers into NufxLib structures.)
|
2015-01-05 05:04:01 +00:00
|
|
|
virtual CString XferFile(LocalFileDetails* pDetails, uint8_t** pDataBuf,
|
2014-11-21 02:10:18 +00:00
|
|
|
long dataLen, uint8_t** pRsrcBuf, long rsrcLen) = 0;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
// Abort progress. Not all subclasses are capable of "undo".
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual void XferAbort(CWnd* pMsgWnd) = 0;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
// Transfer is finished.
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual void XferFinish(CWnd* pMsgWnd) = 0;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Convert from time in seconds to Apple IIgs DateTime format.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
static void UNIXTimeToDateTime(const time_t* pWhen, NuDateTime *pDateTime);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2015-01-12 07:02:35 +00:00
|
|
|
/*
|
|
|
|
* Reads a 16-bit big-endian value from a buffer. Does not guard
|
|
|
|
* against buffer overrun.
|
|
|
|
*/
|
|
|
|
static uint16_t Get16BE(const uint8_t* ptr) {
|
|
|
|
return ptr[1] | (ptr[0] << 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reads a 32-bit big-endian value from a buffer. Does not guard
|
|
|
|
* against buffer overrun.
|
|
|
|
*/
|
|
|
|
static uint32_t Get32BE(const uint8_t* ptr) {
|
|
|
|
return ptr[3] | (ptr[2] << 8) | (ptr[1] << 16) | (ptr[0] << 24);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reads a 16-bit little-endian value from a buffer. Does not guard
|
|
|
|
* against buffer overrun.
|
|
|
|
*/
|
|
|
|
static uint16_t Get16LE(const uint8_t* ptr) {
|
|
|
|
return ptr[0] | (ptr[1] << 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reads a 32-bit little-endian value from a buffer. Does not guard
|
|
|
|
* against buffer overrun.
|
|
|
|
*/
|
|
|
|
static uint32_t Get32LE(const uint8_t* ptr) {
|
|
|
|
return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24);
|
|
|
|
}
|
|
|
|
|
2007-03-27 17:47:10 +00:00
|
|
|
protected:
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Delete the "entries" list.
|
|
|
|
*/
|
2015-01-13 23:54:10 +00:00
|
|
|
virtual void DeleteEntries();
|
2014-11-04 00:26:53 +00:00
|
|
|
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
void ReplaceFssep(WCHAR* str, char oldc, char newc, char newSubst);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Prepare a directory for reading.
|
|
|
|
*
|
|
|
|
* Allocates a Win32dirent struct that must be freed by the caller.
|
|
|
|
*/
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
Win32dirent* OpenDir(const WCHAR* name);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get an entry from an open directory.
|
|
|
|
*
|
|
|
|
* Returns a NULL pointer after the last entry has been read.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
Win32dirent* ReadDir(Win32dirent* dir);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Close a directory.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
void CloseDir(Win32dirent* dir);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Win32 recursive directory descent. Scan the contents of a directory.
|
|
|
|
* If a subdirectory is found, follow it; otherwise, call Win32AddFile to
|
|
|
|
* add the file.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
NuError Win32AddDirectory(const AddFilesDialog* pAddOpts,
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
const WCHAR* dirName, CString* pErrMsg);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Add a file to the list we're adding to the archive. If it's a directory,
|
|
|
|
* and the recursive descent feature is enabled, call Win32AddDirectory to
|
|
|
|
* add the contents of the dir.
|
|
|
|
*
|
|
|
|
* Returns with an error if the file doesn't exist or isn't readable.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
NuError Win32AddFile(const AddFilesDialog* pAddOpts,
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
const WCHAR* pathname, CString* pErrMsg);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* External entry point; just calls the system-specific version.
|
|
|
|
*/
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
NuError AddFile(const AddFilesDialog* pAddOpts, const WCHAR* pathname,
|
2014-11-04 00:26:53 +00:00
|
|
|
CString* pErrMsg);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Each implementation must provide this. It's called from the generic
|
|
|
|
* AddFile function with the high-level add options, a partial pathname,
|
|
|
|
* and a FileDetails structure filled in using Win32 calls.
|
|
|
|
*
|
|
|
|
* One call to AddFile can result in multiple calls to DoAddFile if
|
|
|
|
* the subject of the AddFile call is a directory (and fIncludeSubdirs
|
|
|
|
* is set).
|
|
|
|
*
|
|
|
|
* DoAddFile is not called for subdirectories. The underlying code must
|
|
|
|
* create directories as needed.
|
|
|
|
*
|
|
|
|
* In some cases (such as renaming a file as it is being added) the
|
|
|
|
* information in "*pDetails" may be modified.
|
|
|
|
*/
|
|
|
|
virtual NuError DoAddFile(const AddFilesDialog* pAddOpts,
|
2015-01-05 05:04:01 +00:00
|
|
|
LocalFileDetails* pDetails) = 0;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
void SetPathName(const WCHAR* pathName) {
|
|
|
|
free(fPathName);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pathName != NULL) {
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
fPathName = _wcsdup(pathName);
|
|
|
|
} else {
|
2014-11-18 05:13:13 +00:00
|
|
|
fPathName = NULL;
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
}
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool fReloadFlag; // set after Reload called
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
private:
|
2015-01-13 23:54:10 +00:00
|
|
|
//virtual void CreateIndex();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
//CString fNewPathHolder;
|
|
|
|
//CString fOrigPathHolder;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
WCHAR* fPathName;
|
2014-11-04 00:26:53 +00:00
|
|
|
long fNumEntries;
|
|
|
|
GenericEntry* fEntryHead;
|
|
|
|
GenericEntry* fEntryTail;
|
|
|
|
//GenericEntry** fEntryIndex;
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* One entry in a SelectionSet.
|
|
|
|
*/
|
|
|
|
class SelectionEntry {
|
|
|
|
public:
|
2014-11-04 00:26:53 +00:00
|
|
|
SelectionEntry(GenericEntry* pEntry) {
|
|
|
|
fpEntry = pEntry;
|
|
|
|
//fThreadKind = threadKind;
|
|
|
|
//fFilter = filter;
|
|
|
|
//fReformatName = "";
|
2014-11-18 05:13:13 +00:00
|
|
|
fpPrev = fpNext = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
2015-01-13 23:54:10 +00:00
|
|
|
~SelectionEntry() {}
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
int Reformat(ReformatHolder* pHolder);
|
|
|
|
|
2015-01-13 23:54:10 +00:00
|
|
|
GenericEntry* GetEntry() const { return fpEntry; }
|
|
|
|
//int GetThreadKind() const { return fThreadKind; }
|
|
|
|
//int GetFilter() const { return fFilter; }
|
|
|
|
//const char* GetReformatName() const { return fReformatName; }
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2015-01-13 23:54:10 +00:00
|
|
|
SelectionEntry* GetPrev() const { return fpPrev; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetPrev(SelectionEntry* pPrev) { fpPrev = pPrev; }
|
2015-01-13 23:54:10 +00:00
|
|
|
SelectionEntry* GetNext() const { return fpNext; }
|
2014-11-04 00:26:53 +00:00
|
|
|
void SetNext(SelectionEntry* pNext) { fpNext = pNext; }
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
private:
|
2014-11-04 00:26:53 +00:00
|
|
|
GenericEntry* fpEntry;
|
|
|
|
//int fThreadKind; // data, rsrc, etc (threadMask)
|
|
|
|
//int fFilter; // fAllowedFilters, really
|
|
|
|
//const char* fReformatName; // name of formatting actually applied
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
SelectionEntry* fpPrev;
|
|
|
|
SelectionEntry* fpNext;
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ContentList;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A set of selected files.
|
|
|
|
*
|
|
|
|
* Each entry represents one item that can be displayed, such as a data
|
|
|
|
* fork, resource fork, or comment thread. Thus, a single file may have
|
|
|
|
* multiple entries in the set.
|
|
|
|
*/
|
|
|
|
class SelectionSet {
|
|
|
|
public:
|
2015-01-13 23:54:10 +00:00
|
|
|
SelectionSet() {
|
2014-11-04 00:26:53 +00:00
|
|
|
fNumEntries = 0;
|
2014-11-18 05:13:13 +00:00
|
|
|
fEntryHead = fEntryTail = fIterCurrent = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
2015-01-13 23:54:10 +00:00
|
|
|
~SelectionSet() {
|
2014-11-04 00:26:53 +00:00
|
|
|
DeleteEntries();
|
|
|
|
}
|
|
|
|
|
|
|
|
// create the set from the selected members of a ContentList
|
|
|
|
void CreateFromSelection(ContentList* pContentList, int threadMask);
|
|
|
|
// create the set from all members of a ContentList
|
|
|
|
void CreateFromAll(ContentList* pContentList, int threadMask);
|
|
|
|
|
|
|
|
// get the head of the list
|
2015-01-13 23:54:10 +00:00
|
|
|
SelectionEntry* GetEntries() const { return fEntryHead; }
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2015-01-13 23:54:10 +00:00
|
|
|
void IterReset() {
|
2014-11-18 05:13:13 +00:00
|
|
|
fIterCurrent = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
// move to the next or previous entry as part of iterating
|
2015-01-13 23:54:10 +00:00
|
|
|
SelectionEntry* IterPrev() {
|
2014-11-18 05:13:13 +00:00
|
|
|
if (fIterCurrent == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
fIterCurrent = fEntryTail;
|
|
|
|
else
|
|
|
|
fIterCurrent = fIterCurrent->GetPrev();
|
|
|
|
return fIterCurrent;
|
|
|
|
}
|
2015-01-13 23:54:10 +00:00
|
|
|
SelectionEntry* IterNext() {
|
2014-11-18 05:13:13 +00:00
|
|
|
if (fIterCurrent == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
fIterCurrent = fEntryHead;
|
|
|
|
else
|
|
|
|
fIterCurrent = fIterCurrent->GetNext();
|
|
|
|
return fIterCurrent;
|
|
|
|
}
|
2015-01-13 23:54:10 +00:00
|
|
|
SelectionEntry* IterCurrent() {
|
2014-11-04 00:26:53 +00:00
|
|
|
return fIterCurrent;
|
|
|
|
}
|
2015-01-13 23:54:10 +00:00
|
|
|
bool IterHasPrev() const {
|
2014-11-18 05:13:13 +00:00
|
|
|
if (fIterCurrent == NULL)
|
|
|
|
return fEntryTail != NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
else
|
2014-11-18 05:13:13 +00:00
|
|
|
return (fIterCurrent->GetPrev() != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
2015-01-13 23:54:10 +00:00
|
|
|
bool IterHasNext() const {
|
2014-11-18 05:13:13 +00:00
|
|
|
if (fIterCurrent == NULL)
|
|
|
|
return fEntryHead != NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
else
|
2014-11-18 05:13:13 +00:00
|
|
|
return (fIterCurrent->GetNext() != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
|
2015-01-13 23:54:10 +00:00
|
|
|
int GetNumEntries() const { return fNumEntries; }
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
// count the #of entries whose display name matches "prefix"
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
int CountMatchingPrefix(const WCHAR* prefix);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
// debug dump the contents of the selection set
|
2015-01-13 23:54:10 +00:00
|
|
|
void Dump();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
private:
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Add a GenericEntry to the set, but only if we can find a thread that
|
|
|
|
* matches the flags in "threadMask".
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
void AddToSet(GenericEntry* pEntry, int threadMask);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Add a new entry to the end of the list.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
void AddEntry(SelectionEntry* pEntry);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Delete the "entries" list.
|
|
|
|
*/
|
2015-01-13 23:54:10 +00:00
|
|
|
void DeleteEntries();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
int fNumEntries;
|
|
|
|
SelectionEntry* fIterCurrent;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
SelectionEntry* fEntryHead;
|
|
|
|
SelectionEntry* fEntryTail;
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
#endif /*APP_GENERICARCHIVE_H*/
|