#ifndef FS_FILEWRITER_H #define FS_FILEWRITER_H #include <string> #include <list> #include "fs.h" class FileWriter { public: enum Type { IMMEDIATE, SYNC, ASYNC, MT }; typedef BOOL (CALLBACK* SfvdProto) (HANDLE, LONGLONG); static void SetMaxMemSize(int inMemSize); static void SetType(Type inType); static FileWriter* GetFileWriter(const std::string& inName, long long inFileSize); static void SetReadCallback(BufferCallbackFunc inReadCallback) { mReadCallback = inReadCallback; } static BufferCallbackFunc GetReadCallback() { return mReadCallback; } static void SetWriteCallback(BufferCallbackFunc inWriteCallback) { mWriteCallback = inWriteCallback; } static BufferCallbackFunc GetWriteCallback() { return mWriteCallback; } static void Finalize(); static SfvdProto GetSetFileValidDataFunction(); static void UseSetFileValid(bool inUseSetFileValid) { mUseSetFileValid = inUseSetFileValid; } static void UsePreAllocation(bool inUsePreAllocation) { mUsePreAllocation = inUsePreAllocation; } virtual ~FileWriter() { } virtual bool Open(bool inWriteable, int inModTime) = 0; virtual bool Close() = 0; virtual void GetWriteBuffer(unsigned char*& outBuf, int& outLength) = 0; virtual bool ReleaseWriteBuffer(int inRemainingLength) = 0; virtual void Finish() { } virtual bool IsFinished() = 0; static void AbortSync(); bool AbortAcknowledged() { return mAbortAcknowledged; } virtual bool IsAborting(); virtual void HandleAbort() = 0; const std::string& GetName() { return mName; } HANDLE CreateFile(bool inWriteable, bool inDoOverlappedIO, int inModTime); bool CloseFile(HANDLE& ioHandle, long long inWritten = -1); void DeleteFile(); virtual bool ChModTime(int inModTime) = 0; protected: FileWriter(const std::string& inName, long long inFileSize); bool ChModTime(HANDLE inHandle, int inModTime); FILETIME FileTimeFromEpoch(int inEpoch); std::string mName; long long mFileSize; bool mAbortAcknowledged; static int mMaxMemSize; static Type mType; static std::list<FileWriter*> mActiveFileWriters; static BufferCallbackFunc mReadCallback; static BufferCallbackFunc mWriteCallback; static bool mAbortRequested; static bool mUseSetFileValid; static bool mUsePreAllocation; }; #endif
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 6420 | Frank Compagner |
A number of improvements: - p4fs now supports the global -s (scripted output) option. - p4fs and P4fsV now support the modtime client option. - P4CHARSET is now correctly handled (though no full Unicode support yet). - Increased the maximum command line length for p4fs to the Windows maximum 32768. - Improved error handling. - Fixed a crash when cancelling a sync using the async or multithreaded writers. - P4fsV progressbar now behaves well when passing more than one filespec - P4fsV will now offer the option to overwrite any locally changed (but not checked out) files when it finds these during a sync (cannot clobber ...). - Made the P4fsV error dialog resizeable. - P4fsV Windows layout fixed so it works properly with all Windows style setings. - Ooh, and prettier icons too. |
||
#2 | 6280 | Frank Compagner | Added support for +w filetype | ||
#1 | 6187 | Frank Compagner | Added p4fs project |