Ejemplo n.º 1
0
        private static FFTText GetText(Stream iso, Context context, XmlNode doc, BytesFromIso reader, GenericCharMap charmap, BackgroundWorker worker)
        {
            IDictionary <Guid, ISerializableFile> files = GetFiles(iso, context, doc, reader, charmap, worker);

            if (files == null || worker.CancellationPending)
            {
                return(null);
            }

            var quickEdit = new QuickEdit(files, GetQuickEditLookup(doc.SelectSingleNode("//QuickEdit"), worker));

            if (quickEdit == null || worker.CancellationPending)
            {
                return(null);
            }

            return(new FFTText(context, files, quickEdit));
        }
Ejemplo n.º 2
0
        private static FFTText GetText( Stream iso, Context context, XmlNode doc, BytesFromIso reader, GenericCharMap charmap, BackgroundWorker worker )
        {
            IDictionary<Guid, ISerializableFile> files = GetFiles( iso, context, doc, reader, charmap, worker );
            if ( files == null || worker.CancellationPending )
                return null;

            var quickEdit = new QuickEdit( files, GetQuickEditLookup( doc.SelectSingleNode( "//QuickEdit" ), worker ) );
            if ( quickEdit == null || worker.CancellationPending )
                return null;

            return new FFTText( context, files, quickEdit );
        }
Ejemplo n.º 3
0
        private static IDictionary <Guid, ISerializableFile> GetFiles(Stream iso, Context context, XmlNode layoutDoc, BytesFromIso reader, GenericCharMap charmap, BackgroundWorker worker)
        {
            Dictionary <Guid, ISerializableFile> files = new Dictionary <Guid, ISerializableFile>();

            foreach (XmlNode node in layoutDoc.SelectNodes("//Files/*"))
            {
                if (worker.CancellationPending)
                {
                    return(null);
                }

                FileInfo fi = GetFileInfo(context, node);

                if (worker.CancellationPending)
                {
                    return(null);
                }

                IList <byte> bytes = reader(iso, fi.PrimaryFile.Key, fi.PrimaryFile.Value, fi.Size);

                if (worker.CancellationPending)
                {
                    return(null);
                }

                switch (fi.FileType)
                {
                case FileType.CompressedFile:
                    files.Add(fi.Guid, new SectionedFile(charmap, fi, bytes, true));
                    break;

                case FileType.SectionedFile:
                    files.Add(fi.Guid, new SectionedFile(charmap, fi, bytes));
                    break;

                case FileType.CompressibleOneShotFile:
                    files.Add(fi.Guid, new CompressibleOneShotFile(charmap, fi, bytes));
                    break;

                case FileType.OneShotFile:
                case FileType.PartitionedFile:
                    files.Add(fi.Guid, new PartitionedFile(charmap, fi, bytes));
                    break;
                }

                if (worker.CancellationPending)
                {
                    return(null);
                }
            }

            return(new ReadOnlyDictionary <Guid, ISerializableFile>(files));
        }
Ejemplo n.º 4
0
        private static IDictionary<Guid, ISerializableFile> GetFiles( Stream iso, Context context, XmlNode layoutDoc, BytesFromIso reader, GenericCharMap charmap, BackgroundWorker worker )
        {
            Dictionary<Guid, ISerializableFile> files = new Dictionary<Guid, ISerializableFile>();
            foreach ( XmlNode node in layoutDoc.SelectNodes( "//Files/*" ) )
            {
                if ( worker.CancellationPending )
                    return null;

                FileInfo fi = GetFileInfo( context, node );

                if ( worker.CancellationPending )
                    return null;

                IList<byte> bytes = reader( iso, fi.PrimaryFile.Key, fi.PrimaryFile.Value, fi.Size );

                if ( worker.CancellationPending )
                    return null;

                switch ( fi.FileType )
                {
                    case FileType.CompressedFile:
                        files.Add( fi.Guid, new SectionedFile( charmap, fi, bytes, true ) );
                        break;
                    case FileType.SectionedFile:
                        files.Add( fi.Guid, new SectionedFile( charmap, fi, bytes ) );
                        break;
                    case FileType.CompressibleOneShotFile:
                        files.Add( fi.Guid, new CompressibleOneShotFile( charmap, fi, bytes ) );
                        break;
                    case FileType.OneShotFile:
                    case FileType.PartitionedFile:
                        files.Add( fi.Guid, new PartitionedFile( charmap, fi, bytes ) );
                        break;
                }

                if ( worker.CancellationPending )
                    return null;
            }

            return new ReadOnlyDictionary<Guid, ISerializableFile>( files );
        }