Description

The following is a modified version of a C# program I downloaded at: https://isocs.codeplex.com/.

In its original state, this program simply creates .ISO files from just about any CD or DVD. My dilemma, which led me to creating this program is that our office frequently will receive disks in the mail (discs are ordinarily handled by our scanning dept. since they often contain .JPG, .DOCX, etc). However, in many cases, discs will instead have DICOM images or security footage that needs to be viewed using proprietary software (in these cases, the disc needs to be formatted as a .ISO in order for it to be viewed). Until now, I have been personally handling all inbound disks to our office because there isn’t anyone in the scanning dept confident enough to know when discs should be ISO-ed and how to format them, etc. It is this reason that I have been tasked with sorting through which of them need to be exported to .ISO and which do not (I have been using BurnAware free for those that require it). I finally came to my senses and solved this problem so that users of any skill can perform all of the above tasks with the click of a button!

My modifications to this program allow users of any caliber to insert a CD/DVD into their disk drive (currently this only works on one disc drive at a time) once inserted they will run ISO image inspector and click the “Inspect” button. From here, ISO image inspector will search the top directory of the disk for specific files in order to determine if it should be ISO-ed or not. When ready, the start button will perform one of two possible actions (depending on the containing files). If there are typical files, the start button will simply open up the letter dive in explorer (this is so the user can easily copy and name the contained files). Likewise, if the program recommends that the disc be saved as .ISO, then the user will be prompted to give the .ISO a name, and also be required to search for a directory where they would like to save the .ISO image. The following changes have been made to the original source code:

  1. All output has been translated to English.
  2. Inspect button has been added to evaluate the inserted disk, if the disk contains autorun., DICOMDIR., or README.*, ISO-ing the disk will be recommended.
  3. A progress bar has been added to better help users visualize the estimated remaining time of the .ISO creation.
  4. FolderBrowser dialogbox has been added for users to select a destination.
  5. Confirmation dialog box added confirming when .ISO files are finished, and likewise when a failure occurs in the export.

I will plan on updating with newer versions when I get time to work on this. Please also feel free to comment if I missed anything.

Source Code

/*
 * BELOW IS MY UPDATED CODE TO THE ORIGINAL Form1.cs FILE, WHICH CONTAINS THE ONLY
 * CHANGES THAT I MADE TO THIS PROGRAM.

 * I DO NOT CLAIM OWNERSHIP OF THIS PROGRAM, AS IT IS MERELY MY EXPANSION TO EXISTING
 * CODE THAT I FOUND FROM CODEPLEX.COM

 * THE ORIGINAL SOURCE CAN BE DOWNLOADED FROM: https://isocs.codeplex.com/.
 * SEVERAL OBJECTS WERE ADDED TO THE ORIGINAL GUI,
 * SO IF YOU ARE ONLY OVERWRITING THE ORIGINAL Form1.cs WITH THE BELOW CODE, MAKE SURE
 * THAT THE DESIGNER CONTAINS THE FOLLOWING:

 * BUTTON (named "Inspect"),
 * TEXTBOX (named "ISO"),
 * PROGRESSBAR (named "progressBar1").
 * NOTE THAT "textBox1" HAS BEEN RENAMED TO "Path".
 */


using System;
using System.IO; 
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TestISO
{
    public partial class Form1 : Form
    {
        Iso9660.Iso9660 cISO;
        int previous = 0;
        bool flag = false;

        public Form1()
        {
            InitializeComponent();
        }

        public void iso_maker ( string file, string source )
        {
            int ret = cISO.MakeIsoFromCD(source, file);
            this.progressBar1.Maximum = ((int)cISO.SizeOfCD);

            switch (ret)
            {
                case -1:
                    label2.Text = @"Status: " + @" ERROR! Handle Invalid player.";
                    break;
                case -2:
                    label2.Text = @"Status: " + @" ERROR! The source is not a CD / DVD.";
                    break;
                case -3:
                    label2.Text = @"Status: " + @" ERROR! Insufficient disk space to create the image.";
                    break;
                case -4:
                    label2.Text = @"Status: " + @" ERROR! Destination FAT32 volume and source size > 4096 MB";
                    break;
                case 1:
                    label2.Text = @"Status: "+ @"Creating the current image...";
                    break;
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //New instance
            cISO = new Iso9660.Iso9660();

            cISO.OnFinish += new Iso9660.Iso9660EventHandler(cISO_OnFinish);
            cISO.OnMessage += new Iso9660.Iso9660EventHandler(cISO_OnMessage);
            cISO.OnProgress += new Iso9660.Iso9660EventHandler(cISO_OnProgress);

        }

        private void button2_Click(object sender, EventArgs e)
        {
            cISO.Stop();
            Application.Exit();
        }




        delegate void DelegMessage(string value);
        delegate void DelegFinish(string s, TimeSpan t);
        delegate void DelegProgress(long value);

        private void cISO_OnProgress(Iso9660.EventIso9660 e)
        {
            if (this.InvokeRequired)
            {
                DelegProgress del = new DelegProgress(SetProgress);
                this.Invoke(del, e.WrittenSize);
            }
        }

        private void cISO_OnFinish(Iso9660.EventIso9660 e)
        {

            if (this.InvokeRequired)
            {
                DelegFinish del = new DelegFinish(SetFinish);
                this.Invoke(del, new object[] { @"Image creation completed.", e.TotalElapsedTime });

                if(progressBar1.Value < ((int)cISO.SizeOfCD))
                {
                    MessageBox.Show("xxxxx: FAILURE: xxxxx");
                }
                else
                {
                    MessageBox.Show("Done!");
                }
                Application.Exit();
            }
        }

        private void cISO_OnMessage(Iso9660.EventIso9660 e)
        {
            if (this.InvokeRequired)
            {
                DelegMessage del = new DelegMessage(SetMessage);
                this.Invoke(del, e.ErrorMessage);
            }
        }

        private void SetProgress(long value)
        {
            label1.Text = @"Progression: " + value.ToString() + @"/" + cISO.SizeOfCD.ToString();
            int increment = ((int)value) - previous;
            this.progressBar1.Increment(increment);
            previous = ((int)value);
        }

        private void SetMessage(string value)
        {
            label2.Text = @"State: " + value;
        }

        private void SetFinish(string s,TimeSpan t)
        {
            label2.Text = @"State: " + s + " Total time of creation : " + t.ToString();
            button2.Enabled = false;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (flag == true)
            {
                button1.Enabled = false;
                button2.Enabled = true;

                //if (textBox1.Text != "" && comboBox1.Text != "")
                if (String.IsNullOrEmpty(Path.Text) == false && String.IsNullOrEmpty(comboBox1.Text) == false)
                {
                    iso_maker(Path.Text, comboBox1.Text);
                }
            }
            else
            {
                System.Diagnostics.Process.Start(comboBox1.Text);
            }

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }
                     
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            button1.Enabled = true;

            if (flag == true)
            {
                FolderBrowserDialog dir = new FolderBrowserDialog();

                dir.RootFolder = Environment.SpecialFolder.MyComputer;
                dir.SelectedPath = "F:\\Data\\A";
                dir.ShowDialog();
                Path.Text = dir.SelectedPath + "\\" + ISO.Text + ".iso";
            }
            
        }

        private void Inspect_Click(object sender, EventArgs e)
        {
            flag = false;
            this.ISO.Text = "";
            this.comboBox1.Text = "";
            this.Path.Text = "";
            
            var files = new List<string>();

            foreach (DriveInfo CurrentDrive in DriveInfo.GetDrives())
            {
                // Verify that the type is cd/dvd
                if (CurrentDrive.DriveType == DriveType.CDRom)
                {
                    // Verify the drive is ready
                    if (CurrentDrive.IsReady == true)
                    {
                        files.AddRange(Directory.GetFiles(CurrentDrive.RootDirectory.FullName, "autorun.*", SearchOption.TopDirectoryOnly));
                        files.AddRange(Directory.GetFiles(CurrentDrive.RootDirectory.FullName, "DICOMDIR.*", SearchOption.TopDirectoryOnly));
                        files.AddRange(Directory.GetFiles(CurrentDrive.RootDirectory.FullName, "README.*", SearchOption.TopDirectoryOnly));

                        if (this.comboBox1.Items.Count == 0)
                        {
                            this.comboBox1.Items.AddRange(new object[] { CurrentDrive.Name });
                        }
                        //else
                        //{
                            //for (int x = 0; x <= comboBox1.Items.Count; x++)
                            //{
                                //comboBox1.SelectedItem = x;

                                //if (comboBox1.SelectedItem.ToString() != CurrentDrive.Name.ToString())
                                //{
                                    //this.comboBox1.Items.AddRange(new object[] { CurrentDrive.Name });
                                //}
                            //}

                        //}

                    }
                    
                }
            }

            if (files.Count > 0)
            {
                flag = true;
                label1.Text = "ISO!";
                ISO.Enabled = true;
                comboBox1.Enabled = false;
            }
            else
            {
                label1.Text = "MEDIA!";
                comboBox1.Enabled = true;
                ISO.Enabled = false;
            }

        }

        private void ISO_TextChanged(object sender, EventArgs e)
        {
            if (ISO.TextLength > 0)
            {
                comboBox1.Enabled = true;
            }
            else
            {
                comboBox1.Enabled = false;
            }
        }

    }
}


/*
===================================================================================
 * BELOW IS THE NECESSARY CODE FOR Form1.Designer.cs
 * THE ORIGINAL SOURCE CAN BE DOWNLOADED FROM https://isocs.codeplex.com/.
===================================================================================
*/


using System.IO; 
namespace TestISO
{
    partial class Form1
    {
        /// <summary>
        /// Variable nécessaire au concepteur.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Nettoyage des ressources utilisées.
        /// </summary>
        /// <param name="disposing">true si les ressources managées doivent être supprimées ; sinon, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Code généré par le Concepteur Windows Form

        /// <summary>
        /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
        /// le contenu de cette méthode avec l'éditeur de code.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            this.button1 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.Path = new System.Windows.Forms.TextBox();
            this.comboBox1 = new System.Windows.Forms.ComboBox();
            this.progressBar1 = new System.Windows.Forms.ProgressBar();
            this.Inspect = new System.Windows.Forms.Button();
            this.ISO = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            // 
            // button1
            // 
            this.button1.Enabled = false;
            this.button1.Location = new System.Drawing.Point(304, 22);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 43);
            this.button1.TabIndex = 3;
            this.button1.Text = "start";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // button2
            // 
            this.button2.Enabled = false;
            this.button2.Location = new System.Drawing.Point(304, 114);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(75, 44);
            this.button2.TabIndex = 4;
            this.button2.Text = "abort";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(12, 120);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(51, 13);
            this.label1.TabIndex = 7;
            this.label1.Text = "Progress:";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(12, 145);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(35, 13);
            this.label2.TabIndex = 8;
            this.label2.Text = "State:";
            // 
            // Path
            // 
            this.Path.Enabled = false;
            this.Path.Location = new System.Drawing.Point(12, 72);
            this.Path.Name = "Path";
            this.Path.ReadOnly = true;
            this.Path.Size = new System.Drawing.Size(367, 20);
            this.Path.TabIndex = 5;
            this.Path.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
            // 
            // comboBox1
            // 
            this.comboBox1.Enabled = false;
            this.comboBox1.FormattingEnabled = true;
            this.comboBox1.Location = new System.Drawing.Point(12, 45);
            this.comboBox1.Name = "comboBox1";
            this.comboBox1.Size = new System.Drawing.Size(121, 21);
            this.comboBox1.TabIndex = 2;
            this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
            // 
            // progressBar1
            // 
            this.progressBar1.Location = new System.Drawing.Point(12, 98);
            this.progressBar1.Name = "progressBar1";
            this.progressBar1.Size = new System.Drawing.Size(367, 10);
            this.progressBar1.TabIndex = 6;
            // 
            // Inspect
            // 
            this.Inspect.BackColor = System.Drawing.Color.Black;
            this.Inspect.Font = new System.Drawing.Font("LCD", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Inspect.ForeColor = System.Drawing.Color.Red;
            this.Inspect.Location = new System.Drawing.Point(12, 9);
            this.Inspect.Name = "Inspect";
            this.Inspect.Size = new System.Drawing.Size(121, 30);
            this.Inspect.TabIndex = 0;
            this.Inspect.Text = "Inspect Drive";
            this.Inspect.UseVisualStyleBackColor = false;
            this.Inspect.Click += new System.EventHandler(this.Inspect_Click);
            // 
            // ISO
            // 
            this.ISO.Enabled = false;
            this.ISO.Location = new System.Drawing.Point(165, 45);
            this.ISO.Name = "ISO";
            this.ISO.Size = new System.Drawing.Size(100, 20);
            this.ISO.TabIndex = 1;
            this.ISO.TextChanged += new System.EventHandler(this.ISO_TextChanged);
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label3.Location = new System.Drawing.Point(162, 22);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(81, 18);
            this.label3.TabIndex = 9;
            this.label3.Text = "Filename:";
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(391, 166);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.ISO);
            this.Controls.Add(this.Inspect);
            this.Controls.Add(this.progressBar1);
            this.Controls.Add(this.comboBox1);
            this.Controls.Add(this.Path);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
            this.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximumSize = new System.Drawing.Size(407, 204);
            this.MinimumSize = new System.Drawing.Size(407, 204);
            this.Name = "Form1";
            this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
            this.Text = "ISO image inspector";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox Path;
        private System.Windows.Forms.ComboBox comboBox1;
        public System.Windows.Forms.ProgressBar progressBar1;
        private System.Windows.Forms.Button Inspect;
        private System.Windows.Forms.TextBox ISO;
        private System.Windows.Forms.Label label3;
    }
}



Screenshots

Capture.PNG
Capture.PNG
Capture.PNG
Capture.PNG

1 Spice up

I have yet to encounter a disc that this program could not handle! Please remember to rate, and enjoy!