public void SaveSetData(bool saveAs = false)
        {
            // Opens the Save dialog if saveAs is true or there is no path for setData
            if (string.IsNullOrEmpty(LoadedFilePath) || saveAs)
            {
                var sfd = new SaveFileDialog()
                {
                    Title  = "Save SetData",
                    Filter = $"{GameName} SetData|*.orc|Sonic Generations SetData|*.set.xml|XML|*.xml"
                };
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    LoadedFilePath = sfd.FileName;
                    saveAs         = false;
                }
            }
            if (!string.IsNullOrEmpty(LoadedFilePath) && !saveAs)
            {
                Console.WriteLine("Saving SetData File: {0}", LoadedFilePath);
                if (LoadedFilePath.ToLower().EndsWith(".orc"))
                {
                    SetData.Save(LoadedFilePath, true);
                }
                else if (LoadedFilePath.ToLower().EndsWith(".set.xml"))
                {
                    ColorstoGensSetData = new ColorstoGensSetData();
                    //ColorstoGensSetData.Header = SetData.Header;
                    ColorstoGensSetData.Name    = SetData.Name;
                    ColorstoGensSetData.Objects = SetData.Objects;
                    ColorstoGensSetData.GensExportXML(LoadedFilePath, TemplatesColors, ColorstoGensRenamers, ColorstoGensParamMods, ColorstoGensRotateMods);

                    MessageBox.Show("This feature is currently in development. In order to prevent bugs caused by the program remaining open after an export, the program will now close, but you may open it again immediately without consequence. Thank you for your understanding.");
                    Application.Exit();
                }
                else if (LoadedFilePath.ToLower().EndsWith(".xml"))
                {
                    SetData.ExportXML(LoadedFilePath, TemplatesColors);
                }
                saveToolStripMenuItem.Enabled = true;
                Message("Saved.");
            }
        }
示例#2
0
 public void SaveSetLayer(string path, SetData layer)
 {
     path = FormatCacheDir(path);
     layer.Save(path, true);
 }