Ejemplo n.º 1
0
        public BagFile(FileSystem context, string filename)
        {
            Name = filename;

            // A bag file is always accompanied with an .idx counterpart
            // For example: audio.bag requires the audio.idx file
            var indexFilename = Path.ChangeExtension(filename, ".idx");

            // Build the index and dispose the stream, it is no longer needed after this
            List<IdxEntry> entries;
            using (var indexStream = context.Open(indexFilename))
                entries = new IdxReader(indexStream).Entries;

            index = entries.ToDictionaryWithConflictLog(x => x.Filename,
                "{0} (bag format)".F(filename),
                null, x => "(offs={0}, len={1})".F(x.Offset, x.Length));

            s = context.Open(filename);
        }
Ejemplo n.º 2
0
        public BagFile(string filename, int priority)
        {
            bagFilename = filename;
            bagFilePriority = priority;

            // A bag file is always accompanied with an .idx counterpart
            // For example: audio.bag requires the audio.idx file
            var indexFilename = Path.ChangeExtension(filename, ".idx");

            s = GlobalFileSystem.Open(filename);

            // Build the index and dispose the stream, it is no longer needed after this
            List<IdxEntry> entries;
            using (var indexStream = GlobalFileSystem.Open(indexFilename))
            {
                var reader = new IdxReader(indexStream);

                entries = reader.Entries;
            }

            index = entries.ToDictionaryWithConflictLog(x => x.Hash,
                "{0} (bag format)".F(filename),
                null, x => "(offs={0}, len={1})".F(x.Offset, x.Length));
        }