Example #1
0
        /// <summary>
        /// Exports the selected files for the selected platforms
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mExportButton_Click(object sender, EventArgs e)
        {
            mExporter = new ImporterExporter();

            ArrayList list = new ArrayList();
            foreach (object obj in mFilesListBox.CheckedItems)
                list.Add(obj);

            // The Progress Window kicks off a thread that will individually process
            // each of our items.
            ProgressWindow progressWindow = new ProgressWindow();
            progressWindow.ObjectList = list;
            progressWindow.ProcessObjectDelegate = new ProgressWindow.ObjectDelegate(ProcessFileExport);

            progressWindow.OnProgressComplete += new ProgressWindow.ProgressDelegate(progressWindow_OnProgressComplete);

            DialogResult result = progressWindow.ShowDialog();

            this.Close();
        }
Example #2
0
        /// <summary>
        /// Exports the selected files for the selected platforms
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mExportButton_Click(object sender, EventArgs e)
        {
            mExporter = new ImporterExporter();

            ArrayList list = new ArrayList();

            foreach (object obj in mFilesListBox.CheckedItems)
            {
                list.Add(obj);
            }

            // The Progress Window kicks off a thread that will individually process
            // each of our items.
            ProgressWindow progressWindow = new ProgressWindow();

            progressWindow.ObjectList            = list;
            progressWindow.ProcessObjectDelegate = new ProgressWindow.ObjectDelegate(ProcessFileExport);

            progressWindow.OnProgressComplete += new ProgressWindow.ProgressDelegate(progressWindow_OnProgressComplete);

            DialogResult result = progressWindow.ShowDialog();

            this.Close();
        }
 public void SetUp()
 {
     importerExporter = new ImporterExporter();
     importerExporter.MakeMap = delegate(byte[] data) { return MockRepository.GenerateStub<IMap>(); };
     importerExporter.JsonMapParser = MockRepository.GenerateStub<IJsonMapParser>();
 }
Example #4
0
        /// <summary>
        /// Processes the command line
        /// </summary>
        /// <param name="args"></param>
        private static void ProcessCommandLine(CommandLineArgs commandLineArgs)
        {
            // Perform some validation
            if (commandLineArgs.mExport)
            {
                Otter.Interface.Graphics.Instance = new Otter.Interface.Graphics(0);
                int renderContext = Otter.Interface.Graphics.Instance.CreateContext(0, 10, 10);

                ImporterExporter exporter = new ImporterExporter();

                // We need a valid project specified
                if (!System.IO.File.Exists(commandLineArgs.mProject))
                {
                    System.Console.WriteLine("Invalid or no project specified.");
                    Otter.Interface.Graphics.Instance.DestroyContext(renderContext);
                    return;
                }

                // Open the project
                GUIProject.CurrentProject = GUIProject.Load(commandLineArgs.mProject);

                // We need a valid platform specified
                Platform targetPlatform = null;
                foreach (Platform platform in GUIProject.CurrentProject.Platforms)
                {
                    if (platform.Name == commandLineArgs.mPlatform)
                    {
                        targetPlatform = platform;
                        break;
                    }
                }

                if (targetPlatform == null)
                {
                    System.Console.WriteLine("Invalid or no platform specified");
                    Otter.Interface.Graphics.Instance.DestroyContext(renderContext);
                    return;
                }

                // See if we have an output directory override
                string outputDir = targetPlatform.OutputDirectory;
                if (commandLineArgs.mOutputDir != "")
                {
                    outputDir = commandLineArgs.mOutputDir;
                    targetPlatform.OutputDirectory = outputDir;
                }

                // Determine the output directory.  If it's not rooted, we need to construct
                // the rooted path
                string projectDir = System.IO.Path.GetDirectoryName(commandLineArgs.mProject);
                if (!System.IO.Path.IsPathRooted(outputDir))
                {
                    outputDir = projectDir + "\\" + outputDir;
                }

                // Create the output directory and verify that it exists
                System.IO.Directory.CreateDirectory(outputDir);
                if (!System.IO.Directory.Exists(outputDir))
                {
                    System.Console.WriteLine("Invalid output directory for platform " + targetPlatform.Name + " : " + outputDir);
                    Otter.Interface.Graphics.Instance.DestroyContext(renderContext);
                    return;
                }

                ArrayList       itemsToExport = ImporterExporter.GetItemsToExport(GUIProject.CurrentProject.Entries);
                List <Platform> platforms     = new List <Platform>(new Platform[] { targetPlatform });

                // Finally, export.
                foreach (object item in itemsToExport)
                {
                    System.Console.Write("Exporting.. %s : " + item.ToString());
                    bool bSuccess = exporter.Export(item, platforms);
                    System.Console.WriteLine(bSuccess ? " success" : " FAILED");
                }

                Otter.Interface.Graphics.Instance.DestroyContext(renderContext);
            }
        }
Example #5
0
        /// <summary>
        /// Processes the command line
        /// </summary>
        /// <param name="args"></param>
        private static void ProcessCommandLine(CommandLineArgs commandLineArgs)
        {
            // Perform some validation
            if (commandLineArgs.mExport)
            {
                ImporterExporter exporter = new ImporterExporter();

                // We need a valid project specified
                if (!System.IO.File.Exists(commandLineArgs.mProject))
                {
                    System.Console.WriteLine("Invalid or no project specified.");
                    return;
                }

                // Open the project
                GUIProject.CurrentProject = GUIProject.Load(commandLineArgs.mProject);

                // We need a valid platform specified
                Platform targetPlatform = null;
                foreach (Platform platform in GUIProject.CurrentProject.Platforms)
                {
                    if (platform.Name == commandLineArgs.mPlatform)
                    {
                        targetPlatform = platform;
                        break;
                    }
                }

                if (targetPlatform == null)
                {
                    System.Console.WriteLine("Invalid or no platform specified");
                    return;
                }

                // See if we have an output directory override
                string outputDir = targetPlatform.OutputDirectory;
                if (commandLineArgs.mOutputDir != "")
                {
                    outputDir = commandLineArgs.mOutputDir;
                    targetPlatform.OutputDirectory = outputDir;
                }

                // Determine the output directory.  If it's not rooted, we need to construct
                // the rooted path
                string projectDir = System.IO.Path.GetDirectoryName(commandLineArgs.mProject);
                if (!System.IO.Path.IsPathRooted(outputDir))
                    outputDir = projectDir + "\\" + outputDir;

                // Create the output directory and verify that it exists
                System.IO.Directory.CreateDirectory(outputDir);
                if (!System.IO.Directory.Exists(outputDir))
                {
                    System.Console.WriteLine("Invalid output directory for platform " + targetPlatform.Name + " : " + outputDir);
                    return;
                }

                ArrayList itemsToExport = ImporterExporter.GetItemsToExport(GUIProject.CurrentProject.Entries);
                List<Platform> platforms = new List<Platform>(new Platform[] { targetPlatform });

                // Finally, export.
                foreach (object item in itemsToExport)
                {
                    System.Console.Write("Exporting.. %s : " + item.ToString());
                    bool bSuccess = exporter.Export(item, platforms);
                    System.Console.WriteLine(bSuccess ? " success" : " FAILED");
                }
            }
        }