Exemplo n.º 1
0
 private void WriteFileTree(AnnoRDA.FileSystem fileSystem, ArchiveFileMap archiveFiles, IList <AnnoRDA.BlockContentsSource> residentBuffers)
 {
     this.WriteStructureStart(FileSystemTags.Structures.Names.FileTree);
     this.WritePathMap(fileSystem.Root.Folders, "", archiveFiles, residentBuffers);
     this.WriteFileMap(fileSystem.Root.Files, "", archiveFiles, residentBuffers);
     this.WriteStructureEnd();
 }
Exemplo n.º 2
0
        private void WriteArchiveMap(AnnoRDA.FileSystem fileSystem, ArchiveFileMap archiveFiles)
        {
            this.WriteStructureStart(FileSystemTags.Structures.Names.ArchiveMap);

            IList <AnnoRDA.BlockContentsSource> residentBuffers = new List <AnnoRDA.BlockContentsSource>();

            this.WriteFileTree(fileSystem, archiveFiles, residentBuffers);
            this.WriteArchiveFiles(archiveFiles);
            this.WriteResidentBuffers(residentBuffers);

            this.WriteStructureEnd();
        }
Exemplo n.º 3
0
        private void WriteFileContents(AnnoRDA.File file, string fullFilePath, ArchiveFileMap archiveFiles, IList <AnnoRDA.BlockContentsSource> residentBuffers)
        {
            this.WriteListStart();

            this.WriteAttribute(FileSystemTags.Attributes.Names.FileName, (string)fullFilePath);

            int archiveFileIndex = archiveFiles.GetIndexForLoadPath(file.ContentsSource.BlockContentsSource.ArchiveFilePath);

            if (archiveFileIndex < 0)
            {
                throw new System.ArgumentException("archive file path not present in archive file map");
            }
            if (archiveFileIndex != 0)
            {
                this.WriteAttribute(FileSystemTags.Attributes.Names.ArchiveFileIndex, (int)archiveFileIndex);
            }

            if (file.ContentsSource.PositionInBlock != 0)
            {
                this.WriteAttribute(FileSystemTags.Attributes.Names.Position, (long)file.ContentsSource.PositionInBlock);
            }
            if (file.ContentsSource.CompressedSize != 0)
            {
                this.WriteAttribute(FileSystemTags.Attributes.Names.CompressedSize, (long)file.ContentsSource.CompressedSize);
            }
            if (file.ContentsSource.UncompressedSize != 0)
            {
                this.WriteAttribute(FileSystemTags.Attributes.Names.UncompressedSize, (long)file.ContentsSource.UncompressedSize);
            }
            if (file.ModificationTimestamp != 0)
            {
                this.WriteAttribute(FileSystemTags.Attributes.Names.ModificationTime, (long)file.ModificationTimestamp);
            }
            if (file.ContentsSource.BlockContentsSource.Flags.Value != 0)
            {
                this.WriteAttribute(FileSystemTags.Attributes.Names.Flags, (int)file.ContentsSource.BlockContentsSource.Flags.Value);
            }

            if (file.ContentsSource.BlockContentsSource.Flags.IsMemoryResident)
            {
                int residentBufferIndex = this.GetIndexInListAddIfMissing(residentBuffers, file.ContentsSource.BlockContentsSource);
                if (residentBufferIndex != 0)
                {
                    this.WriteAttribute(FileSystemTags.Attributes.Names.ResidentBufferIndex, (int)residentBufferIndex);
                }
            }

            this.WriteListEnd();
        }
Exemplo n.º 4
0
        private void WriteArchiveFiles(ArchiveFileMap archiveFiles)
        {
            this.WriteStructureStart(FileSystemTags.Structures.Names.ArchiveFiles);

            foreach (string archiveFile in archiveFiles.GetNames())
            {
                this.WriteListStart();
                this.WriteGenericStringAttribute(archiveFile);
                this.WriteGenericStringAttribute("");
                this.WriteListEnd();
            }

            this.WriteStructureEnd();

            this.WriteAttribute(FileSystemTags.Attributes.Names.LastArchiveFile, (string)archiveFiles.GetLastName());
        }
Exemplo n.º 5
0
 private void WriteFileMap(IEnumerable <AnnoRDA.File> files, string fullPathSoFar, ArchiveFileMap archiveFiles, IList <AnnoRDA.BlockContentsSource> residentBuffers)
 {
     this.WriteStructureStart(FileSystemTags.Structures.Names.FileMap);
     foreach (var file in files.OrderBy(file => file.Name, this.fileNameComparer))
     {
         this.WriteGenericStringAttribute(file.Name);
         this.WriteFileContents(file, fullPathSoFar + file.Name, archiveFiles, residentBuffers);
     }
     this.WriteStructureEnd();
 }
Exemplo n.º 6
0
 private void WriteFolderContents(AnnoRDA.Folder folder, string fullPathSoFar, ArchiveFileMap archiveFiles, IList <AnnoRDA.BlockContentsSource> residentBuffers)
 {
     this.WriteListStart();
     this.WritePathMap(folder.Folders, fullPathSoFar, archiveFiles, residentBuffers);
     this.WriteFileMap(folder.Files, fullPathSoFar, archiveFiles, residentBuffers);
     this.WriteListEnd();
 }
Exemplo n.º 7
0
 public void WriteFileSystem(AnnoRDA.FileSystem fileSystem, ArchiveFileMap archiveFiles)
 {
     this.WriteArchiveMap(fileSystem, archiveFiles);
     this.writer.FinalizeFile(this.tags);
 }