コード例 #1
0
        public static void CreateAutosave(Track track)
        {
            var dir = GetTrackDirectory(track);

            if (track.Name.Equals("*") || track.Name.Equals("<untitled>"))
            {
                dir = Utils.Constants.TracksDirectory + "Unnamed Track" + Path.DirectorySeparatorChar;
            }
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            String autosaveString = ("autosave_" + DateTime.Now.Month + "." + DateTime.Now.Day + "." + DateTime.Now.Year + "_" + DateTime.Now.Hour + "." + DateTime.Now.Minute);

            switch (Settings.DefaultAutosaveFormat)
            {
            case ".trk":
                TRKWriter.SaveTrack(track, autosaveString);
                break;

            case ".json":
                JSONWriter.SaveTrack(track, autosaveString);
                break;

            case ".sol":
                SOLWriter.SaveTrack(track, autosaveString);
                break;
            }
        }
コード例 #2
0
        public static string SaveTrackToJsonFile(Track track, string savename)
        {
            int saveindex = GetSaveIndex(track);
            var filename  = JSONWriter.SaveTrack(track, saveindex + " " + savename);

            track.Filename = filename;
            return(filename);
        }