private void SaveTilesButton_Click(object sender, EventArgs e)
        {
            SaveProperties();
            if (string.IsNullOrEmpty(savePath) || changedCopyTexturesSetting)
            {
                bool saveTexturesToFolder = copyTexturesCheckbox.Checked;

                if (saveTexturesToFolder)
                {
                    BetterFolderBrowser fb = new BetterFolderBrowser();
                    fb.Title       = "Browse for tileset save location";
                    fb.RootFolder  = "C:\\";
                    fb.Multiselect = false;

                    if (fb.ShowDialog(this) == DialogResult.OK)
                    {
                        tiles.copyTextures = true;
                        savePath           = fb.SelectedPath;
                        TilesSaver.SaveTilesAndTextures(fb.SelectedPath, tiles);
                        tilesUnsavedChanges.Visible = false;
                    }
                }
                else
                {
                    SaveFileDialog sfd = new SaveFileDialog();
                    sfd.Title      = "Save Tileset";
                    sfd.Filter     = "Tileset Files|*.xml|All files|*.*";
                    sfd.DefaultExt = "xml";
                    DialogResult result = sfd.ShowDialog();

                    if (result == DialogResult.OK)
                    {
                        tiles.copyTextures = false;
                        tiles.SaveTiles(sfd.FileName);
                        savePath = sfd.FileName;
                        tilesUnsavedChanges.Visible = false;
                    }
                }
            }
            else
            {
                if (!copyTexturesCheckbox.Checked)
                {
                    tiles.SaveTiles(savePath);
                    tilesUnsavedChanges.Visible = false;
                }
                else
                {
                    tiles.copyTextures = true;
                    TilesSaver.SaveTilesAndTextures(savePath, tiles);
                    tilesUnsavedChanges.Visible = false;
                }
            }
        }
Exemple #2
0
 private void Menu_Load(object sender, EventArgs e)
 {
     TilesSaver.Init();
 }