public static void Command_SaveAs() { if (DialogWindowOpen) { return; } DialogWindowOpen = true; SaveFileDialog sfd = new SaveFileDialog(); sfd.AddExtension = true; sfd.Filter = "Level Files (*.lvl)|*.lvl"; sfd.DefaultExt = "lvl"; sfd.ShowDialog(MainWindow.Instance); if (sfd.FileName != "") { SaverLoader sl = new SaverLoader(); sl.SaveAs(sfd.FileName); Global.Unsaved = false; Global.OpenFilePath = sfd.FileName; RecentFilesController.AddFile(sfd.FileName); } DialogWindowOpen = false; }
public static void Command_Open(string filePath = "") { if (DialogWindowOpen) { return; } if (filePath.Length == 0) { DialogWindowOpen = true; OpenFileDialog sfd = new OpenFileDialog(); sfd.ShowDialog(MainWindow.Instance); if (sfd.FileName != "") { filePath = sfd.FileName; RecentFilesController.AddFile(sfd.FileName); } } if (filePath != "") { if (Global.State == States.MapOpen) { Global.Command_Close(); } SaverLoader sl = new SaverLoader(); sl.Load(filePath); Global.OpenFilePath = filePath; RecentFilesController.AddFile(filePath); } Global.Unsaved = false; DialogWindowOpen = false; }
public static void Command_Save() { if (DialogWindowOpen) { return; } DialogWindowOpen = true; if (Global.OpenFilePath != null && Global.OpenFilePath.Length > 0) { SaverLoader sl = new SaverLoader(); sl.SaveAs(Global.OpenFilePath); Global.Unsaved = false; } else { DialogWindowOpen = false; Command_SaveAs(); } DialogWindowOpen = false; }