Пример #1
0
        void exportJobLogMenuItem_Click(object sender, RoutedEventArgs e)
        {
            object selectedItem = this.SyncHistoryListBox.SelectedItem;

            if (selectedItem != null)
            {
                string      jobId       = this.syncRecordDict[(ListBoxItem)selectedItem];
                SyncSetting syncSetting = SyncRecord.LoadSyncSettingByJobId(jobId);
                if (syncSetting != null)
                {
                    System.Windows.Forms.SaveFileDialog dlg = new System.Windows.Forms.SaveFileDialog();
                    dlg.Title  = "选择保存文件";
                    dlg.Filter = "Log (*.log)|*.log";

                    System.Windows.Forms.DialogResult dr = dlg.ShowDialog();
                    if (dr.Equals(System.Windows.Forms.DialogResult.OK))
                    {
                        string logSaveFilePath = dlg.FileName;
                        LogExporter.exportLog(
                            Path.Combine(this.myAppPath, "logs", jobId, "success.log"),
                            Path.Combine(this.myAppPath, "logs", jobId, "error.log"),
                            Path.Combine(this.myAppPath, "logs", jobId, "skipped.log"),
                            Path.Combine(this.myAppPath, "logs", jobId, "exists.log"),
                            Path.Combine(this.myAppPath, "logs", jobId, "not_overwrite.log"),
                            Path.Combine(this.myAppPath, "logs", jobId, "overwrite.log"),
                            logSaveFilePath);
                    }
                }
            }
        }
        public void ExportLog(LogExporter exporter, ParsedLog parsedLog)
        {
            log.In(exporter);

            exporter.Export(currentProject, parsedLog);

            log.Out();
        }
Пример #3
0
        private void lvCopyCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            var logEntry = lstLog.SelectedItem as LogEntryViewModel;

            if (logEntry != null)
            {
                Clipboard.SetText(LogExporter.Format(logEntry));
            }
        }
Пример #4
0
 private void btnExport_Click(object sender, RoutedEventArgs e)
 {
     Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
     dlg.DefaultExt = ".zip";
     dlg.Filter     = "Log and configuration archive (.zip)|*.zip";
     if (dlg.ShowDialog() == true)
     {
         LogExporter.Export(dlg.FileName);
         MessageBox.Show(String.Format("Exported logs and configuration data to {0}", dlg.FileName), "Export", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }
        public void ExportLog(LogExporter exporter)
        {
            log.In(exporter);

            ParsedLog parsedLog
                = reader.ReadLines(currentProject.SearchCriteria,
                                   currentProject.PatternDefinition.ColumnDefinitionList,
                                   currentProject.HighlightDefinitionList,
                                   0, int.MaxValue);

            ExportLog(exporter, parsedLog);

            log.Out();
        }
Пример #6
0
        /// <summary>
        /// Export logs to the disk
        /// </summary>
        /// <param name="path">The path where logs should be stored</param>
        /// <param name="logType">The type of logs that should be saved. Can be null if all logs should be saved</param>
        /// <param name="exportType">The type of export that should be performed</param>
        internal void Export(string path, LogType?logType, ExportType exportType)
        {
            if (_logList.Count == 0)
            {
                return;
            }
            List <Log> exportList;

            if (logType != null)
            {
                exportList = new List <Log>();
                foreach (Log l in _logList)
                {
                    if (l.LogType == logType)
                    {
                        exportList.Add(l);
                    }
                }
            }
            else
            {
                exportList = _logList;
            }

            if (exportList == null || exportList.Count == 0)
            {
                throw new ArgumentNullException();
            }

            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (exportType)
            {
            case ExportType.Html:
                LogExporter.ExportHtml(path, exportList);
                break;

            default:
                LogExporter.ExportTxt(path, exportList);
                break;

            case ExportType.Csv:
                LogExporter.ExportCsv(path, exportList);
                break;

            case ExportType.Excel:
                LogExporter.ExportExcel(path, exportList);
                break;
            }
        }
Пример #7
0
        private void ExportLog_EventHandler(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.SaveFileDialog dlg = new System.Windows.Forms.SaveFileDialog();
            dlg.Title  = "选择保存文件";
            dlg.Filter = "Log (*.log)|*.log";

            System.Windows.Forms.DialogResult dr = dlg.ShowDialog();
            if (dr.Equals(System.Windows.Forms.DialogResult.OK))
            {
                string logFilePath = dlg.FileName;
                LogExporter.exportLog(this.fileUploadSuccessLogPath,
                                      this.fileUploadErrorLogPath,
                                      this.fileSkippedLogPath,
                                      this.fileExistsLogPath,
                                      this.fileNotOverwriteLogPath,
                                      this.fileOverwriteLogPath, logFilePath);
            }
        }
Пример #8
0
        private void ExportLogEntries_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            bool?result = saveDialog.ShowDialog();

            if (!result.Value)
            {
                return;
            }

            var exporter = new LogExporter();
            CollectionViewSource viewSource = GetCollectionViewSource();

            if (viewSource.View != null)
            {
                var entries = from entry in viewSource.View.Cast <LogEntryViewModel>()
                              select(LogEntry) entry;
                exporter.Save(saveDialog.OpenFile(), entries);
            }
        }
Пример #9
0
    private void RunNextTest()
    {
        log("Test Started running!");

        if (_testQueue.Count > 0)
        {
            TestData nextTest = _testQueue[0];
            StartCoroutine(runTest(nextTest));
            _testQueue.Remove(nextTest);

            _testRunningText.text = "<color=orange>Test Running - " + (_totalTests - _testQueue.Count) + " / " + _totalTests + "</color>";
            log(_testQueue.Count + " more tests in queue", "yellow");
        }
        else
        {
            LogExporter.ExportTestDataToExcel(_testResults);
            _testRunningText.text = "<color=green> Done testing!</color>";
            log("All tests are done!");
        }
    }
Пример #10
0
 private void btnSaveLog_Click(object sender, RoutedEventArgs e)
 {
     LogExporter.ExportWithFileChooser();
 }
Пример #11
0
        public GameUI(Game game) : base(game)
        {
            orbis       = (Orbis)game;
            logger      = Logger.GetInstance();
            logExporter = new LogExporter();

            play  = new SpriteDefinition(_contentManager.GetTexture("UI/Button_Play"), new Rectangle(0, 0, 96, 64));
            pause = new SpriteDefinition(_contentManager.GetTexture("UI/Button_Pause"), new Rectangle(0, 0, 96, 64));

            AddChild(playButton = new Button(this, play)
            {
                AnchorPosition   = AnchorPosition.TopRight,
                RelativePosition = new Point(-(RIGHT_UI_WIDTH - 96) / 2 - 96, -10),
                Size             = new Point(96, 64),
                LayerDepth       = 0,
                Focused          = true
            });

            AddChild(nextButton = new Button(this, new SpriteDefinition(_contentManager.GetTexture("UI/Button_Next"), new Rectangle(0, 0, 70, 64)))
            {
                AnchorPosition   = AnchorPosition.TopRight,
                RelativePosition = new Point(-(RIGHT_UI_WIDTH - playButton.Size.X) / 2, -10),
                Size             = new Point(70, 64),
                LayerDepth       = 0,
                Focused          = true
            });

            AddChild(exportButton = new Button(this, new SpriteDefinition(_contentManager.GetTexture("UI/Button_Export"), new Rectangle(0, 0, 70, 64)))
            {
                AnchorPosition   = AnchorPosition.TopRight,
                RelativePosition = new Point(-(RIGHT_UI_WIDTH - playButton.Size.X) / 2 - playButton.Size.X - 70, -10),
                Size             = new Point(70, 64),
                LayerDepth       = 0,
                Focused          = true
            });

            playButton.Click   += PlayButton_Click;
            nextButton.Click   += NextButton_Click;
            exportButton.Click += ExportButton_Click;

            // Progress bar
            AddChild(progressBar = new ProgressBar(this)
            {
                AnchorPosition   = AnchorPosition.BottomLeft,
                RelativePosition = new Point(20, -70),
                Size             = new Point(_game.Window.ClientBounds.Width - RIGHT_UI_WIDTH - 40, 50),
                LayerDepth       = 0
            });

            // Background for progressbar
            AddChild(backgroundProgressBar = new RelativeTexture(this, new SpriteDefinition(_contentManager.GetColorTexture(UI_COLOR), new Rectangle(0, 0, 1, 1)))
            {
                Size             = new Point(_game.Window.ClientBounds.Width - RIGHT_UI_WIDTH, BOTTOM_UI_HEIGHT),
                AnchorPosition   = AnchorPosition.BottomLeft,
                RelativePosition = new Point(0, -BOTTOM_UI_HEIGHT),
                LayerDepth       = 1
            });

            // Background for UI
            AddChild(background = new RelativeTexture(this, new SpriteDefinition(_contentManager.GetColorTexture(UI_COLOR), new Rectangle(0, 0, 1, 1)))
            {
                Size             = new Point(RIGHT_UI_WIDTH, _game.Window.ClientBounds.Height),
                AnchorPosition   = AnchorPosition.TopRight,
                RelativePosition = new Point(-RIGHT_UI_WIDTH, 0),
                LayerDepth       = 1
            });

            // Background for UI
            AddChild(cellInfoBackground = new RelativeTexture(this, new SpriteDefinition(_contentManager.GetColorTexture(UI_COLOR), new Rectangle(0, 0, 1, 1)))
            {
                Size             = new Point(RIGHT_UI_WIDTH, 300),
                AnchorPosition   = AnchorPosition.BottomRight,
                RelativePosition = new Point(-RIGHT_UI_WIDTH * 2 - 10, -BOTTOM_UI_HEIGHT - 310),
                LayerDepth       = 0.0000001f,
                Visible          = false
            });

            AddChild(text = new RelativeText(this, _contentManager.GetFont("DebugFont"))
            {
                Text             = "",
                AnchorPosition   = AnchorPosition.BottomRight,
                RelativePosition = new Point(-RIGHT_UI_WIDTH * 2, -BOTTOM_UI_HEIGHT - 300),
                LayerDepth       = 0,
                Visible          = false
            });

            // Scene panel
            var sceneSize = new Point(_game.Window.ClientBounds.Width - RIGHT_UI_WIDTH, _game.Window.ClientBounds.Height - BOTTOM_UI_HEIGHT);

            AddChild(scene = new RelativeTexture(this, new SpriteDefinition(
                                                     new RenderTarget2D(orbis.GraphicsDevice, sceneSize.X, sceneSize.Y),
                                                     new Rectangle(0, 0, sceneSize.X, sceneSize.Y)))
            {
                Size             = sceneSize,
                AnchorPosition   = AnchorPosition.TopRight,
                RelativePosition = new Point(0, 0),
                LayerDepth       = 0.5f
            });
            // Scene panel itself is invisible, we just use it for size and texture storage
            scene.Visible = false;

            AddChild(civPanel = new CivPanel(this, orbis.Scene.Civilizations)
            {
                AnchorPosition   = AnchorPosition.TopRight,
                RelativePosition = new Point(-RIGHT_UI_WIDTH, 64),
                Size             = new Point(RIGHT_UI_WIDTH, game.Window.ClientBounds.Height - 64),
                LayerDepth       = 0.99F
            });

            screenResized = true;
        }