1 // Object Viewer Qt - BNP Manager Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2011 Roland WINKLMEIER <roland.m.winklmeier@gmail.com>
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "nel/misc/types_nl.h"
24 #include <nel/misc/singleton.h>
42 typedef std::vector
<PackedFile
> TPackedFilesList
;
46 NLMISC_SAFE_SINGLETON_DECL(BNPFileHandle
)
60 static void releaseInstance();
62 /*void append (const QString destFilename, const QString origFilename, uint32 sizeToRead);
66 * Read the header from the bnp file and create a filelist
67 * \param filename (consisting the whole path)
69 bool readHeader (const std::string
&filePath
);
71 bool writeHeader (const std::string
&filePath
, uint32 offset
);
74 * Append the header to a created bnp file
75 * \param filename (consisting the whole path)
77 void appendHeader (const std::string
&filename
) {}
80 * Create a vector of all packed files inside the bnp file
81 * \param reference to the vector, which has to be filled
83 void list (TPackedFilesList
& FileList
);
86 * Create a vector of all file names inside the bnp file
87 * \param reference to the vector, which has to be filled
89 void fileNames( std::vector
<std::string
>& fileNames
);
92 * Create a new bnp file
93 * \param string file path
95 void createFile( std::string filePath
);
98 * Add files to the current aktive bnp file
99 * \param vector of file pathes to add
101 void addFiles( const std::vector
<std::string
>& filePathes
);
104 * Delete files from the current aktive bnp file
105 * \param vector of files names
107 void deleteFiles (const std::vector
<std::string
>& fileNames
);
110 * Unpack the selected packed files into user defined dir
111 * \param directory path, where the files should be unpacked
112 * \param list of files, which has to be unpacked
114 bool unpack (const std::string
&dirName
, const std::vector
<std::string
>& fileList
);
117 * Compares two filenames
118 * \param left: left packed file
119 * \param right: right packed file
122 static bool compare(const PackedFile
&left
, const PackedFile
&right
);
127 * Append one file to an existing bnp file
128 * \param destination: the active bnp file to append the file
129 * \param source: the source file to pack
131 void append( const std::string
& destination
, const PackedFile
& source
);
133 TPackedFilesList m_packedFiles
;
135 // currently opened and displayed bnp file
136 std::string m_openedBNPFile
;
138 // offset where the header of the bnp file begins
139 uint32 m_offsetFromBeginning
;