private void LoadSolWorker(sol_track sol) { lock (_loadsync) { try { _editor.ChangeTrack(SOLLoader.LoadTrack(sol)); } catch (Exception e) { GameCanvas.QueuedActions.Enqueue(() => _canvas.ShowError( "Failed to load the track:" + Environment.NewLine + e.Message)); return; } } }
private void LoadSOL(sol_track sol) { lock (_loadsync) { try { Settings.Local.EnableSong = false; game.Track.ChangeTrack(SOLLoader.LoadTrack(sol)); } catch (Exception e) { PopupWindow.QueuedActions.Enqueue(() => PopupWindow.Error( "Failed to load the track:" + Environment.NewLine + e.Message)); return; } } }
private void AutoLoad() { try { game.Canvas.Loading = true; string lasttrack; if (Program.args.Length > 0) { Settings.LastSelectedTrack = Program.args[0]; lasttrack = Settings.LastSelectedTrack; } else { lasttrack = Settings.LastSelectedTrack; var trdr = Constants.TracksDirectory; if (!lasttrack.StartsWith(trdr)) { return; } } if (lasttrack.Contains("Crash Backup")) { if (!GameCanvas.ShowLoadCrashBackup(game.Canvas, lasttrack)) { game.Canvas.Loading = false; return; } } if (string.Equals( Path.GetExtension(lasttrack), ".trk", StringComparison.InvariantCultureIgnoreCase)) { var trackname = TrackIO.GetTrackName(lasttrack); lock (LoadSync) { var track = TRKLoader.LoadTrack(lasttrack, trackname); ChangeTrack(track); } } else if (string.Equals( Path.GetExtension(lasttrack), ".json", StringComparison.InvariantCultureIgnoreCase)) { var trackname = TrackIO.GetTrackName(lasttrack); lock (LoadSync) { var track = JSONLoader.LoadTrack(lasttrack); if (track.Name == Constants.DefaultTrackName || string.IsNullOrEmpty(track.Name)) { track.Name = trackname; } ChangeTrack(track); } } else if (string.Equals( Path.GetExtension(lasttrack), ".sol", StringComparison.InvariantCultureIgnoreCase)) { var trackname = TrackIO.GetTrackName(lasttrack); var sol = SOLLoader.LoadSol(lasttrack); if (sol.Count == 0) { return; } lock (LoadSync) { var track = SOLLoader.LoadTrack(sol[0]); ChangeTrack(track); } } } catch (Exception e) { Debug.WriteLine("Autoload failure: " + e.ToString()); } finally { game.Canvas.Loading = false; } }