コード例 #1
0
        public static IBookmark[] GetMessageBookmarks(this IBookmarks bmks, IMessage msg)
        {
            var indexes1 = bmks.FindBookmark(bmks.Factory.CreateBookmark(msg, 0, false));
            var indexes2 = bmks.FindBookmark(bmks.Factory.CreateBookmark(msg, int.MaxValue, false));

            return(Enumerable.Range(indexes1.Item1, indexes2.Item2 - indexes1.Item1).Select(i => bmks[i]).ToArray());
        }
コード例 #2
0
        public Presenter(
            IBookmarks bookmarks,
            IFiltersList hlFilters,
            IView view,
            LogViewer.IPresenter viewerPresenter,
            IPresentersFacade navHandler)
        {
            this.hlFilters       = hlFilters;
            this.bookmarks       = bookmarks;
            this.view            = view;
            this.viewerPresenter = viewerPresenter;
            this.navHandler      = navHandler;

            viewerPresenter.FocusedMessageChanged += delegate(object sender, EventArgs args)
            {
                if (GetPropertiesForm() != null)
                {
                    GetPropertiesForm().UpdateView(viewerPresenter.FocusedMessage);
                }
            };
            bookmarks.OnBookmarksChanged += (sender, args) =>
            {
                var focused = viewerPresenter.FocusedMessage;
                if (GetPropertiesForm() != null && focused != null)
                {
                    if (args.AffectedBookmarks.Any(b => b.Position == focused.Position))
                    {
                        GetPropertiesForm().UpdateView(focused);
                    }
                }
            };
        }
コード例 #3
0
        public LogSource(ILogSourcesManagerInternal owner, int id,
                         ILogProviderFactory providerFactory, IConnectionParams connectionParams,
                         IModelThreads threads, ITempFilesManager tempFilesManager, Persistence.IStorageManager storageManager,
                         IInvokeSynchronization invoker, Settings.IGlobalSettingsAccessor globalSettingsAccess, IBookmarks bookmarks)
        {
            this.owner                = owner;
            this.tracer               = new LJTraceSource("LogSource", string.Format("ls{0:D2}", id));
            this.tempFilesManager     = tempFilesManager;
            this.invoker              = invoker;
            this.globalSettingsAccess = globalSettingsAccess;
            this.bookmarks            = bookmarks;

            try
            {
                this.logSourceThreads              = new LogSourceThreads(this.tracer, threads, this);
                this.timeGaps                      = new TimeGapsDetector(tracer, invoker, new LogSourceGapsSource(this));
                this.timeGaps.OnTimeGapsChanged   += timeGaps_OnTimeGapsChanged;
                this.logSourceSpecificStorageEntry = CreateLogSourceSpecificStorageEntry(providerFactory, connectionParams, storageManager);

                var extendedConnectionParams = connectionParams.Clone(true);
                this.LoadPersistedSettings(extendedConnectionParams);
                this.provider = providerFactory.CreateFromConnectionParams(this, extendedConnectionParams);
            }
            catch (Exception e)
            {
                tracer.Error(e, "Failed to initialize log source");
                ((ILogSource)this).Dispose();
                throw;
            }

            this.owner.Container.Add(this);
            this.owner.FireOnLogSourceAdded(this);

            this.LoadBookmarks();
        }
コード例 #4
0
        public Presenter(
            IBookmarks bookmarks,
            IView view,
            LogViewer.IPresenter viewerPresenter,
            SearchResult.IPresenter searchResultPresenter,
            BookmarksList.IPresenter listPresenter,
            StatusReports.IPresenter statusReportFactory,
            IPresentersFacade navHandler,
            IAlertPopup alerts,
            ITraceSourceFactory traceSourceFactory
            )
        {
            this.bookmarks             = bookmarks;
            this.view                  = view;
            this.viewerPresenter       = viewerPresenter;
            this.tracer                = traceSourceFactory.CreateTraceSource("UI", "ui.bmkm");
            this.statusReportFactory   = statusReportFactory;
            this.searchResultPresenter = searchResultPresenter;
            this.navHandler            = navHandler;
            this.listPresenter         = listPresenter;
            this.alerts                = alerts;

            listPresenter.Click += (s, bmk) =>
            {
                IPresenter myPublicIntf = this;
                myPublicIntf.NavigateToBookmark(bmk, BookmarkNavigationOptions.EnablePopups | BookmarkNavigationOptions.BookmarksStringsSet);
            };

            view.SetPresenter(this);
        }
コード例 #5
0
        public Presenter(
            IBookmarks bookmarks,
            ILogSourcesManager sourcesManager,
            IView view,
            IHeartBeatTimer heartbeat,
            LoadedMessages.IPresenter loadedMessagesPresenter,
            IClipboardAccess clipboardAccess,
            IColorTheme colorTheme,
            IChangeNotification changeNotification,
            ITraceSourceFactory traceSourceFactory
            )
        {
            this.bookmarks = bookmarks;
            this.view      = view;
            this.loadedMessagesPresenter = loadedMessagesPresenter;
            this.clipboardAccess         = clipboardAccess;
            this.colorTheme         = colorTheme;
            this.changeNotification = changeNotification;
            this.trace = traceSourceFactory.CreateTraceSource("UI", "bmks");

            itemsSelector = Selectors.Create(
                () => bookmarks.Items,
                () => selectedBookmarks,
                () => colorTheme.ThreadColors,
                () => loadedMessagesPresenter.LogViewerPresenter.Coloring,
                CreateViewItems
                );
            focusedMessagePositionSelector = Selectors.Create(
                () => loadedMessagesPresenter.LogViewerPresenter.FocusedMessageBookmark,
                () => bookmarks.Items,
                FindFocusedMessagePosition
                );

            view.SetViewModel(this);
        }
コード例 #6
0
        public Presenter(
            IBookmarks bookmarks,
            IFiltersList hlFilters,
            IView view,
            LogViewer.IPresenterInternal viewerPresenter,
            IPresentersFacade navHandler,
            IColorTheme theme,
            IChangeNotification parentChangeNotification,
            Telemetry.ITelemetryCollector telemetryCollector
            )
        {
            this.hlFilters          = hlFilters;
            this.bookmarks          = bookmarks;
            this.view               = view;
            this.viewerPresenter    = viewerPresenter;
            this.navHandler         = navHandler;
            this.changeNotification = parentChangeNotification.CreateChainedChangeNotification(false);

            this.getFocusedMessage = Selectors.Create(() => viewerPresenter.FocusedMessage,
                                                      message => message?.GetLogSource() == null ? null : message);
            var getBookmarkData = bookmarks == null ? () => (null, null) :
                                  Selectors.Create(getFocusedMessage, () => bookmarks.Items, (focused, bmks) =>
            {
                if (focused == null)
                {
                    return(noSelection, null);
                }
                var isBookmarked = IsMessageBookmarked(focused);
                return(isBookmarked ? "yes" : "no", isBookmarked ? "clear bookmark" : "set bookmark");
            });
コード例 #7
0
        public PresenterFactory(
            IHeartBeatTimer heartbeat,
            IPresentersFacade presentationFacade,
            IClipboardAccess clipboard,
            IBookmarksFactory bookmarksFactory,
            Telemetry.ITelemetryCollector telemetry,
            ILogSourcesManager logSources,
            IInvokeSynchronization modelInvoke,
            IModelThreads modelThreads,
            IFiltersList hlFilters,
            IBookmarks bookmarks,
            Settings.IGlobalSettingsAccessor settings,
            ISearchManager searchManager,
            IFiltersFactory filtersFactory
            )
        {
            this.heartbeat          = heartbeat;
            this.presentationFacade = presentationFacade;
            this.clipboard          = clipboard;
            this.bookmarksFactory   = bookmarksFactory;
            this.telemetry          = telemetry;

            this.logSources     = logSources;
            this.modelInvoke    = modelInvoke;
            this.modelThreads   = modelThreads;
            this.hlFilters      = hlFilters;
            this.bookmarks      = bookmarks;
            this.settings       = settings;
            this.searchManager  = searchManager;
            this.filtersFactory = filtersFactory;
        }
コード例 #8
0
        public Presenter(
            IBookmarks bookmarks,
            IView view,
            LogViewer.IPresenter viewerPresenter,
            SearchResult.IPresenter searchResultPresenter,
            BookmarksList.IPresenter listPresenter,
            StatusReports.IPresenter statusReportFactory,
            IPresentersFacade navHandler,
            IViewUpdates viewUpdates,
            IAlertPopup alerts)
        {
            this.bookmarks             = bookmarks;
            this.view                  = view;
            this.viewerPresenter       = viewerPresenter;
            this.tracer                = new LJTraceSource("UI", "ui.bmkm");
            this.statusReportFactory   = statusReportFactory;
            this.searchResultPresenter = searchResultPresenter;
            this.viewUpdates           = viewUpdates;
            this.navHandler            = navHandler;
            this.listPresenter         = listPresenter;
            this.alerts                = alerts;

            viewerPresenter.FocusedMessageBookmarkChanged += delegate(object sender, EventArgs args)
            {
                listPresenter.SetMasterFocusedMessage(viewerPresenter.GetFocusedMessageBookmark());
            };
            listPresenter.Click += (s, bmk) =>
            {
                IPresenter myPublicIntf = this;
                myPublicIntf.NavigateToBookmark(bmk, BookmarkNavigationOptions.EnablePopups | BookmarkNavigationOptions.BookmarksStringsSet);
            };

            view.SetPresenter(this);
        }
コード例 #9
0
        public Presenter(
            IBookmarks bookmarks,
            ILogSourcesManager sourcesManager,
            IView view,
            IHeartBeatTimer heartbeat,
            LoadedMessages.IPresenter loadedMessagesPresenter,
            IClipboardAccess clipboardAccess)
        {
            this.bookmarks = bookmarks;
            this.view      = view;
            this.loadedMessagesPresenter = loadedMessagesPresenter;
            this.clipboardAccess         = clipboardAccess;
            this.trace = new LJTraceSource("UI", "bmks");

            bookmarks.OnBookmarksChanged += (sender, evt) => updateTracker.Invalidate();
            heartbeat.OnTimer            += (sender, evt) =>
            {
                if (evt.IsNormalUpdate && updateTracker.Validate())
                {
                    UpdateViewInternal(null, ViewUpdateFlags.None);
                }
            };
            sourcesManager.OnLogSourceVisiblityChanged += (sender, evt) => updateTracker.Invalidate();
            loadedMessagesPresenter.LogViewerPresenter.ColoringModeChanged += (sender, evt) => view.Invalidate();

            view.SetPresenter(this);
        }
コード例 #10
0
ファイル: Model.cs プロジェクト: pnelson786/logjoint
 public Model(
     IInvokeSynchronization threadSync,
     Telemetry.ITelemetryCollector telemetryCollector,
     Persistence.IWebContentCache webCache,
     Persistence.IContentCache contentCache,
     Persistence.IStorageManager storageManager,
     IBookmarks bookmarks,
     ILogSourcesManager sourcesManager,
     IModelThreads threads,
     ITempFilesManager tempFilesManager,
     Preprocessing.IPreprocessingManagerExtensionsRegistry preprocessingManagerExtentionsRegistry,
     Preprocessing.ILogSourcesPreprocessingManager logSourcesPreprocessingManager,
     Preprocessing.IPreprocessingStepsFactory preprocessingStepsFactory,
     Progress.IProgressAggregator progressAggregator,
     ILogProviderFactoryRegistry logProviderFactoryRegistry,
     IUserDefinedFormatsManager userDefinedFormatsManager,
     MRU.IRecentlyUsedEntities mru,
     Progress.IProgressAggregatorFactory progressAggregatorsFactory,
     IHeartBeatTimer heartbeat,
     ILogSourcesController logSourcesController,
     IShutdown shutdown,
     WebBrowserDownloader.IDownloader webBrowserDownloader,
     AppLaunch.ICommandLineHandler commandLineHandler,
     Postprocessing.IPostprocessorsManager postprocessorsManager,
     Postprocessing.IUserNamesProvider analyticsShortNames,
     Analytics.TimeSeries.ITimeSeriesTypesAccess timeSeriesTypes,
     Postprocessing.IAggregatingLogSourceNamesProvider logSourceNamesProvider
     )
 {
     this.ModelThreadSynchronization = threadSync;
     this.Telemetry        = telemetryCollector;
     this.WebContentCache  = webCache;
     this.ContentCache     = contentCache;
     this.StorageManager   = storageManager;
     this.Bookmarks        = bookmarks;
     this.SourcesManager   = sourcesManager;
     this.Threads          = threads;
     this.TempFilesManager = tempFilesManager;
     this.PreprocessingManagerExtensionsRegistry = preprocessingManagerExtentionsRegistry;
     this.PreprocessingStepsFactory      = preprocessingStepsFactory;
     this.LogSourcesPreprocessingManager = logSourcesPreprocessingManager;
     this.ProgressAggregator             = progressAggregator;
     this.LogProviderFactoryRegistry     = logProviderFactoryRegistry;
     this.UserDefinedFormatsManager      = userDefinedFormatsManager;
     this.ProgressAggregatorsFactory     = progressAggregatorsFactory;
     this.MRU                    = mru;
     this.Heartbeat              = heartbeat;
     this.LogSourcesController   = logSourcesController;
     this.Shutdown               = shutdown;
     this.WebBrowserDownloader   = webBrowserDownloader;
     this.CommandLineHandler     = commandLineHandler;
     this.PostprocessorsManager  = postprocessorsManager;
     this.ShortNames             = analyticsShortNames;
     this.TimeSeriesTypes        = timeSeriesTypes;
     this.LogSourceNamesProvider = logSourceNamesProvider;
 }
コード例 #11
0
 public BookmarkCollection(IBookmarks bookmarks,
                           TimeSpan maximumWaitTime)
 {
     _settings             = bookmarks ?? throw new ArgumentNullException(nameof(bookmarks));
     _maximumWaitTime      = maximumWaitTime;
     _syncRoot             = new object();
     _dataSourcesByLogFile = new Dictionary <ILogFile, IDataSource>();
     _bookmarks            = new Dictionary <Bookmark, BookmarkSettings>();
     Update();
 }
コード例 #12
0
        public StateInspectorPresenter(
            IView view,
            IStateInspectorVisualizerModel model,
            IUserNamesProvider shortNames,
            ILogSourcesManager logSources,
            LoadedMessages.IPresenter loadedMessagesPresenter,
            IBookmarks bookmarks,
            IModelThreads threads,
            IPresentersFacade presentersFacade,
            IClipboardAccess clipboardAccess,
            SourcesManager.IPresenter sourcesManagerPresenter,
            IColorTheme theme
            )
        {
            this.view                    = view;
            this.model                   = model;
            this.shortNames              = shortNames;
            this.threads                 = threads;
            this.presentersFacade        = presentersFacade;
            this.bookmarks               = bookmarks;
            this.clipboardAccess         = clipboardAccess;
            this.sourcesManagerPresenter = sourcesManagerPresenter;
            this.loadedMessagesPresenter = loadedMessagesPresenter;
            this.theme                   = theme;

            view.SetEventsHandler(this);

            logSources.OnLogSourceAnnotationChanged += (sender, e) =>
            {
                InvalidateTree();
            };

            loadedMessagesPresenter.LogViewerPresenter.FocusedMessageChanged += (sender, args) =>
            {
                HandleFocusedMessageChange();
            };

            bookmarks.OnBookmarksChanged += (sender, args) =>
            {
                view.BeginUpdateStateHistoryList(false, false);
                view.EndUpdateStateHistoryList(null, false, redrawFocusedMessageMark: true);
            };

            model.Changed += (sender, args) =>
            {
                InvalidateTree();
                HandleFocusedMessageChange();
                RemoveMissingGroupsFromCache();
            };

            InvalidateTree();
            HandleFocusedMessageChange();
        }
コード例 #13
0
 public LogSourcesManager(
     IHeartBeatTimer heartbeat,
     IInvokeSynchronization invoker,
     IModelThreads threads,
     ITempFilesManager tempFilesManager,
     Persistence.IStorageManager storageManager,
     IBookmarks bookmarks,
     Settings.IGlobalSettingsAccessor globalSettingsAccess
     ) : this(heartbeat,
              new LogSourceFactory(threads, bookmarks, invoker, storageManager, tempFilesManager, globalSettingsAccess))
 {
 }
コード例 #14
0
        public BoostOrca(IBookMarkCache bookMarkCache, IMiningConfiguration miningConfiguration, IBookmarks bookmarks, ISafespots safespots, IMovement movement, IMainConfiguration mainConfiguration, IShip ship, IMeCache meCache)
        {
            _bookMarkCache       = bookMarkCache;
            _miningConfiguration = miningConfiguration;
            _bookmarks           = bookmarks;
            _safespots           = safespots;
            _movement            = movement;
            _mainConfiguration   = mainConfiguration;
            _ship    = ship;
            _meCache = meCache;

            IsEnabled = true;
            BehaviorManager.BehaviorsToPulse.Add(BotModes.BoostOrca, this);
            ModuleName = "BoostOrca";
        }
コード例 #15
0
 public void Init()
 {
     view = Substitute.For <IView>();
     presentationObjectsFactory = Substitute.For <Postprocessing.Common.IPresentationObjectsFactory>();
     bookmarks               = Substitute.For <IBookmarks>();
     storageManager          = Substitute.For <Persistence.IStorageManager>();
     loadedMessagesPresenter = Substitute.For <LoadedMessages.IPresenter>();
     userNamesProvider       = Substitute.For <IUserNamesProvider>();
     view.When(v => v.SetViewModel(Arg.Any <IViewModel>())).Do(x => viewModel = x.Arg <IViewModel>());
     quickSearchTextBoxPresenter = Substitute.For <QuickSearchTextBox.IPresenter>();
     changeNotification          = Substitute.For <IChangeNotification>();
     theme = Substitute.For <IColorTheme>();
     theme.ThreadColors.Returns(ImmutableArray.Create(new Color(1), new Color(2)));
     presentationObjectsFactory.CreateQuickSearch(Arg.Any <QuickSearchTextBox.IView>()).Returns(quickSearchTextBoxPresenter);
 }
コード例 #16
0
        public MoveToDropOffLocationPartialBehavior(IMovement movement, IEntityProvider entityProvider, ICargoConfiguration cargoConfiguration, IBookMarkCache bookMarkCache, IBookmarks bookmarks,
                                                    IMovementConfiguration movementConfiguration, IMeCache meCache, MathUtility mathUtility, IIsxeveProvider isxeveProvider)
        {
            _movement              = movement;
            _entityProvider        = entityProvider;
            _cargoConfiguration    = cargoConfiguration;
            _bookMarkCache         = bookMarkCache;
            _bookmarks             = bookmarks;
            _movementConfiguration = movementConfiguration;
            _meCache        = meCache;
            _mathUtility    = mathUtility;
            _isxeveProvider = isxeveProvider;

            ModuleName = "MoveToDropOffLocationPartialBehavior";
        }
コード例 #17
0
ファイル: LogSourcesManager.cs プロジェクト: cxsun/logjoint
 public LogSourcesManager(
     IHeartBeatTimer heartbeat,
     ISynchronizationContext invoker,
     IModelThreadsInternal threads,
     ITempFilesManager tempFilesManager,
     Persistence.IStorageManager storageManager,
     IBookmarks bookmarks,
     Settings.IGlobalSettingsAccessor globalSettingsAccess,
     MRU.IRecentlyUsedEntities recentlyUsedEntities,
     IShutdown shutdown,
     ITraceSourceFactory traceSourceFactory,
     IChangeNotification changeNotification
     ) : this(heartbeat, recentlyUsedEntities, shutdown, traceSourceFactory, changeNotification,
              new LogSourceFactory(threads, bookmarks, invoker, storageManager, tempFilesManager, globalSettingsAccess, traceSourceFactory))
 {
 }
コード例 #18
0
 public LogSourceFactory(
     IModelThreads threads,
     IBookmarks bookmarks,
     IInvokeSynchronization invoker,
     Persistence.IStorageManager storageManager,
     ITempFilesManager tempFilesManager,
     Settings.IGlobalSettingsAccessor globalSettingsAccess
     )
 {
     this.threads              = threads;
     this.bookmarks            = bookmarks;
     this.invoker              = invoker;
     this.storageManager       = storageManager;
     this.tempFilesManager     = tempFilesManager;
     this.globalSettingsAccess = globalSettingsAccess;
 }
コード例 #19
0
        public PresentationModel(
            ILogSourcesManager logSources,
            IInvokeSynchronization modelInvoke,
            IModelThreads modelThreads,
            IFiltersList hlFilters,
            IBookmarks bookmarks,
            Settings.IGlobalSettingsAccessor settings
            )
        {
            this.logSources   = logSources;
            this.modelThreads = modelThreads;
            this.hlFilters    = hlFilters;
            this.bookmarks    = bookmarks;
            this.settings     = settings;

            updateSourcesInvoker = new AsyncInvokeHelper(modelInvoke, UpdateSources);

            logSources.OnLogSourceColorChanged += (s, e) =>
            {
                if (OnLogSourceColorChanged != null)
                {
                    OnLogSourceColorChanged(s, e);
                }
            };
            logSources.OnLogSourceAdded += (s, e) =>
            {
                updateSourcesInvoker.Invoke();
            };
            logSources.OnLogSourceRemoved += (s, e) =>
            {
                updateSourcesInvoker.Invoke();
            };
            logSources.OnLogSourceStatsChanged += (s, e) =>
            {
                if ((e.Flags & LogProviderStatsFlag.PositionsRange) != 0)
                {
                    if ((e.Flags & LogProviderStatsFlag.AvailableTimeUpdatedIncrementallyFlag) == 0)
                    {
                        updateSourcesInvoker.Invoke();
                    }
                    else if (OnSourceMessagesChanged != null)
                    {
                        OnSourceMessagesChanged(this, EventArgs.Empty);
                    }
                }
            };
        }
コード例 #20
0
        public Presenter(
            ILogSourcesManager logSources,
            IBookmarks bookmarks,
            IView view,
            Presenters.Timeline.IPresenter timelinePresenter,
            IHeartBeatTimer heartbeat)
        {
            this.logSources        = logSources;
            this.bookmarks         = bookmarks;
            this.view              = view;
            this.timelinePresenter = timelinePresenter;

            this.logSources.OnLogSourceStatsChanged += (sender, args) =>
            {
                if ((args.Flags & (LogProviderStatsFlag.CachedTime | LogProviderStatsFlag.AvailableTime)) != 0)
                {
                    lazyUpdateFlag.Invalidate();
                }
            };
            this.logSources.OnLogTimeGapsChanged += (sender, args) =>
            {
                lazyUpdateFlag.Invalidate();
            };
            this.logSources.OnLogSourceVisiblityChanged += (sender, args) =>
            {
                lazyUpdateFlag.Invalidate();
            };
            this.logSources.OnLogSourceRemoved += (sender, args) =>
            {
                lazyUpdateFlag.Invalidate();
            };
            this.bookmarks.OnBookmarksChanged += (sender, args) =>
            {
                lazyUpdateFlag.Invalidate();
            };

            heartbeat.OnTimer += (sender, args) =>
            {
                if (args.IsNormalUpdate && lazyUpdateFlag.Validate())
                {
                    UpdateView();
                }
            };

            view.SetPresenter(this);
            view.SetEnabled(false);
        }
コード例 #21
0
ファイル: Model.cs プロジェクト: rkapl123/logjoint
 public Model(
     ISynchronizationContext threadSync,
     IChangeNotification changeNotification,
     Persistence.IWebContentCache webCache,
     Persistence.IContentCache contentCache,
     Persistence.IStorageManager storageManager,
     IBookmarks bookmarks,
     ILogSourcesManager sourcesManager,
     IModelThreads threads,
     ITempFilesManager tempFilesManager,
     Preprocessing.IModel preprocessingModel,
     Progress.IProgressAggregator progressAggregator,
     ILogProviderFactoryRegistry logProviderFactoryRegistry,
     IUserDefinedFormatsManager userDefinedFormatsManager,
     MRU.IRecentlyUsedEntities mru,
     Progress.IProgressAggregatorFactory progressAggregatorsFactory,
     IShutdown shutdown,
     WebViewTools.IWebViewTools webViewTools,
     Postprocessing.IModel postprocessingModel,
     IPluginsManager pluginsManager,
     ITraceSourceFactory traceSourceFactory,
     LogMedia.IFileSystem fileSystem
     )
 {
     this.SynchronizationContext = threadSync;
     this.ChangeNotification     = changeNotification;
     this.WebContentCache        = webCache;
     this.ContentCache           = contentCache;
     this.StorageManager         = storageManager;
     this.Bookmarks                  = bookmarks;
     this.SourcesManager             = sourcesManager;
     this.Threads                    = threads;
     this.TempFilesManager           = tempFilesManager;
     this.Preprocessing              = preprocessingModel;
     this.ProgressAggregator         = progressAggregator;
     this.LogProviderFactoryRegistry = logProviderFactoryRegistry;
     this.UserDefinedFormatsManager  = userDefinedFormatsManager;
     this.ProgressAggregatorsFactory = progressAggregatorsFactory;
     this.MRU                = mru;
     this.Shutdown           = shutdown;
     this.WebViewTools       = webViewTools;
     this.Postprocessing     = postprocessingModel;
     this.PluginsManager     = pluginsManager;
     this.TraceSourceFactory = traceSourceFactory;
     this.FileSystem         = fileSystem;
 }
コード例 #22
0
 public LogSourceFactory(
     IModelThreadsInternal threads,
     IBookmarks bookmarks,
     ISynchronizationContext invoker,
     Persistence.IStorageManager storageManager,
     ITempFilesManager tempFilesManager,
     Settings.IGlobalSettingsAccessor globalSettingsAccess,
     ITraceSourceFactory traceSourceFactory
     )
 {
     this.threads              = threads;
     this.bookmarks            = bookmarks;
     this.invoker              = invoker;
     this.storageManager       = storageManager;
     this.tempFilesManager     = tempFilesManager;
     this.globalSettingsAccess = globalSettingsAccess;
     this.traceSourceFactory   = traceSourceFactory;
 }
コード例 #23
0
ファイル: DataSources.cs プロジェクト: radtek/Tailviewer
        public DataSources(ILogFileFactory logFileFactory,
                           ITaskScheduler taskScheduler,
                           IFilesystem filesystem,
                           IDataSourcesSettings settings,
                           IBookmarks bookmarks)
        {
            _logFileFactory  = logFileFactory ?? throw new ArgumentNullException(nameof(logFileFactory));
            _taskScheduler   = taskScheduler;
            _filesystem      = filesystem ?? throw new ArgumentNullException(nameof(filesystem));
            _maximumWaitTime = TimeSpan.FromMilliseconds(100);
            _syncRoot        = new object();
            _settings        = settings ?? throw new ArgumentNullException(nameof(settings));
            _bookmarks       = new BookmarkCollection(bookmarks, _maximumWaitTime);
            _dataSources     = new List <IDataSource>();
            _dataSourceIds   = new HashSet <DataSourceId>();
            foreach (DataSource dataSource in settings)
            {
                AddDataSource(dataSource);
            }

            foreach (IDataSource dataSource in _dataSources)
            {
                DataSourceId parentId = dataSource.Settings.ParentId;
                if (parentId != DataSourceId.Empty)
                {
                    var parent = _dataSources.FirstOrDefault(x => x.Id == parentId) as MergedDataSource;
                    if (parent != null)
                    {
                        parent.Add(dataSource);
                    }
                    else
                    {
                        Log.WarnFormat("DataSource '{0} ({1})' is assigned a parent '{2}' but we don't know that one",
                                       dataSource.FullFileName,
                                       dataSource.Id,
                                       parentId);
                        // We don't want the rest of the application having to deal with this.
                        // Therefore we'll simply remove the parent link and treat this data
                        // source as any other ungrouped one.
                        dataSource.Settings.ParentId = DataSourceId.Empty;
                    }
                }
            }
        }
コード例 #24
0
 public BookmarkController(
     IBookmarks bookmarks,
     IModelThreads threads,
     IHeartBeatTimer heartbeat
     )
 {
     tracer = LJTraceSource.EmptyTracer;
     threads.OnThreadListChanged += (s, e) =>
     {
         bookmarksNeedPurgeFlag.Invalidate();
     };
     heartbeat.OnTimer += (sender, args) =>
     {
         if (args.IsNormalUpdate && bookmarksNeedPurgeFlag.Validate())
         {
             bookmarks.PurgeBookmarksForDisposedThreads();
         }
     };
     bookmarks.OnBookmarksChanged += (sender, e) =>
     {
         if (e.Type == BookmarksChangedEventArgs.ChangeType.Added || e.Type == BookmarksChangedEventArgs.ChangeType.Removed ||
             e.Type == BookmarksChangedEventArgs.ChangeType.RemovedAll || e.Type == BookmarksChangedEventArgs.ChangeType.Purged)
         {
             foreach (var affectedSource in
                      e.AffectedBookmarks
                      .Select(b => b.GetLogSource())
                      .Where(s => s.LogSourceStateIsOkToChangePersistentState())
                      .Distinct())
             {
                 try
                 {
                     affectedSource.StoreBookmarks();
                 }
                 catch (Persistence.StorageException storageException)
                 {
                     tracer.Error(storageException, "Failed to store bookmarks for log {0}",
                                  affectedSource.GetSafeConnectionId());
                 }
             }
         }
     };
 }
コード例 #25
0
 public SearchResultMessagesModel(
     ILogSourcesManager logSources,
     ISearchManager searchManager,
     IFiltersFactory filtersFactory,
     IModelThreads threads,
     IBookmarks bookmarks,
     Settings.IGlobalSettingsAccessor settings
     )
 {
     this.logSources     = logSources;
     this.searchManager  = searchManager;
     this.threads        = threads;
     this.bookmarks      = bookmarks;
     this.settings       = settings;
     this.filtersFactory = filtersFactory;
     logSources.OnLogSourceColorChanged += (s, e) =>
     {
         OnLogSourceColorChanged?.Invoke(s, e);
     };
 }
コード例 #26
0
        public Ratting(ISocial social, IMeCache meCache, IBookmarks bookmarks, ISalvageConfiguration salvageConfiguration, IRattingConfiguration rattingConfiguration, IAnomalyProvider anomalyProvider,
                       IEntityProvider entityProvider, IAnomalyClaimTracker anomalyClaimTracker, ISafespots safespots, IMovement movement, IShip ship, IAsteroidBelts asteroidBelts, IMovementConfiguration movementConfiguration,
                       IAlerts alerts, ITargetQueue targetQueue, IAttackers attackers)
        {
            _social               = social;
            _meCache              = meCache;
            _bookmarks            = bookmarks;
            _salvageConfiguration = salvageConfiguration;
            _rattingConfiguration = rattingConfiguration;
            _anomalyProvider      = anomalyProvider;
            _entityProvider       = entityProvider;
            _anomalyClaimTracker  = anomalyClaimTracker;
            _safespots            = safespots;
            _movement             = movement;
            _ship                  = ship;
            _asteroidBelts         = asteroidBelts;
            _movementConfiguration = movementConfiguration;
            _alerts                = alerts;
            _targetQueue           = targetQueue;
            _attackers             = attackers;

            BehaviorManager.BehaviorsToPulse.Add(BotModes.Ratting, this);
            ModuleName     = "Ratting";
            IsEnabled      = true;
            PulseFrequency = 2;

            var knownEwarPointTargetTags = new List <string> {
                "Dire Guristas", "Arch Angel Hijacker", "Arch Angel Outlaw", "Arch Angel Rogue",
                "Arch Angel Thug", "Sansha's Loyal", "Guardian Agent", "Guardian Initiate",
                "Guardian Scout", "Guardian Spy", " Watchman", " Patroller",
                "Elder Blood Upholder", "Elder Blood Worshipper", "Elder Blood Follower", "Elder Blood Herald",
                "Blood Wraith", "Blood Disciple", "Strain "
            };

            _cachedResourcesByKeys.Add(KnownEwarPointTargetTags, knownEwarPointTargetTags);

            _randomWaitObject = new RandomWaitObject(ModuleName);
            _randomWaitObject.AddWait(new KeyValuePair <int, int>(30, 70), 5);
            _randomWaitObject.AddWait(new KeyValuePair <int, int>(5, 15), 10);
        }
コード例 #27
0
        public LogSource(ILogSourcesManagerInternal owner, int id,
                         ILogProviderFactory providerFactory, IConnectionParams connectionParams,
                         IModelThreadsInternal threads, ITempFilesManager tempFilesManager, Persistence.IStorageManager storageManager,
                         ISynchronizationContext modelSyncContext, Settings.IGlobalSettingsAccessor globalSettingsAccess, IBookmarks bookmarks,
                         ITraceSourceFactory traceSourceFactory, RegularExpressions.IRegexFactory regexFactory, LogMedia.IFileSystem fileSystem)
        {
            this.owner                = owner;
            this.tracer               = traceSourceFactory.CreateTraceSource("LogSource", string.Format("ls{0:D2}", id));
            this.tempFilesManager     = tempFilesManager;
            this.modelSyncContext     = modelSyncContext;
            this.globalSettingsAccess = globalSettingsAccess;
            this.bookmarks            = bookmarks;
            this.traceSourceFactory   = traceSourceFactory;
            this.regexFactory         = regexFactory;
            this.fileSystem           = fileSystem;

            try
            {
                this.logSourceThreads              = new LogSourceThreads(this.tracer, threads, this);
                this.timeGaps                      = new TimeGapsDetector(tracer, modelSyncContext, new LogSourceGapsSource(this), traceSourceFactory);
                this.timeGaps.OnTimeGapsChanged   += timeGaps_OnTimeGapsChanged;
                this.logSourceSpecificStorageEntry = CreateLogSourceSpecificStorageEntry(providerFactory, connectionParams, storageManager);

                var extendedConnectionParams = connectionParams.Clone(true);
                this.LoadPersistedSettings(extendedConnectionParams);
                this.provider = providerFactory.CreateFromConnectionParams(this, extendedConnectionParams);
            }
            catch (Exception e)
            {
                tracer.Error(e, "Failed to initialize log source");
                ((ILogSource)this).Dispose();
                throw;
            }

            this.owner.Add(this);
            this.owner.FireOnLogSourceAdded(this);

            this.LoadBookmarks();
        }
コード例 #28
0
ファイル: LogSourceFactory.cs プロジェクト: rkapl123/logjoint
 public LogSourceFactory(
     IModelThreadsInternal threads,
     IBookmarks bookmarks,
     ISynchronizationContext invoker,
     Persistence.IStorageManager storageManager,
     ITempFilesManager tempFilesManager,
     Settings.IGlobalSettingsAccessor globalSettingsAccess,
     ITraceSourceFactory traceSourceFactory,
     RegularExpressions.IRegexFactory regexFactory,
     LogMedia.IFileSystem fileSystem
     )
 {
     this.threads              = threads;
     this.bookmarks            = bookmarks;
     this.invoker              = invoker;
     this.storageManager       = storageManager;
     this.tempFilesManager     = tempFilesManager;
     this.globalSettingsAccess = globalSettingsAccess;
     this.traceSourceFactory   = traceSourceFactory;
     this.regexFactory         = regexFactory;
     this.fileSystem           = fileSystem;
 }
コード例 #29
0
 public PresenterFactory(
     IChangeNotification changeNotification,
     IHeartBeatTimer heartbeat,
     IPresentersFacade presentationFacade,
     IClipboardAccess clipboard,
     IBookmarksFactory bookmarksFactory,
     Telemetry.ITelemetryCollector telemetry,
     ILogSourcesManager logSources,
     ISynchronizationContext modelInvoke,
     IModelThreads modelThreads,
     IFiltersList hlFilters,
     IBookmarks bookmarks,
     Settings.IGlobalSettingsAccessor settings,
     ISearchManager searchManager,
     IFiltersFactory filtersFactory,
     IColorTheme theme,
     ITraceSourceFactory traceSourceFactory,
     RegularExpressions.IRegexFactory regexFactory
     )
 {
     this.changeNotification = changeNotification;
     this.heartbeat          = heartbeat;
     this.presentationFacade = presentationFacade;
     this.clipboard          = clipboard;
     this.bookmarksFactory   = bookmarksFactory;
     this.telemetry          = telemetry;
     this.logSources         = logSources;
     this.modelInvoke        = modelInvoke;
     this.modelThreads       = modelThreads;
     this.hlFilters          = hlFilters;
     this.bookmarks          = bookmarks;
     this.settings           = settings;
     this.searchManager      = searchManager;
     this.filtersFactory     = filtersFactory;
     this.theme = theme;
     this.traceSourceFactory = traceSourceFactory;
     this.regexFactory       = regexFactory;
 }
コード例 #30
0
 public BookmarkController(
     IBookmarks bookmarks,
     IModelThreads threads,
     IHeartBeatTimer heartbeat,
     ISynchronizationContext synchronization
     )
 {
     tracer         = LJTraceSource.EmptyTracer;
     bookmarksPurge = new AsyncInvokeHelper(synchronization, bookmarks.PurgeBookmarksForDisposedThreads);
     threads.OnThreadListChanged += (s, e) =>
     {
         bookmarksPurge.Invoke();
     };
     bookmarks.OnBookmarksChanged += (sender, e) =>
     {
         if (e.Type == BookmarksChangedEventArgs.ChangeType.Added || e.Type == BookmarksChangedEventArgs.ChangeType.Removed ||
             e.Type == BookmarksChangedEventArgs.ChangeType.RemovedAll || e.Type == BookmarksChangedEventArgs.ChangeType.Purged)
         {
             foreach (var affectedSource in
                      e.AffectedBookmarks
                      .Select(b => b.GetLogSource())
                      .Where(s => s.LogSourceStateIsOkToChangePersistentState())
                      .Distinct())
             {
                 try
                 {
                     affectedSource.StoreBookmarks();
                 }
                 catch (Persistence.StorageException storageException)
                 {
                     tracer.Error(storageException, "Failed to store bookmarks for log {0}",
                                  affectedSource.GetSafeConnectionId());
                 }
             }
         }
     };
 }