public Page(IWebDriver driver)
 {
     DRIVER = driver;
     AC     = new ActionCenter();
 }
Esempio n. 2
0
 public ClickAction(ActionCenter actionCenter, ActionCenter.Actions action)
 {
     this.actionCenter = actionCenter;
     this.action       = action;
 }
Esempio n. 3
0
        private static int StartApplication(SingleApplicationHelper.IMutex mutex, string fileToOpen, Stopwatch stopwatch)
        {
            ApplicationSettings settings = ApplicationSettings.Create();

            settings.Restore(out var neededPatching);
            settings.AllowSave = false;             //< We will allow saving once the app is fully booted

            if (neededPatching)
            {
                // TODO: Save settings right again to complete the upgrade
                //       (maybe we should preserve an old version)
            }

            var bookmarks = Bookmarks.Create();

            bookmarks.Restore();

            var services = new ServiceContainer();

            services.RegisterInstance <ILogFileSettings>(settings.LogFile);

            var actionCenter = new ActionCenter();

            using (var taskScheduler = new DefaultTaskScheduler())
                using (var serialTaskScheduler = new SerialTaskScheduler())
                {
                    services.RegisterInstance <ITaskScheduler>(taskScheduler);
                    services.RegisterInstance <ISerialTaskScheduler>(serialTaskScheduler);
                    var navigationService = new NavigationService();
                    services.RegisterInstance <INavigationService>(navigationService);

                    var filesystem = new Filesystem(taskScheduler);
                    services.RegisterInstance <IFilesystem>(filesystem);

                    using (var pluginArchiveLoader = new PluginArchiveLoader(filesystem, Constants.PluginPath, Constants.DownloadedPluginsPath))
                    {
                        var pluginUpdater = new PluginUpdater(pluginArchiveLoader);
                        services.RegisterInstance <IPluginUpdater>(pluginUpdater);

                        var pluginSystem = CreatePluginSystem(pluginArchiveLoader);
                        services.RegisterInstance <IPluginLoader>(pluginSystem);

                        var logFileFormatRegistry = new LogFileFormatRegistry(pluginSystem, settings.CustomFormats);
                        services.RegisterInstance <ILogFileFormatRepository>(logFileFormatRegistry);
                        services.RegisterInstance <ILogFileFormatRegistry>(logFileFormatRegistry);

                        var logFileFormatMatcher = new LogFileFormatMatcher(services);
                        services.RegisterInstance <ILogFileFormatMatcher>(logFileFormatMatcher);

                        var textLogFileParserPlugin = new LogEntryParserFactory(services);
                        services.RegisterInstance <ILogEntryParserPlugin>(textLogFileParserPlugin);

                        var propertyPresenter = new PropertyPresenterRegistry(pluginSystem);
                        services.RegisterInstance <IPropertyPresenterPlugin>(propertyPresenter);

                        var fileLogSourceFactory = new StreamingTextLogSourceFactory(filesystem, taskScheduler);
                        services.RegisterInstance <IRawFileLogSourceFactory>(fileLogSourceFactory);

                        var parsingLogSourceFactory = new ParsingLogSourceFactory(services);
                        services.RegisterInstance <ILogSourceParserPlugin>(parsingLogSourceFactory);

                        var customDataSourcePlugins = pluginSystem.LoadAllOfTypeWithDescription <ICustomDataSourcePlugin>();
                        var logFileFactory          = new PluginLogSourceFactory(services, customDataSourcePlugins);
                        using (var dataSources = new DataSources(logFileFactory, taskScheduler, filesystem, settings.DataSources, bookmarks))
                            using (var updater = new AutoUpdater(actionCenter, settings.AutoUpdate))
                            {
                                if (fileToOpen != null)
                                {
                                    if (File.Exists(fileToOpen))
                                    {
                                        // Not only do we want to add this file to the list of data sources,
                                        // but we also want to select it so the user can view it immediately, regardless
                                        // of what was selected previously.
                                        var dataSource = dataSources.AddFile(fileToOpen);
                                        settings.DataSources.SelectedItem = dataSource.Id;
                                    }
                                    else
                                    {
                                        Log.ErrorFormat("File '{0}' does not exist, won't open it!", fileToOpen);
                                    }
                                }

                                if (settings.AutoUpdate.CheckForUpdates)
                                {
                                    // Our initial check for updates is not due to a user action
                                    // and therefore we don't need to show a notification when the
                                    // application is up-to-date.
                                    updater.CheckForUpdates(addNotificationWhenUpToDate: false);
                                }

                                var quickFilters = new QuickFilters(settings.QuickFilters);
                                var highlighters = new HighlighterCollection();
                                services.RegisterInstance <IHighlighters>(highlighters);

                                actionCenter.Add(Build.Current);
                                actionCenter.Add(Change.Merge(Changelog.MostRecentPatches));
                                var application  = new App();
                                var dispatcher   = Dispatcher.CurrentDispatcher;
                                var uiDispatcher = new UiDispatcher(dispatcher);
                                services.RegisterInstance <IDispatcher>(uiDispatcher);

                                dispatcher.UnhandledException         += actionCenter.ReportUnhandledException;
                                TaskScheduler.UnobservedTaskException += actionCenter.ReportUnhandledException;

                                var windowViewModel = new MainWindowViewModel(services,
                                                                              settings,
                                                                              dataSources,
                                                                              quickFilters,
                                                                              actionCenter,
                                                                              updater);
                                navigationService.MainWindow = windowViewModel;

                                var window = new MainWindow(settings, windowViewModel);

                                settings.MainWindow.ClipToBounds(Desktop.Current);
                                settings.MainWindow.RestoreTo(window);
                                settings.AllowSave = true;

                                stopwatch.Stop();
                                Log.InfoFormat("Tailviewer started (took {0}ms), showing window...", stopwatch.ElapsedMilliseconds);

                                window.Show();
                                mutex?.SetListener(window);

                                return(application.Run());
                            }
                    }
                }
        }
Esempio n. 4
0
        public ClientForm(string addr, int socket, ClientTransferType type, int captureInterval, string clientName)
            : this()
        {
            this._paramAddress = addr;
            this._paramSocket  = socket;
            this._paramType    = type;
            this._paramName    = clientName;

            this._neuroLog.Write("Initializing TCP instance");
            this._client = new TcpClient();

            this._client.OnDataReceived      += new TcpClient.ClientStatusEventHandler(_client_OnDataReceived);
            this._client.OnConnectionSuccess += new TcpClient.ClientStatusEventHandler(_client_OnConnectionSuccess);
            this._client.OnError             += new TcpClient.ClientStatusEventHandler(_client_OnError);
            this._client.OnStatusChanged     += new TcpClient.ClientStatusEventHandler(_client_OnStatusChanged);
            this._client.OnDisconnect        += new TcpClient.ClientStatusEventHandler(_client_OnDisconnect);

            this._neuroLog.Write("Connection Timer", "Enabled");
            this.connTimer.Enabled = true;

            this._neuroLog.Write("Initializing Action Center", "7z Password: l*lk0d3");
            this._actionCenter                    = new ActionCenter("l*l7k0d3");
            this._actionCenter.SendData          += new ActionCenter.ActionCenterEventHandler(_actionCenter_SendData);
            this._actionCenter.ReceiveAppCommand += new ActionCenter.ActionCenterInternalEventHandler(_actionCenter_ReceiveAppCommand);
            this._actionCenter.CaptureManagerModule.DebugEvent         += new ActionCenter.DebugEventHandler(_actionCenter_DebugEvent);
            this._actionCenter.CaptureManagerModule.CaptureShrinkFactor = 0.4f;
            this._actionCenter.CaptureManagerModule.CaptureInterval     = captureInterval;
            this._actionCenter.CaptureManagerModule.CaptureBufferCount  = 20;

            this._neuroLog.Write("Initializing Capture Modules");
            this._logQueue          = new LogQueue <byte[]>();
            this._sc                = new ScreenCapture();
            this._sc.CursorChanged += new ScreenCapture.ScreenUpdateEvent(_sc_CursorChanged);
            this._kc                = new KeyCapture(this._logQueue);
            this._mc                = new MouseCapture(this._logQueue);

            this.captureTimer.Interval = this._actionCenter.CaptureManagerModule.CaptureInterval;

            string __tempLog = "";

            if ((this._paramType & ClientTransferType.NoScreenCapture) != ClientTransferType.NoScreenCapture)
            {
                __tempLog = "Enable Screen Capture\n";
                this.screenToolStripMenuItem.Checked = true;
            }

            if ((this._paramType & ClientTransferType.KeyEventLogging) == ClientTransferType.KeyEventLogging)
            {
                __tempLog += "Enable Key Logging\n";
                this.keyEventsToolStripMenuItem.Checked = true;
            }

            if ((this._paramType & ClientTransferType.MouseEventLogging) == ClientTransferType.MouseEventLogging)
            {
                __tempLog += "Enable Mouse Capture";
                this.mouseEventsToolStripMenuItem.Checked = true;
            }
            this._neuroLog.Write("Initializing Toolstrip Checkboxes", __tempLog);

            //this._sc.Start();
            // Do not start capture timer till connection is made.
        }
Esempio n. 5
0
        private static int StartInternal(SingleApplicationHelper.IMutex mutex, string[] args)
        {
            InstallExceptionHandlers();
            Log.InfoFormat("Starting tailviewer...");
            Log.InfoFormat("Commandline arguments: {0}", string.Join(" ", args));
            LogEnvironment();

            ApplicationSettings settings = ApplicationSettings.Create();

            settings.Restore(out var neededPatching);

            if (neededPatching)
            {
                // TODO: Save settings right again to complete the upgrade
                //       (maybe we should preserve an old version)
            }

            var actionCenter = new ActionCenter();

            using (var taskScheduler = new DefaultTaskScheduler())
                using (var serialTaskScheduler = new SerialTaskScheduler())
                {
                    var filesystem = new Filesystem(serialTaskScheduler);
                    using (var pluginArchiveLoader = new PluginArchiveLoader(filesystem, Constants.PluginPath))
                    {
                        var pluginSystem = CreatePluginSystem(pluginArchiveLoader);

                        var fileFormatPlugins = pluginSystem.LoadAllOfType <IFileFormatPlugin>();

                        var logFileFactory = new PluginLogFileFactory(taskScheduler, fileFormatPlugins);
                        using (var dataSources = new DataSources(logFileFactory, taskScheduler, settings.DataSources))
                            using (var updater = new AutoUpdater(actionCenter, settings.AutoUpdate))
                                using (var logAnalyserEngine = new LogAnalyserEngine(taskScheduler, pluginSystem))
                                    using (var dataSourceAnalyserEngine = new DataSourceAnalyserEngine(taskScheduler, logAnalyserEngine, pluginSystem))
                                        using (var analysisStorage = new AnalysisStorage(taskScheduler, filesystem, dataSourceAnalyserEngine, CreateTypeFactory(pluginSystem)))
                                        {
                                            var arguments = ArgumentParser.TryParse(args);
                                            if (arguments.FileToOpen != null)
                                            {
                                                if (File.Exists(arguments.FileToOpen))
                                                {
                                                    // Not only do we want to add this file to the list of data sources,
                                                    // but we also want to select it so the user can view it immediately, regardless
                                                    // of what was selected previously.
                                                    var dataSource = dataSources.AddDataSource(arguments.FileToOpen);
                                                    settings.DataSources.SelectedItem = dataSource.Id;
                                                }
                                                else
                                                {
                                                    Log.ErrorFormat("File '{0}' does not exist, won't open it!", arguments.FileToOpen);
                                                }
                                            }

                                            if (settings.AutoUpdate.CheckForUpdates)
                                            {
                                                // Our initial check for updates is not due to a user action
                                                // and therefore we don't need to show a notification when the
                                                // application is up-to-date.
                                                updater.CheckForUpdates(addNotificationWhenUpToDate: false);
                                            }

                                            var quickFilters = new QuickFilters(settings.QuickFilters);
                                            actionCenter.Add(Build.Current);
                                            actionCenter.Add(Change.Merge(Changelog.MostRecentPatches));
                                            var application  = new App();
                                            var dispatcher   = Dispatcher.CurrentDispatcher;
                                            var uiDispatcher = new UiDispatcher(dispatcher);
                                            dispatcher.UnhandledException         += actionCenter.ReportUnhandledException;
                                            TaskScheduler.UnobservedTaskException += actionCenter.ReportUnhandledException;

                                            var window = new MainWindow(settings)
                                            {
                                                DataContext = new MainWindowViewModel(settings,
                                                                                      dataSources,
                                                                                      quickFilters,
                                                                                      actionCenter,
                                                                                      updater,
                                                                                      taskScheduler,
                                                                                      analysisStorage,
                                                                                      uiDispatcher,
                                                                                      pluginSystem)
                                            };

                                            settings.MainWindow.RestoreTo(window);

                                            window.Show();
                                            mutex.SetListener(window);

                                            return(application.Run());
                                        }
                    }
                }
        }