PacketFileReaderBase::PacketFileReaderBase( geFilePool &file_pool, const std::string &path, const std::string &prefix) : FileBundleReader(file_pool, path, prefix), data_has_crc_( khExists(IndexFilename()) ? PacketIndexReader( file_pool, IndexFilename()). data_has_crc() : true) { }
PacketFileReader::PacketFileReader( geFilePool &file_pool, const std::string &path) : PacketFileReaderBase(file_pool, path, false), index_reader_(file_pool, IndexFilename()) { if (index_reader_.data_has_crc()) { PacketFileReaderBase::SetDataHasCrc(); } }
BOOL LibraryFile::AddSpecificIndex(SuperGallery *ParentGal, PathName *Path, SGLibType Type, StringBase *Description, UINT32 bModified, BOOL bIsWebLib) { if(ParentGal == NULL || Path == NULL || !Libraries.IsEmpty() || !Path->IsValid()) { ERROR3("LibraryFile::AddSpecificIndex - Problems on entry"); return FALSE; } // Check the path for the library exists // if(!SGLibOil::FileExists(Path)) // return FALSE; // Remember the pathname and type MyPath = *Path; MyType = Type; ParentGallery = ParentGal; // Create the sub lib Library *NewSubLib = new Library; if (NewSubLib != NULL) { // Path = "C:\testlib\animals\xarainfo\animals.txt" // Path of files themselves... FilesPath = "C:\testlib\animals" NewSubLib->m_bIsWebLib = bIsWebLib; PathName TmpPath(Path->GetLocation(FALSE)); NewSubLib->SetModified(bModified); // If it's a root directory we need the slash... PathName FilesPath; String_256 TmpRootCheck(TmpPath.GetLocation(TRUE)); if(SGLibOil::IsRootDirectory(&TmpRootCheck)) FilesPath.SetPathName(TmpPath.GetLocation(TRUE)); else FilesPath.SetPathName(TmpPath.GetLocation(FALSE)); // Default title for the new group String_256 Desc256; String_64 Desc64; if(Description == NULL) Desc256 = Path->GetTruncatedPath(60); else Desc256 = *Description; Desc256.Left(&Desc64, 64); // The filename of the index String_64 IndexFilename(Path->GetFileName(TRUE)); // Add this new index to the library file and scan it in... if(NewSubLib->Init(ParentGal, &FilesPath, &Desc64, &IndexFilename, Type, FALSE, (Description != NULL))) { Libraries.AddTail(NewSubLib); // Keep track of libraries added for redraw purposes... AddNewFolderToScrollRedrawSystem(NewSubLib); return TRUE; } else { // if there was a problem, don't go round leaving memory everywhere... delete NewSubLib; NewSubLib = NULL; } } // Nothing added return FALSE; }