Пример #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
 void destroy()
 {
     BRenderDevice.destroyDevice();
 }
Пример #3
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();
        }
Пример #4
0
        public static void Main(string[] args)
        {
            Xceed.Zip.Licenser.LicenseKey = "ZIN23-BUSZZ-NND31-7WBA";

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("======Networked AO Gen client V" + cVersion + "=========");
            Console.ForegroundColor = ConsoleColor.White;



            if (!networkAOInterface.networkAccessAvailable())
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR : access to esfile\\phoenix not available");
                Console.ForegroundColor = ConsoleColor.White;
                return;
            }


            TerrainGlobals.mGameDir = computeGameDir();


            //create D3D as a static function
            PictureBox dumControl = new PictureBox();

            if (!BRenderDevice.createDevice(/*this*/ dumControl, 512, 512, false))
            {
                return;
            }

            TerrainGlobals.getLODVB().init();


            Console.WriteLine("Polling for work");

            //CLM General TRY-CATCH block here to grab anything else I've missed
            try
            {
                while (mStayAlive)
                {
                    pollManagerForAvailableJobs();
                    Thread.Sleep(1000);
                }
            }catch (Exception e)
            {
                //we've died somewhere. Write a crashlog with the exception and time.
                if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "crashlogs"))
                {
                    Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "crashlogs");
                }

                string       errorLogName = AppDomain.CurrentDomain.BaseDirectory + "crashlogs\\" + Guid.NewGuid().ToString() + ".txt";
                StreamWriter w            = new StreamWriter(errorLogName, true);
                w.WriteLine(DateTime.Now.ToString());
                w.WriteLine(e.ToString());
                w.Close();

                //send an e-mail to COLT MCANLIS
                sendCrashEmail(errorLogName);

                //now, respawn our app
                Process proc = new Process();
                proc.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + "DistributedLightingClient.exe";
                proc.Start();

                // proc.WaitForExit(60000);
            }

            //another try block here, incase we can't shutdown..
            try
            {
                TerrainGlobals.getLODVB().destroy();
                BRenderDevice.destroyDevice();
            }catch (Exception e)
            {
            }
        }