示例#1
0
 public void BackupTrack(bool Crash = true)
 {
     try
     {
         if (_track.Lines.Count == 0)
         {
             return;
         }
         var saveindex  = 0;
         var trackfiles =
             TrackLoader.EnumerateTRKFiles(Program.CurrentDirectory + "Tracks" + Path.DirectorySeparatorChar +
                                           _track.Name);
         for (var i = 0; i < trackfiles.Length; i++)
         {
             var s = Path.GetFileNameWithoutExtension(trackfiles[i]);
             s = s.Remove(s.IndexOf(' '));
             if (int.TryParse(s, out saveindex))
             {
                 break;
             }
         }
         saveindex++;
         if (saveindex < 2 && !Crash)
         {
             return;
         }
         var save = Crash ? (saveindex + " " + "Crash Backup") : " Autosave";
         game.Loading = true;
         EnterTrackRead();
         {
             TrackLoader.SaveTrackTrk(_track, save, game.CurrentSong?.ToString());
         }
         ExitTrackRead();
         game.Loading = false;
         game.Invalidate();
     }
     catch
     {
         //ignored
     }
 }
示例#2
0
 internal void Save(string savename, Audio.Song song)
 {
     TrackLoader.SaveTrackTrk(_track, savename, song.ToString());
 }