private void btnLoadItunesLibraryData_Click(object sender, EventArgs e) { tbMessages.Text = ""; OperationResult op = new OperationResult(); try { var iTunesData = GetiTunesLibXml(); if (!op.Success) { tbMessages.Text = op.GetAllErrorsAndExceptionsWthNl(); return; } _mp3Repository = new Mp3Repository(ddtbDbFile.ItemText, ref op); if (!op.Success) { tbMessages.Text = op.GetAllErrorsAndExceptionsWthNl(); return; } _mp3Repository.DropAllITunesTables(ref op); if (!op.Success) { tbMessages.Text = op.GetAllErrorsAndExceptionsWthNl(); return; } _mp3Repository.CreateItunesTables(ref op); if (!op.Success) { tbMessages.Text = op.GetAllErrorsAndExceptionsWthNl(); return; } _mp3Repository.InsertITunesData(iTuneSongs, iTunesPlayLists, ref op); if (!op.Success) { tbMessages.Text = op.GetAllErrorsAndExceptionsWthNl(); return; } } catch (Exception ex) { op.AddException(ex); tbMessages.Text = op.GetAllErrorsAndExceptionsWthNl(); return; } if (!op.Success) { tbMessages.Text = op.GetAllErrorsAndExceptionsWthNl(); return; } tbMessages.Text = "Finished"; }
private void CreateMp3Repository(string dbName, ref OperationResult op) { try { //dbName = dbName.EndsWith(".db") ? dbName : dbName + ".db"; //op.AddError($"{dbName} is not a Sqlite fil. Must end with \".db\"."); //if (!op.Success) //{ // return; //} _mp3Repository = new Mp3Repository(dbName, ref op); } catch (Exception ex) { op.AddException(ex); } }
private void CreateMp3Repository(string dbName, ref OperationResult op) { try { if (!dbName.EndsWith(".db", StringComparison.InvariantCultureIgnoreCase)) { op.AddError($"{dbName} is not a Sqlite fil. Must end with \".db\"."); return; } if (!File.Exists(dbName)) { op.AddError($"{dbName} does not exist."); return; } _mp3Repository = new Mp3Repository(dbName, ref op); } catch (Exception ex) { op.AddException(ex); } }
private void btnSyncITunesWithMp3_Click(object sender, EventArgs e) { tbMessages.Text = ""; OperationResult op = new OperationResult(); try { _mp3Repository = new Mp3Repository(ddtbDbFile.ItemText, ref op); if (!op.Success) { tbMessages.Text = op.GetAllErrorsAndExceptionsWthNl(); return; } _mp3Repository.SyncITunesDataWithMp3s(ref op); if (!op.Success) { tbMessages.Text = op.GetAllErrorsAndExceptionsWthNl(); return; } } catch (Exception ex) { op.AddException(ex); tbMessages.Text = op.GetAllErrorsAndExceptionsWthNl(); return; } if (!op.Success) { tbMessages.Text = op.GetAllErrorsAndExceptionsWthNl(); return; } tbMessages.Text = "Finished"; }