예제 #1
0
        public MiscInfoControl()
        {
            // Activates double buffering
            this.SetStyle(ControlStyles.DoubleBuffer |
                          ControlStyles.OptimizedDoubleBuffer |
                          ControlStyles.UserPaint |
                          ControlStyles.AllPaintingInWmPaint, true);
            this.UpdateStyles();

            InitializeComponent();

            // Listen to Messages
            IMessageQueue queueMessage = ServiceScope.Get <IMessageBroker>().GetOrCreate("message");

            queueMessage.OnMessageReceive += OnMessageReceive;

            // Setup Non-Music ListView
            listViewNonMusicFiles.View             = View.LargeIcon;
            listViewNonMusicFiles.ShowItemToolTips = true;
            listViewNonMusicFiles.LabelEdit        = true;
            listViewNonMusicFiles.FullRowSelect    = true;
            listViewNonMusicFiles.GridLines        = true;
            listViewNonMusicFiles.Sorting          = SortOrder.Ascending;

            // Build the Context Menu for the Non Music Files Listview
            MenuItem[] nonMusicMenuitems = new MenuItem[2];
            nonMusicMenuitems[0]              = new MenuItem();
            nonMusicMenuitems[0].Text         = localisation.ToString("main", "NonMusicContextMenuRenameToFolderJpg");
            nonMusicMenuitems[0].Click       += listViewNonMusicFiles_RenameToFolderJpg;
            nonMusicMenuitems[0].DefaultItem  = true;
            nonMusicMenuitems[1]              = new MenuItem();
            nonMusicMenuitems[1].Text         = localisation.ToString("main", "NonMusicContextMenuDeleteFiles");
            nonMusicMenuitems[1].Click       += listViewNonMusicFiles_DeleteFiles;
            listViewNonMusicFiles.ContextMenu = new ContextMenu(nonMusicMenuitems);
        }
예제 #2
0
 /// <summary>
 ///   Localise the Screen
 /// </summary>
 private void LocaliseScreen()
 {
     labelHeader.Text = localisation.ToString("Lookup", "HeaderDetails");
     chTrackNum.Text  = localisation.ToString("Lookup", "ColTrackNum");
     chTitle.Text     = localisation.ToString("Lookup", "ColTitle");
     chFileName.Text  = localisation.ToString("Lookup", "ColFileName");
 }
예제 #3
0
 /// <summary>
 ///   Localise the Screen
 /// </summary>
 private void LocaliseScreen()
 {
     log.Trace(">>>");
     Text          = String.Format(localisation.ToString("LyricsSearch", "Header"), tbArtist.Text, tbTitle.Text);
     chSite.Text   = localisation.ToString("LyricsSearch", "Site");
     chResult.Text = localisation.ToString("LyricsSearch", "Result");
     chLyric.Text  = localisation.ToString("LyricsSearch", "Lyric");
     log.Trace("<<<");
 }
        private void UpdateDBThread()
        {
            log.Debug("Database Update: Starting Database update thread");
            _processCount = 0;
            _audioFiles   = 0;

            OpenConnection();
            while ((fileThread.ThreadState == ThreadState.Running || _processCount < files.Count) && !_abortScan)
            {
                if (_processCount == files.Count || files.Count == 0)
                {
                    continue;
                }
                string fileName = files[_processCount].FullName;
                if (Util.IsAudio(fileName))
                {
                    _audioFiles++;
                    try
                    {
                        ByteVector.UseBrokenLatin1Behavior = true;
                        File file = File.Create(fileName);
                        AddSong(file);
                    }
                    catch (CorruptFileException)
                    {
                        log.Warn("FolderScan: Ignoring track {0} - Corrupt File!", fileName);
                    }
                    catch (UnsupportedFormatException)
                    {
                        log.Warn("FolderScan: Ignoring track {0} - Unsupported format!", fileName);
                    }
                }
                _processCount++;
            }

            CloseConnection();
            _scanHasRun = true;

            DateTime stopTime = DateTime.Now;

            _ts = stopTime - _startTime;
            float fSecsPerTrack = ((float)_ts.TotalSeconds / files.Count);

            _trackPerSecSummary = "";
            if (files.Count > 0)
            {
                _trackPerSecSummary = string.Format(localisation.ToString("Settings", "DBScanTrackSummary"), fSecsPerTrack);
            }

            log.Info(
                "Database Update: Music database update done.  Processed {0} tracks in: {1:d2}:{2:d2}:{3:d2}{4}",
                _audioFiles, _ts.Hours, _ts.Minutes, _ts.Seconds, _trackPerSecSummary);

            log.Debug("Database Update: Ending Database Update thread");
        }
예제 #5
0
 /// <summary>
 ///   Localise the Screen
 /// </summary>
 private void LocaliseScreen()
 {
     if (_replace)
     {
         labelHeader.Text = localisation.ToString("FindReplace", "HeaderReplace");
     }
     else
     {
         labelHeader.Text = localisation.ToString("FindReplace", "HeaderFind");
     }
 }
        public FreeDBMultiCDSelect()
        {
            InitializeComponent();

            BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor;
            ServiceScope.Get <IThemeManager>().NotifyThemeChange();

            Text = localisation.ToString("FreeDB", "Header");
        }
 public static string Localise(string context, string text)
 {
     if (localisation != null)
     {
         return(localisation.ToString(context, text));
     }
     else
     {
         return("");
     }
 }
예제 #8
0
 private void LocaliseScreen()
 {
     // Update the column Headings
     foreach (DataGridViewColumn col in dataGridViewRip.Columns)
     {
         col.HeaderText = localisation.ToString("column_header", col.Name);
     }
 }
 /// <summary>
 ///   Localise the Screen
 /// </summary>
 private void LocaliseScreen()
 {
     labelHeader.Text = localisation.ToString("Lookup", "HeaderSearchResult");
     chArtist.Text    = localisation.ToString("Lookup", "ColArtist");
     chTitle.Text     = localisation.ToString("Lookup", "ColAlbum");
     chTracks.Text    = localisation.ToString("Lookup", "ColTracks");
     chYear.Text      = localisation.ToString("Lookup", "ColYear");
     chLabel.Text     = localisation.ToString("Lookup", "ColLabel");
 }
 /// <summary>
 ///   Localise the Screen
 /// </summary>
 private void LocaliseScreen()
 {
     labelHeader.Text = localisation.ToString("Lookup", "HeaderArtistAlbum");
 }
예제 #11
0
        public GridViewBurn(Main main)
        {
            _main = main;

            // Setup message queue for receiving Messages
            IMessageQueue queueMessage = ServiceScope.Get <IMessageBroker>().GetOrCreate("message");

            queueMessage.OnMessageReceive += OnMessageReceive;

            InitializeComponent();

            _main.BurnButtonsEnabled = false;

            // Create the Temp Directory for the burner
            if (!Directory.Exists(tmpBurnDirectory))
            {
                Directory.CreateDirectory(tmpBurnDirectory);
            }

            // Load the Settings
            gridColumns = new GridViewColumnsBurn();

            dataGridViewBurn.AutoGenerateColumns = false;
            dataGridViewBurn.DataSource          = bindingList;

            // Now Setup the columns, we want to display
            CreateColumns();

            CreateContextMenu();

            lbBurningStatus.Text = localisation.ToString("Burning", "DragAndDrop");
            // "Use Drag & Drop to order the tracks for burning";
        }
예제 #12
0
        /// <summary>
        ///   Do Case Conversion for the given track.
        ///   Called internally by the Convert button and by the Save clause, if set in Preferences
        /// </summary>
        /// <param name = "track"></param>
        public void CaseConvert(TrackData track, int rowIndex)
        {
            bool bErrors = false;

            // Convert the Filename
            if (checkBoxConvertFileName.Checked)
            {
                string fileName = ConvertCase(Path.GetFileNameWithoutExtension(track.FileName));

                // Now check the length of the filename
                if (fileName.Length > 255)
                {
                    log.Debug("Filename too long: {0}", fileName);
                    track.Status = 2;
                    _main.TracksGridView.AddErrorMessage(_main.TracksGridView.View.Rows[rowIndex],
                                                         String.Format("{0}: {1}",
                                                                       localisation.ToString("tag2filename", "NameTooLong"),
                                                                       fileName));
                    bErrors = true;
                }

                if (!bErrors)
                {
                    // Now that we have a correct Filename
                    track.FileName = string.Format("{0}{1}", fileName, Path.GetExtension(track.FileName));
                    track.Changed  = true;
                    _main.TracksGridView.Changed = true;
                    _main.TracksGridView.SetBackgroundColorChanged(rowIndex);
                    Options.Songlist[rowIndex] = track;
                }
            }

            // Convert the Tags
            if (checkBoxConvertTags.Checked)
            {
                string strConv  = "";
                bool   bChanged = false;
                if (checkBoxArtist.Checked)
                {
                    strConv  = track.Artist;
                    bChanged = (strConv = ConvertCase(strConv)) != track.Artist ? true : false || bChanged;
                    if (bChanged)
                    {
                        track.Artist = strConv;
                    }
                }
                if (checkBoxAlbumArtist.Checked)
                {
                    strConv  = track.AlbumArtist;
                    bChanged = (strConv = ConvertCase(strConv)) != track.AlbumArtist ? true : false || bChanged;
                    if (bChanged)
                    {
                        track.AlbumArtist = strConv;
                    }
                }
                if (checkBoxAlbum.Checked)
                {
                    strConv  = track.Album;
                    bChanged = (strConv = ConvertCase(strConv)) != track.Album ? true : false || bChanged;
                    if (bChanged)
                    {
                        track.Album = strConv;
                    }
                }
                if (checkBoxTitle.Checked)
                {
                    strConv  = track.Title;
                    bChanged = (strConv = ConvertCase(strConv)) != track.Title ? true : false || bChanged;
                    if (bChanged)
                    {
                        track.Title = strConv;
                    }
                }
                if (checkBoxComment.Checked)
                {
                    strConv  = track.Comment;
                    bChanged = (strConv = ConvertCase(strConv)) != track.Comment ? true : false || bChanged;
                    if (bChanged)
                    {
                        track.Comment = strConv;
                    }
                }

                if (bChanged)
                {
                    track.Changed = true;
                    _main.TracksGridView.Changed = true;
                    _main.TracksGridView.SetBackgroundColorChanged(rowIndex);
                    Options.Songlist[rowIndex] = track;
                }
            }
        }
예제 #13
0
        /// <summary>
        ///   Localise the Screen
        /// </summary>
        private void LocaliseScreen()
        {
            // Extended Panels. Doing it via TTExtendedPanel doesn't work for some reason
            treeViewPanel.CaptionText         = localisation.ToString("main", "TreeViewPanel");
            optionsPanelLeft.CaptionText      = localisation.ToString("main", "OptionsPanel");
            contextMenuTreeView.Items[0].Text = localisation.ToString("contextmenu", "Copy");
            contextMenuTreeView.Items[1].Text = localisation.ToString("contextmenu", "Cut");
            contextMenuTreeView.Items[2].Text = localisation.ToString("contextmenu", "Paste");
            contextMenuTreeView.Items[3].Text = localisation.ToString("contextmenu", "Delete");
            contextMenuTreeView.Items[4].Text = localisation.ToString("contextmenu", "Refresh");

            contextMenuStripFilter.Items[0].Text = localisation.ToString("contextmenu", "InsertFilter");
            contextMenuStripFilter.Items[1].Text = localisation.ToString("contextmenu", "DeleteFilter");

            // Filter Grid Headings
            TagFilterField.HeaderText    = localisation.ToString("main", "FilterHeadingField");
            TagFilterValue.HeaderText    = localisation.ToString("main", "FilterHeadingFilter");
            TagFilterOperator.HeaderText = localisation.ToString("main", "FilterHeadingOperator");

            // Data Provider Combo
            cbDataProvider.Items.Clear();
            cbDataProvider.Items.Add(localisation.ToString("main", "FolderView"));
            cbDataProvider.Items.Add(localisation.ToString("main", "NetworkView"));
            cbDataProvider.Items.Add(localisation.ToString("main", "DBView"));
        }
예제 #14
0
 /// <summary>
 ///   Localise the Screen
 /// </summary>
 private void LocaliseScreen()
 {
     labelHeader.Text = localisation.ToString("TagAndRename", "HeadingTag");
 }
예제 #15
0
        private void ConversionThread()
        {
            if (_main.InvokeRequired)
            {
                ThreadSafeConvertDelegate d = ConversionThread;
                _main.Invoke(d);
                return;
            }

            log.Trace(">>>");
            string rootFolder = _main.EncoderOutputDirectory;

            if (string.IsNullOrEmpty(rootFolder))
            {
                rootFolder = Options.MainSettings.RipTargetFolder;
            }

            string encoder = null;

            if (_main.EncoderCombo.SelectedItem != null)
            {
                encoder = (string)(_main.EncoderCombo.SelectedItem as Item).Value;
            }

            if (encoder == null)
            {
                return;
            }

            try
            {
                if (!Directory.Exists(rootFolder) && !string.IsNullOrEmpty(rootFolder))
                {
                    Directory.CreateDirectory(rootFolder);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(localisation.ToString("Conversion", "ErrorDirectory"), localisation.ToString("message", "Error_Title"), MessageBoxButtons.OK);
                log.Error("Error creating Conversion output directory: {0}. {1}", rootFolder, ex.Message);
                return;
            }

            foreach (DataGridViewRow row in dataGridViewConvert.Rows)
            {
                // Reset the Status field to 0
                row.Cells[0].Value = 0;
            }

            _currentRow = -1;
            foreach (DataGridViewRow row in dataGridViewConvert.Rows)
            {
                _currentRow = row.Index;

                ConversionData track = bindingList[_currentRow];

                string inputFile = track.Track.FullFileName;
                string outFile   = Util.ReplaceParametersWithTrackValues(Options.MainSettings.RipFileNameFormat, track.Track);
                outFile = Path.Combine(rootFolder, outFile);
                string directoryName = Path.GetDirectoryName(outFile);

                // Now check the validity of the directory
                if (!Directory.Exists(directoryName))
                {
                    try
                    {
                        Directory.CreateDirectory(directoryName);
                    }
                    catch (Exception e1)
                    {
                        log.Error("Error creating folder: {0} {1]", directoryName, e1.Message);
                        row.Cells[0].Value       = localisation.ToString("message", "Error");
                        row.Cells[0].ToolTipText = String.Format("{0}: {1}", localisation.ToString("message", "Error"), e1.Message);
                        continue; // Process next row
                    }
                }

                outFile = audioEncoder.SetEncoder(encoder, outFile);
                UpdateNewFileName(outFile);

                if (inputFile == outFile)
                {
                    row.Cells[0].ToolTipText = String.Format("{0}: {1}", inputFile, localisation.ToString("Conversion", "SameFile"));
                    log.Error("No conversion for {0}. Output would overwrite input", inputFile);
                    continue;
                }

                int stream = Bass.BASS_StreamCreateFile(inputFile, 0, 0, BASSFlag.BASS_STREAM_DECODE);
                if (stream == 0)
                {
                    row.Cells[0].ToolTipText = String.Format("{0}: {1}", inputFile, localisation.ToString("Conversion", "OpenFileError"));
                    log.Error("Error creating stream for file {0}. Error: {1}", inputFile,
                              Enum.GetName(typeof(BASSError), Bass.BASS_ErrorGetCode()));
                    continue;
                }

                log.Info("Convert file {0} -> {1}", inputFile, outFile);

                if (audioEncoder.StartEncoding(stream) != BASSError.BASS_OK)
                {
                    row.Cells[0].ToolTipText = String.Format("{0}: {1}", inputFile, localisation.ToString("Conversion", "EncodingFileError"));
                    log.Error("Error starting Encoder for File {0}. Error: {1}", inputFile,
                              Enum.GetName(typeof(BASSError), Bass.BASS_ErrorGetCode()));
                    Bass.BASS_StreamFree(stream);
                    continue;
                }

                dataGridViewConvert.Rows[_currentRow].Cells[0].Value = 100;

                Bass.BASS_StreamFree(stream);

                try
                {
                    // Now Tag the encoded File
                    File tagInFile  = File.Create(inputFile);
                    File tagOutFile = File.Create(outFile);
                    tagOutFile.Tag.AlbumArtists = tagInFile.Tag.AlbumArtists;
                    tagOutFile.Tag.Album        = tagInFile.Tag.Album;
                    tagOutFile.Tag.Genres       = tagInFile.Tag.Genres;
                    tagOutFile.Tag.Year         = tagInFile.Tag.Year;
                    tagOutFile.Tag.Performers   = tagInFile.Tag.Performers;
                    tagOutFile.Tag.Track        = tagInFile.Tag.Track;
                    tagOutFile.Tag.TrackCount   = tagInFile.Tag.TrackCount;
                    tagOutFile.Tag.Title        = tagInFile.Tag.Title;
                    tagOutFile.Tag.Comment      = tagInFile.Tag.Comment;
                    tagOutFile.Tag.Composers    = tagInFile.Tag.Composers;
                    tagOutFile.Tag.Conductor    = tagInFile.Tag.Conductor;
                    tagOutFile.Tag.Copyright    = tagInFile.Tag.Copyright;
                    tagOutFile.Tag.Disc         = tagInFile.Tag.Disc;
                    tagOutFile.Tag.DiscCount    = tagInFile.Tag.DiscCount;
                    tagOutFile.Tag.Lyrics       = tagInFile.Tag.Lyrics;
                    tagOutFile.Tag.Pictures     = tagInFile.Tag.Pictures;
                    tagOutFile = Util.FormatID3Tag(tagOutFile);
                    tagOutFile.Save();
                }
                catch (Exception ex)
                {
                    log.Error("Error tagging encoded file {0}. Error: {1}", outFile, ex.Message);
                }
            }
            Options.MainSettings.LastConversionEncoderUsed = encoder;
            _currentRow = -1;

            log.Trace("<<<");
        }
예제 #16
0
        /// <summary>
        ///   Do Case Conversion for the given track.
        ///   Called internally by the Convert button and by the Save clause, if set in Preferences
        /// </summary>
        /// <param name = "track"></param>
        public void CaseConvert(TrackData track, int rowIndex)
        {
            bool bErrors = false;

            // Convert the Filename
            if (checkBoxConvertFileName.Checked)
            {
                string fileName = ConvertCase(Path.GetFileNameWithoutExtension(track.FileName));

                // Now check the length of the filename
                if (fileName.Length > 255)
                {
                    log.Debug("Filename too long: {0}", fileName);
                    _main.TracksGridView.SetStatusColumnError(_main.TracksGridView.View.Rows[rowIndex]);
                    _main.TracksGridView.AddErrorMessage(_main.TracksGridView.View.Rows[rowIndex],
                                                         String.Format("{0}: {1}",
                                                                       localisation.ToString("tag2filename", "NameTooLong"),
                                                                       fileName));
                    bErrors = true;
                }

                // Check, if we would generate duplicate file names
                foreach (DataGridViewRow file in _main.TracksGridView.View.Rows)
                {
                    // Don't compare the file with itself
                    if (rowIndex == file.Index)
                    {
                        continue;
                    }

                    TrackData filedata = _main.TracksGridView.TrackList[file.Index];
                    if (filedata.FileName.ToLowerInvariant() == fileName.ToLowerInvariant())
                    {
                        log.Debug("New Filename already exists: {0}", fileName);
                        _main.TracksGridView.SetStatusColumnError(_main.TracksGridView.View.Rows[rowIndex]);
                        _main.TracksGridView.AddErrorMessage(_main.TracksGridView.View.Rows[rowIndex],
                                                             String.Format("{0}: {1}",
                                                                           localisation.ToString("tag2filename", "FileExists"),
                                                                           fileName));
                        bErrors = true;
                        break;
                    }
                }
                if (!bErrors)
                {
                    // Now that we have a correct Filename and no duplicates accept the changes
                    track.FileName = string.Format("{0}{1}", fileName, Path.GetExtension(track.FileName));
                    track.Changed  = true;
                    _main.TracksGridView.Changed = true;
                    _main.TracksGridView.SetBackgroundColorChanged(rowIndex);
                }
            }

            // Convert the Tags
            if (checkBoxConvertTags.Checked)
            {
                string strConv  = "";
                bool   bChanged = false;
                if (checkBoxArtist.Checked)
                {
                    strConv  = track.Artist;
                    bChanged = (strConv = ConvertCase(strConv)) != track.Artist ? true : false || bChanged;
                    if (bChanged)
                    {
                        track.Artist = strConv;
                    }
                }
                if (checkBoxAlbumArtist.Checked)
                {
                    strConv  = track.AlbumArtist;
                    bChanged = (strConv = ConvertCase(strConv)) != track.AlbumArtist ? true : false || bChanged;
                    if (bChanged)
                    {
                        track.AlbumArtist = strConv;
                    }
                }
                if (checkBoxAlbum.Checked)
                {
                    strConv  = track.Album;
                    bChanged = (strConv = ConvertCase(strConv)) != track.Album ? true : false || bChanged;
                    if (bChanged)
                    {
                        track.Album = strConv;
                    }
                }
                if (checkBoxTitle.Checked)
                {
                    strConv  = track.Title;
                    bChanged = (strConv = ConvertCase(strConv)) != track.Title ? true : false || bChanged;
                    if (bChanged)
                    {
                        track.Title = strConv;
                    }
                }
                if (checkBoxComment.Checked)
                {
                    strConv  = track.Comment;
                    bChanged = (strConv = ConvertCase(strConv)) != track.Comment ? true : false || bChanged;
                    if (bChanged)
                    {
                        track.Comment = strConv;
                    }
                }

                if (bChanged)
                {
                    track.Changed = true;
                    _main.TracksGridView.Changed = true;
                    _main.TracksGridView.SetBackgroundColorChanged(rowIndex);
                }
            }
        }
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            if (!File.Exists(Options.MainSettings.MediaPortalDatabase))
            {
                MessageBox.Show(localisation.ToString("dbsearch", "NoMusicDB"), "", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }

            if (tbArtist.Text.Trim() == "" && tbAlbum.Text.Trim() == "" && tbTitle.Text.Trim() == "")
            {
                MessageBox.Show(localisation.ToString("dbsearch", "NoSearchValues"), "", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }

            if (!_main.TreeView.DatabaseMode)
            {
                _main.TreeView.DatabaseMode = true;
            }

            string sql = "select strPath from tracks where {0} order by {1}";

            string whereClause   = "";
            string orderByClause = "";

            if (tbArtist.Text.Trim() != "")
            {
                whereClause += string.Format("(strArtist like '%{0}%' OR strAlbumArtist like '%{0}%')",
                                             Util.RemoveInvalidChars(tbArtist.Text.Trim()));
                orderByClause += "strArtist";
            }

            if (tbAlbum.Text.Trim() != "")
            {
                if (whereClause != "")
                {
                    whereClause += " AND ";
                }
                whereClause += string.Format("strAlbum like '%{0}%' ", Util.RemoveInvalidChars(tbAlbum.Text.Trim()));

                if (orderByClause != "")
                {
                    orderByClause += ",";
                }
                orderByClause += "strAlbum";
            }

            if (tbTitle.Text.Trim() != "")
            {
                if (whereClause != "")
                {
                    whereClause += " AND ";
                }
                whereClause += string.Format("strTitle like '%{0}%' ", Util.RemoveInvalidChars(tbTitle.Text.Trim()));
                if (orderByClause != "")
                {
                    orderByClause += ",";
                }
                orderByClause += "strTitle";
            }

            sql = string.Format(sql, whereClause, orderByClause);
            List <string> songs = new List <string>();

            string connection = string.Format(@"Data Source={0}", Options.MainSettings.MediaPortalDatabase);

            try
            {
                Cursor = Cursors.WaitCursor;
                int count             = 0;
                SQLiteConnection conn = new SQLiteConnection(connection);
                conn.Open();
                using (SQLiteCommand cmd = new SQLiteCommand())
                {
                    cmd.Connection  = conn;
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = sql;
                    log.Debug("Database Scan: Executing sql: {0}", sql);
                    using (SQLiteDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            songs.Add(reader.GetString(0));
                            count++;
                            if (count > 999)
                            {
                                Cursor = Cursors.Default;
                                MessageBox.Show(localisation.ToString("dbsearch", "TooMuchRows"), "", MessageBoxButtons.OK,
                                                MessageBoxIcon.Exclamation);
                                break;
                            }
                        }
                    }
                }
                Cursor = Cursors.Default;
                conn.Close();
            }
            catch (Exception ex)
            {
                log.Error("Database Scan: Error executing sql: {0}", ex.Message);
            }

            log.Debug("Database Scan: Query returned {0} songs", songs.Count);
            _main.TracksGridView.AddDatabaseSongsToGrid(songs);
        }
예제 #18
0
 /// <summary>
 ///   Localise the Screen
 /// </summary>
 private void LocaliseScreen()
 {
     Text = localisation.ToString("About", "Header");
     tbDescription.Text = localisation.ToString("About", "Description");
 }
예제 #19
0
 private void Localisation()
 {
     Text = localisation.ToString("lyricssearch", "Heading");
 }
예제 #20
0
        public Preview()
        {
            InitializeComponent();

            // Insert the first Column
            AddGridColumn(0, "FileName", localisation.ToString("column_header", "FileName"), 250);
        }
예제 #21
0
 /// <summary>
 ///   Localise the Screen
 /// </summary>
 private void LocaliseScreen()
 {
     labelHeader.Text = localisation.ToString("organise", "Heading");
 }
예제 #22
0
 /// <summary>
 ///   Create Context Menu
 /// </summary>
 private void Localisation()
 {
     contextMenu.Items[0].Text = localisation.ToString("player", "ClearPlayList");
     contextMenu.Items[2].Text = localisation.ToString("player", "LoadPlayList");
     contextMenu.Items[3].Text = localisation.ToString("player", "SavePlayList");
 }
예제 #23
0
        /// <summary>
        ///   Convert File Name to Tag
        /// </summary>
        /// <param name = "parameters"></param>
        private void Tag2FileName(string parameter)
        {
            log.Trace(">>>");
            bool         bErrors    = false;
            DataGridView tracksGrid = _main.TracksGridView.View;

            enumerateStartValue   = (int)numericUpDownStartAt.Value;
            enumerateNumberDigits = (int)numericUpDownNumberDigits.Value;

            foreach (DataGridViewRow row in tracksGrid.Rows)
            {
                if (!row.Selected)
                {
                    continue;
                }

                string fileName = parameter;
                track = Options.Songlist[row.Index];

                try
                {
                    fileName = ReplaceParametersWithValues(parameter);

                    // Now check the length of the filename
                    if (fileName.Length > 255)
                    {
                        log.Debug("Filename too long: {0}", fileName);
                        Options.Songlist[row.Index].Status = 2;
                        _main.TracksGridView.AddErrorMessage(row,
                                                             String.Format("{0}: {1}",
                                                                           localisation.ToString("tag2filename", "NameTooLong"),
                                                                           fileName));
                        continue; // Process next row
                    }

                    // Check, if we would generate duplicate file names
                    foreach (DataGridViewRow file in tracksGrid.Rows)
                    {
                        TrackData filedata = Options.Songlist[file.Index];
                        if (filedata.FileName.ToLowerInvariant() == fileName.ToLowerInvariant())
                        {
                            log.Debug("New Filename already exists: {0}", fileName);
                            Options.Songlist[row.Index].Status = 2;
                            _main.TracksGridView.AddErrorMessage(row,
                                                                 String.Format("{0}: {1}",
                                                                               localisation.ToString("tag2filename", "FileExists"),
                                                                               fileName));
                            bErrors = true;
                            break;
                        }
                    }

                    if (bErrors)
                    {
                        bErrors = false;
                        continue;
                    }

                    string ext = Path.GetExtension(track.FileName);

                    // Now that we have a correct Filename and no duplicates accept the changes
                    track.FileName = string.Format("{0}{1}", fileName, ext);
                    track.Changed  = true;

                    _main.TracksGridView.Changed = true;
                    _main.TracksGridView.SetBackgroundColorChanged(row.Index);
                    Options.Songlist[row.Index] = track;
                }
                catch (Exception ex)
                {
                    log.Error("Error Renaming File: {0} stack: {1}", ex.Message, ex.StackTrace);
                    Options.Songlist[row.Index].Status = 2;
                    _main.TracksGridView.AddErrorMessage(row,
                                                         String.Format("{0}: {1}", localisation.ToString("tag2filename", "Rename"),
                                                                       fileName));
                    bErrors = true;
                }
            }

            _main.TracksGridView.Changed = bErrors;
            // check, if we still have changed items in the list
            foreach (TrackData track in Options.Songlist)
            {
                if (track.Changed)
                {
                    _main.TracksGridView.Changed = true;
                }
            }

            tracksGrid.Refresh();
            tracksGrid.Parent.Refresh();

            log.Trace("<<<");
        }
예제 #24
0
 /// <summary>
 ///   Localise the Screen
 /// </summary>
 private void LocaliseScreen()
 {
     Text         = localisation.ToString("AmazonAlbumSearch", "Header");
     chAlbum.Text = localisation.ToString("AmazonAlbumSearch", "Albums");
 }