using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using NEROLib;
namespace NeroFiddlesCOM.NET
{
///
/// Summary description for DiscInfo.
///
public class DiscInfoForm : System.Windows.Forms.Form
{
private NeroDrive m_drive;
private Nero m_nero;
private string m_sImageFilepath;
private _INeroDriveEvents_OnDoneCDInfoEventHandler m_evOnDoneCDInfo;
private System.Windows.Forms.Button c_OK;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox c_Artist;
private System.Windows.Forms.TextBox c_Title;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox c_FreeCapacityBlocks;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox c_UnusedBlocks;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox c_MediaType;
private System.Windows.Forms.TextBox c_AvailableEraseMode;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox c_Device;
private System.Windows.Forms.Button c_Refresh;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.ListView c_MediumFlags;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.TextBox c_TotalCapacity;
private System.Windows.Forms.Label label13;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
private System.Windows.Forms.TextBox c_Layer0MaxBlocks;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.CheckBox c_IsWritable;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ListView c_Tracks;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.ColumnHeader columnHeader4;
private System.Windows.Forms.ColumnHeader columnHeader5;
private System.Windows.Forms.ColumnHeader columnHeader6;
private System.Windows.Forms.Button c_VMSInfo;
private readonly NERO_MEDIUM_FLAGS [] m_nmf = {NERO_MEDIUM_FLAGS.NCDIMF_VIRTUALMULTISESSION, NERO_MEDIUM_FLAGS.NCDIMF_HDB_SUPPORTED};
private ControlEnabler m_controlEnabler;
// Constructor for getting disc info from a physical drive.
//
public DiscInfoForm(NeroDrive drive, Nero nero)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
m_controlEnabler = new ControlEnabler (this);
m_drive = drive;
m_nero = nero;
}
// Constructor for getting disc info from an image file.
//
public DiscInfoForm(string sImageFilepath, Nero nero)
{
InitializeComponent();
m_nero = nero;
m_sImageFilepath = sImageFilepath;
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem("Virtual Multisession");
System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem("HDB");
this.c_OK = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.c_Artist = new System.Windows.Forms.TextBox();
this.c_Title = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.c_FreeCapacityBlocks = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.c_UnusedBlocks = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.c_MediaType = new System.Windows.Forms.TextBox();
this.c_AvailableEraseMode = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.c_Device = new System.Windows.Forms.TextBox();
this.c_Refresh = new System.Windows.Forms.Button();
this.label11 = new System.Windows.Forms.Label();
this.c_MediumFlags = new System.Windows.Forms.ListView();
this.label12 = new System.Windows.Forms.Label();
this.c_TotalCapacity = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.c_Layer0MaxBlocks = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.c_IsWritable = new System.Windows.Forms.CheckBox();
this.label3 = new System.Windows.Forms.Label();
this.c_Tracks = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
this.columnHeader6 = new System.Windows.Forms.ColumnHeader();
this.label16 = new System.Windows.Forms.Label();
this.c_VMSInfo = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// c_OK
//
this.c_OK.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.c_OK.Location = new System.Drawing.Point(392, 8);
this.c_OK.Name = "c_OK";
this.c_OK.TabIndex = 30;
this.c_OK.Text = "OK";
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 16);
this.label1.TabIndex = 0;
this.label1.Text = "Artist:";
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 64);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 16);
this.label2.TabIndex = 2;
this.label2.Text = "Title:";
//
// c_Artist
//
this.c_Artist.Location = new System.Drawing.Point(64, 40);
this.c_Artist.Name = "c_Artist";
this.c_Artist.ReadOnly = true;
this.c_Artist.Size = new System.Drawing.Size(248, 20);
this.c_Artist.TabIndex = 1;
this.c_Artist.Text = "";
//
// c_Title
//
this.c_Title.Location = new System.Drawing.Point(64, 64);
this.c_Title.Name = "c_Title";
this.c_Title.ReadOnly = true;
this.c_Title.Size = new System.Drawing.Size(248, 20);
this.c_Title.TabIndex = 3;
this.c_Title.Text = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(168, 88);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(40, 16);
this.label4.TabIndex = 6;
this.label4.Text = "blocks";
//
// c_FreeCapacityBlocks
//
this.c_FreeCapacityBlocks.Location = new System.Drawing.Point(97, 88);
this.c_FreeCapacityBlocks.Name = "c_FreeCapacityBlocks";
this.c_FreeCapacityBlocks.ReadOnly = true;
this.c_FreeCapacityBlocks.Size = new System.Drawing.Size(71, 20);
this.c_FreeCapacityBlocks.TabIndex = 5;
this.c_FreeCapacityBlocks.Text = "";
this.c_FreeCapacityBlocks.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label6
//
this.label6.Location = new System.Drawing.Point(8, 88);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(80, 16);
this.label6.TabIndex = 4;
this.label6.Text = "Free capacity:";
//
// label7
//
this.label7.Location = new System.Drawing.Point(168, 112);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(40, 16);
this.label7.TabIndex = 9;
this.label7.Text = "blocks";
//
// c_UnusedBlocks
//
this.c_UnusedBlocks.Location = new System.Drawing.Point(97, 112);
this.c_UnusedBlocks.Name = "c_UnusedBlocks";
this.c_UnusedBlocks.ReadOnly = true;
this.c_UnusedBlocks.Size = new System.Drawing.Size(71, 20);
this.c_UnusedBlocks.TabIndex = 8;
this.c_UnusedBlocks.Text = "";
this.c_UnusedBlocks.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label9
//
this.label9.Location = new System.Drawing.Point(8, 112);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(80, 16);
this.label9.TabIndex = 7;
this.label9.Text = "Unused:";
//
// label5
//
this.label5.Location = new System.Drawing.Point(8, 160);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(80, 16);
this.label5.TabIndex = 13;
this.label5.Text = "Media Type:";
//
// c_MediaType
//
this.c_MediaType.Location = new System.Drawing.Point(96, 160);
this.c_MediaType.Name = "c_MediaType";
this.c_MediaType.ReadOnly = true;
this.c_MediaType.Size = new System.Drawing.Size(216, 20);
this.c_MediaType.TabIndex = 14;
this.c_MediaType.Text = "";
//
// c_AvailableEraseMode
//
this.c_AvailableEraseMode.Location = new System.Drawing.Point(96, 184);
this.c_AvailableEraseMode.Name = "c_AvailableEraseMode";
this.c_AvailableEraseMode.ReadOnly = true;
this.c_AvailableEraseMode.Size = new System.Drawing.Size(216, 20);
this.c_AvailableEraseMode.TabIndex = 16;
this.c_AvailableEraseMode.Text = "";
//
// label10
//
this.label10.Location = new System.Drawing.Point(8, 184);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(80, 24);
this.label10.TabIndex = 15;
this.label10.Text = "Available Erase Modes:";
//
// label8
//
this.label8.Location = new System.Drawing.Point(8, 16);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(56, 16);
this.label8.TabIndex = 28;
this.label8.Text = "Device:";
//
// c_Device
//
this.c_Device.Location = new System.Drawing.Point(64, 16);
this.c_Device.Name = "c_Device";
this.c_Device.ReadOnly = true;
this.c_Device.Size = new System.Drawing.Size(248, 20);
this.c_Device.TabIndex = 29;
this.c_Device.Text = "";
//
// c_Refresh
//
this.c_Refresh.Location = new System.Drawing.Point(392, 72);
this.c_Refresh.Name = "c_Refresh";
this.c_Refresh.TabIndex = 26;
this.c_Refresh.Text = "Refresh";
this.c_Refresh.Click += new System.EventHandler(this.c_Refresh_Click);
//
// label11
//
this.label11.Location = new System.Drawing.Point(320, 144);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(80, 16);
this.label11.TabIndex = 17;
this.label11.Text = "Medium Flags:";
//
// c_MediumFlags
//
this.c_MediumFlags.CheckBoxes = true;
listViewItem1.StateImageIndex = 0;
listViewItem2.StateImageIndex = 0;
this.c_MediumFlags.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
listViewItem1,
listViewItem2});
this.c_MediumFlags.Location = new System.Drawing.Point(320, 160);
this.c_MediumFlags.MultiSelect = false;
this.c_MediumFlags.Name = "c_MediumFlags";
this.c_MediumFlags.Size = new System.Drawing.Size(136, 40);
this.c_MediumFlags.TabIndex = 18;
this.c_MediumFlags.View = System.Windows.Forms.View.SmallIcon;
//
// label12
//
this.label12.Location = new System.Drawing.Point(168, 136);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(40, 16);
this.label12.TabIndex = 12;
this.label12.Text = "blocks";
//
// c_TotalCapacity
//
this.c_TotalCapacity.Location = new System.Drawing.Point(96, 136);
this.c_TotalCapacity.Name = "c_TotalCapacity";
this.c_TotalCapacity.ReadOnly = true;
this.c_TotalCapacity.Size = new System.Drawing.Size(71, 20);
this.c_TotalCapacity.TabIndex = 11;
this.c_TotalCapacity.Text = "";
this.c_TotalCapacity.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label13
//
this.label13.Location = new System.Drawing.Point(8, 136);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(80, 16);
this.label13.TabIndex = 10;
this.label13.Text = "Total capacity:";
//
// c_Layer0MaxBlocks
//
this.c_Layer0MaxBlocks.Location = new System.Drawing.Point(96, 216);
this.c_Layer0MaxBlocks.Name = "c_Layer0MaxBlocks";
this.c_Layer0MaxBlocks.ReadOnly = true;
this.c_Layer0MaxBlocks.Size = new System.Drawing.Size(71, 20);
this.c_Layer0MaxBlocks.TabIndex = 20;
this.c_Layer0MaxBlocks.Text = "";
this.c_Layer0MaxBlocks.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label14
//
this.label14.Location = new System.Drawing.Point(8, 216);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(80, 16);
this.label14.TabIndex = 19;
this.label14.Text = "Max Layer 0 :";
//
// label15
//
this.label15.Location = new System.Drawing.Point(168, 216);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(40, 16);
this.label15.TabIndex = 21;
this.label15.Text = "blocks";
//
// c_IsWritable
//
this.c_IsWritable.Enabled = false;
this.c_IsWritable.Location = new System.Drawing.Point(224, 216);
this.c_IsWritable.Name = "c_IsWritable";
this.c_IsWritable.Size = new System.Drawing.Size(16, 16);
this.c_IsWritable.TabIndex = 22;
//
// label3
//
this.label3.Location = new System.Drawing.Point(240, 216);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(64, 16);
this.label3.TabIndex = 23;
this.label3.Text = "Is Writable?";
//
// c_Tracks
//
this.c_Tracks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2,
this.columnHeader3,
this.columnHeader4,
this.columnHeader5,
this.columnHeader6});
this.c_Tracks.FullRowSelect = true;
this.c_Tracks.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.c_Tracks.Location = new System.Drawing.Point(8, 256);
this.c_Tracks.Name = "c_Tracks";
this.c_Tracks.Size = new System.Drawing.Size(456, 112);
this.c_Tracks.TabIndex = 25;
this.c_Tracks.View = System.Windows.Forms.View.Details;
//
// columnHeader1
//
this.columnHeader1.Text = "S#";
this.columnHeader1.Width = 30;
//
// columnHeader2
//
this.columnHeader2.Text = "T#";
this.columnHeader2.Width = 30;
//
// columnHeader3
//
this.columnHeader3.Text = "Type";
//
// columnHeader4
//
this.columnHeader4.Text = "Artist - Title";
this.columnHeader4.Width = 150;
//
// columnHeader5
//
this.columnHeader5.Text = "Start Block";
this.columnHeader5.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.columnHeader5.Width = 80;
//
// columnHeader6
//
this.columnHeader6.Text = "Length Blocks";
this.columnHeader6.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.columnHeader6.Width = 80;
//
// label16
//
this.label16.Location = new System.Drawing.Point(8, 240);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(48, 16);
this.label16.TabIndex = 24;
this.label16.Text = "Tracks:";
//
// c_VMSInfo
//
this.c_VMSInfo.Location = new System.Drawing.Point(392, 104);
this.c_VMSInfo.Name = "c_VMSInfo";
this.c_VMSInfo.TabIndex = 27;
this.c_VMSInfo.Text = "VMS Info";
this.c_VMSInfo.Click += new System.EventHandler(this.c_VMSInfo_Click);
//
// DiscInfoForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.c_OK;
this.ClientSize = new System.Drawing.Size(474, 376);
this.Controls.Add(this.c_VMSInfo);
this.Controls.Add(this.label16);
this.Controls.Add(this.c_Tracks);
this.Controls.Add(this.label3);
this.Controls.Add(this.c_IsWritable);
this.Controls.Add(this.c_MediumFlags);
this.Controls.Add(this.label11);
this.Controls.Add(this.c_Artist);
this.Controls.Add(this.c_Title);
this.Controls.Add(this.c_FreeCapacityBlocks);
this.Controls.Add(this.c_UnusedBlocks);
this.Controls.Add(this.c_MediaType);
this.Controls.Add(this.c_AvailableEraseMode);
this.Controls.Add(this.c_Device);
this.Controls.Add(this.c_TotalCapacity);
this.Controls.Add(this.c_Layer0MaxBlocks);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.c_OK);
this.Controls.Add(this.label4);
this.Controls.Add(this.label6);
this.Controls.Add(this.label7);
this.Controls.Add(this.label9);
this.Controls.Add(this.label5);
this.Controls.Add(this.label10);
this.Controls.Add(this.label8);
this.Controls.Add(this.c_Refresh);
this.Controls.Add(this.label12);
this.Controls.Add(this.label13);
this.Controls.Add(this.label14);
this.Controls.Add(this.label15);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "DiscInfoForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "DiscInfo";
this.ResumeLayout(false);
}
#endregion
private void DisplayDiscInfo (NeroCDInfo cdinfo)
{
bool bEnableGetVMSInfo = false;
if (cdinfo != null)
{
bEnableGetVMSInfo = 0 != (cdinfo.MediumFlags & NERO_MEDIUM_FLAGS.NCDIMF_VIRTUALMULTISESSION);
c_IsWritable.Checked = cdinfo.IsWriteable;
c_Artist.Text = cdinfo.Artist;
c_Title.Text = cdinfo.Title;
c_FreeCapacityBlocks.Text = cdinfo.FreeCapacityInBlocks.ToString ();
c_UnusedBlocks.Text = ((uint) cdinfo.UnusedBlocks).ToString ();
string sEraseModes = "";
string [] sModes = new string[2] {"Entire", "Quick"};
int iEraseModes = cdinfo.AvailableEraseModes;
int i = 0;
foreach (string sMode in sModes)
{
if (0 != (iEraseModes & (1<