Exemple #1
0
        private void commitButton_Click(object sender, EventArgs e)
        {
            if (gennedTypes == null)
            {
                gennedTypes = new MapStore();
            }
            //Open world_gen.txt
            openWorldgenFile.ShowDialog();

            //Save it!
            if (openWorldgenFile.FileName == "world_gen.txt") //Having the default name means you've not specified a path
            {
                MessageBox.Show("Cancelled");
            }
            else if (gennedTypes.isEmpty() == true)
            {
                MessageBox.Show("You've not imported any map data!");
            }
            else if (openWorldgenFile.FileName.Substring(openWorldgenFile.FileName.Length - 4, 4) != ".txt")
            {
                string x = openWorldgenFile.FileName.Substring(openWorldgenFile.FileName.Length - 4, 4);
                MessageBox.Show("That doesn't appear to be a text file");
            }
            else
            {
                HeightmapProcessing.CommitToFile(int.Parse(xComboBox.SelectedItem.ToString()), int.Parse(yComboBox.SelectedItem.ToString()), nameTextBox.Text, gennedTypes, openWorldgenFile.FileName);
            }
        }