コード例 #1
0
 public Downloader(
     IConsoleService console,
     ISettingsStorage settings)
 {
     _console  = console;
     _settings = settings;
 }
コード例 #2
0
        public ListInformation([NotNull] IConsoleService console, [NotNull] ICheckerService checkerService) : base("list-information", "list")
        {
            Console        = console;
            CheckerService = checkerService;

            Shortcut = "l";
        }
コード例 #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 },
                    },
コード例 #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();
            });
        }
コード例 #5
0
ファイル: GitHubService.cs プロジェクト: famoser/archive
 public GitHubService(IConsoleService consoleService, IProgressService progressService, Dictionary <string, string> configuredKeyValues) : base(new Dictionary <string, string>()
 {
     { GitHubUsername, "GitHub username" },
     { GitHubPassword, "GitHub password" }
 }, consoleService, progressService, configuredKeyValues)
 {
 }
コード例 #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);
            }
        }
コード例 #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)
 {
 }
コード例 #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);
            }
        }
コード例 #9
0
ファイル: MainForm.cs プロジェクト: Ekstrem/OverWeightControl
        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);
                }
            };
        }
コード例 #10
0
ファイル: FlatAct.cs プロジェクト: Ekstrem/OverWeightControl
        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);
            }
        }
コード例 #11
0
 private void OnError(IConsoleService console)
 {
     if (_trigger != null)
     {
         _trigger.ErrorNotifier.ShowErrorWarning();
     }
 }
コード例 #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));
        }
コード例 #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);
            }           
        }
コード例 #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;
 }
コード例 #15
0
 public Proxy(
     IConsoleService console,
     ISettingsStorage settings)
 {
     _console  = console;
     _settings = settings;
 }
コード例 #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;
            }
        }
コード例 #17
0
ファイル: SOSHost.cs プロジェクト: nissims/diagnostics
        /// <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;
            }
        }
コード例 #18
0
ファイル: CommonTargets.cs プロジェクト: laupas/starterkit
 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;
 }
コード例 #19
0
 public BackupWorkflow(IConsoleService consoleService, IProgressService progressService,
                       IStorageService storageService)
 {
     _consoleService  = consoleService;
     _storageService  = storageService;
     _progressService = progressService;
 }
コード例 #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);
            }
        }
コード例 #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");
        }
コード例 #22
0
 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);
     }
 }
コード例 #23
0
 public ApplicationService(
     IConsoleService consoleService,
     IGameService gameService)
 {
     _consoleService = consoleService;
     _gameService    = gameService;
 }
コード例 #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);
        }
コード例 #25
0
 public Interactions(
     IEnumerable <IPlugin> plugins,
     IConsoleService consoleService)
 {
     _plugins        = plugins;
     _consoleService = consoleService;
 }
コード例 #26
0
ファイル: ConfigureService.cs プロジェクト: famoser/archive
 protected ConfigureService(Dictionary <string, string> allKeyValues, IConsoleService consoleService, IProgressService progressService, Dictionary <string, string> configuredKeyValues)
 {
     AllKeyValues        = allKeyValues;
     ConsoleService      = consoleService;
     ProgressService     = progressService;
     ConfiguredKeyValues = configuredKeyValues;
 }
コード例 #27
0
 public Md5HashComputerFiles(
     IWorkFlowProducerConsumer consumer,
     ISettingsStorage settings,
     IConsoleService console)
     : base(consumer, settings, console)
 {
     _console.AddEvent($"{nameof(Md5HashComputerFiles)} ready.");
 }
コード例 #28
0
ファイル: Router.cs プロジェクト: BubbaFatAss/NzbDrone
 public Router(INzbDroneServiceFactory nzbDroneServiceFactory, IServiceProvider serviceProvider,
                 IConsoleService consoleService, Logger logger)
 {
     _nzbDroneServiceFactory = nzbDroneServiceFactory;
     _serviceProvider = serviceProvider;
     _consoleService = consoleService;
     _logger = logger;
 }
コード例 #29
0
 public Router(INzbDroneServiceFactory nzbDroneServiceFactory, IServiceProvider serviceProvider,
               IConsoleService consoleService, Logger logger)
 {
     _nzbDroneServiceFactory = nzbDroneServiceFactory;
     _serviceProvider        = serviceProvider;
     _consoleService         = consoleService;
     _logger = logger;
 }
コード例 #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;
 }
コード例 #31
0
 public SaveForAfcFiles(
     IWorkFlowProducerConsumer consumer,
     ISettingsStorage settings,
     IConsoleService console)
     : base(consumer, settings, console)
 {
     _console.AddEvent($"{nameof(SaveForAfcFiles)} ready.");
 }
コード例 #32
0
 public ActDataHeating(
     DbContext context,
     IConsoleService console)
 {
     _console = console;
     _context = (ModelContext)context;
     StartTask();
 }
コード例 #33
0
        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);
        }
コード例 #34
0
        public ConsoleViewModel(IConsoleService consoleService)
        {
            Argument.IsNotNull(() => consoleService);

            Output = string.Empty;

            _consoleService = consoleService;
            _consoleService.LogMessage += OnConsoleServiceLogMessage;
        }
コード例 #35
0
ファイル: Router.cs プロジェクト: peterlandry/NzbDrone
 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;
 }
コード例 #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);
            }
        }
コード例 #37
0
 private void ConsoleOnUpdated(IConsoleService console)
 {
     SetIsDirty();
 }
コード例 #38
0
 public WorkFlowManager(IFactory factory)
 {
     _commandLineParser = factory.CommandLineParser;
     _fileSystem = factory.FileSystem;
     _consoleService = factory.ConsoleService;
 }
コード例 #39
0
ファイル: InteractiveTask.cs プロジェクト: Priya91/XTask
 public InteractiveTask(string prompt, ITaskRegistry registry, IConsoleService consoleService = null)
 {
     this.prompt = prompt;
     this.registry = registry;
     this.consoleService = consoleService ?? ConsoleHelper.Console;
 }
コード例 #40
0
ファイル: ConsoleHelper.cs プロジェクト: JeremyKuhne/XTask
 public StatusAppender(IConsoleService console, string status)
 {
     _console = console;
     _originalTitle = _console.Title;
     _console.Title = string.Format(CultureInfo.CurrentUICulture, "{0}: {1}", _originalTitle, status);
 }
コード例 #41
0
 public ConsoleInputReader(IConsoleService consoleService)
 {
     _consoleService = consoleService;
 }
コード例 #42
0
ファイル: ConsoleHelper.cs プロジェクト: ramarag/XTask
 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);
 }
コード例 #43
0
 public ClEyeService(IConsoleService consoleService)
 {
     ConsoleService = consoleService;
 }
コード例 #44
0
 public IInputFactory WithConsoleService(IConsoleService consoleService)
 {
     _consoleService = consoleService;
     return this;
 }
コード例 #45
0
 public void Initialize(IConsoleService consoleService, ServerModel server)
 {
     ConsoleService = consoleService;
     Server = server;
 }
コード例 #46
0
 public TrackerService(IConsoleService consoleService)
 {
     ConsoleService = consoleService;
 }
コード例 #47
0
 public void Initialize(IConsoleService consoleService,  ServerModel server, CamerasModel cameras)
 {
     base.Initialize(consoleService, server);
     _cameras = cameras;
 }
コード例 #48
0
 private void ConsoleOnUpdated(IConsoleService console)
 {
     _isDirty = true;
 }
コード例 #49
0
 public ServerService(IConsoleService consoleService, ServerModel server, CamerasModel cameras)
 {
     Initialize(consoleService, server, cameras);
 }
コード例 #50
0
 public ConsoleServiceClient(IConsoleService service)
 {
     this.c = service;
 }