internal bool LoadFile(Beatmap beatmap, bool warnOnLostChanges, bool clearCache)
        {
            FinishBreakDrag();
            changeManager.FinishAction();

            if (warnOnLostChanges && CheckForChanges())
            {
                DialogResult r = NotificationManager.MessageBox(LocalisationManager.GetString(OsuString.Editor_FileOperations_RevertFileToLastSavedState), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
                switch (r)
                {
                case DialogResult.Cancel:
                    return(false);

                case DialogResult.No:
                    return(false);
                }
            }

            GameBase.SetTitle(Path.GetFileName(beatmap.Filename));
            Instance.SelectNone();
            changeManager.IgnorePush = true;

            SkinManager.ResetColoursToSkin();

            if (clearCache)
            {
                TextureManager.ClearBeatmapCache(true);
            }

            AudioEngine.LoadAudio(beatmap, false, false);

            ChangeAudioRate(100);

            EventManager.ShowVideo = ConfigManager.sEditorVideo;

            bool existingMap;

            try
            {
                hitObjectManager.SetBeatmap(beatmap, Mods.None);
                existingMap = hitObjectManager.LoadWithEvents();
            }
            catch (OsuFileUnreadableException)
            {
                GameBase.ChangeModeInstant(OsuModes.SelectEdit, true);
                changeManager.IgnorePush = false;
                return(false);
            }

            if (Compose != null)
            {
                if (beatmap.PlayMode != LoadedMode)
                {
                    GameBase.ChangeMode(OsuModes.Edit, true);
                    changeManager.IgnorePush = false;
                    return(false);
                }
            }

            eventManager = hitObjectManager.eventManager;

            eventManager.spriteManagerBGWide.EnableProfiling = true;
            eventManager.spriteManagerBG.EnableProfiling     = true;
            eventManager.spriteManagerFG.EnableProfiling     = true;

            changeManager.RefreshManagers();

            if (!existingMap || beatmap.Creator.Length == 0)
            {
                if (Compose != null)
                {
                    Compose.ChangeAltDistance(ConfigManager.sDistanceSpacing.Default);
                }
                ShowSongSetup(false);
            }

            beatmap.BeatmapVersion = Beatmap.BEATMAP_VERSION;

            hitObjectManager.UpdateSlidersAll(false);

            if (Design != null)
            {
                Design.Reset();
            }

            if (currentMode != null)
            {
                currentMode.Enter();
            }

            changeManager.HistoryClear();

            if (aiMod != null)
            {
                aiMod.Run();
            }

            //New map is being loaded- remove invalid breaks
            BreakDirty         = true;
            CheckInvalidBreaks = true;
            UpdateBreaks(true, true, false, false);

            GameBase.EditorControl.LoadMenu();

            changeManager.Dirty      = false;
            changeManager.IgnorePush = false;
            return(true);
        }