private void AddEntryToDictionary( EdataDictionaryPathEntry entry, ContentPathSplitInfo entryPathSplitInfo, EdataDictionaryRootEntry dictionaryRoot) { if (entryPathSplitInfo.SplitIndex == 0) { dictionaryRoot.AddFollowingEntry(entry); //entry.PrecedingEntry = dictionaryRoot; } else { var precedingPath = entryPathSplitInfo.GetPathToSplitIndex(); EdataDictionaryPathEntry precedingPathEntry = dictionaryRoot.SelectEntryByPath(precedingPath); var pp = precedingPathEntry as EdataDictionaryDirEntry; if (precedingPathEntry != null) { pp.AddFollowingEntry(entry); //entry.PrecedingEntry = pp; } else { throw new Exception(String.Format( "Cannot find a following precedding entry: {0}", precedingPath)); } } }
/// <summary> /// Assigns a dictionary data of the content files to the corresponding dictionary entries. /// </summary> /// <param name="contentFiles"></param> /// <param name="dictionaryRoot"></param> protected virtual void AssignContentFilesInfoToDictEntries( IEnumerable <EdataContentFile> contentFiles, EdataDictionaryRootEntry dictionaryRoot) { foreach (var file in contentFiles) { var matchingEntry = dictionaryRoot.SelectEntryByPath(file.Path); EdataDictionaryFileEntry fileEntry = matchingEntry as EdataDictionaryFileEntry; if (fileEntry != null) { fileEntry.FileOffset = file.Offset; fileEntry.FileLength = file.Length; fileEntry.FileChecksum = file.Checksum; } } }