예제 #1
0
 static Logger()
 {
     Logger.DebugLog          = new MultipleLogger();
     Logger.InfoLog           = new MultipleLogger();
     Logger.WarnLog           = new MultipleLogger();
     Logger.ErrorLog          = new MultipleLogger();
     Logger.FatalLog          = new MultipleLogger();
     Logger.IsEnabledDebugLog = Logger.GetBoolValueFromWebConfig("Mslc.Common.Logger.Trace.IsEnabled");
     if (Logger.GetBoolValueFromWebConfig("Mslc.Common.Logger.File.IsEnabled"))
     {
         Logger.DebugLog.AddLogger(LogManager.GetLogger("DebugFileLogger"));
         Logger.InfoLog.AddLogger(LogManager.GetLogger("InfoFileLogger"));
         Logger.WarnLog.AddLogger(LogManager.GetLogger("WarnFileLogger"));
         Logger.ErrorLog.AddLogger(LogManager.GetLogger("ErrorFileLogger"));
         Logger.FatalLog.AddLogger(LogManager.GetLogger("FatalFileLogger"));
     }
     if (Logger.GetBoolValueFromWebConfig("Mslc.Common.Logger.Db.IsEnabled"))
     {
         Logger.DebugLog.AddLogger(LogManager.GetLogger("DebugDbLogger"));
         Logger.InfoLog.AddLogger(LogManager.GetLogger("InfoDbLogger"));
         Logger.WarnLog.AddLogger(LogManager.GetLogger("WarnDbLogger"));
         Logger.ErrorLog.AddLogger(LogManager.GetLogger("ErrorDbLogger"));
         Logger.FatalLog.AddLogger(LogManager.GetLogger("FatalDbLogger"));
     }
 }
예제 #2
0
        public static void Run(Logger log, string instanceName, string databaseType, string databaseName, bool dropDatabase, string scriptsLocation, string environmentName, bool useSimpleRecoveryMode)
        {
            _instanceName          = instanceName;
            _databaseType          = databaseType;
            _databaseName          = databaseName;
            _dropDatabase          = dropDatabase;
            _scriptsLocation       = scriptsLocation;
            _environmentName       = environmentName;
            _useSimpleRecoveryMode = useSimpleRecoveryMode;

            var loggers = new List <Logger>();

            loggers.Add(log);
            loggers.Add(new Log4NetLogger(_logger));

            var multiLogger = new MultipleLogger(loggers);
            var config      = GetRoundhousEConfiguration(multiLogger);

            //should be wrapped in his api
            ApplicationConfiguraton.set_defaults_if_properties_are_not_set(config);

            //should be wrapped in his api
            ApplicationConfiguraton.build_the_container(config);

            var runner = GetMigrationRunner(config);

            runner.run();
        }
예제 #3
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            if (lstFrames.SelectedItems.Count > 0)
            {
                List <ILogger> loggers = new List <ILogger>();
                loggers.Add(mainForm.ConsoleLogger);

                ProgressBarWnd wnd = new ProgressBarWnd();
                wnd.Text             = "Exporting frame...";
                wnd.ProgressBarStyle = ProgressBarStyle.Blocks;
                loggers.Add(wnd);

                MultipleLogger logger = new MultipleLogger(loggers);

                HotFrame hotFrame   = lstFrames.SelectedItems[0].Tag as HotFrame;
                var      rootFolder = project.Folder + "\\" + Project.MetadataFolder;
                var      annot      = hotFrame.Timestamp.ToString("HH_mm_ss");

                wnd.Worker.DoWork += delegate(object senderWorker, DoWorkEventArgs eWorker)
                {
                    MatlabExporter.ExportHotFrame(rootFolder, annot, hotFrame, MatlabExporterOptions.Overwrite, logger, wnd.CancelTokenSource.Token);
                };

                wnd.ShowDialog();
            }
        }
예제 #4
0
        private void sampleLiDARToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (TimeLineWnd == null)
            {
                MessageBox.Show("Frame is not selected! Open the TimeLine window and select a frame.", "Frame is not selected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            List <ILogger> loggers = new List <ILogger>();

            loggers.Add(ConsoleLogger);

            MainForm       form = (MainForm)this.MdiParent;
            ProgressBarWnd wnd  = new ProgressBarWnd();

            wnd.Text = "Export LiDAR frames...";
            loggers.Add(wnd);

            MultipleLogger logger = new MultipleLogger(loggers);

            wnd.WriteLine("Export LiDAR frames..");
            toolStripProgressBar.Visible = true;

            DateTime startTime = TimeLineWnd.CurrentTime;

            startTime = new DateTime(startTime.Year, startTime.Month, startTime.Day, startTime.Hour, startTime.Minute, startTime.Second);

            wnd.Worker.DoWork += delegate(object senderWorker, DoWorkEventArgs eWorker)
            {
                try
                {
                    for (int k = 0; k < 100; k++)
                    {
                        wnd.CancelTokenSource.Token.ThrowIfCancellationRequested();
                        DateTime currentTime = startTime.AddSeconds(k);
                        wnd.WriteLine("Time: " + currentTime.ToString("yyyy-MM-hh HH:mm:ss.fff"));
                        this.SampleLiDAR(currentTime, LiDARTransformType.None);
                    }
                }
                catch (OperationCanceledException)
                {
                    logger.WriteLineWarning("User cancelled!");
                    return;
                }
                catch (Exception ex)
                {
                    logger.WriteLineError("Error occured: " + ex.Message);
                }

                logger.WriteLineInfo("done.");
            };

            wnd.Worker.RunWorkerCompleted += delegate(object senderWorker, RunWorkerCompletedEventArgs eWorker)
            {
                toolStripProgressBar.Visible = false;
            };

            wnd.ShowDialog();
        }
예제 #5
0
        /// <summary>
        /// Convert Velodyne data stream into internal format
        /// </summary>
        /// <param name="velodyneDataStream"></param>
        private void ConvertVelodyneDataStream(VelodyneDataStream velodyneDataStream)
        {
            MainForm       form = (MainForm)this.MdiParent;
            ProgressBarWnd wnd  = new ProgressBarWnd();

            wnd.Text = "Conversion: " + velodyneDataStream.ShortName;

            // create multiple logger
            List <ILogger> loggers = new List <ILogger>();

            loggers.Add(Logger);
            loggers.Add(wnd);
            MultipleLogger logger = new MultipleLogger(loggers);


            wnd.Worker.DoWork += delegate(object senderWorker, DoWorkEventArgs eWorker)
            {
                foreach (VelodyneDataLine dataLine in velodyneDataStream.DataLines)
                {
                    VelodyneConverter converter = VelodyneConverter.Create(form.Project.Folder + "\\" + velodyneDataStream.SubFolder + "\\" + dataLine.PcapLocation);

                    converter.ProgressReport += delegate(object senderReport, ProgressReportEventArgs argsReport)
                    {
                        logger.WriteLineInfo(argsReport.CurrentDataTime.ToString("yyy-MM-dd hh:mm:ss") + " " + argsReport.ReadBytes / 1000000 + " MB " + argsReport.Precentage.ToString("0.00") + "%" + Environment.NewLine);
                        logger.WriteProgress(argsReport.Precentage);
                    };

                    try
                    {
                        converter.Convert(wnd.CancelTokenSource.Token);
                    }
                    catch (OperationCanceledException)
                    {
                        // TODO: clean up files!
                    }
                    catch (Exception ex)
                    {
                        logger.WriteLineInfo("Error occured: " + ex.Message);
                    }
                }
            };

            wnd.Worker.RunWorkerCompleted += delegate(object senderWorker, RunWorkerCompletedEventArgs eWorker)
            {
                logger.WriteLineInfo("Conversion done.");
                logger.WriteProgress(100);
            };

            wnd.ShowDialog();
        }
예제 #6
0
        protected IContainer build_the_container()
        {
            IWindsorContainer windsor_container = new WindsorContainer();

            infrastructure.logging.ILog nant_logger = new NAntLogger(this);
            infrastructure.logging.ILog log4net_logger = new Log4NetLogger(the_logger);
            infrastructure.logging.ILog multi_logger = new MultipleLogger(new List<infrastructure.logging.ILog> { nant_logger, log4net_logger });

            windsor_container.Kernel.AddComponentInstance<infrastructure.logging.ILog>(multi_logger);
            windsor_container.AddComponent<IFileSystemAccess, WindowsFileSystemAccess>();
            windsor_container.AddComponent<ILogFactory, MultipleLoggerLogFactory>();

            return new infrastructure.containers.custom.WindsorContainer(windsor_container);
        }
예제 #7
0
        private void extractFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List <ILogger> loggers = new List <ILogger>();

            loggers.Add(ConsoleLogger);

            if (!Directory.Exists(Project.Folder + "\\" + Project.MetadataFolder))
            {
                Directory.CreateDirectory(Project.Folder + "\\" + Project.MetadataFolder);
            }
            var fileLogger = FileLogger.Create(Project.Folder + "\\" + Project.MetadataFolder + "\\metadata.txt", Project.Folder + "\\" + Project.MetadataFolder + "\\warnings.txt");

            loggers.Add(fileLogger);

            MainForm       form = (MainForm)this.MdiParent;
            ProgressBarWnd wnd  = new ProgressBarWnd();

            wnd.Text             = "Loading project...";
            wnd.ProgressBarStyle = ProgressBarStyle.Blocks;
            loggers.Add(wnd);

            MultipleLogger logger = new MultipleLogger(loggers);

            wnd.WriteLine("Start loading project: " + projectFolder);
            toolStripProgressBar.Visible = true;

            wnd.Worker.DoWork += delegate(object senderWorker, DoWorkEventArgs eWorker)
            {
                try
                {
                    MetadataBuilder.Create(Project, new MultipleLogger(loggers), wnd.CancelTokenSource.Token);
                }
                catch (OperationCanceledException)
                {
                }
                catch (Exception ex)
                {
                    logger.WriteLineError("Error occured: " + ex.Message);
                }
            };

            wnd.Worker.RunWorkerCompleted += delegate(object senderWorker, RunWorkerCompletedEventArgs eWorker)
            {
                toolStripProgressBar.Visible = false;
                fileLogger.Flush();
                fileLogger.Dispose();
            };

            wnd.ShowDialog();
        }
예제 #8
0
        private IContainer build_the_container()
        {
            IWindsorContainer windsor_container = new WindsorContainer();

            infrastructure.logging.ILog nant_logger    = new NAntLogger(this);
            infrastructure.logging.ILog log4net_logger = new Log4NetLogger(the_logger);
            infrastructure.logging.ILog multi_logger   = new MultipleLogger(new List <infrastructure.logging.ILog> {
                nant_logger, log4net_logger
            });

            windsor_container.Kernel.AddComponentInstance <infrastructure.logging.ILog>(multi_logger);
            windsor_container.AddComponent <IFileSystemAccess, WindowsFileSystemAccess>();
            windsor_container.AddComponent <ILogFactory, MultipleLoggerLogFactory>();

            return(new infrastructure.containers.custom.WindsorContainer(windsor_container));
        }
예제 #9
0
        public MainForm()
        {
            Eto.Serialization.Xaml.XamlReader.Load(this);
            Icon = new Icon(this.GetResource("Resources.programm.ico"));

            timetableBackup = new Dictionary <object, Timetable>();

            Settings         = new Settings();
            undo             = new UndoManager();
            registry         = new RegisterStore();
            update           = new UpdateManager(Settings);
            extensionManager = new ExtensionManager(this, update);
            crashReporter    = new CrashReporting.CrashReporter(this);
            fileHandler      = new FileHandler(this, this, this, undo);

            lineEditingControl.Initialize(this);

            var logger = new MultipleLogger(logTextBox);

            if (Settings.Get("log.enable-file", false))
            {
                logger.Loggers.Add(new TempLogger(this));
            }
            if (OptionsParser.MPCompatLog)
            {
                logger.Loggers.Add(new ConsoleLogger());
            }
            Logger = logger;

            KeyDown += (s, e) =>
            {
                if (e.Key == Keys.R || e.Key == Keys.Escape)
                {
                    lineEditingControl.DispatchKeystroke(e);
                }
            };

            fileHandler.FileStateChanged += FileHandler_FileStateChanged;
            fileHandler.FileOpened       += FileHandler_FileOpened;

            Init();
        }
예제 #10
0
        private void updateFileTimesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List <ILogger> loggers = new List <ILogger>();

            loggers.Add(ConsoleLogger);

            MainForm       form = (MainForm)this.MdiParent;
            ProgressBarWnd wnd  = new ProgressBarWnd();

            wnd.Text = "Updating file times...";
            loggers.Add(wnd);

            MultipleLogger logger = new MultipleLogger(loggers);

            wnd.WriteLine("Start updating file times: " + projectFolder);
            toolStripProgressBar.Visible = true;

            wnd.Worker.DoWork += delegate(object senderWorker, DoWorkEventArgs eWorker)
            {
                try
                {
                    int k = 0;
                    foreach (DataStream stream in Project.DataStreams)
                    {
                        wnd.CancelTokenSource.Token.ThrowIfCancellationRequested();

                        logger.WriteProgress((++k / (double)Project.DataStreams.Count()) * 100.0);
                        if (stream is ImageDataStream)
                        {
                            logger.WriteLineInfo("Image data stream: " + stream.ShortName);
                            ImageDataStream imageDataStream = stream as ImageDataStream;
                            imageDataStream.UpdateFileTimes();
                        }

                        if (stream is VideoDataStream)
                        {
                            logger.WriteLineInfo("Image data stream: " + stream.ShortName);
                            VideoDataStream videoDataStream = stream as VideoDataStream;
                            videoDataStream.UpdateFileTimes();
                        }
                    }
                }
                catch (OperationCanceledException)
                {
                    logger.WriteLineWarning("User cancelled!");
                    return;
                }
                catch (Exception ex)
                {
                    logger.WriteLineError("Error occured: " + ex.Message);
                }

                logger.WriteLineInfo("done.");
            };

            wnd.Worker.RunWorkerCompleted += delegate(object senderWorker, RunWorkerCompletedEventArgs eWorker)
            {
                toolStripProgressBar.Visible = false;
            };

            wnd.ShowDialog();
        }
예제 #11
0
        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fdb    = new FolderBrowserDialog();
            DialogResult        result = fdb.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }

            projectFolder = fdb.SelectedPath;

            MainForm       form = (MainForm)this.MdiParent;
            ProgressBarWnd wnd  = new ProgressBarWnd();

            wnd.Text             = "Loading project...";
            wnd.ProgressBarStyle = ProgressBarStyle.Marquee;

            // create multiple logger
            List <ILogger> loggers = new List <ILogger>();

            loggers.Add(ConsoleLogger);
            loggers.Add(wnd);
            MultipleLogger logger = new MultipleLogger(loggers);

            logger.WriteLineInfo("Start loading project: " + projectFolder);

            wnd.Worker.DoWork += delegate(object senderWorker, DoWorkEventArgs eWorker)
            {
                try
                {
                    Project = Project.Load(projectFolder, logger);
                }
                catch (OperationCanceledException)
                {
                    logger.WriteLineInfo("Cancelled!");
                    eWorker.Cancel = true;
                }
                catch (Exception ex)
                {
                    logger.WriteLineInfo("Error occured: " + ex.Message);
                    eWorker.Cancel = true;
                }
            };

            wnd.Worker.RunWorkerCompleted += delegate(object senderWorker, RunWorkerCompletedEventArgs eWorker)
            {
                if (!eWorker.Cancelled)
                {
                    logger.WriteLineInfo("Project has been loaded!");
                    logger.WriteLineInfo("Project folder: " + this.Project.Folder);
                    logger.WriteLineInfo("No. of data streams: " + this.Project.DataStreams.Count());
                    MetadataBuilder.PrintSummary(this.Project, ConsoleLogger);
                    if (DataStreamWnd != null)
                    {
                        DataStreamWnd.UpdateUI();
                    }
                    form?.ReportProgress(100);
                    wnd.WriteProgress(100);
                    wnd.Close();
                }
            };

            wnd.ShowDialog();
        }
예제 #12
0
파일: Program.cs 프로젝트: FPLedit/FPLedit
        private static (LastFileHandler, Bootstrapper) InitializeMainComponents()
        {
            var lfh = new LastFileHandler();

            // Bootstrap the first main components
            var bootstrapper = new Bootstrapper(lfh);

            // Initialize CrashReporter, so it can be used early
            crashReporter = new CrashReporter(bootstrapper);

            // Wire up missin pieces in file handling
            lfh.Initialize(bootstrapper);

            // Initailize some loosely coupled UI components, so that extensions can use them
            EtoExtensions.Initialize(bootstrapper);                                   // Initialize Eto extensions
            FontCollection.InitAsync();                                               // Load list of available fonts, async, as this should not be needed by any extension.
#pragma warning disable CA2000
            TemplateDebugger.GetInstance().AttachDebugger(new GuiTemplateDebugger()); // Attach javascript debugger form
#pragma warning restore CA2000

            // Reset default file format versions on first run.
            var lastRunVersion = bootstrapper.FullSettings.Get <string>("updater.lastrun-version");
            if (!string.IsNullOrEmpty(lastRunVersion) && lastRunVersion != VersionInformation.Current.DisplayVersion)
            {
                bootstrapper.FullSettings.SetEnum("core.default-network-file-format", Timetable.PRESET_NETWORK_VERSION);
                bootstrapper.FullSettings.SetEnum("core.default-file-format", Timetable.PRESET_LINEAR_VERSION);
                bootstrapper.PreBootstrapWarnings.Add(T._("Die Standard-Dateiformatversionen wurden zurückgesetzt, da Sie die Version von FPLedit aktualisiert haben. Diese Einstellung kann unter Einstellungen > Dateiversionen geändert werden."));
            }
            bootstrapper.FullSettings.Set("updater.lastrun-version", VersionInformation.Current.DisplayVersion);

            // Load default versions for new timetable files from config.
            var linearDefaultVersion = bootstrapper.FullSettings.GetEnum("core.default-file-format", Timetable.DefaultLinearVersion);
            var linCompat            = linearDefaultVersion.GetVersionCompat();
            if (linCompat.Compatibility == TtVersionCompatType.ReadWrite && linCompat.Type == TimetableType.Linear)
            {
                Timetable.DefaultLinearVersion = linearDefaultVersion;
            }
            else
            {
                bootstrapper.PreBootstrapWarnings.Add(T._("Gewählte lineare Standardversion ist nicht R/W-kompatibel!"));
            }

            var networkDefaultVersion = bootstrapper.FullSettings.GetEnum("core.default-network-file-format", Timetable.DefaultNetworkVersion);
            var netCompat             = networkDefaultVersion.GetVersionCompat();
            if (netCompat.Compatibility == TtVersionCompatType.ReadWrite && netCompat.Type == TimetableType.Network)
            {
                Timetable.DefaultNetworkVersion = networkDefaultVersion;
            }
            else
            {
                bootstrapper.PreBootstrapWarnings.Add(T._("Gewählte Netzwerk-Standardversion ist nicht R/W-kompatibel!"));
            }

            // Load logger before extensions
            var logger = new MultipleLogger();
            if (bootstrapper.FullSettings.Get("log.enable-file", false))
            {
                logger.AttachLogger(new TempLogger(bootstrapper));
            }
            if (OptionsParser.ConsoleLog)
            {
                logger.AttachLogger(new ConsoleLogger());
            }
            bootstrapper.InjectLogger(logger);

            // Output some version stats
            bootstrapper.Logger.Debug("Current version: " + VersionInformation.Current.DisplayVersion);
            bootstrapper.Logger.Debug("Runtime version: " + VersionInformation.Current.RuntimeVersion);
            bootstrapper.Logger.Debug("OS version: " + VersionInformation.Current.OsVersion);

            // Init feature flags
            FeatureFlags.Initialize(((IReducedPluginInterface)bootstrapper).Settings);

            var restartable = new RestartHandler(bootstrapper);

            // Add default plugins
            bootstrapper.ExtensionManager.InjectPlugin(new CorePlugins.MenuPlugin(), 0);
            bootstrapper.ExtensionManager.InjectPlugin(new Editor.EditorPlugin(), 0);
            bootstrapper.ExtensionManager.InjectPlugin(new CorePlugins.DefaultPlugin(restartable, bootstrapper), 0);

            return(lfh, bootstrapper);
        }