DiscInfo.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using NEROLib;
  7. namespace NeroFiddlesCOM.NET
  8. {
  9. /// <summary>
  10. /// Summary description for DiscInfo.
  11. /// </summary>
  12. public class DiscInfoForm : System.Windows.Forms.Form
  13. {
  14. private NeroDrive m_drive;
  15. private Nero m_nero;
  16. private string m_sImageFilepath;
  17. private _INeroDriveEvents_OnDoneCDInfoEventHandler m_evOnDoneCDInfo;
  18. private System.Windows.Forms.Button c_OK;
  19. private System.Windows.Forms.Label label1;
  20. private System.Windows.Forms.Label label2;
  21. private System.Windows.Forms.TextBox c_Artist;
  22. private System.Windows.Forms.TextBox c_Title;
  23. private System.Windows.Forms.Label label4;
  24. private System.Windows.Forms.TextBox c_FreeCapacityBlocks;
  25. private System.Windows.Forms.Label label6;
  26. private System.Windows.Forms.Label label7;
  27. private System.Windows.Forms.TextBox c_UnusedBlocks;
  28. private System.Windows.Forms.Label label9;
  29. private System.Windows.Forms.Label label5;
  30. private System.Windows.Forms.TextBox c_MediaType;
  31. private System.Windows.Forms.TextBox c_AvailableEraseMode;
  32. private System.Windows.Forms.Label label10;
  33. private System.Windows.Forms.Label label8;
  34. private System.Windows.Forms.TextBox c_Device;
  35. private System.Windows.Forms.Button c_Refresh;
  36. private System.Windows.Forms.Label label11;
  37. private System.Windows.Forms.ListView c_MediumFlags;
  38. private System.Windows.Forms.Label label12;
  39. private System.Windows.Forms.TextBox c_TotalCapacity;
  40. private System.Windows.Forms.Label label13;
  41. /// <summary>
  42. /// Required designer variable.
  43. /// </summary>
  44. private System.ComponentModel.Container components = null;
  45. private System.Windows.Forms.TextBox c_Layer0MaxBlocks;
  46. private System.Windows.Forms.Label label14;
  47. private System.Windows.Forms.Label label15;
  48. private System.Windows.Forms.CheckBox c_IsWritable;
  49. private System.Windows.Forms.Label label3;
  50. private System.Windows.Forms.ListView c_Tracks;
  51. private System.Windows.Forms.Label label16;
  52. private System.Windows.Forms.ColumnHeader columnHeader1;
  53. private System.Windows.Forms.ColumnHeader columnHeader2;
  54. private System.Windows.Forms.ColumnHeader columnHeader3;
  55. private System.Windows.Forms.ColumnHeader columnHeader4;
  56. private System.Windows.Forms.ColumnHeader columnHeader5;
  57. private System.Windows.Forms.ColumnHeader columnHeader6;
  58. private System.Windows.Forms.Button c_VMSInfo;
  59. private readonly NERO_MEDIUM_FLAGS [] m_nmf = {NERO_MEDIUM_FLAGS.NCDIMF_VIRTUALMULTISESSION, NERO_MEDIUM_FLAGS.NCDIMF_HDB_SUPPORTED};
  60. private ControlEnabler m_controlEnabler;
  61. // Constructor for getting disc info from a physical drive.
  62. //
  63. public DiscInfoForm(NeroDrive drive, Nero nero)
  64. {
  65. //
  66. // Required for Windows Form Designer support
  67. //
  68. InitializeComponent();
  69. m_controlEnabler = new ControlEnabler (this);
  70. m_drive = drive;
  71. m_nero = nero;
  72. }
  73. // Constructor for getting disc info from an image file.
  74. //
  75. public DiscInfoForm(string sImageFilepath, Nero nero)
  76. {
  77. InitializeComponent();
  78. m_nero = nero;
  79. m_sImageFilepath = sImageFilepath;
  80. }
  81. /// <summary>
  82. /// Clean up any resources being used.
  83. /// </summary>
  84. protected override void Dispose( bool disposing )
  85. {
  86. if( disposing )
  87. {
  88. if(components != null)
  89. {
  90. components.Dispose();
  91. }
  92. }
  93. base.Dispose( disposing );
  94. }
  95. #region Windows Form Designer generated code
  96. /// <summary>
  97. /// Required method for Designer support - do not modify
  98. /// the contents of this method with the code editor.
  99. /// </summary>
  100. private void InitializeComponent()
  101. {
  102. System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem("Virtual Multisession");
  103. System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem("HDB");
  104. this.c_OK = new System.Windows.Forms.Button();
  105. this.label1 = new System.Windows.Forms.Label();
  106. this.label2 = new System.Windows.Forms.Label();
  107. this.c_Artist = new System.Windows.Forms.TextBox();
  108. this.c_Title = new System.Windows.Forms.TextBox();
  109. this.label4 = new System.Windows.Forms.Label();
  110. this.c_FreeCapacityBlocks = new System.Windows.Forms.TextBox();
  111. this.label6 = new System.Windows.Forms.Label();
  112. this.label7 = new System.Windows.Forms.Label();
  113. this.c_UnusedBlocks = new System.Windows.Forms.TextBox();
  114. this.label9 = new System.Windows.Forms.Label();
  115. this.label5 = new System.Windows.Forms.Label();
  116. this.c_MediaType = new System.Windows.Forms.TextBox();
  117. this.c_AvailableEraseMode = new System.Windows.Forms.TextBox();
  118. this.label10 = new System.Windows.Forms.Label();
  119. this.label8 = new System.Windows.Forms.Label();
  120. this.c_Device = new System.Windows.Forms.TextBox();
  121. this.c_Refresh = new System.Windows.Forms.Button();
  122. this.label11 = new System.Windows.Forms.Label();
  123. this.c_MediumFlags = new System.Windows.Forms.ListView();
  124. this.label12 = new System.Windows.Forms.Label();
  125. this.c_TotalCapacity = new System.Windows.Forms.TextBox();
  126. this.label13 = new System.Windows.Forms.Label();
  127. this.c_Layer0MaxBlocks = new System.Windows.Forms.TextBox();
  128. this.label14 = new System.Windows.Forms.Label();
  129. this.label15 = new System.Windows.Forms.Label();
  130. this.c_IsWritable = new System.Windows.Forms.CheckBox();
  131. this.label3 = new System.Windows.Forms.Label();
  132. this.c_Tracks = new System.Windows.Forms.ListView();
  133. this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
  134. this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
  135. this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
  136. this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
  137. this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
  138. this.columnHeader6 = new System.Windows.Forms.ColumnHeader();
  139. this.label16 = new System.Windows.Forms.Label();
  140. this.c_VMSInfo = new System.Windows.Forms.Button();
  141. this.SuspendLayout();
  142. //
  143. // c_OK
  144. //
  145. this.c_OK.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  146. this.c_OK.Location = new System.Drawing.Point(392, 8);
  147. this.c_OK.Name = "c_OK";
  148. this.c_OK.TabIndex = 30;
  149. this.c_OK.Text = "OK";
  150. //
  151. // label1
  152. //
  153. this.label1.Location = new System.Drawing.Point(8, 40);
  154. this.label1.Name = "label1";
  155. this.label1.Size = new System.Drawing.Size(56, 16);
  156. this.label1.TabIndex = 0;
  157. this.label1.Text = "Artist:";
  158. //
  159. // label2
  160. //
  161. this.label2.Location = new System.Drawing.Point(8, 64);
  162. this.label2.Name = "label2";
  163. this.label2.Size = new System.Drawing.Size(56, 16);
  164. this.label2.TabIndex = 2;
  165. this.label2.Text = "Title:";
  166. //
  167. // c_Artist
  168. //
  169. this.c_Artist.Location = new System.Drawing.Point(64, 40);
  170. this.c_Artist.Name = "c_Artist";
  171. this.c_Artist.ReadOnly = true;
  172. this.c_Artist.Size = new System.Drawing.Size(248, 20);
  173. this.c_Artist.TabIndex = 1;
  174. this.c_Artist.Text = "";
  175. //
  176. // c_Title
  177. //
  178. this.c_Title.Location = new System.Drawing.Point(64, 64);
  179. this.c_Title.Name = "c_Title";
  180. this.c_Title.ReadOnly = true;
  181. this.c_Title.Size = new System.Drawing.Size(248, 20);
  182. this.c_Title.TabIndex = 3;
  183. this.c_Title.Text = "";
  184. //
  185. // label4
  186. //
  187. this.label4.Location = new System.Drawing.Point(168, 88);
  188. this.label4.Name = "label4";
  189. this.label4.Size = new System.Drawing.Size(40, 16);
  190. this.label4.TabIndex = 6;
  191. this.label4.Text = "blocks";
  192. //
  193. // c_FreeCapacityBlocks
  194. //
  195. this.c_FreeCapacityBlocks.Location = new System.Drawing.Point(97, 88);
  196. this.c_FreeCapacityBlocks.Name = "c_FreeCapacityBlocks";
  197. this.c_FreeCapacityBlocks.ReadOnly = true;
  198. this.c_FreeCapacityBlocks.Size = new System.Drawing.Size(71, 20);
  199. this.c_FreeCapacityBlocks.TabIndex = 5;
  200. this.c_FreeCapacityBlocks.Text = "";
  201. this.c_FreeCapacityBlocks.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  202. //
  203. // label6
  204. //
  205. this.label6.Location = new System.Drawing.Point(8, 88);
  206. this.label6.Name = "label6";
  207. this.label6.Size = new System.Drawing.Size(80, 16);
  208. this.label6.TabIndex = 4;
  209. this.label6.Text = "Free capacity:";
  210. //
  211. // label7
  212. //
  213. this.label7.Location = new System.Drawing.Point(168, 112);
  214. this.label7.Name = "label7";
  215. this.label7.Size = new System.Drawing.Size(40, 16);
  216. this.label7.TabIndex = 9;
  217. this.label7.Text = "blocks";
  218. //
  219. // c_UnusedBlocks
  220. //
  221. this.c_UnusedBlocks.Location = new System.Drawing.Point(97, 112);
  222. this.c_UnusedBlocks.Name = "c_UnusedBlocks";
  223. this.c_UnusedBlocks.ReadOnly = true;
  224. this.c_UnusedBlocks.Size = new System.Drawing.Size(71, 20);
  225. this.c_UnusedBlocks.TabIndex = 8;
  226. this.c_UnusedBlocks.Text = "";
  227. this.c_UnusedBlocks.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  228. //
  229. // label9
  230. //
  231. this.label9.Location = new System.Drawing.Point(8, 112);
  232. this.label9.Name = "label9";
  233. this.label9.Size = new System.Drawing.Size(80, 16);
  234. this.label9.TabIndex = 7;
  235. this.label9.Text = "Unused:";
  236. //
  237. // label5
  238. //
  239. this.label5.Location = new System.Drawing.Point(8, 160);
  240. this.label5.Name = "label5";
  241. this.label5.Size = new System.Drawing.Size(80, 16);
  242. this.label5.TabIndex = 13;
  243. this.label5.Text = "Media Type:";
  244. //
  245. // c_MediaType
  246. //
  247. this.c_MediaType.Location = new System.Drawing.Point(96, 160);
  248. this.c_MediaType.Name = "c_MediaType";
  249. this.c_MediaType.ReadOnly = true;
  250. this.c_MediaType.Size = new System.Drawing.Size(216, 20);
  251. this.c_MediaType.TabIndex = 14;
  252. this.c_MediaType.Text = "";
  253. //
  254. // c_AvailableEraseMode
  255. //
  256. this.c_AvailableEraseMode.Location = new System.Drawing.Point(96, 184);
  257. this.c_AvailableEraseMode.Name = "c_AvailableEraseMode";
  258. this.c_AvailableEraseMode.ReadOnly = true;
  259. this.c_AvailableEraseMode.Size = new System.Drawing.Size(216, 20);
  260. this.c_AvailableEraseMode.TabIndex = 16;
  261. this.c_AvailableEraseMode.Text = "";
  262. //
  263. // label10
  264. //
  265. this.label10.Location = new System.Drawing.Point(8, 184);
  266. this.label10.Name = "label10";
  267. this.label10.Size = new System.Drawing.Size(80, 24);
  268. this.label10.TabIndex = 15;
  269. this.label10.Text = "Available Erase Modes:";
  270. //
  271. // label8
  272. //
  273. this.label8.Location = new System.Drawing.Point(8, 16);
  274. this.label8.Name = "label8";
  275. this.label8.Size = new System.Drawing.Size(56, 16);
  276. this.label8.TabIndex = 28;
  277. this.label8.Text = "Device:";
  278. //
  279. // c_Device
  280. //
  281. this.c_Device.Location = new System.Drawing.Point(64, 16);
  282. this.c_Device.Name = "c_Device";
  283. this.c_Device.ReadOnly = true;
  284. this.c_Device.Size = new System.Drawing.Size(248, 20);
  285. this.c_Device.TabIndex = 29;
  286. this.c_Device.Text = "";
  287. //
  288. // c_Refresh
  289. //
  290. this.c_Refresh.Location = new System.Drawing.Point(392, 72);
  291. this.c_Refresh.Name = "c_Refresh";
  292. this.c_Refresh.TabIndex = 26;
  293. this.c_Refresh.Text = "Refresh";
  294. this.c_Refresh.Click += new System.EventHandler(this.c_Refresh_Click);
  295. //
  296. // label11
  297. //
  298. this.label11.Location = new System.Drawing.Point(320, 144);
  299. this.label11.Name = "label11";
  300. this.label11.Size = new System.Drawing.Size(80, 16);
  301. this.label11.TabIndex = 17;
  302. this.label11.Text = "Medium Flags:";
  303. //
  304. // c_MediumFlags
  305. //
  306. this.c_MediumFlags.CheckBoxes = true;
  307. listViewItem1.StateImageIndex = 0;
  308. listViewItem2.StateImageIndex = 0;
  309. this.c_MediumFlags.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
  310. listViewItem1,
  311. listViewItem2});
  312. this.c_MediumFlags.Location = new System.Drawing.Point(320, 160);
  313. this.c_MediumFlags.MultiSelect = false;
  314. this.c_MediumFlags.Name = "c_MediumFlags";
  315. this.c_MediumFlags.Size = new System.Drawing.Size(136, 40);
  316. this.c_MediumFlags.TabIndex = 18;
  317. this.c_MediumFlags.View = System.Windows.Forms.View.SmallIcon;
  318. //
  319. // label12
  320. //
  321. this.label12.Location = new System.Drawing.Point(168, 136);
  322. this.label12.Name = "label12";
  323. this.label12.Size = new System.Drawing.Size(40, 16);
  324. this.label12.TabIndex = 12;
  325. this.label12.Text = "blocks";
  326. //
  327. // c_TotalCapacity
  328. //
  329. this.c_TotalCapacity.Location = new System.Drawing.Point(96, 136);
  330. this.c_TotalCapacity.Name = "c_TotalCapacity";
  331. this.c_TotalCapacity.ReadOnly = true;
  332. this.c_TotalCapacity.Size = new System.Drawing.Size(71, 20);
  333. this.c_TotalCapacity.TabIndex = 11;
  334. this.c_TotalCapacity.Text = "";
  335. this.c_TotalCapacity.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  336. //
  337. // label13
  338. //
  339. this.label13.Location = new System.Drawing.Point(8, 136);
  340. this.label13.Name = "label13";
  341. this.label13.Size = new System.Drawing.Size(80, 16);
  342. this.label13.TabIndex = 10;
  343. this.label13.Text = "Total capacity:";
  344. //
  345. // c_Layer0MaxBlocks
  346. //
  347. this.c_Layer0MaxBlocks.Location = new System.Drawing.Point(96, 216);
  348. this.c_Layer0MaxBlocks.Name = "c_Layer0MaxBlocks";
  349. this.c_Layer0MaxBlocks.ReadOnly = true;
  350. this.c_Layer0MaxBlocks.Size = new System.Drawing.Size(71, 20);
  351. this.c_Layer0MaxBlocks.TabIndex = 20;
  352. this.c_Layer0MaxBlocks.Text = "";
  353. this.c_Layer0MaxBlocks.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  354. //
  355. // label14
  356. //
  357. this.label14.Location = new System.Drawing.Point(8, 216);
  358. this.label14.Name = "label14";
  359. this.label14.Size = new System.Drawing.Size(80, 16);
  360. this.label14.TabIndex = 19;
  361. this.label14.Text = "Max Layer 0 :";
  362. //
  363. // label15
  364. //
  365. this.label15.Location = new System.Drawing.Point(168, 216);
  366. this.label15.Name = "label15";
  367. this.label15.Size = new System.Drawing.Size(40, 16);
  368. this.label15.TabIndex = 21;
  369. this.label15.Text = "blocks";
  370. //
  371. // c_IsWritable
  372. //
  373. this.c_IsWritable.Enabled = false;
  374. this.c_IsWritable.Location = new System.Drawing.Point(224, 216);
  375. this.c_IsWritable.Name = "c_IsWritable";
  376. this.c_IsWritable.Size = new System.Drawing.Size(16, 16);
  377. this.c_IsWritable.TabIndex = 22;
  378. //
  379. // label3
  380. //
  381. this.label3.Location = new System.Drawing.Point(240, 216);
  382. this.label3.Name = "label3";
  383. this.label3.Size = new System.Drawing.Size(64, 16);
  384. this.label3.TabIndex = 23;
  385. this.label3.Text = "Is Writable?";
  386. //
  387. // c_Tracks
  388. //
  389. this.c_Tracks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
  390. this.columnHeader1,
  391. this.columnHeader2,
  392. this.columnHeader3,
  393. this.columnHeader4,
  394. this.columnHeader5,
  395. this.columnHeader6});
  396. this.c_Tracks.FullRowSelect = true;
  397. this.c_Tracks.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
  398. this.c_Tracks.Location = new System.Drawing.Point(8, 256);
  399. this.c_Tracks.Name = "c_Tracks";
  400. this.c_Tracks.Size = new System.Drawing.Size(456, 112);
  401. this.c_Tracks.TabIndex = 25;
  402. this.c_Tracks.View = System.Windows.Forms.View.Details;
  403. //
  404. // columnHeader1
  405. //
  406. this.columnHeader1.Text = "S#";
  407. this.columnHeader1.Width = 30;
  408. //
  409. // columnHeader2
  410. //
  411. this.columnHeader2.Text = "T#";
  412. this.columnHeader2.Width = 30;
  413. //
  414. // columnHeader3
  415. //
  416. this.columnHeader3.Text = "Type";
  417. //
  418. // columnHeader4
  419. //
  420. this.columnHeader4.Text = "Artist - Title";
  421. this.columnHeader4.Width = 150;
  422. //
  423. // columnHeader5
  424. //
  425. this.columnHeader5.Text = "Start Block";
  426. this.columnHeader5.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  427. this.columnHeader5.Width = 80;
  428. //
  429. // columnHeader6
  430. //
  431. this.columnHeader6.Text = "Length Blocks";
  432. this.columnHeader6.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  433. this.columnHeader6.Width = 80;
  434. //
  435. // label16
  436. //
  437. this.label16.Location = new System.Drawing.Point(8, 240);
  438. this.label16.Name = "label16";
  439. this.label16.Size = new System.Drawing.Size(48, 16);
  440. this.label16.TabIndex = 24;
  441. this.label16.Text = "Tracks:";
  442. //
  443. // c_VMSInfo
  444. //
  445. this.c_VMSInfo.Location = new System.Drawing.Point(392, 104);
  446. this.c_VMSInfo.Name = "c_VMSInfo";
  447. this.c_VMSInfo.TabIndex = 27;
  448. this.c_VMSInfo.Text = "VMS Info";
  449. this.c_VMSInfo.Click += new System.EventHandler(this.c_VMSInfo_Click);
  450. //
  451. // DiscInfoForm
  452. //
  453. this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  454. this.CancelButton = this.c_OK;
  455. this.ClientSize = new System.Drawing.Size(474, 376);
  456. this.Controls.Add(this.c_VMSInfo);
  457. this.Controls.Add(this.label16);
  458. this.Controls.Add(this.c_Tracks);
  459. this.Controls.Add(this.label3);
  460. this.Controls.Add(this.c_IsWritable);
  461. this.Controls.Add(this.c_MediumFlags);
  462. this.Controls.Add(this.label11);
  463. this.Controls.Add(this.c_Artist);
  464. this.Controls.Add(this.c_Title);
  465. this.Controls.Add(this.c_FreeCapacityBlocks);
  466. this.Controls.Add(this.c_UnusedBlocks);
  467. this.Controls.Add(this.c_MediaType);
  468. this.Controls.Add(this.c_AvailableEraseMode);
  469. this.Controls.Add(this.c_Device);
  470. this.Controls.Add(this.c_TotalCapacity);
  471. this.Controls.Add(this.c_Layer0MaxBlocks);
  472. this.Controls.Add(this.label2);
  473. this.Controls.Add(this.label1);
  474. this.Controls.Add(this.c_OK);
  475. this.Controls.Add(this.label4);
  476. this.Controls.Add(this.label6);
  477. this.Controls.Add(this.label7);
  478. this.Controls.Add(this.label9);
  479. this.Controls.Add(this.label5);
  480. this.Controls.Add(this.label10);
  481. this.Controls.Add(this.label8);
  482. this.Controls.Add(this.c_Refresh);
  483. this.Controls.Add(this.label12);
  484. this.Controls.Add(this.label13);
  485. this.Controls.Add(this.label14);
  486. this.Controls.Add(this.label15);
  487. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  488. this.MaximizeBox = false;
  489. this.MinimizeBox = false;
  490. this.Name = "DiscInfoForm";
  491. this.ShowInTaskbar = false;
  492. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
  493. this.Text = "DiscInfo";
  494. this.ResumeLayout(false);
  495. }
  496. #endregion
  497. private void DisplayDiscInfo (NeroCDInfo cdinfo)
  498. {
  499. bool bEnableGetVMSInfo = false;
  500. if (cdinfo != null)
  501. {
  502. bEnableGetVMSInfo = 0 != (cdinfo.MediumFlags & NERO_MEDIUM_FLAGS.NCDIMF_VIRTUALMULTISESSION);
  503. c_IsWritable.Checked = cdinfo.IsWriteable;
  504. c_Artist.Text = cdinfo.Artist;
  505. c_Title.Text = cdinfo.Title;
  506. c_FreeCapacityBlocks.Text = cdinfo.FreeCapacityInBlocks.ToString ();
  507. c_UnusedBlocks.Text = ((uint) cdinfo.UnusedBlocks).ToString ();
  508. string sEraseModes = "";
  509. string [] sModes = new string[2] {"Entire", "Quick"};
  510. int iEraseModes = cdinfo.AvailableEraseModes;
  511. int i = 0;
  512. foreach (string sMode in sModes)
  513. {
  514. if (0 != (iEraseModes & (1<<i)))
  515. {
  516. if (sEraseModes != "")
  517. {
  518. sEraseModes += " ";
  519. }
  520. sEraseModes += sMode;
  521. }
  522. i ++;
  523. }
  524. c_AvailableEraseMode.Text = sEraseModes;
  525. c_MediaType.Text = m_nero.get_TypeNameOfMedia (cdinfo.MediaType);
  526. ShowMediumFlags (cdinfo.MediumFlags);
  527. c_TotalCapacity.Text = cdinfo.TotalCapacity.ToString ();
  528. c_Layer0MaxBlocks.Text = cdinfo.Layer0MaxBlocks.ToString ();
  529. c_Tracks.Items.Clear ();
  530. foreach (NeroTrack trk in cdinfo.Tracks)
  531. {
  532. ListViewItem lvi = c_Tracks.Items.Add (trk.SessionNumber.ToString ());
  533. c_Tracks.Items[lvi.Index].SubItems.Add (trk.TrackNumber.ToString ());
  534. string sTrackType = "Unknown";
  535. switch (trk.TrackType)
  536. {
  537. case NERO_TRACK_TYPE.NERO_TT_AUDIO:
  538. sTrackType = "Audio";
  539. break;
  540. case NERO_TRACK_TYPE.NERO_TT_DATA:
  541. sTrackType = "Data";
  542. break;
  543. }
  544. c_Tracks.Items[lvi.Index].SubItems.Add (sTrackType);
  545. string sArtist = trk.Artist == ""? "Unknown": trk.Artist;
  546. string sTitle = trk.Title == ""? "Unknown": trk.Title;
  547. c_Tracks.Items[lvi.Index].SubItems.Add (sArtist + " - " + sTitle);
  548. c_Tracks.Items[lvi.Index].SubItems.Add (trk.TrackStartBlk.ToString ());
  549. c_Tracks.Items[lvi.Index].SubItems.Add (trk.TrackLengthInBlks.ToString ());
  550. }
  551. }
  552. else
  553. {
  554. c_IsWritable.Checked = false;
  555. c_Artist.Text = "";
  556. c_Title.Text = "";
  557. c_FreeCapacityBlocks.Text = "";
  558. c_UnusedBlocks.Text = "";
  559. c_AvailableEraseMode.Text = "";
  560. c_MediaType.Text = "";
  561. c_TotalCapacity.Text = "";
  562. c_Layer0MaxBlocks.Text = "";
  563. c_Tracks.Items.Clear ();
  564. ShowMediumFlags (0);
  565. MessageBox.Show (this, "No disc!");
  566. }
  567. c_VMSInfo.Enabled = bEnableGetVMSInfo;
  568. }
  569. private void drive_OnDoneCDInfo(INeroCDInfo pCDInfo)
  570. {
  571. m_drive.OnDoneCDInfo -= m_evOnDoneCDInfo;
  572. this.Cursor = Cursors.Default;
  573. m_controlEnabler.EnableAllControls (true);
  574. DisplayDiscInfo ((NeroCDInfo) pCDInfo);
  575. }
  576. private void ShowMediumFlags (NERO_MEDIUM_FLAGS nmf)
  577. {
  578. int i = 0;
  579. foreach (NERO_MEDIUM_FLAGS flag in m_nmf)
  580. {
  581. c_MediumFlags.Items[i++].Checked = (0 != (nmf & flag));
  582. }
  583. }
  584. protected override void OnLoad(EventArgs e)
  585. {
  586. base.OnLoad (e);
  587. if (m_drive != null)
  588. {
  589. c_Device.Text = m_drive.DeviceName;
  590. m_evOnDoneCDInfo = new _INeroDriveEvents_OnDoneCDInfoEventHandler(drive_OnDoneCDInfo);
  591. m_drive.OnDoneCDInfo += m_evOnDoneCDInfo;
  592. }
  593. else
  594. {
  595. c_Device.Text = m_sImageFilepath;
  596. NeroCDInfo cdinfo = (NeroCDInfo) m_nero.GetDiscImageInfo (m_sImageFilepath);
  597. DisplayDiscInfo (cdinfo);
  598. }
  599. RefreshDiscInfo ();
  600. }
  601. private void RefreshDiscInfo ()
  602. {
  603. if (m_drive != null)
  604. {
  605. this.Cursor = Cursors.WaitCursor;
  606. m_controlEnabler.EnableAllControls (false);
  607. m_drive.CDInfo (NERO_CDINFO_FLAGS.NERO_READ_CD_TEXT);
  608. }
  609. }
  610. private void c_Refresh_Click(object sender, System.EventArgs e)
  611. {
  612. RefreshDiscInfo ();
  613. }
  614. private void c_VMSInfo_Click(object sender, System.EventArgs e)
  615. {
  616. VMSInfoForm frm = new VMSInfoForm();
  617. frm.m_drive = m_drive;
  618. frm.ShowDialog (this);
  619. }
  620. }
  621. }