コード例 #1
0
        public static void SaveProject <T>(ISavable <T> view, bool dialog = false)
        {
            if (dialog)
            {
                Directory.CreateDirectory(view.DefaultSaveFolder);
            }
            string path = dialog ? IOHelper.SaveProjectDialog(view.DefaultSaveFolder) : view.AutoSavePath;

            // If the file name is not an empty string open it for saving.
            if (path == "")
            {
                return;
            }
            try {
                SaveJson(path, view.GetSaveData());
            } catch (Exception ex) {
                Console.WriteLine(ex.StackTrace);
                Console.WriteLine(ex.Message);

                MessageBox.Show("Project could not be saved!");
            }
        }