Ejemplo n.º 1
0
 public Downloader(
     IConsoleService console,
     ISettingsStorage settings)
 {
     _console  = console;
     _settings = settings;
 }
        public ListInformation([NotNull] IConsoleService console, [NotNull] ICheckerService checkerService) : base("list-information", "list")
        {
            Console        = console;
            CheckerService = checkerService;

            Shortcut = "l";
        }
Ejemplo n.º 3
0
        protected static void WriteExitCodeList(IConsoleService console, string title, Func <ExitCode, bool> exitCodePredicate)
        {
            var exitCodes = (from field in typeof(ExitCode).GetFields(BindingFlags.Public | BindingFlags.Static)
                             let attr = field.GetCustomAttribute <ReturnableExitCodeAttribute>()
                                        where attr != null
                                        let code = (ExitCode)field.GetValue(null) !
                                                   where exitCodePredicate(code)
                                                   let decimalCode = ((int)code).ToString()
                                                                     let hexCode = "0x" + Convert.ToString((int)code, 16).PadLeft(8, '0')
                                                                                   select(decimalCode, hexCode, description: attr.Description)).ToArray();

            console.WriteLine();
            console.WriteLine($"{title}:");
            if (exitCodes.Length == 0)
            {
                console.WriteLine("   In this category no exit codes are returned.");
            }
            else
            {
                new TableControl(console)
                {
                    Margin            = new(3, 0, 0, 0),
                    ShowColumnHeaders = false,
                    Columns           =
                    {
                        new() { WidthMode = ColumnWidthMode.Auto },
                        new() { WidthMode = ColumnWidthMode.Auto },
                        new() { WidthMode = ColumnWidthMode.Star },
                    },
Ejemplo n.º 4
0
        public MainWindow(IGenerator generator, ICallService callService, IAgentService agentService, IConsoleService consoleService, IOptions <AppSettings> settings)
        {
            InitializeComponent();

            this.generator      = generator;
            this.callService    = callService;
            this.consoleService = consoleService;
            this.agentService   = agentService;
            this.settings       = settings.Value;

            var allAgents = agentService.GetAllAgents();

            foreach (var agent in allAgents)
            {
                AgenstList.Items.Add(agent);
            }



            Calls      = new Queue <Call>();
            ActiveCall = new List <Call>();
            var newCalls = callService.GenerateCalls();

            foreach (var call in newCalls)
            {
                Calls.Enqueue(call);
            }


            LogConsole.Items.Add(consoleService.CallInfo(Calls.Count()));
            Task.Factory.StartNew(() =>
            {
                BeginInvokeExample();
            });
        }
Ejemplo n.º 5
0
 public GitHubService(IConsoleService consoleService, IProgressService progressService, Dictionary <string, string> configuredKeyValues) : base(new Dictionary <string, string>()
 {
     { GitHubUsername, "GitHub username" },
     { GitHubPassword, "GitHub password" }
 }, consoleService, progressService, configuredKeyValues)
 {
 }
Ejemplo n.º 6
0
        internal static int LoadToGrid(
            List <PpvkFileInfo> data,
            ICollection <ColumnInfo> columns,
            DataGridView actGridView,
            IConsoleService console = null)
        {
            try
            {
                actGridView.Rows.Clear();
                foreach (var flatAct in data)
                {
                    var index = actGridView.Rows.Add();
                    foreach (var e in columns)
                    {
                        var value      = flatAct.GetType().GetProperty(e.Name)?.GetValue(flatAct, null);
                        var isDateType = flatAct.GetType().GetProperty(e.Name)?.PropertyType == typeof(DateTime);
                        var res        = DateTime.TryParse(value?.ToString(), out var buf)
                            ? (buf.Equals(DateTime.MinValue) ? String.Empty : buf.ToString())
                            : string.Empty;
                        actGridView.Rows[index].Cells[e.Name].Value = isDateType ? res : value;
                    }
                }

                return(data.Count);
            }
            catch (Exception e)
            {
                console?.AddException(e);
                return(0);
            }
        }
Ejemplo n.º 7
0
 public FolderService(IConsoleService consoleService, IProgressService progressService, Dictionary <string, string> configuredKeyValues) : base(new Dictionary <string, string>()
 {
     { Folder, "Folder" },
     { Zipping, "Zip Folder (enter y if you want the folder to be zipped)" }
 }, consoleService, progressService, configuredKeyValues)
 {
 }
Ejemplo n.º 8
0
        private static void AddServiceMetadata(
            ISettingsStorage settings,
            IConsoleService console,
            ServiceHost host)
        {
            try
            {
                if (bool.TryParse(settings[ArgsKeyList.IsDebugMode], out bool isDebug) &&
                    isDebug)
                {
                    var smb = new ServiceMetadataBehavior
                    {
                        HttpGetEnabled = true,
                        HttpGetUrl     =
                            new Uri(
                                $"http://{settings[ArgsKeyList.ServerName]}:{settings[ArgsKeyList.Port]}/mex")
                    };

                    host.Description.Behaviors.Add(smb);
                }
            }
            catch (Exception e)
            {
                console?.AddException(e);
                console?.AddEvent("MEX does not activated.", ConsoleMessageType.Information);
            }
        }
Ejemplo n.º 9
0
        public MainForm(
            IUnityContainer container,
            ISettingsStorage settings,
            IConsoleService console)
        {
            _container = container;
            _settings = settings;
            _console = console;
            if (container.Registrations.Any(a => a.RegisteredType == typeof(UpdateClient)))
                _updateClient = container.Resolve<UpdateClient>();
            InitializeComponent();
            TopLevel = true;

            IntitForms();

            // Администрирование
            settingsToolStripMenuItem.Click += (s, e) => StartForm("EditorSettingsStorage");
            nodeRolesToolStripMenuItem.Click += (s, e) => StartForm("PackageAdmining");
            
            openHelpToolStripMenuItem.Click += (s, e) =>
            {
                try
                {
                    var fileName = $"..\\docs\\help.pdf";
                    if (!File.Exists(fileName))
                        throw new FileNotFoundException("Help.pdf not found");
                    System.Diagnostics.Process.Start(fileName);
                }
                catch (Exception ex)
                {
                    _console.AddException(ex);
                }
            };
        }
Ejemplo n.º 10
0
        internal static int LoadToGrid(
            ICollection <FlatAct> data,
            ICollection <ColumnInfo> columns,
            DataGridView actGridView,
            IConsoleService console = null)
        {
            try
            {
                actGridView.Rows.Clear();
                foreach (var flatAct in data)
                {
                    var index = actGridView.Rows.Add();
                    foreach (var e in columns)
                    {
                        actGridView.Rows[index].Cells[e.Name].Value =
                            flatAct.GetType().GetProperty(e.Name)?.GetValue(flatAct, null);
                    }
                }

                return(data.Count);
            }
            catch (Exception e)
            {
                console?.AddException(e);
                return(0);
            }
        }
Ejemplo n.º 11
0
 private void OnError(IConsoleService console)
 {
     if (_trigger != null)
     {
         _trigger.ErrorNotifier.ShowErrorWarning();
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Create an instance of the hosting class
        /// </summary>
        /// <param name="target">target instance</param>
        public SOSHost(ITarget target)
        {
            Target                 = target;
            ConsoleService         = target.Services.GetService <IConsoleService>();
            ModuleService          = target.Services.GetService <IModuleService>();
            ThreadService          = target.Services.GetService <IThreadService>();
            MemoryService          = target.Services.GetService <IMemoryService>();
            _ignoreAddressBitsMask = MemoryService.SignExtensionMask();

            string rid = InstallHelper.GetRid();

            SOSPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), rid);

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                var debugClient = new DebugClient(this);
                _interface = debugClient.IDebugClient;
            }
            else
            {
                var lldbServices = new LLDBServices(this);
                _interface = lldbServices.ILLDBServices;
            }
            _hostWrapper = new HostWrapper(target.Host);
            _hostWrapper.AddServiceWrapper(SymbolServiceWrapper.IID_ISymbolService, () => new SymbolServiceWrapper(target.Host));
        }
Ejemplo n.º 13
0
        public ServiceHostStart(string[] serviceNames, IConsoleService[] consoleServices)
        {            
            var runServices = Config.GetServiceConfigList().Where(c => serviceNames.Contains(c.Item.Key)).ToArray();
            //var runServices = Config.GetServiceConfigList();
            
            if (Config.IsConsoleMode)
            {
                foreach (var sc in runServices)
                {
                    Log.Info(sc.Item.Key);
                    Log.Info(string.Format("{0}: {1}", "HostTypeDeclaration", sc.Item.HostTypeDeclaration));
                    Log.Info(string.Format("{0}: {1}", "HostTypeFullname", sc.Item.HostTypeFullname));
                    Log.Info(string.Format("{0}: {1}", "HostTypeAssembly", sc.Item.HostTypeAssembly));
                    Log.Info(string.Format("{0}: {1}", "ContractTypeDeclaration", sc.Item.ContractTypeDeclaration));
                    Log.Info(string.Format("{0}: {1}", "ContractTypeFullname", sc.Item.ContractTypeFullname));
                    Log.Info(string.Format("{0}: {1}", "ContractTypeAssembly", sc.Item.ContractTypeAssembly));
                    Log.Info(string.Format("{0}: {1}", "ServiceAddressPort", sc.Item.ServiceAddressPort));
                    Log.Info(string.Format("{0}: {1}", "EndpointName", sc.Item.EndpointName));
                    Log.Info(string.Format("{0}: {1}", "AuthorizedGroups", sc.Item.AuthorizedGroups));                   
                }

                sr = new ServiceRunner(runServices);   
             
                // console services
                List<IConsoleService> consoleServiceList = new List<IConsoleService>();
                consoleServiceList.AddRange(consoleServices);
                if (consoleServices != null && consoleServices.Any())
                    sr.AddConsoleServices(consoleServiceList);
            }           
        }
Ejemplo n.º 14
0
 public Builder([NotNull] IConfiguration configuration, [NotNull] IConsoleService console, [NotNull] IFactory factory, [NotNull] IFileSystem fileSystem, [NotNull] IProjectService projectService, [NotNull, ItemNotNull, ImportMany] IEnumerable <ITask> tasks) : base(configuration, tasks)
 {
     Console        = console;
     FileSystem     = fileSystem;
     ProjectService = projectService;
     Factory        = factory;
 }
Ejemplo n.º 15
0
 public Proxy(
     IConsoleService console,
     ISettingsStorage settings)
 {
     _console  = console;
     _settings = settings;
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Create an instance of the hosting class. Has the lifetime of the target. Depends on the
        /// context service for the current thread and runtime.
        /// </summary>
        /// <param name="services">service provider</param>
        public SOSHost(IServiceProvider services)
        {
            Services      = services;
            Target        = services.GetService <ITarget>() ?? throw new DiagnosticsException("No target");
            TargetWrapper = new TargetWrapper(services);
            Target.DisposeOnDestroy(this);
            ConsoleService = services.GetService <IConsoleService>();
            ModuleService  = services.GetService <IModuleService>();
            ThreadService  = services.GetService <IThreadService>();
            MemoryService  = services.GetService <IMemoryService>();
            TargetWrapper.ServiceWrapper.AddServiceWrapper(SymbolServiceWrapper.IID_ISymbolService, () => new SymbolServiceWrapper(services.GetService <ISymbolService>(), MemoryService));
            _ignoreAddressBitsMask = MemoryService.SignExtensionMask();
            _sosLibrary            = services.GetService <SOSLibrary>();

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                var debugClient = new DebugClient(this);
                _interface = debugClient.IDebugClient;
            }
            else
            {
                var lldbServices = new LLDBServices(this);
                _interface = lldbServices.ILLDBServices;
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Create an instance of the hosting class
        /// </summary>
        /// <param name="serviceProvider">Service provider</param>
        public SOSHost(IServiceProvider serviceProvider)
        {
            DataTarget dataTarget = serviceProvider.GetService <DataTarget>();

            DataReader       = dataTarget.DataReader;
            _console         = serviceProvider.GetService <IConsoleService>();
            AnalyzeContext   = serviceProvider.GetService <AnalyzeContext>();
            _memoryService   = serviceProvider.GetService <MemoryService>();
            _registerService = serviceProvider.GetService <RegisterService>();
            _versionCache    = new ReadVirtualCache(_memoryService);

            string rid = InstallHelper.GetRid();

            SOSPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), rid);
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                var debugClient = new DebugClient(this);
                _ccw       = debugClient;
                _interface = debugClient.IDebugClient;
            }
            else
            {
                var lldbServices = new LLDBServices(this);
                _ccw       = lldbServices;
                _interface = lldbServices.ILLDBServices;
            }
        }
Ejemplo n.º 18
0
 public CommonTargets(ILoggerFactory loggerFactory, Options options, IProcessHelper processHelper, IConsoleService consoleService)
 {
     this.logger         = loggerFactory.CreateLogger(nameof(CommonTargets));
     this.options        = options;
     this.processHelper  = processHelper;
     this.consoleService = consoleService;
 }
Ejemplo n.º 19
0
 public BackupWorkflow(IConsoleService consoleService, IProgressService progressService,
                       IStorageService storageService)
 {
     _consoleService  = consoleService;
     _storageService  = storageService;
     _progressService = progressService;
 }
Ejemplo n.º 20
0
        private static Binding GetCustomBinding(
            ISettingsStorage settings,
            IConsoleService console)
        {
            var tcpBinding = GetNetBinding(console);

            try
            {
                var binding = (CustomBinding)Activator.CreateInstance(
                    typeof(CustomBinding), tcpBinding);
                var rbe = new ReliableSessionBindingElement();
                binding.Elements.Add(rbe);
                var bme = Activator.CreateInstance <BinaryMessageEncodingBindingElement>();
                bme.CompressionFormat = CompressionFormat.GZip;
                binding.Elements.Add(bme);
                var tf = Activator.CreateInstance <TransactionFlowBindingElement>();
                binding.Elements.Add(tf);

                return(binding);
            }
            catch (Exception e)
            {
                console?.AddException(e);
                return(tcpBinding);
            }
        }
Ejemplo n.º 21
0
        public void QueryFormatsAsExpected()
        {
            IConsoleService console = Substitute.For <IConsoleService>();

            console.QueryYesNo("Foo{0}", "bar").Should().BeFalse();
            console.Received(1).Write("Foobar [yes/no] \n");
        }
 public GeneratedPackagesService(IModeDeploimentService modeDeploimentService,
                                 IBackupFile backupFile,
                                 IConsoleService consoleService,
                                 IUpdateFileService updateFileService,
                                 ICmdCordovaService cmdCordovaService,
                                 IConfigurationService configurationService,
                                 ISelectPathDirectoryService selectPathDirectoryService,
                                 IEventAggregator eventAggregator,
                                 ILoggerService loggerService)
 {
     _modeDeploimentService      = modeDeploimentService;
     _backupFile                 = backupFile;
     _consoleService             = consoleService;
     _updateFileService          = updateFileService;
     _cmdCordovaService          = cmdCordovaService;
     _configurationService       = configurationService;
     _selectPathDirectoryService = selectPathDirectoryService;
     _eventAggregator            = eventAggregator;
     _loggerService              = loggerService;
     _config = _configurationService.GetConfig();
     if (!_eventAggregator.GetEvent <CmdIsFinishEvent>().Contains(OnFinishRecevied))
     {
         _eventAggregator.GetEvent <CmdIsFinishEvent>().Subscribe(OnFinishRecevied, false);
     }
 }
Ejemplo n.º 23
0
 public ApplicationService(
     IConsoleService consoleService,
     IGameService gameService)
 {
     _consoleService = consoleService;
     _gameService    = gameService;
 }
Ejemplo n.º 24
0
        public void AnswersReturnExpected(string answer, bool expected)
        {
            IConsoleService console = Substitute.For <IConsoleService>();

            console.ReadLine().Returns(answer);
            console.QueryYesNo(String.Empty).Should().Be(expected);
        }
Ejemplo n.º 25
0
 public Interactions(
     IEnumerable <IPlugin> plugins,
     IConsoleService consoleService)
 {
     _plugins        = plugins;
     _consoleService = consoleService;
 }
Ejemplo n.º 26
0
 protected ConfigureService(Dictionary <string, string> allKeyValues, IConsoleService consoleService, IProgressService progressService, Dictionary <string, string> configuredKeyValues)
 {
     AllKeyValues        = allKeyValues;
     ConsoleService      = consoleService;
     ProgressService     = progressService;
     ConfiguredKeyValues = configuredKeyValues;
 }
 public Md5HashComputerFiles(
     IWorkFlowProducerConsumer consumer,
     ISettingsStorage settings,
     IConsoleService console)
     : base(consumer, settings, console)
 {
     _console.AddEvent($"{nameof(Md5HashComputerFiles)} ready.");
 }
Ejemplo n.º 28
0
 public Router(INzbDroneServiceFactory nzbDroneServiceFactory, IServiceProvider serviceProvider,
                 IConsoleService consoleService, Logger logger)
 {
     _nzbDroneServiceFactory = nzbDroneServiceFactory;
     _serviceProvider = serviceProvider;
     _consoleService = consoleService;
     _logger = logger;
 }
Ejemplo n.º 29
0
 public Router(INzbDroneServiceFactory nzbDroneServiceFactory, IServiceProvider serviceProvider,
               IConsoleService consoleService, Logger logger)
 {
     _nzbDroneServiceFactory = nzbDroneServiceFactory;
     _serviceProvider        = serviceProvider;
     _consoleService         = consoleService;
     _logger = logger;
 }
Ejemplo n.º 30
0
 public Factory([NotNull] IConfiguration configuration, [NotNull] ICompositionService compositionService, [NotNull] ITraceService trace, [NotNull] IConsoleService console, [NotNull] IFileSystem fileSystem)
 {
     Configuration      = configuration;
     CompositionService = compositionService;
     Trace      = trace;
     Console    = console;
     FileSystem = fileSystem;
 }
Ejemplo n.º 31
0
 public SaveForAfcFiles(
     IWorkFlowProducerConsumer consumer,
     ISettingsStorage settings,
     IConsoleService console)
     : base(consumer, settings, console)
 {
     _console.AddEvent($"{nameof(SaveForAfcFiles)} ready.");
 }
Ejemplo n.º 32
0
 public ActDataHeating(
     DbContext context,
     IConsoleService console)
 {
     _console = console;
     _context = (ModelContext)context;
     StartTask();
 }
        public void Initialize(StereoCameraCalibrationModel calibration, IConsoleService consoleService)
        {
            Calibration = calibration;

            _capture1 = new TrackerService(consoleService);
            _capture1.Initialize(Calibration.Camera1);
            _capture2 = new TrackerService(consoleService);
            _capture2.Initialize(Calibration.Camera2);
        }
        public ConsoleViewModel(IConsoleService consoleService)
        {
            Argument.IsNotNull(() => consoleService);

            Output = string.Empty;

            _consoleService = consoleService;
            _consoleService.LogMessage += OnConsoleServiceLogMessage;
        }
Ejemplo n.º 35
0
 public Router(INzbDroneServiceFactory nzbDroneServiceFactory, IServiceProvider serviceProvider, IStartupArguments startupArguments,
                 IConsoleService consoleService, IRuntimeInfo runtimeInfo, Logger logger)
 {
     _nzbDroneServiceFactory = nzbDroneServiceFactory;
     _serviceProvider = serviceProvider;
     _startupArguments = startupArguments;
     _consoleService = consoleService;
     _runtimeInfo = runtimeInfo;
     _logger = logger;
 }
Ejemplo n.º 36
0
        public CameraViewModel(
            CameraModel camera, 
            ITrackerService trackerService, 
            ICameraService cameraService, 
            IConsoleService consoleService,
            HelixCameraVisualizationService visualizationService)
        {
            Camera = camera;
            TrackerService = trackerService;
            CameraService = cameraService;
            ConsoleService = consoleService;
            VisualizationService = visualizationService;

            CameraService.Initialize(Camera);
            TrackerService.Initialize(Camera);
            VisualizationService.Initialize(Camera);

            if (!IsInDesignMode)
            {
                Messenger.Default.Register<AddMotionControllerMessage>(this,
                    message =>
                    {
                        TrackerService.AddMotionController(message.MotionController);
                    });

                Messenger.Default.Register<RemoveMotionControllerMessage>(this,
                    message =>
                    {
                        TrackerService.RemoveMotionController(message.MotionController);
                    });

                // add existing controllers
                foreach (MotionControllerViewModel mcvw in SimpleIoc.Default.GetAllCreatedInstances<MotionControllerViewModel>())
                {
                    TrackerService.AddMotionController(mcvw.MotionController);
                }

                SimpleIoc.Default.Register(() => this, Camera.GUID, true);
                Messenger.Default.Send(new AddCameraMessage(Camera));
                // try loading previously saved configurations for this camera
                SimpleIoc.Default.GetInstance<ISettingsService>().LoadCamera(camera);
                Camera.Calibration = SimpleIoc.Default.GetInstance<SettingsViewModel>().SettingsService.LoadCalibration(Camera.GUID);
            }
        }
 private void ConsoleOnUpdated(IConsoleService console)
 {
     SetIsDirty();
 }
 public WorkFlowManager(IFactory factory)
 {
     _commandLineParser = factory.CommandLineParser;
     _fileSystem = factory.FileSystem;
     _consoleService = factory.ConsoleService;
 }
Ejemplo n.º 39
0
 public InteractiveTask(string prompt, ITaskRegistry registry, IConsoleService consoleService = null)
 {
     this.prompt = prompt;
     this.registry = registry;
     this.consoleService = consoleService ?? ConsoleHelper.Console;
 }
Ejemplo n.º 40
0
 public StatusAppender(IConsoleService console, string status)
 {
     _console = console;
     _originalTitle = _console.Title;
     _console.Title = string.Format(CultureInfo.CurrentUICulture, "{0}: {1}", _originalTitle, status);
 }
 public ConsoleInputReader(IConsoleService consoleService)
 {
     _consoleService = consoleService;
 }
Ejemplo n.º 42
0
 public StatusAppender(IConsoleService console, string status)
 {
     this.console = console;
     this.originalTitle = this.console.Title;
     this.console.Title = String.Format(CultureInfo.CurrentUICulture, "{0}: {1}", this.originalTitle, status);
 }
Ejemplo n.º 43
0
 public ClEyeService(IConsoleService consoleService)
 {
     ConsoleService = consoleService;
 }
 public IInputFactory WithConsoleService(IConsoleService consoleService)
 {
     _consoleService = consoleService;
     return this;
 }
Ejemplo n.º 45
0
 public void Initialize(IConsoleService consoleService, ServerModel server)
 {
     ConsoleService = consoleService;
     Server = server;
 }
Ejemplo n.º 46
0
 public TrackerService(IConsoleService consoleService)
 {
     ConsoleService = consoleService;
 }
Ejemplo n.º 47
0
 public void Initialize(IConsoleService consoleService,  ServerModel server, CamerasModel cameras)
 {
     base.Initialize(consoleService, server);
     _cameras = cameras;
 }
 private void ConsoleOnUpdated(IConsoleService console)
 {
     _isDirty = true;
 }
Ejemplo n.º 49
0
 public ServerService(IConsoleService consoleService, ServerModel server, CamerasModel cameras)
 {
     Initialize(consoleService, server, cameras);
 }
Ejemplo n.º 50
0
 public ConsoleServiceClient(IConsoleService service)
 {
     this.c = service;
 }