Exemple #1
0
        public void StartSession(IPluginInterface pluginInterface, string basePath)
        {
            session = Guid.NewGuid().ToString();
            var fn = Path.Combine(basePath, $"fpledit-dump-{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.fpldmp");

            writer = new DumpWriter(fn);

            // Output some messages before starting so that user is informed better (and does not forget to turn it off!)
            pluginInterface.Logger.Warning(T._("Debug Dump ist aktiviert! Dies kann dazu führen, dass große Datenmengen aufgezeichnet werden.\nSession file: {0}\n----------", fn));

            var l = pluginInterface.Logger;

            if (l.CanAttach)
            {
                l.AttachLogger(new DumpLogger(writer));
            }

            AddDumpUiInteraction();
            AddTimetableListener(pluginInterface);

            pluginInterface.ExtensionsLoaded += (s, e) =>
            {
                writer.WriteEvent(DumpEventType.DebugDumpInternal, "Session started", session);
                writer.WriteEvent(DumpEventType.DebugDumpInternal, "Enabled extensions", pluginInterface.Settings.Get("extmgr.enabled", ""));
            };
            pluginInterface.AppClosing += (s, e) => { writer.WriteEvent(DumpEventType.DebugDumpInternal, "Gracefully terminating session", session); };

            var tmpDir = pluginInterface.GetTemp("");

            watcher = new FileSystemWatcher(tmpDir, "*.*")
            {
                NotifyFilter = NotifyFilters.LastWrite
            };
            watcher.Changed            += WatcherEvent;
            watcher.Created            += WatcherEvent;
            watcher.EnableRaisingEvents = true;
        }
Exemple #2
0
 public DumpLogger(DumpWriter writer)
 {
     this.writer = writer;
 }