/// <summary>
        /// Detect and process new files in the songs folder.
        /// </summary>
        private static void processSongs()
        {
            int newFolderCount = -1;

            //Process any new files waiting to be imported.
            if (handleNewFiles() || BeatmapManager.ChangedPackages.Count > 0 || BeatmapManager.ChangedFolders.Count > 0)
            {
                //We might need a full refresh even with new files added, if this is signalled.
                forceFullRefresh = false;
            }
            else
            {
                //Check if the number of directories in the songs dir has changed.
                //If it has, then we definitely need to do a full pass over available maps.
                newFolderCount = Directory.GetDirectories(BeatmapManager.SongsDirectory).Length + Directory.GetFiles(BeatmapManager.SongsDirectory).Length;

                if (BeatmapManager.FolderFileCount != newFolderCount)
                {
                    Debug.Print(@"Folder/Filecount changed from {0} to {1}", BeatmapManager.FolderFileCount, newFolderCount);

                    string _status = null;
                    if (BeatmapManager.FolderFileCount == 0)
                    {
                        _status             = LocalisationManager.GetString(OsuString.BeatmapImport_TimeToPopulateAnEmptyDatabase);
                        promptOnFullProcess = false;
                    }
                    else if (BeatmapManager.FolderFileCount < newFolderCount)
                    {
                        _status = LocalisationManager.GetString(OsuString.BeatmapImport_DetectedNewMapsAdded);
                    }
                    else
                    {
                        _status = LocalisationManager.GetString(OsuString.BeatmapImport_DetectedMapsRemoved);
                    }

                    if (status != null)
                    {
                        status.SetStatus(_status);
                    }

                    forceFullRefresh = true;
                }
            }

            if (status != null)
            {
                BeatmapManager.AssignStatusHandler(status.SetStatus);
            }

            //confirm this operation if the user has a lot of maps.
            if (forceFullRefresh && promptOnFullProcess
#if !DEBUG
                && BeatmapManager.Beatmaps.Count > 1000
#endif
                )
            {
                bool response = false;

                GameBase.RunBackgroundThread(delegate
                {
                    pDialog pd = new pDialog(LocalisationManager.GetString(OsuString.BeatmapImport_FullProcess), false);
                    pd.Closed += delegate { promptOnFullProcess = false; };

                    pd.AddOption(LocalisationManager.GetString(OsuString.General_Confirm), Color.YellowGreen, delegate
                    {
                        response            = true;
                        promptOnFullProcess = false;
                    });

                    pd.AddOption(LocalisationManager.GetString(OsuString.General_Cancel), Color.OrangeRed, delegate
                    {
                        response            = false;
                        promptOnFullProcess = false;
                    });

                    GameBase.Scheduler.Add(delegate
                    {
                        GameBase.ShowDialog(pd);
                    });
                });

                while (promptOnFullProcess && GameBase.Mode == OsuModes.BeatmapImport)
                {
                    Thread.Sleep(50);
                }

                if (!response)
                {
                    GameBase.Scheduler.Add(Exit);
                    BeatmapManager.ClearStatusHandlers();
                    return;
                }
            }

            BeatmapManager.CheckAndProcess(forceFullRefresh, promptOnFullProcess);
            BeatmapManager.ClearStatusHandlers();

            if (newFolderCount >= 0)
            {
                BeatmapManager.FolderFileCount = newFolderCount;
            }

            GameBase.Scheduler.Add(Exit);
        }