DiscInfo.cs 25 KB

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