mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Decode CompactDisc media tags from image info in GUI.
This commit is contained in:
2
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
2
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
@@ -1614,6 +1614,8 @@
|
||||
<e p="Tabs" t="Include">
|
||||
<e p="tabAtaInfo.xeto" t="Include" />
|
||||
<e p="tabAtaInfo.xeto.cs" t="Include" />
|
||||
<e p="tabCompactDiscInfo.xeto" t="Include" />
|
||||
<e p="tabCompactDiscInfo.xeto.cs" t="Include" />
|
||||
<e p="tabScsiInfo.xeto" t="Include" />
|
||||
<e p="tabScsiInfo.xeto.cs" t="Include" />
|
||||
</e>
|
||||
|
||||
@@ -32,8 +32,10 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes.Enums;
|
||||
using DiscImageChef.CommonTypes.Interfaces;
|
||||
using DiscImageChef.Decoders.CD;
|
||||
using DiscImageChef.Decoders.SCSI;
|
||||
using DiscImageChef.Gui.Tabs;
|
||||
using Eto.Forms;
|
||||
@@ -260,6 +262,131 @@ namespace DiscImageChef.Gui.Panels
|
||||
tabAtaInfo tabAtaInfo = new tabAtaInfo();
|
||||
tabAtaInfo.LoadData(ataIdentify, atapiIdentify, null);
|
||||
tabInfos.Pages.Add(tabAtaInfo);
|
||||
|
||||
byte[] toc = null;
|
||||
TOC.CDTOC? decodedToc = null;
|
||||
byte[] fullToc = null;
|
||||
FullTOC.CDFullTOC? decodedFullToc = null;
|
||||
byte[] pma = null;
|
||||
byte[] atip = null;
|
||||
ATIP.CDATIP? decodedAtip = null;
|
||||
byte[] cdtext = null;
|
||||
CDTextOnLeadIn.CDText? decodedCdText = null;
|
||||
string mediaCatalogueNumber = null;
|
||||
|
||||
if(imageFormat.Info.ReadableMediaTags != null &&
|
||||
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_TOC))
|
||||
{
|
||||
toc = imageFormat.ReadDiskTag(MediaTagType.CD_TOC);
|
||||
|
||||
if(toc.Length > 0)
|
||||
{
|
||||
ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(toc, 0));
|
||||
if(dataLen + 2 != toc.Length)
|
||||
{
|
||||
byte[] tmp = new byte[toc.Length + 2];
|
||||
Array.Copy(toc, 0, tmp, 2, toc.Length);
|
||||
tmp[0] = (byte)((toc.Length & 0xFF00) >> 8);
|
||||
tmp[1] = (byte)(toc.Length & 0xFF);
|
||||
toc = tmp;
|
||||
}
|
||||
|
||||
decodedToc = TOC.Decode(toc);
|
||||
}
|
||||
}
|
||||
|
||||
if(imageFormat.Info.ReadableMediaTags != null &&
|
||||
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_FullTOC))
|
||||
{
|
||||
fullToc = imageFormat.ReadDiskTag(MediaTagType.CD_FullTOC);
|
||||
|
||||
if(fullToc.Length > 0)
|
||||
{
|
||||
ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(fullToc, 0));
|
||||
if(dataLen + 2 != fullToc.Length)
|
||||
{
|
||||
byte[] tmp = new byte[fullToc.Length + 2];
|
||||
Array.Copy(fullToc, 0, tmp, 2, fullToc.Length);
|
||||
tmp[0] = (byte)((fullToc.Length & 0xFF00) >> 8);
|
||||
tmp[1] = (byte)(fullToc.Length & 0xFF);
|
||||
fullToc = tmp;
|
||||
}
|
||||
|
||||
decodedFullToc = FullTOC.Decode(fullToc);
|
||||
}
|
||||
}
|
||||
|
||||
if(imageFormat.Info.ReadableMediaTags != null &&
|
||||
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_PMA))
|
||||
{
|
||||
pma = imageFormat.ReadDiskTag(MediaTagType.CD_PMA);
|
||||
|
||||
if(pma.Length > 0)
|
||||
{
|
||||
ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(pma, 0));
|
||||
if(dataLen + 2 != pma.Length)
|
||||
{
|
||||
byte[] tmp = new byte[pma.Length + 2];
|
||||
Array.Copy(pma, 0, tmp, 2, pma.Length);
|
||||
tmp[0] = (byte)((pma.Length & 0xFF00) >> 8);
|
||||
tmp[1] = (byte)(pma.Length & 0xFF);
|
||||
pma = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(imageFormat.Info.ReadableMediaTags != null &&
|
||||
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_ATIP))
|
||||
{
|
||||
atip = imageFormat.ReadDiskTag(MediaTagType.CD_ATIP);
|
||||
|
||||
uint dataLen = Swapping.Swap(BitConverter.ToUInt32(atip, 0));
|
||||
if(dataLen + 4 != atip.Length)
|
||||
{
|
||||
byte[] tmp = new byte[atip.Length + 4];
|
||||
Array.Copy(atip, 0, tmp, 4, atip.Length);
|
||||
tmp[0] = (byte)((atip.Length & 0xFF000000) >> 24);
|
||||
tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16);
|
||||
tmp[2] = (byte)((atip.Length & 0xFF00) >> 8);
|
||||
tmp[3] = (byte)(atip.Length & 0xFF);
|
||||
atip = tmp;
|
||||
}
|
||||
|
||||
decodedAtip = ATIP.Decode(atip);
|
||||
}
|
||||
|
||||
if(imageFormat.Info.ReadableMediaTags != null &&
|
||||
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_TEXT))
|
||||
{
|
||||
cdtext = imageFormat.ReadDiskTag(MediaTagType.CD_TEXT);
|
||||
|
||||
uint dataLen = Swapping.Swap(BitConverter.ToUInt32(cdtext, 0));
|
||||
if(dataLen + 4 != cdtext.Length)
|
||||
{
|
||||
byte[] tmp = new byte[cdtext.Length + 4];
|
||||
Array.Copy(cdtext, 0, tmp, 4, cdtext.Length);
|
||||
tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24);
|
||||
tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16);
|
||||
tmp[2] = (byte)((cdtext.Length & 0xFF00) >> 8);
|
||||
tmp[3] = (byte)(cdtext.Length & 0xFF);
|
||||
cdtext = tmp;
|
||||
}
|
||||
|
||||
decodedCdText = CDTextOnLeadIn.Decode(cdtext);
|
||||
}
|
||||
|
||||
if(imageFormat.Info.ReadableMediaTags != null &&
|
||||
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_MCN))
|
||||
{
|
||||
byte[] mcn = imageFormat.ReadDiskTag(MediaTagType.CD_MCN);
|
||||
|
||||
mediaCatalogueNumber = Encoding.UTF8.GetString(mcn);
|
||||
}
|
||||
|
||||
tabCompactDiscInfo tabCompactDiscInfo = new tabCompactDiscInfo();
|
||||
tabCompactDiscInfo.LoadData(toc, atip, null, null, fullToc, pma, cdtext, decodedToc, decodedAtip, null,
|
||||
decodedFullToc, decodedCdText, null, mediaCatalogueNumber, null);
|
||||
tabInfos.Pages.Add(tabCompactDiscInfo);
|
||||
}
|
||||
|
||||
#region XAML controls
|
||||
|
||||
@@ -31,19 +31,18 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.Core.Media.Info;
|
||||
using DiscImageChef.Decoders.Bluray;
|
||||
using DiscImageChef.Decoders.CD;
|
||||
using DiscImageChef.Decoders.DVD;
|
||||
using DiscImageChef.Decoders.SCSI.MMC;
|
||||
using DiscImageChef.Decoders.SCSI.SSC;
|
||||
using DiscImageChef.Decoders.Xbox;
|
||||
using DiscImageChef.Gui.Controls;
|
||||
using DiscImageChef.Gui.Forms;
|
||||
using DiscImageChef.Gui.Tabs;
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
using Eto.Serialization.Xaml;
|
||||
@@ -186,78 +185,14 @@ namespace DiscImageChef.Gui.Panels
|
||||
tabSsc.Visible = grpDensitySupport.Visible || grpMediumSupport.Visible || btnSaveDensitySupport.Visible ||
|
||||
btnSaveMediumSupport.Visible;
|
||||
|
||||
if(this.scsiInfo.DecodedCompactDiscInformation.HasValue)
|
||||
{
|
||||
tabCdInformation.Visible = true;
|
||||
txtCdInformation.Text = DiscInformation.Prettify000b(scsiInfo.DecodedCompactDiscInformation);
|
||||
btnCdInformation.Visible = scsiInfo.CompactDiscInformation != null;
|
||||
}
|
||||
|
||||
if(this.scsiInfo.DecodedToc.HasValue)
|
||||
{
|
||||
tabCdToc.Visible = true;
|
||||
txtCdToc.Text = TOC.Prettify(scsiInfo.DecodedToc);
|
||||
btnCdToc.Visible = scsiInfo.Toc != null;
|
||||
}
|
||||
|
||||
if(this.scsiInfo.FullToc.HasValue)
|
||||
{
|
||||
tabCdFullToc.Visible = true;
|
||||
txtCdFullToc.Text = FullTOC.Prettify(scsiInfo.FullToc);
|
||||
btnCdFullToc.Visible = scsiInfo.RawToc != null;
|
||||
}
|
||||
|
||||
if(this.scsiInfo.DecodedSession.HasValue)
|
||||
{
|
||||
tabCdSession.Visible = true;
|
||||
txtCdSession.Text = Session.Prettify(scsiInfo.DecodedSession);
|
||||
btnCdSession.Visible = scsiInfo.Session != null;
|
||||
}
|
||||
|
||||
if(this.scsiInfo.DecodedCdTextLeadIn.HasValue)
|
||||
{
|
||||
tabCdText.Visible = true;
|
||||
txtCdText.Text = CDTextOnLeadIn.Prettify(this.scsiInfo.DecodedCdTextLeadIn);
|
||||
btnCdText.Visible = scsiInfo.CdTextLeadIn != null;
|
||||
}
|
||||
|
||||
if(this.scsiInfo.DecodedAtip.HasValue)
|
||||
{
|
||||
tabCdAtip.Visible = true;
|
||||
txtCdAtip.Text = ATIP.Prettify(this.scsiInfo.Atip);
|
||||
btnCdAtip.Visible = scsiInfo.Atip != null;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(scsiInfo.Mcn))
|
||||
{
|
||||
stkMcn.Visible = true;
|
||||
txtMcn.Text = scsiInfo.Mcn;
|
||||
}
|
||||
|
||||
if(this.scsiInfo.Isrcs != null && this.scsiInfo.Isrcs.Count > 0)
|
||||
{
|
||||
grpIsrcs.Visible = true;
|
||||
|
||||
TreeGridItemCollection isrcsItems = new TreeGridItemCollection();
|
||||
|
||||
grdIsrcs.Columns.Add(new GridColumn {HeaderText = "ISRC", DataCell = new TextBoxCell(0)});
|
||||
grdIsrcs.Columns.Add(new GridColumn {HeaderText = "Track", DataCell = new TextBoxCell(0)});
|
||||
|
||||
grdIsrcs.AllowMultipleSelection = false;
|
||||
grdIsrcs.ShowHeader = true;
|
||||
grdIsrcs.DataStore = isrcsItems;
|
||||
|
||||
foreach(KeyValuePair<byte, string> isrc in this.scsiInfo.Isrcs)
|
||||
isrcsItems.Add(new TreeGridItem {Values = new object[] {isrc.Key.ToString(), isrc.Value}});
|
||||
}
|
||||
|
||||
btnCdPma.Visible = this.scsiInfo.Pma != null;
|
||||
|
||||
tabCdMisc.Visible = stkMcn.Visible || grpIsrcs.Visible || btnCdPma.Visible;
|
||||
|
||||
tabCd.Visible = tabCdInformation.Visible || tabCdToc.Visible || tabCdFullToc.Visible ||
|
||||
tabCdSession.Visible || tabCdText.Visible || tabCdAtip.Visible || stkMcn.Visible ||
|
||||
grpIsrcs.Visible || btnCdPma.Visible;
|
||||
tabCompactDiscInfo tabCompactDiscInfo = new tabCompactDiscInfo();
|
||||
tabCompactDiscInfo.LoadData(scsiInfo.Toc, scsiInfo.Atip, scsiInfo.CompactDiscInformation, scsiInfo.Session,
|
||||
scsiInfo.RawToc, this.scsiInfo.Pma, this.scsiInfo.CdTextLeadIn,
|
||||
this.scsiInfo.DecodedToc, this.scsiInfo.DecodedAtip,
|
||||
this.scsiInfo.DecodedSession, this.scsiInfo.FullToc,
|
||||
this.scsiInfo.DecodedCdTextLeadIn, this.scsiInfo.DecodedCompactDiscInformation,
|
||||
this.scsiInfo.Mcn, this.scsiInfo.Isrcs);
|
||||
tabInfos.Pages.Add(tabCompactDiscInfo);
|
||||
|
||||
if(this.scsiInfo.DecodedPfi.HasValue)
|
||||
{
|
||||
|
||||
103
DiscImageChef.Gui/Tabs/tabCompactDiscInfo.xeto
Normal file
103
DiscImageChef.Gui/Tabs/tabCompactDiscInfo.xeto
Normal file
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!--
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ============================================================================
|
||||
//
|
||||
// Filename : pnlScsiInfo.xeto
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : SCSI media information panel.
|
||||
//
|
||||
// ==[ Description ] ==========================================================
|
||||
//
|
||||
// Defines the structure for the SCSI media information panel.
|
||||
//
|
||||
// ==[ License ] ==============================================================
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ============================================================================
|
||||
// Copyright © 2011-2018 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
-->
|
||||
<TabPage Text="CompactDisc" Visible="False" xmlns="http://schema.picoe.ca/eto.forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<TabControl>
|
||||
<TabPage ID="tabCdInformation" Text="Information" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem Expand="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
||||
<TextArea ID="txtCdInformation" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
<Button Click="OnBtnCdInformationClick" ID="btnCdInformation"
|
||||
Text="Save READ DISC INFORMATION response"/>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
<TabPage ID="tabCdToc" Text="TOC" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem Expand="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
||||
<TextArea ID="txtCdToc" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
<Button Click="OnBtnCdTocClick" ID="btnCdToc" Text="Save READ TOC response"/>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
<TabPage ID="tabCdFullToc" Text="TOC (full)" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem Expand="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
||||
<TextArea ID="txtCdFullToc" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
<Button Click="OnBtnCdFullTocClick" ID="btnCdFullToc" Text="Save READ RAW TOC response"/>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
<TabPage ID="tabCdSession" Text="Session" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem Expand="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
||||
<TextArea ID="txtCdSession" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
<Button Click="OnBtnCdSessionClick" ID="btnCdSession" Text="Save READ SESSION response"/>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
<TabPage ID="tabCdText" Text="CD-TEXT" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem Expand="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
||||
<TextArea ID="txtCdText" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
<Button Click="OnBtnCdTextClick" ID="btnCdText" Text="Save Lead-In CD-TEXT"/>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
<TabPage ID="tabCdAtip" Text="ATIP" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem Expand="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
||||
<TextArea ID="txtCdAtip" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
<Button Click="OnBtnCdAtipClick" ID="btnCdAtip" Text="Save READ ATIP response"/>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
<TabPage ID="tabCdMisc" Text="Miscellaneous" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||
<StackLayout Orientation="Horizontal" ID="stkMcn" Visible="False">
|
||||
<Label ID="lblMcn" Text="Media catalog number"/>
|
||||
<TextBox ID="txtMcn" ReadOnly="True"/>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
||||
<GroupBox ID="grpIsrcs" Text="ISRCs" Visible="False">
|
||||
<TreeGridView ID="grdIsrcs"/>
|
||||
</GroupBox>
|
||||
</StackLayoutItem>
|
||||
<Button Click="OnBtnCdPmaClick" ID="btnCdPma" Text="Save READ PMA response" Visible="False"/>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
</TabControl>
|
||||
</TabPage>
|
||||
230
DiscImageChef.Gui/Tabs/tabCompactDiscInfo.xeto.cs
Normal file
230
DiscImageChef.Gui/Tabs/tabCompactDiscInfo.xeto.cs
Normal file
@@ -0,0 +1,230 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : pnlxeto.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : SCSI media information panel.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Implements the SCSI media information panel.
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright © 2011-2018 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using DiscImageChef.Decoders.CD;
|
||||
using DiscImageChef.Decoders.SCSI.MMC;
|
||||
using Eto.Forms;
|
||||
using Eto.Serialization.Xaml;
|
||||
|
||||
namespace DiscImageChef.Gui.Tabs
|
||||
{
|
||||
public class tabCompactDiscInfo : TabPage
|
||||
{
|
||||
byte[] atipData;
|
||||
byte[] cdTextLeadInData;
|
||||
byte[] compactDiscInformationData;
|
||||
byte[] pmaData;
|
||||
byte[] rawTocData;
|
||||
byte[] sessionData;
|
||||
byte[] tocData;
|
||||
|
||||
public tabCompactDiscInfo()
|
||||
{
|
||||
XamlReader.Load(this);
|
||||
}
|
||||
|
||||
internal void LoadData(byte[] toc, byte[] atip,
|
||||
byte[] compactDiscInformation, byte[] session, byte[] rawToc,
|
||||
byte[] pma, byte[] cdTextLeadIn,
|
||||
TOC.CDTOC? decodedToc, ATIP.CDATIP? decodedAtip,
|
||||
Session.CDSessionInfo? decodedSession, FullTOC.CDFullTOC? fullToc,
|
||||
CDTextOnLeadIn.CDText? decodedCdTextLeadIn,
|
||||
DiscInformation.StandardDiscInformation? decodedCompactDiscInformation, string mcn,
|
||||
Dictionary<byte, string> isrcs)
|
||||
{
|
||||
tocData = toc;
|
||||
atipData = atip;
|
||||
compactDiscInformationData = compactDiscInformation;
|
||||
sessionData = session;
|
||||
rawTocData = rawToc;
|
||||
pmaData = pma;
|
||||
cdTextLeadInData = cdTextLeadIn;
|
||||
|
||||
if(decodedCompactDiscInformation.HasValue)
|
||||
{
|
||||
tabCdInformation.Visible = true;
|
||||
txtCdInformation.Text = DiscInformation.Prettify000b(decodedCompactDiscInformation);
|
||||
btnCdInformation.Visible = compactDiscInformation != null;
|
||||
}
|
||||
|
||||
if(decodedToc.HasValue)
|
||||
{
|
||||
tabCdToc.Visible = true;
|
||||
txtCdToc.Text = TOC.Prettify(decodedToc);
|
||||
btnCdToc.Visible = toc != null;
|
||||
}
|
||||
|
||||
if(fullToc.HasValue)
|
||||
{
|
||||
tabCdFullToc.Visible = true;
|
||||
txtCdFullToc.Text = FullTOC.Prettify(fullToc);
|
||||
btnCdFullToc.Visible = rawToc != null;
|
||||
}
|
||||
|
||||
if(decodedSession.HasValue)
|
||||
{
|
||||
tabCdSession.Visible = true;
|
||||
txtCdSession.Text = Session.Prettify(decodedSession);
|
||||
btnCdSession.Visible = session != null;
|
||||
}
|
||||
|
||||
if(decodedCdTextLeadIn.HasValue)
|
||||
{
|
||||
tabCdText.Visible = true;
|
||||
txtCdText.Text = CDTextOnLeadIn.Prettify(decodedCdTextLeadIn);
|
||||
btnCdText.Visible = cdTextLeadIn != null;
|
||||
}
|
||||
|
||||
if(decodedAtip.HasValue)
|
||||
{
|
||||
tabCdAtip.Visible = true;
|
||||
txtCdAtip.Text = ATIP.Prettify(atip);
|
||||
btnCdAtip.Visible = atip != null;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(mcn))
|
||||
{
|
||||
stkMcn.Visible = true;
|
||||
txtMcn.Text = mcn;
|
||||
}
|
||||
|
||||
if(isrcs != null && isrcs.Count > 0)
|
||||
{
|
||||
grpIsrcs.Visible = true;
|
||||
|
||||
TreeGridItemCollection isrcsItems = new TreeGridItemCollection();
|
||||
|
||||
grdIsrcs.Columns.Add(new GridColumn {HeaderText = "ISRC", DataCell = new TextBoxCell(0)});
|
||||
grdIsrcs.Columns.Add(new GridColumn {HeaderText = "Track", DataCell = new TextBoxCell(0)});
|
||||
|
||||
grdIsrcs.AllowMultipleSelection = false;
|
||||
grdIsrcs.ShowHeader = true;
|
||||
grdIsrcs.DataStore = isrcsItems;
|
||||
|
||||
foreach(KeyValuePair<byte, string> isrc in isrcs)
|
||||
isrcsItems.Add(new TreeGridItem {Values = new object[] {isrc.Key.ToString(), isrc.Value}});
|
||||
}
|
||||
|
||||
btnCdPma.Visible = pma != null;
|
||||
|
||||
tabCdMisc.Visible = stkMcn.Visible || grpIsrcs.Visible || btnCdPma.Visible;
|
||||
|
||||
Visible = tabCdInformation.Visible || tabCdToc.Visible || tabCdFullToc.Visible || tabCdSession.Visible ||
|
||||
tabCdText.Visible || tabCdAtip.Visible || stkMcn.Visible || grpIsrcs.Visible ||
|
||||
btnCdPma.Visible;
|
||||
}
|
||||
|
||||
void SaveElement(byte[] data)
|
||||
{
|
||||
SaveFileDialog dlgSaveBinary = new SaveFileDialog();
|
||||
dlgSaveBinary.Filters.Add(new FileFilter {Extensions = new[] {"*.bin"}, Name = "Binary"});
|
||||
DialogResult result = dlgSaveBinary.ShowDialog(this);
|
||||
|
||||
if(result != DialogResult.Ok) return;
|
||||
|
||||
FileStream saveFs = new FileStream(dlgSaveBinary.FileName, FileMode.Create);
|
||||
saveFs.Write(data, 0, data.Length);
|
||||
|
||||
saveFs.Close();
|
||||
}
|
||||
|
||||
protected void OnBtnCdInformationClick(object sender, EventArgs e)
|
||||
{
|
||||
SaveElement(compactDiscInformationData);
|
||||
}
|
||||
|
||||
protected void OnBtnCdTocClick(object sender, EventArgs e)
|
||||
{
|
||||
SaveElement(tocData);
|
||||
}
|
||||
|
||||
protected void OnBtnCdFullTocClick(object sender, EventArgs e)
|
||||
{
|
||||
SaveElement(rawTocData);
|
||||
}
|
||||
|
||||
protected void OnBtnCdSessionClick(object sender, EventArgs e)
|
||||
{
|
||||
SaveElement(sessionData);
|
||||
}
|
||||
|
||||
protected void OnBtnCdTextClick(object sender, EventArgs e)
|
||||
{
|
||||
SaveElement(cdTextLeadInData);
|
||||
}
|
||||
|
||||
protected void OnBtnCdAtipClick(object sender, EventArgs e)
|
||||
{
|
||||
SaveElement(atipData);
|
||||
}
|
||||
|
||||
protected void OnBtnCdPmaClick(object sender, EventArgs e)
|
||||
{
|
||||
SaveElement(pmaData);
|
||||
}
|
||||
|
||||
#region XAML controls
|
||||
#pragma warning disable 169
|
||||
#pragma warning disable 649
|
||||
TabPage tabCdInformation;
|
||||
TextArea txtCdInformation;
|
||||
Button btnCdInformation;
|
||||
TabPage tabCdToc;
|
||||
TextArea txtCdToc;
|
||||
Button btnCdToc;
|
||||
TabPage tabCdFullToc;
|
||||
TextArea txtCdFullToc;
|
||||
Button btnCdFullToc;
|
||||
TabPage tabCdSession;
|
||||
TextArea txtCdSession;
|
||||
Button btnCdSession;
|
||||
TabPage tabCdText;
|
||||
TextArea txtCdText;
|
||||
Button btnCdText;
|
||||
TabPage tabCdAtip;
|
||||
TextArea txtCdAtip;
|
||||
Button btnCdAtip;
|
||||
TabPage tabCdMisc;
|
||||
StackLayout stkMcn;
|
||||
Label lblMcn;
|
||||
TextBox txtMcn;
|
||||
GroupBox grpIsrcs;
|
||||
TreeGridView grdIsrcs;
|
||||
Button btnCdPma;
|
||||
#pragma warning restore 169
|
||||
#pragma warning restore 649
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user