Ejemplo n.º 1
0
        // TODO: More graphically aware decoders
        void OnCmbTagSelectedIndexChanged(object sender, EventArgs e)
        {
            if (!(cmbTag.SelectedValue is MediaTagWithData tagWithData))
            {
                return;
            }

            // TODO: Decoders should be able to handle tags with/without length header
            txtPrintHex.Text   = PrintHex.ByteArrayToHexArrayString(tagWithData.Data, HEX_COLUMNS);
            tabDecoded.Visible = true;
            switch (tagWithData.Tag)
            {
            case MediaTagType.CD_TOC:
                txtDecoded.Text = TOC.Prettify(tagWithData.Data);
                break;

            case MediaTagType.CD_SessionInfo:
                txtDecoded.Text = Session.Prettify(tagWithData.Data);
                break;

            case MediaTagType.CD_FullTOC:
                txtDecoded.Text = FullTOC.Prettify(tagWithData.Data);
                break;

            case MediaTagType.CD_PMA:
                txtDecoded.Text = PMA.Prettify(tagWithData.Data);
                break;

            case MediaTagType.CD_ATIP:
                txtDecoded.Text = ATIP.Prettify(tagWithData.Data);
                break;

            case MediaTagType.CD_TEXT:
                txtDecoded.Text = CDTextOnLeadIn.Prettify(tagWithData.Data);
                break;

            case MediaTagType.CD_MCN:
                txtDecoded.Text = Encoding.ASCII.GetString(tagWithData.Data);
                break;

            case MediaTagType.DVD_PFI:
                txtDecoded.Text = PFI.Prettify(tagWithData.Data);
                break;

            case MediaTagType.DVD_CMI:
                txtDecoded.Text = CSS_CPRM.PrettifyLeadInCopyright(tagWithData.Data);
                break;

            case MediaTagType.DVDRAM_DDS:
                txtDecoded.Text = DDS.Prettify(tagWithData.Data);
                break;

            case MediaTagType.DVDRAM_SpareArea:
                txtDecoded.Text = Spare.Prettify(tagWithData.Data);
                break;

            case MediaTagType.DVDR_PFI:
                txtDecoded.Text = PFI.Prettify(tagWithData.Data);
                break;

            case MediaTagType.HDDVD_MediumStatus:
                txtDecoded.Text = PFI.Prettify(tagWithData.Data);
                break;

            case MediaTagType.BD_DI:
                txtDecoded.Text = DI.Prettify(tagWithData.Data);
                break;

            case MediaTagType.BD_BCA:
                txtDecoded.Text = BCA.Prettify(tagWithData.Data);
                break;

            case MediaTagType.BD_DDS:
                txtDecoded.Text = Decoders.Bluray.DDS.Prettify(tagWithData.Data);
                break;

            case MediaTagType.BD_CartridgeStatus:
                txtDecoded.Text = Cartridge.Prettify(tagWithData.Data);
                break;

            case MediaTagType.BD_SpareArea:
                txtDecoded.Text = Decoders.Bluray.Spare.Prettify(tagWithData.Data);
                break;

            case MediaTagType.MMC_WriteProtection:
                txtDecoded.Text = WriteProtect.PrettifyWriteProtectionStatus(tagWithData.Data);
                break;

            case MediaTagType.MMC_DiscInformation:
                txtDecoded.Text = DiscInformation.Prettify(tagWithData.Data);
                break;

            case MediaTagType.SCSI_INQUIRY:
                txtDecoded.Text = Inquiry.Prettify(tagWithData.Data);
                break;

            case MediaTagType.SCSI_MODEPAGE_2A:
                txtDecoded.Text = Modes.PrettifyModePage_2A(tagWithData.Data);
                break;

            case MediaTagType.ATA_IDENTIFY:
            case MediaTagType.ATAPI_IDENTIFY:
                txtDecoded.Text = Identify.Prettify(tagWithData.Data);
                break;

            case MediaTagType.Xbox_SecuritySector:
                txtDecoded.Text = SS.Prettify(tagWithData.Data);
                break;

            case MediaTagType.SCSI_MODESENSE_6:
                txtDecoded.Text = Modes.PrettifyModeHeader6(tagWithData.Data, PeripheralDeviceTypes.DirectAccess);
                break;

            case MediaTagType.SCSI_MODESENSE_10:
                txtDecoded.Text = Modes.PrettifyModeHeader10(tagWithData.Data, PeripheralDeviceTypes.DirectAccess);
                break;

            case MediaTagType.Xbox_DMI:
                txtDecoded.Text = DMI.IsXbox360(tagWithData.Data)
                                          ? DMI.PrettifyXbox360(tagWithData.Data)
                                          : DMI.PrettifyXbox(tagWithData.Data);
                break;

            default:
                tabDecoded.Visible = false;
                break;
            }
        }
Ejemplo n.º 2
0
        public ChartSheetContentSequence(IStreamReader reader)
            : base(reader)
        {
            // reset id counter for chart groups
            ChartFormatIdGenerator.Instance.StartNewChartsheetSubstream();
            ChartAxisIdGenerator.Instance.StartNewChartsheetSubstream();

            // CHARTSHEETCONTENT = [WriteProtect] [SheetExt] [WebPub] *HFPicture PAGESETUP PrintSize [HeaderFooter] [BACKGROUND] *Fbi *Fbi2 [ClrtClient] [PROTECTION]
            //          [Palette] [SXViewLink] [PivotChartBits] [SBaseRef] [MsoDrawingGroup] OBJECTS Units CHARTFOMATS SERIESDATA *WINDOW *CUSTOMVIEW [CodeName] [CRTMLFRT] EOF

            // [WriteProtect]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.WriteProtect)
            {
                this.WriteProtect = (WriteProtect)BiffRecord.ReadRecord(reader);
            }

            // [SheetExt]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.SheetExt)
            {
                this.SheetExt = (SheetExt)BiffRecord.ReadRecord(reader);
            }

            // [WebPub]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.WebPub)
            {
                this.WebPub = (WebPub)BiffRecord.ReadRecord(reader);
            }

            // *HFPicture
            while (BiffRecord.GetNextRecordType(reader) == RecordType.HFPicture)
            {
                this.HFPictures.Add((HFPicture)BiffRecord.ReadRecord(reader));
            }

            // PAGESETUP
            this.PageSetupSequence = new PageSetupSequence(reader);

            // PrintSize
            if (BiffRecord.GetNextRecordType(reader) == RecordType.PrintSize)
            {
                this.PrintSize = (PrintSize)BiffRecord.ReadRecord(reader);
            }

            // [HeaderFooter]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.HeaderFooter)
            {
                this.HeaderFooter = (HeaderFooter)BiffRecord.ReadRecord(reader);
            }

            // [BACKGROUND]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.BkHim)
            {
                this.BackgroundSequence = new BackgroundSequence(reader);
            }

            // *Fbi
            this.Fbis = new List <Fbi>();
            while (BiffRecord.GetNextRecordType(reader) == RecordType.Fbi)
            {
                this.Fbis.Add((Fbi)BiffRecord.ReadRecord(reader));
            }

            // *Fbi2
            this.Fbi2s = new List <Fbi2>();
            while (BiffRecord.GetNextRecordType(reader) == RecordType.Fbi2)
            {
                this.Fbi2s.Add((Fbi2)BiffRecord.ReadRecord(reader));
            }

            // [ClrtClient]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.ClrtClient)
            {
                this.ClrtClient = (ClrtClient)BiffRecord.ReadRecord(reader);
            }

            // [PROTECTION]
            this.ProtectionSequence = new ProtectionSequence(reader);

            // [Palette]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.Palette)
            {
                this.Palette = (Palette)BiffRecord.ReadRecord(reader);
            }

            // [SXViewLink]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.SXViewLink)
            {
                this.SXViewLink = (SXViewLink)BiffRecord.ReadRecord(reader);
            }

            // [PivotChartBits]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.PivotChartBits)
            {
                this.PivotChartBits = (PivotChartBits)BiffRecord.ReadRecord(reader);
            }

            // [SBaseRef]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.SBaseRef)
            {
                this.SBaseRef = (SBaseRef)BiffRecord.ReadRecord(reader);
            }

            // [MsoDrawingGroup]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.MsoDrawingGroup)
            {
                this.MsoDrawingGroup = (MsoDrawingGroup)BiffRecord.ReadRecord(reader);
            }

            // OBJECTS
            this.ObjectsSequence = new ObjectsSequence(reader);

            // Units
            this.Units = (Units)BiffRecord.ReadRecord(reader);

            // CHARTFOMATS
            this.ChartFormatsSequence = new ChartFormatsSequence(reader);

            // SERIESDATA
            this.SeriesDataSequence = new SeriesDataSequence(reader);

            // *WINDOW
            this.WindowSequences = new List <WindowSequence>();
            while (BiffRecord.GetNextRecordType(reader) == RecordType.Window2)
            {
                this.WindowSequences.Add(new WindowSequence(reader));
            }

            // *CUSTOMVIEW
            this.CustomViewSequences = new List <CustomViewSequence>();

            // CUSTOMVIEW seems to be totally optional,
            // so check for the existence of the next sequences
            while (BiffRecord.GetNextRecordType(reader) != RecordType.CodeName &&
                   BiffRecord.GetNextRecordType(reader) != RecordType.CrtMlFrt &&
                   BiffRecord.GetNextRecordType(reader) != RecordType.EOF)
            {
                this.CustomViewSequences.Add(new CustomViewSequence(reader));
            }

            //this.CustomViewSequences = new List<CustomViewSequence>();
            //while (BiffRecord.GetNextRecordType(reader) == RecordType.UserSViewBegin)
            //{
            //    this.CustomViewSequences.Add(new CustomViewSequence(reader));
            //}

            // [CodeName]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.CodeName)
            {
                this.CodeName = (CodeName)BiffRecord.ReadRecord(reader);
            }

            // [CRTMLFRT]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.CrtMlFrt)
            {
                this.CrtMlfrtSequence = new CrtMlfrtSequence(reader);
            }

            // EOF
            this.EOF = (EOF)BiffRecord.ReadRecord(reader);
        }