示例#1
0
 /// <summary>
 /// Constructor for class - create a new reader for a given Database.
 /// Read the settings for the iPod and iTunesDB location.
 /// </summary>
 /// <param name="mediaDB">The database in which to add the tracks.</param>
 public IPod5GDbReader(MediaDatabase mediaDB)
 {
     this.iTunesDBFile = ISavr.Properties.Settings.Default.iPodControlDir;
     this.mediaDB = mediaDB;
     this.iPodDrive = ISavr.Properties.Settings.Default.DriveLetter;
 }
示例#2
0
文件: FrmMain.cs 项目: rcw5/iSavr
        private void frmMain_Load(object sender, EventArgs e)
        {
            mediaDataBase = new MediaDatabase();
            db = new IPod5GDbReader(mediaDataBase);

            //Ask for the iTunesDB the first time the application is loaded.
            if ((ISavr.Properties.Settings.Default.iPodControlDir.Equals("")) || (ISavr.Properties.Settings.Default.DriveLetter.Equals("")))
            {
                MessageBox.Show("Welcome to iSavr!\nAs this is the first time you have loaded the application, you will need to point me to your iTunes Database file!", "Welcome to iSavr!");
                showPreferencesForm();
            }
            try
            {
                reloadDatabase();
            }
            catch (Exception)
            {
                //loop forever until we have a database!
                while (true)
                {
                    DialogResult result = MessageBox.Show("Cannot access iTunes Database - check that your iPod is connected.", "Error Reading Database", MessageBoxButtons.RetryCancel);
                    if (result == DialogResult.Retry)
                    {
                        try
                        {
                            reloadDatabase();
                            break;
                        }
                        catch (Exception)
                        {
                            //go around again!
                        }

                    }
                    else if (result == DialogResult.Cancel)
                    {
                        break;
                    }
                }

            }
        }