예제 #1
0
        //----------------------------
        //----------------------------
        #region AO Section Export
        private void exportAOFileList()
        {
            String batchExportLog = outputLog;

            if (batchExportLog == null)
            {
                batchExportLog = Path.Combine(CoreGlobals.getWorkPaths().mLogsDirectory, "batchExportLog." + System.DateTime.Now.ToFileTimeUtc() + ".txt");
            }
            mExportLogStream = new StreamWriter(batchExportLog, true);


            //export settings
            Export360.ExportSettings settings = null;
            if (mUseCustomExportSettings == -1 || mUseCustomExportSettings == 0)
            {
                settings = null;
            }
            else if (mUseCustomExportSettings == 1)
            {
                settings = new Export360.ExportSettings();
                settings.SettingsQuick();
            }
            else if (mUseCustomExportSettings == 2)
            {
                settings = new Export360.ExportSettings();
                settings.SettingsFinal();
            }


            bool createOwnDevice = BRenderDevice.getDevice() == null;

            if (createOwnDevice)
            {
                BRenderDevice.createDevice(this, 640, 480, false);
            }

            GrannyManager2.init();

            for (int fileCount = 0; fileCount < mScenarioFilesToExport.Count; fileCount++)// (string file in ToExportListBox.SelectedItems)
            {
                string scenarioName = mScenarioFilesToExport[fileCount].mFilename;
                string terrainName  = mTerrainFilesToExport[mScenarioFilesToExport[fileCount].mTerrainFileIndex].mFilename;

                bool okExported = TEDIO.TEDtoAOSection(terrainName, scenarioName, outputDir, mAoNumSections, mAoSectionIndex, settings);
            }

            if (createOwnDevice)
            {
                BRenderDevice.destroyDevice();
            }

            mExportLogStream.Close();

            if (mStatusResult == 0)
            {
                File.Delete(batchExportLog);
            }

            clearList();
        }
예제 #2
0
        //----------------------------
        private void exportFileList()
        {
            String batchExportLog = outputLog;

            if (batchExportLog == null)
            {
                batchExportLog = Path.Combine(CoreGlobals.getWorkPaths().mLogsDirectory, "batchExportLog." + System.DateTime.Now.ToFileTimeUtc() + ".txt");
            }
            mExportLogStream = new StreamWriter(batchExportLog, true);
            listBox1.Items.Clear();


            DateTime start = DateTime.Now;

            SimTerrainType.loadTerrainTypes();


            Exportbutton.Enabled = false;
            progressBar1.Value   = 0;
            progressBar1.Maximum = mScenarioFilesToExport.Count;// ToExportListBox.SelectedItems.Count;



            //export settings
            Export360.ExportSettings settings = null;
            if (mUseCustomExportSettings == -1)
            {
                settings = null;
            }
            else if (mUseCustomExportSettings == 0)
            {
                ExportDialog mExportDialog = new ExportDialog();
                mExportDialog.mExportSettings = new Export360.ExportSettings();
                mExportDialog.mExportSettings.SettingsQuick();
                mExportDialog.mIsQuickExport = true;
                if (mExportDialog.ShowDialog() == DialogResult.OK)
                {
                    settings = mExportDialog.mExportSettings;
                }
            }
            else if (mUseCustomExportSettings == 1)
            {
                settings = new Export360.ExportSettings();
                settings.SettingsQuick();
            }
            else if (mUseCustomExportSettings == 2)
            {
                settings = new Export360.ExportSettings();
                settings.SettingsFinal();
            }



            bool createOwnDevice = BRenderDevice.getDevice() == null;

            if (createOwnDevice)
            {
                BRenderDevice.createDevice(this, 640, 480, false);
            }

            GrannyManager2.init();

            saveCheckOptions();

            for (int fileCount = 0; fileCount < mScenarioFilesToExport.Count; fileCount++)// (string file in ToExportListBox.SelectedItems)
            {
                string scenarioName = mScenarioFilesToExport[fileCount].mFilename;
                string terrainName  = mTerrainFilesToExport[mScenarioFilesToExport[fileCount].mTerrainFileIndex].mFilename;

                bool terrainAlreadyExported = hasBeenExported(fileCount);

                //if our owner terrain has already been exported, and we're not generating XSD files, bail.
                if (terrainAlreadyExported && !doXSD.Checked)
                {
                    continue;
                }

                bool canEdit = mIgnorePerforce ? true : P4CanEdit(scenarioName, terrainName, mCheckoutFromPerforce);

                if (canEdit)
                {
                    //toggle our check boxes for already exported terrain files
                    doXTD.Checked &= !terrainAlreadyExported;
                    doXTT.Checked &= !terrainAlreadyExported;
                    doXTH.Checked &= !terrainAlreadyExported;

                    bool okExported = TEDIO.TEDto360(terrainName, scenarioName,
                                                     outputDir,
                                                     settings,
                                                     doXTD.Checked,
                                                     doXTT.Checked,
                                                     doXTH.Checked,
                                                     doXSD.Checked,
                                                     doLRP.Checked,
                                                     doDEP.Checked,
                                                     doTAG.Checked,
                                                     doXMB.Checked);



                    if (okExported)
                    {
                        outputMessage(Path.GetFileNameWithoutExtension(scenarioName) + ": EXPORT SUCCEEDED!--------------------");
                    }
                    else
                    {
                        mStatusResult = 2;
                        outputMessage(Path.GetFileNameWithoutExtension(scenarioName) + ": ABORTED! There was a problem exporting the files");
                        P4RevertAllNeededFiles(scenarioName, terrainName);
                    }
                }

                progressBar1.Invoke(updateProgress);
                restoreCheckOptions();
                markScenarioExported(fileCount);
            }



            if (createOwnDevice)
            {
                BRenderDevice.destroyDevice();
            }

            if (!mIgnorePerforce && mCheckinWhenFinished)
            {
                outputMessage("Checking in files");
                P4SubmitChangelist();
            }


            Exportbutton.Enabled = true;

            TimeSpan ts = DateTime.Now - start;

            outputMessage("====Time : " + ts.TotalMinutes + " Minutes");
            outputMessage("====Export Finished====");

            //   GrannyManager2.deinit();

            mExportLogStream.Close();

            if (mStatusResult == 0)
            {
                File.Delete(batchExportLog);
            }

            clearList();
        }