Ejemplo n.º 1
0
 public static void ExportObjectsWithMegaList(Window window = null)
 {
     try
     {
         GenerationsLib.Core.FolderSelectDialog ofd = new GenerationsLib.Core.FolderSelectDialog();
         ofd.Title = "Select a clean Data Folder";
         if (ofd.ShowDialog() == true)
         {
             string gameConfigPath = System.IO.Path.Combine(ofd.FileName, "Game", "GameConfig.bin");
             if (File.Exists(gameConfigPath))
             {
                 GameConfig     SourceConfig   = new GameConfig(gameConfigPath);
                 SaveFileDialog saveFileDialog = new SaveFileDialog()
                 {
                     Filter = "Exported TXT | *.txt",
                     Title  = "Save Exported Results As..."
                 };
                 if (saveFileDialog.ShowDialog() == DialogResult.OK)
                 {
                     Methods.Entities.ObjectCollection.ExportObjectsFromDataFolderToFile(saveFileDialog.FileName, ofd.FileName, SourceConfig, Methods.Solution.CurrentSolution.CurrentScene.Entities.SceneObjects);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         System.Windows.MessageBox.Show("Unable to export Objects. " + ex.Message);
     }
 }
Ejemplo n.º 2
0
        public static void ImportObjectsWithMegaList(Window window = null)
        {
            try
            {
                GenerationsLib.Core.FolderSelectDialog ofd = new GenerationsLib.Core.FolderSelectDialog();
                ofd.Title = "Select a clean Data Folder";
                if (ofd.ShowDialog() == true)
                {
                    string gameConfigPath = System.IO.Path.Combine(ofd.FileName, "Game", "GameConfig.bin");
                    if (File.Exists(gameConfigPath))
                    {
                        GameConfig SourceConfig   = new GameConfig(gameConfigPath);
                        var        objectImporter = new ObjectImporter(ofd.FileName, SourceConfig, Methods.Solution.CurrentSolution.CurrentScene.Entities.SceneObjects, Methods.Solution.CurrentSolution.StageConfig, Editor);
                        if (window != null)
                        {
                            objectImporter.Owner = window;
                        }
                        objectImporter.ShowDialog();

                        if (objectImporter.DialogResult != true)
                        {
                            return; // nothing to do
                        }
                        // user clicked Import, get to it!
                        Methods.Internal.UserInterface.UpdateControls();
                        Editor.EntitiesToolbar?.RefreshSpawningObjects(Methods.Solution.CurrentSolution.CurrentScene.Entities.SceneObjects);
                        Methods.Internal.UserInterface.SplineControls.UpdateSplineSpawnObjectsList(Methods.Solution.CurrentSolution.CurrentScene.Entities.SceneObjects);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Unable to import Objects. " + ex.Message);
            }
        }
Ejemplo n.º 3
0
 private void button3_Click(object sender, RoutedEventArgs e)
 {
     GenerationsLib.Core.FolderSelectDialog path = new GenerationsLib.Core.FolderSelectDialog();
     path.ShowDialog();
     if (path.FileName != null)
     {
         SceneFolder      = path.FileName;
         LocationBox.Text = SceneFolder;
     }
 }
        public static string SelectDataDirectory()
        {
            using (var folderBrowserDialog = new GenerationsLib.Core.FolderSelectDialog())
            {
                folderBrowserDialog.Title = "Select Data Folder";

                if (!folderBrowserDialog.ShowDialog())
                {
                    return(null);
                }

                return(folderBrowserDialog.FileName);
            }
        }
Ejemplo n.º 5
0
 private void SavedPlacesExport_Click(object sender, RoutedEventArgs e)
 {
     if (Classes.Prefrences.CommonPathsStorage.Collection.SavedPlaces != null && Classes.Prefrences.CommonPathsStorage.Collection.SavedPlaces.Count >= 1)
     {
         string[] output = new string[Classes.Prefrences.CommonPathsStorage.Collection.SavedPlaces.Count];
         Classes.Prefrences.CommonPathsStorage.Collection.SavedPlaces.CopyTo(output, 0);
         GenerationsLib.Core.FolderSelectDialog fsd = new GenerationsLib.Core.FolderSelectDialog();
         fsd.InitialDirectory = Methods.ProgramPaths.SettingsPortableDirectory;
         fsd.Title            = "Select a Place to Save the Output";
         if (fsd.ShowDialog() == true)
         {
             string result = System.IO.Path.Combine(fsd.FileName, "SavedPlacesExport.txt");
             if (!System.IO.File.Exists(result))
             {
                 System.IO.File.Create(result).Close();
             }
             System.IO.File.WriteAllLines(result, output);
         }
     }
 }