public ExternalSearchService(IAppConfiguration config, IDiagnosticsService diagnostics)
        {
            ServiceUri = config.ServiceDiscoveryUri;

            Trace = diagnostics.SafeGetSource("ExternalSearchService");

            // Extract credentials
            var userInfo = ServiceUri.UserInfo;
            ICredentials credentials = null;
            if (!String.IsNullOrEmpty(userInfo))
            {
                var split = userInfo.Split(':');
                if (split.Length != 2)
                {
                    throw new FormatException("Invalid user info in SearchServiceUri!");
                }

                // Split the credentials out
                credentials = new NetworkCredential(split[0], split[1]);
                ServiceUri = new UriBuilder(ServiceUri)
                {
                    UserName = null,
                    Password = null
                }.Uri;
            }

            if (_healthIndicatorStore == null)
            {
                _healthIndicatorStore = new BaseUrlHealthIndicatorStore(new AppInsightsHealthIndicatorLogger());
            }

            _client = new SearchClient(ServiceUri, config.SearchServiceResourceType, credentials, _healthIndicatorStore, new TracingHttpHandler(Trace));
        }
示例#2
0
 public Processor(IRegisters registers, IIntreruptQueue intreruptQueue, IMemory memory, IDiagnosticsService diagnosticsService)
 {
     _registers          = registers;
     _intreruptQueue     = intreruptQueue;
     _memory             = memory;
     _diagnosticsService = diagnosticsService;
 }
示例#3
0
        public ExternalSearchService(IAppConfiguration config, IDiagnosticsService diagnostics)
        {
            ServiceUri = config.SearchServiceUri;
            Trace      = diagnostics.SafeGetSource("ExternalSearchService");

            // Extract credentials
            var          userInfo    = ServiceUri.UserInfo;
            ICredentials credentials = null;

            if (!String.IsNullOrEmpty(userInfo))
            {
                var split = userInfo.Split(':');
                if (split.Length != 2)
                {
                    throw new FormatException("Invalid user info in SearchServiceUri!");
                }

                // Split the credentials out
                credentials = new NetworkCredential(split[0], split[1]);
                ServiceUri  = new UriBuilder(ServiceUri)
                {
                    UserName = null,
                    Password = null
                }.Uri;
            }

            _client = new SearchClient(ServiceUri, credentials, new TracingHttpHandler(Trace));
        }
示例#4
0
        public PackageUploadService(
            IPackageService packageService,
            IPackageFileService packageFileService,
            IEntitiesContext entitiesContext,
            IReservedNamespaceService reservedNamespaceService,
            IValidationService validationService,
            ICoreLicenseFileService coreLicenseFileService,
            ICoreReadmeFileService coreReadmeFileService,
            IDiagnosticsService diagnosticsService,
            IPackageVulnerabilitiesManagementService vulnerabilityService,
            IPackageMetadataValidationService metadataValidationService)
        {
            _packageService           = packageService ?? throw new ArgumentNullException(nameof(packageService));
            _packageFileService       = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
            _entitiesContext          = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
            _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
            _validationService        = validationService ?? throw new ArgumentNullException(nameof(validationService));
            _coreLicenseFileService   = coreLicenseFileService ?? throw new ArgumentNullException(nameof(coreLicenseFileService));
            _coreReadmeFileService    = coreReadmeFileService ?? throw new ArgumentNullException(nameof(coreReadmeFileService));

            if (diagnosticsService == null)
            {
                throw new ArgumentNullException(nameof(diagnosticsService));
            }
            _vulnerabilityService      = vulnerabilityService ?? throw new ArgumentNullException(nameof(vulnerabilityService));
            _metadataValidationService = metadataValidationService ?? throw new ArgumentNullException(nameof(metadataValidationService));
        }
        public PythonAnalyzerSession(IServiceContainer services,
                                     IProgressReporter progress,
                                     Action <Task> startNextSession,
                                     CancellationToken analyzerCancellationToken,
                                     IDependencyChainWalker <AnalysisModuleKey, PythonAnalyzerEntry> walker,
                                     int version,
                                     PythonAnalyzerEntry entry,
                                     bool forceGC = false)
        {
            _services         = services;
            _startNextSession = startNextSession;

            _analyzerCancellationToken = analyzerCancellationToken;
            Version = version;
            AffectedEntriesCount = walker?.AffectedValues.Count ?? 1;
            _walker  = walker;
            _entry   = entry;
            _state   = State.NotStarted;
            _forceGC = forceGC;

            _diagnosticsService = _services.GetService <IDiagnosticsService>();
            _platformService    = _services.GetService <IOSPlatform>();
            _analyzer           = _services.GetService <IPythonAnalyzer>();
            _log = _services.GetService <ILogger>();
            _moduleDatabaseService = _services.GetService <IModuleDatabaseService>();
            _progress = progress;

            var interpreter = _services.GetService <IPythonInterpreter>();

            _modulesPathResolver  = interpreter.ModuleResolution.CurrentPathResolver;
            _typeshedPathResolver = interpreter.TypeshedResolution.CurrentPathResolver;
        }
 public DiagnosticsController(IDiagnosticsService diagnosticsService,
     IDiagnosticsMapper diagnosticsMapper, ICookieParser cookieParser)
 {
     _diagnosticsService = diagnosticsService;
     _diagnosticsMapper = diagnosticsMapper;
     _cookieParser = cookieParser;
 }
        public DiagnosticsViewModel(IDiagnosticsService diagnosticsService, ISchedulerService schedulerService)
        {
            Cpu           = Constants.UI.Diagnostics.DefaultCpuString;
            ManagedMemory = Constants.UI.Diagnostics.DefaultManagedMemoryString;
            TotalMemory   = Constants.UI.Diagnostics.DefaultTotalMemoryString;

            diagnosticsService.Cpu
            .Select(x => FormatCpu(x))
            .DistinctUntilChanged()
            .ObserveOn(schedulerService.Dispatcher)
            .Subscribe(x => Cpu = x,
                       e =>
            {
                Logger.Error(e);
                Cpu = Constants.UI.Diagnostics.DefaultCpuString;
            })
            .DisposeWith(this);

            diagnosticsService.Memory
            .Select(x => FormatMemory(x))
            .DistinctUntilChanged()
            .ObserveOn(schedulerService.Dispatcher)
            .Subscribe(x =>
            {
                ManagedMemory = x.ManagedMemory;
                TotalMemory   = x.TotalMemory;
            },
                       e =>
            {
                Logger.Error(e);
                ManagedMemory = Constants.UI.Diagnostics.DefaultManagedMemoryString;
                TotalMemory   = Constants.UI.Diagnostics.DefaultTotalMemoryString;
            })
            .DisposeWith(this);
        }
示例#8
0
 public DiagnosticsController(IDiagnosticsService diagnosticsService,
                              IDiagnosticsMapper diagnosticsMapper, ICookieParser cookieParser)
 {
     _diagnosticsService = diagnosticsService;
     _diagnosticsMapper  = diagnosticsMapper;
     _cookieParser       = cookieParser;
 }
示例#9
0
 public UserService(
     IAppConfiguration config,
     IEntityRepository <User> userRepository,
     IEntityRepository <Credential> credentialRepository,
     IEntityRepository <Organization> organizationRepository,
     IAuditingService auditing,
     IEntitiesContext entitiesContext,
     IContentObjectService contentObjectService,
     ISecurityPolicyService securityPolicyService,
     IDateTimeProvider dateTimeProvider,
     ICredentialBuilder credentialBuilder,
     ITelemetryService telemetryService,
     IDiagnosticsService diagnosticsService)
     : this()
 {
     Config                 = config;
     UserRepository         = userRepository;
     CredentialRepository   = credentialRepository;
     OrganizationRepository = organizationRepository;
     Auditing               = auditing;
     EntitiesContext        = entitiesContext;
     ContentObjectService   = contentObjectService;
     SecurityPolicyService  = securityPolicyService;
     DateTimeProvider       = dateTimeProvider;
     TelemetryService       = telemetryService;
     DiagnosticsSource      = diagnosticsService.SafeGetSource(nameof(UserService));
 }
示例#10
0
        public PythonAnalyzerSession(IServiceManager services,
                                     IProgressReporter progress,
                                     AsyncManualResetEvent analysisCompleteEvent,
                                     Action <Task> startNextSession,
                                     CancellationToken analyzerCancellationToken,
                                     IDependencyChainWalker <AnalysisModuleKey, PythonAnalyzerEntry> walker,
                                     int version,
                                     PythonAnalyzerEntry entry)
        {
            _services = services;
            _analysisCompleteEvent     = analysisCompleteEvent;
            _startNextSession          = startNextSession;
            _analyzerCancellationToken = analyzerCancellationToken;
            Version = version;
            AffectedEntriesCount = walker?.AffectedValues.Count ?? 1;
            _walker = walker;
            _entry  = entry;
            _state  = State.NotStarted;

            _diagnosticsService = _services.GetService <IDiagnosticsService>();
            _analyzer           = _services.GetService <IPythonAnalyzer>();
            _log       = _services.GetService <ILogger>();
            _telemetry = _services.GetService <ITelemetryService>();
            _progress  = progress;
        }
        public SecurityPolicyService(
            IEntitiesContext entitiesContext,
            IAuditingService auditing,
            IDiagnosticsService diagnostics,
            IAppConfiguration configuration,
            Lazy <IUserService> userService,
            Lazy <IPackageOwnershipManagementService> packageOwnershipManagementService,
            ITelemetryService telemetryService,
            MicrosoftTeamSubscription microsoftTeamSubscription = null)
        {
            EntitiesContext = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
            Auditing        = auditing ?? throw new ArgumentNullException(nameof(auditing));

            if (diagnostics == null)
            {
                throw new ArgumentNullException(nameof(diagnostics));
            }

            Diagnostics                        = diagnostics.SafeGetSource(nameof(SecurityPolicyService));
            Configuration                      = configuration ?? throw new ArgumentNullException(nameof(configuration));
            DefaultSubscription                = new DefaultSubscription();
            MicrosoftTeamSubscription          = microsoftTeamSubscription;
            _packageOwnershipManagementService = packageOwnershipManagementService ?? throw new ArgumentNullException(nameof(packageOwnershipManagementService));
            _userService                       = userService ?? throw new ArgumentNullException(nameof(userService));
            _telemetryService                  = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
        }
        private static ISqlConnectionFactory CreateDbConnectionFactory(IDiagnosticsService diagnostics, string name,
                                                                       string connectionString, ISecretInjector secretInjector)
        {
            var logger = diagnostics.SafeGetSource($"AzureSqlConnectionFactory-{name}");

            return(new AzureSqlConnectionFactory(connectionString, secretInjector, logger));
        }
示例#13
0
 public PackageUploadService(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IReservedNamespaceService reservedNamespaceService,
     IValidationService validationService,
     IAppConfiguration config,
     ITyposquattingService typosquattingService,
     ITelemetryService telemetryService,
     ICoreLicenseFileService coreLicenseFileService,
     IDiagnosticsService diagnosticsService,
     IFeatureFlagService featureFlagService,
     IPackageVulnerabilityService vulnerabilityService)
 {
     _packageService           = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _packageFileService       = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
     _entitiesContext          = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
     _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
     _validationService        = validationService ?? throw new ArgumentNullException(nameof(validationService));
     _config = config ?? throw new ArgumentNullException(nameof(config));
     _typosquattingService   = typosquattingService ?? throw new ArgumentNullException(nameof(typosquattingService));
     _telemetryService       = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
     _coreLicenseFileService = coreLicenseFileService ?? throw new ArgumentNullException(nameof(coreLicenseFileService));
     if (diagnosticsService == null)
     {
         throw new ArgumentNullException(nameof(diagnosticsService));
     }
     _trace = diagnosticsService.GetSource(nameof(PackageUploadService));
     _featureFlagService   = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
     _vulnerabilityService = vulnerabilityService ?? throw new ArgumentNullException(nameof(vulnerabilityService));
 }
示例#14
0
        public AuthenticationService(
            IEntitiesContext entities, IAppConfiguration config, IDiagnosticsService diagnostics,
            IAuditingService auditing, IEnumerable <Authenticator> providers, ICredentialBuilder credentialBuilder,
            ICredentialValidator credentialValidator, IDateTimeProvider dateTimeProvider,
            ILdapService ldapService)
        {
            if (entities == null)
            {
                throw new ArgumentNullException(nameof(entities));
            }

            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (diagnostics == null)
            {
                throw new ArgumentNullException(nameof(diagnostics));
            }

            if (auditing == null)
            {
                throw new ArgumentNullException(nameof(auditing));
            }

            if (providers == null)
            {
                throw new ArgumentNullException(nameof(providers));
            }

            if (credentialBuilder == null)
            {
                throw new ArgumentNullException(nameof(credentialBuilder));
            }

            if (credentialValidator == null)
            {
                throw new ArgumentNullException(nameof(credentialValidator));
            }

            if (dateTimeProvider == null)
            {
                throw new ArgumentNullException(nameof(dateTimeProvider));
            }

            InitCredentialFormatters();

            Entities             = entities;
            _config              = config;
            Auditing             = auditing;
            _trace               = diagnostics.SafeGetSource("AuthenticationService");
            Authenticators       = providers.ToDictionary(p => p.Name, StringComparer.OrdinalIgnoreCase);
            _credentialBuilder   = credentialBuilder;
            _credentialValidator = credentialValidator;
            _dateTimeProvider    = dateTimeProvider;

            this.Ldap = ldapService;
        }
示例#15
0
 public void Configure(NetworkServicesConfig config)
 {
     if (clubPenguinClient != null)
     {
         clubPenguinClient.Destroy();
     }
     clubPenguinClient = new ClubPenguinClient(monoBehaviour, config.CPAPIServicehost, config.CPAPIClientToken, config.ClientApiVersion, config.CPGameServerZone, !offlineMode && config.CPGameServerEncrypted, config.CPGameServerDebug, config.CPLagMonitoring, config.CPGameServerLatencyWindowSize, config.CPWebServiceLatencyWindowSize, config.CPMonitoringServicehost, config.CPWebsiteAPIServicehost, offlineMode);
     currentConfig     = config;
     worldService      = new WorldService();
     worldService.Initialize(clubPenguinClient);
     playerStateService = new PlayerStateService();
     playerStateService.Initialize(clubPenguinClient);
     chatService = new ChatService();
     chatService.Initialize(clubPenguinClient);
     playerActionService = new PlayerActionService();
     playerActionService.Initialize(clubPenguinClient);
     iglooService = new IglooService();
     iglooService.Initialize(clubPenguinClient);
     inventoryService = new InventoryService();
     inventoryService.Initialize(clubPenguinClient);
     breadcrumbService = new BreadcrumbService();
     breadcrumbService.Initialize(clubPenguinClient);
     savedOutfitService = new SavedOutfitService();
     savedOutfitService.Initialize(clubPenguinClient);
     prototypeService = new PrototypeService();
     prototypeService.Initialize(clubPenguinClient);
     questService = new QuestService();
     questService.Initialize(clubPenguinClient);
     consumableService = new ConsumableService();
     consumableService.Initialize(clubPenguinClient);
     friendsService = new FriendsService();
     friendsService.Initialize(clubPenguinClient);
     rewardService = new RewardService();
     rewardService.Initialize(clubPenguinClient);
     taskService = new TaskNetworkService();
     taskService.Initialize(clubPenguinClient);
     minigameService = new MinigameService();
     minigameService.Initialize(clubPenguinClient);
     iapService = new IAPService();
     iapService.Initialize(clubPenguinClient);
     tutorialService = new TutorialService();
     tutorialService.Initialize(clubPenguinClient);
     moderationService = new ModerationService();
     moderationService.Initialize(clubPenguinClient);
     disneyStoreService = new DisneyStoreService();
     disneyStoreService.Initialize(clubPenguinClient);
     newsfeedService = new NewsfeedService();
     newsfeedService.Initialize(clubPenguinClient);
     catalogService = new CatalogService();
     catalogService.Initialize(clubPenguinClient);
     partyGameService = new PartyGameService();
     partyGameService.Initialize(clubPenguinClient);
     scheduledEventService = new ScheduledEventService();
     scheduledEventService.Initialize(clubPenguinClient);
     diagnosticsService = new DiagnosticsService();
     diagnosticsService.Initialize(clubPenguinClient);
     captchaService = new CaptchaService();
     captchaService.Initialize(clubPenguinClient);
 }
示例#16
0
 public CmdLineDriver(IServiceProvider services, ILoader ldr, IDecompiler decompiler)
 {
     this.services      = services;
     this.ldr           = ldr;
     this.decompiler    = decompiler;
     this.config        = services.RequireService <IConfigurationService>();
     this.diagnosticSvc = services.RequireService <IDiagnosticsService>();
 }
示例#17
0
 public void Setup()
 {
     lv = new ListView();
     lv.CreateControl();
     interactor = new TestDiagnosticsInteractor();
     interactor.Attach(lv);
     svc = interactor;
 }
示例#18
0
 public LeImageLoader(IServiceProvider services, string filename, byte[] imgRaw, uint e_lfanew) : base(services, filename, imgRaw)
 {
     diags                = Services.RequireService <IDiagnosticsService>();
     lfaNew               = e_lfanew;
     importStubs          = new Dictionary <uint, Tuple <Address, ImportReference> >();
     imageSymbols         = new SortedList <Address, ImageSymbol>();
     PreferredBaseAddress = Address.Ptr32(0x0010_0000);  //$REVIEW: arbitrary address.
 }
示例#19
0
 public NeImageLoader(IServiceProvider services, string filename, byte[] rawBytes, uint e_lfanew)
     : base(services, filename, rawBytes)
 {
     this.diags        = Services.RequireService <IDiagnosticsService>();
     this.lfaNew       = e_lfanew;
     this.importStubs  = new Dictionary <uint, Tuple <Address, ImportReference> >();
     this.imageSymbols = new SortedList <Address, ImageSymbol>();
 }
示例#20
0
        /// <summary>
        /// Get all the information associated with the specified groups.
        /// </summary>
        /// <param name="commaDelimitedGroups"></param>
        /// <returns></returns>
        public static string GetInfo(params DiagnosticGroup[] groups)
        {
            IDiagnosticsService svc = _serviceCreator();

            svc.FilterOn(true, groups);
            string data = svc.GetDataTextual();

            return(data);
        }
示例#21
0
        /// <summary>
        /// Get all the information associated with the specified groups.
        /// </summary>
        /// <param name="commaDelimitedGroups"></param>
        /// <returns></returns>
        public static string GetInfo(string commaDelimitedGroups)
        {
            IDiagnosticsService svc = _serviceCreator();

            svc.FilterOn(true, commaDelimitedGroups);
            string data = svc.GetDataTextual();

            return(data);
        }
        public SecretReaderFactory(IDiagnosticsService diagnosticsService)
        {
            if (diagnosticsService == null)
            {
                throw new ArgumentNullException(nameof(diagnosticsService));
            }

            _diagnosticsService = diagnosticsService;
        }
示例#23
0
 public CloudBlobFileStorageService(
     ICloudBlobClient client,
     IAppConfiguration configuration,
     ISourceDestinationRedirectPolicy redirectPolicy,
     IDiagnosticsService diagnosticsService) : base(client, diagnosticsService)
 {
     _configuration  = configuration;
     _redirectPolicy = redirectPolicy;
 }
 public CloudBlobCoreFileStorageService(
     ICloudBlobClient client,
     IDiagnosticsService diagnosticsService,
     ICloudBlobContainerInformationProvider cloudBlobFolderInformationProvider)
 {
     _client = client ?? throw new ArgumentNullException(nameof(client));
     _trace  = diagnosticsService?.SafeGetSource(nameof(CloudBlobCoreFileStorageService)) ?? throw new ArgumentNullException(nameof(diagnosticsService));
     _cloudBlobFolderInformationProvider = cloudBlobFolderInformationProvider ?? throw new ArgumentNullException(nameof(cloudBlobFolderInformationProvider));
 }
        public TelemetryService(IDiagnosticsService diagnosticsService)
        {
            if (diagnosticsService == null)
            {
                throw new ArgumentNullException(nameof(diagnosticsService));
            }

            _trace = diagnosticsService.GetSource("TelemetryService");
        }
示例#26
0
        public DiagnosticsViewModel(IDiagnosticsService diagnosticsService, ISchedulerService schedulerService)
        {
            Id = string.Format("Identifier: {0}", Guid.NewGuid());

            Rps           = Constants.DefaultRpsString;
            Cpu           = Constants.DefaultCpuString;
            ManagedMemory = Constants.DefaultManagedMemoryString;
            TotalMemory   = Constants.DefaultTotalMemoryString;

            _log = new RangeObservableCollection <string>();

            _disposable = new CompositeDisposable
            {
                diagnosticsService.Log
                .ObserveOn(schedulerService.Dispatcher)
                .Subscribe(x => _log.Add(x),
                           e =>
                {
                    Logger.Error(e);
                    _log.Clear();
                }),

                diagnosticsService.Rps
                .Select(FormatRps)
                .ObserveOn(schedulerService.Dispatcher)
                .Subscribe(x => Rps = x,
                           e =>
                {
                    Logger.Error(e);
                    Rps = Constants.DefaultRpsString;
                }),

                diagnosticsService.Cpu
                .Select(FormatCpu)
                .ObserveOn(schedulerService.Dispatcher)
                .Subscribe(x => Cpu = x,
                           e =>
                {
                    Logger.Error(e);
                    Cpu = Constants.DefaultCpuString;
                }),

                diagnosticsService.Memory
                .Select(FormatMemory)
                .ObserveOn(schedulerService.Dispatcher)
                .Subscribe(x =>
                {
                    ManagedMemory = x.ManagedMemory;
                    TotalMemory   = x.TotalMemory;
                }, e =>
                {
                    Logger.Error(e);
                    ManagedMemory = Constants.DefaultManagedMemoryString;
                    TotalMemory   = Constants.DefaultTotalMemoryString;
                })
            };
        }
        public SecretReaderFactory(IDiagnosticsService diagnosticsService)
        {
            if (diagnosticsService == null)
            {
                throw new ArgumentNullException(nameof(diagnosticsService));
            }

            _diagnosticsService = diagnosticsService;
        }
 public void Setup()
 {
     lv = new ListView();
     lv.CreateControl();
     interactor = new TestDiagnosticsInteractor();
     interactor.Attach(lv);
     svc = interactor;
     mr = new MockRepository();
 }
示例#29
0
        public AuthenticationService(
            IEntitiesContext entities, IAppConfiguration config, IDiagnosticsService diagnostics,
            AuditingService auditing, IEnumerable<Authenticator> providers, ICredentialBuilder credentialBuilder,
            ICredentialValidator credentialValidator, IDateTimeProvider dateTimeProvider)
        {
            if (entities == null)
            {
                throw new ArgumentNullException(nameof(entities));
            }

            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (diagnostics == null)
            {
                throw new ArgumentNullException(nameof(diagnostics));
            }

            if (auditing == null)
            {
                throw new ArgumentNullException(nameof(auditing));
            }

            if (providers == null)
            {
                throw new ArgumentNullException(nameof(providers));
            }

            if (credentialBuilder == null)
            {
                throw new ArgumentNullException(nameof(credentialBuilder));
            }

            if (credentialValidator == null)
            {
                throw new ArgumentNullException(nameof(credentialValidator));
            }

            if (dateTimeProvider == null)
            {
                throw new ArgumentNullException(nameof(dateTimeProvider));
            }

            InitCredentialFormatters();

            Entities = entities;
            _config = config;
            Auditing = auditing;
            _trace = diagnostics.SafeGetSource("AuthenticationService");
            Authenticators = providers.ToDictionary(p => p.Name, StringComparer.OrdinalIgnoreCase);
            _credentialBuilder = credentialBuilder;
            _credentialValidator = credentialValidator;
            _dateTimeProvider = dateTimeProvider;
        }
示例#30
0
        public MainController(MainViewModel viewModel, IMemoryService memoryService,
                              IDiagnosticsService diagnosticsService,
                              IEnumerable <IWorkspaceDescriptor> workspaceDescriptors)
            : base(viewModel)
        {
            _logger = LogManager.GetCurrentClassLogger();
            _logger.Debug("Main controller starting...");

            _workspaceDescriptors = workspaceDescriptors;

            var availableWorkspaces = _workspaceDescriptors.OrderBy(x => x.Position)
                                      .Select(x => x.Name)
                                      .ToList();

            foreach (var availableWorkspace in availableWorkspaces)
            {
                _logger.Debug("Available workspace - '{0}'", availableWorkspace);
            }

            availableWorkspaces.Insert(0, string.Empty);

            ViewModel.AddAvailableWorkspaces(availableWorkspaces);

            _disposable = new CompositeDisposable
            {
                ViewModel.AddWorkspaceStream
                .Subscribe(CreateWorkspace),

                ViewModel.RemoveWorkspaceStream
                .Do(RemoveWorkspace)
                .Delay(TimeSpan.FromMilliseconds(DisposeDelay))
                .Do(DeleteWorkspace)
                .Subscribe(),

                memoryService.MemoryInMegaBytes
                .DistinctUntilChanged()
                .Throttle(TimeSpan.FromSeconds(1))
                .Subscribe(UpdateUsedMemory),

                diagnosticsService.PerformanceCounters(1000)
                .Subscribe(x =>
                {
                    Debug.WriteLine("PrivateWorkingSetMemory = " +
                                    decimal.Round(Convert.ToDecimal(x.PrivateWorkingSetMemory) / (1024 * 1000), 2));
                    Debug.WriteLine("TotalAvailableMemoryMb = " + x.TotalAvailableMemoryMb);
                }),

                diagnosticsService.LoadedAssembly
                .Subscribe(x => Debug.WriteLine("Assembly = " + x.FullName))
            };

            for (var i = 0; i < 200; i++)
            {
                _logger.Debug("Log Item = " + i);
            }
        }
示例#31
0
 /// <summary>
 /// Initializes a new instance of the ViewModelWorker class
 /// </summary>
 /// <param name="navigationService">NavigationService provided by Caliburn.Micro</param>
 /// <param name="progressService">ProgressService provided by Caliburn.Micro</param>
 /// <param name="eventAggregator">EventAggregator provided by Caliburn.Micro</param>
 /// <param name="storageService">StorageService provided by Caliburn.Micro</param>
 /// <param name="navigationHelperService">NavigationHelperService provided by Caliburn.Micro</param>
 /// <param name="ratingService">RatingService provided by Caliburn.Micro</param>
 /// <param name="diagnosticsService">DiagnosticsService provided by Caliburn.Micro</param>
 public ViewModelWorker(INavigationService navigationService, IProgressService progressService, IEventAggregator eventAggregator, IStorageService storageService, INavigationHelperService navigationHelperService, IRatingService ratingService, IDiagnosticsService diagnosticsService)
 {
     this.navigationService       = navigationService;
     this.progressService         = progressService;
     this.eventAggregator         = eventAggregator;
     this.storageService          = storageService;
     this.navigationHelperService = navigationHelperService;
     this.ratingService           = ratingService;
     this.diagnosticsService      = diagnosticsService;
 }
示例#32
0
 public void Setup()
 {
     mr = new MockRepository();
     sc = new ServiceContainer();
     cfgSvc = mr.Stub<IConfigurationService>();
     fsSvc = mr.Stub<IFileSystemService>();
     diagSvc = mr.Stub<IDiagnosticsService>();
     sc.AddService<IFileSystemService>(fsSvc);
     sc.AddService<IDiagnosticsService>(diagSvc);
 }
示例#33
0
 public void Setup()
 {
     mr      = new MockRepository();
     sc      = new ServiceContainer();
     cfgSvc  = mr.Stub <IConfigurationService>();
     fsSvc   = mr.Stub <IFileSystemService>();
     diagSvc = mr.Stub <IDiagnosticsService>();
     sc.AddService <IFileSystemService>(fsSvc);
     sc.AddService <IDiagnosticsService>(diagSvc);
 }
 public void Constructor_ThrowsArgumentNullIfArgumentMissing(
     IEntitiesContext entities,
     IAuditingService auditing,
     IDiagnosticsService diagnostics,
     IAppConfiguration configuration,
     Lazy <IUserService> userServiceFactory,
     Lazy <IPackageOwnershipManagementService> packageOwnershipManagementServiceFactory)
 {
     Assert.Throws <ArgumentNullException>(() => new SecurityPolicyService(entities, auditing, diagnostics, configuration, userServiceFactory, packageOwnershipManagementServiceFactory));
 }
示例#35
0
 /// <summary>
 /// Initializes a new instance of the ViewModelWorker class
 /// </summary>
 /// <param name="navigationService">NavigationService provided by Caliburn.Micro</param>
 /// <param name="progressService">ProgressService provided by Caliburn.Micro</param>
 /// <param name="eventAggregator">EventAggregator provided by Caliburn.Micro</param>
 /// <param name="storageService">StorageService provided by Caliburn.Micro</param>
 /// <param name="navigationHelperService">NavigationHelperService provided by Caliburn.Micro</param>
 /// <param name="ratingService">RatingService provided by Caliburn.Micro</param>
 /// <param name="diagnosticsService">DiagnosticsService provided by Caliburn.Micro</param>
 public ViewModelWorker(INavigationService navigationService, IProgressService progressService, IEventAggregator eventAggregator, IStorageService storageService, INavigationHelperService navigationHelperService, IRatingService ratingService, IDiagnosticsService diagnosticsService)
 {
     this.navigationService = navigationService;
     this.progressService = progressService;
     this.eventAggregator = eventAggregator;
     this.storageService = storageService;
     this.navigationHelperService = navigationHelperService;
     this.ratingService = ratingService;
     this.diagnosticsService = diagnosticsService;
 }
 public LuceneIndexingService(
     IEntityRepository <Package> packageSource,
     Lucene.Net.Store.Directory directory,
     IDiagnosticsService diagnostics,
     IAppConfiguration config)
 {
     _packageRepository   = packageSource;
     _directory           = directory;
     _getShouldAutoUpdate = config == null ? new Func <bool>(() => true) : new Func <bool>(() => config.AutoUpdateSearchIndex);
     Trace = diagnostics.SafeGetSource("LuceneIndexingService");
 }
示例#37
0
        public TelemetryService(IDiagnosticsService diagnosticsService, ITelemetryClient telemetryClient = null)
        {
            if (diagnosticsService == null)
            {
                throw new ArgumentNullException(nameof(diagnosticsService));
            }

            _telemetryClient = telemetryClient ?? throw new ArgumentNullException(nameof(telemetryClient));

            _diagnosticsSource = diagnosticsService.GetSource("TelemetryService");
        }
示例#38
0
        public LuceneIndexingService(
            IEntityRepository<Package> packageSource,
            IEntityRepository<CuratedPackage> curatedPackageSource,
            Lucene.Net.Store.Directory directory,
			IDiagnosticsService diagnostics)
        {
            _packageRepository = packageSource;
            _curatedPackageRepository = curatedPackageSource;
            _directory = directory;
            Trace = diagnostics.SafeGetSource("LuceneIndexingService");
        }
        public LuceneIndexingService(
            IEntityRepository<Package> packageSource,
            IEntityRepository<CuratedPackage> curatedPackageSource,
            Lucene.Net.Store.Directory directory,
			IDiagnosticsService diagnostics,
            IAppConfiguration config)
        {
            _packageRepository = packageSource;
            _curatedPackageRepository = curatedPackageSource;
            _directory = directory;
            _getShouldAutoUpdate = config == null ? new Func<bool>(() => true) : new Func<bool>(() => config.AutoUpdateSearchIndex);
            Trace = diagnostics.SafeGetSource("LuceneIndexingService");
        }
        public AuthenticationService(IEntitiesContext entities, IAppConfiguration config, IDiagnosticsService diagnostics, AuditingService auditing, IEnumerable<Authenticator> providers)
        {
            _credentialFormatters = new Dictionary<string, Func<string, string>>(StringComparer.OrdinalIgnoreCase) {
                { "password", _ => Strings.CredentialType_Password },
                { "apikey", _ => Strings.CredentialType_ApiKey },
                { "external", FormatExternalCredentialType }
            };

            Entities = entities;
            Config = config;
            Auditing = auditing;
            Trace = diagnostics.SafeGetSource("AuthenticationService");
            Authenticators = providers.ToDictionary(p => p.Name, StringComparer.OrdinalIgnoreCase);
        }
示例#41
0
        public ContentService(IFileStorageService fileStorage, IDiagnosticsService diagnosticsService)
        {
            if (fileStorage == null)
            {
                throw new ArgumentNullException("fileStorage");
            }

            if (diagnosticsService == null)
            {
                throw new ArgumentNullException("diagnosticsService");
            }

            FileStorage = fileStorage;
            Trace = diagnosticsService.GetSource("ContentService");
        }
        public CachingSecretReader(ISecretReader secretReader, IDiagnosticsService diagnosticsService)
        {
            if (secretReader == null)
            {
                throw new ArgumentNullException(nameof(secretReader));
            }

            if (diagnosticsService == null)
            {
                throw new ArgumentNullException(nameof(diagnosticsService));
            }

            _internalReader = secretReader;
            _cache = new Dictionary<string, string>();
            _trace = diagnosticsService.GetSource("CachingSecretReader");
        }
示例#43
0
 public static ImageSegment LoadSegment(MemorySegment_v1 segment, IPlatform platform, IDiagnosticsService diagSvc)
 {
     Address addr;
     if (!platform.TryParseAddress(segment.Address, out addr))
     {
         diagSvc.Warn(
             "Unable to parse address '{0}' in memory map segment {1}.",
             segment.Address,
             segment.Name);
         return null;
     }
     uint size;
     if (!uint.TryParse(segment.Size, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out size))
     {
         diagSvc.Warn(
             "Unable to parse hexadecimal size '{0}' in memory map segment {1}.",
             segment.Size,
             segment.Name);
         return null;
     }
     return new ImageSegment(segment.Name, addr, size, ConvertAccess(segment.Attributes));
 }
示例#44
0
        private void CreateServices(IServiceFactory svcFactory, IServiceContainer sc, DecompilerMenus dm)
        {
            sc.AddService<DecompilerHost>(this);

            config = svcFactory.CreateDecompilerConfiguration();
            sc.AddService(typeof(IConfigurationService), config);

            var cmdFactory = new Commands.CommandFactory(sc);
            sc.AddService<ICommandFactory>(cmdFactory);

            sc.AddService(typeof(IStatusBarService), (IStatusBarService)this);

            diagnosticsSvc = svcFactory.CreateDiagnosticsService(form.DiagnosticsList);
            sc.AddService(typeof(IDiagnosticsService), diagnosticsSvc);

            decompilerSvc = svcFactory.CreateDecompilerService();
            sc.AddService(typeof(IDecompilerService), decompilerSvc);

            uiSvc = svcFactory.CreateShellUiService(form, dm);
            subWindowCommandTarget = uiSvc;
            sc.AddService(typeof(IDecompilerShellUiService), uiSvc);
            sc.AddService(typeof(IDecompilerUIService), uiSvc);

            var codeViewSvc = new CodeViewerServiceImpl(sc);
            sc.AddService(typeof(ICodeViewerService), codeViewSvc);
            var segmentViewSvc = new ImageSegmentServiceImpl(sc);
            sc.AddService(typeof(ImageSegmentService), segmentViewSvc);

            var del = svcFactory.CreateDecompilerEventListener();
            workerDlgSvc = (IWorkerDialogService)del;
            sc.AddService(typeof(IWorkerDialogService), workerDlgSvc);
            sc.AddService(typeof(DecompilerEventListener), del);

            loader = svcFactory.CreateLoader();
            sc.AddService(typeof(ILoader), loader);

            var abSvc = svcFactory.CreateArchiveBrowserService();
            sc.AddService(typeof(IArchiveBrowserService), abSvc);

            sc.AddService(typeof(ILowLevelViewService), svcFactory.CreateMemoryViewService());
            sc.AddService(typeof(IDisassemblyViewService), svcFactory.CreateDisassemblyViewService());

            var tlSvc = svcFactory.CreateTypeLibraryLoaderService();
            sc.AddService(typeof(ITypeLibraryLoaderService), tlSvc);

            this.projectBrowserSvc = svcFactory.CreateProjectBrowserService(form.ProjectBrowser);
            sc.AddService<IProjectBrowserService>(projectBrowserSvc);

            var upSvc = svcFactory.CreateUiPreferencesService();
            sc.AddService<IUiPreferencesService>(upSvc);

            var fsSvc = svcFactory.CreateFileSystemService();
            sc.AddService<IFileSystemService>(fsSvc);

            this.searchResultsTabControl = svcFactory.CreateTabControlHost(form.TabControl);
            sc.AddService<ITabControlHostService>(this.searchResultsTabControl);

            srSvc = svcFactory.CreateSearchResultService(form.FindResultsList);
            sc.AddService<ISearchResultService>(srSvc);
            searchResultsTabControl.Attach((IWindowPane) srSvc, form.FindResultsPage);
            searchResultsTabControl.Attach((IWindowPane) diagnosticsSvc, form.DiagnosticsPage);

            var resEditService = svcFactory.CreateResourceEditorService();
            sc.AddService<IResourceEditorService>(resEditService);
        }
 public ExceptionLogger(IDiagnosticsService diagnosticsService, ICookieParser cookieParser)
 {
     _diagnosticsService = diagnosticsService;
     _cookieParser = cookieParser;
 }
示例#46
0
 public NeImageLoader(IServiceProvider services, string filename, byte[] rawBytes, uint e_lfanew)
     : base(services, filename, rawBytes)
 {
     ImageReader rdr = new LeImageReader(RawImage, e_lfanew);
     diags = Services.RequireService<IDiagnosticsService>();
     this.lfaNew = e_lfanew;
     this.importStubs = new Dictionary<uint, Tuple<Address, ImportReference>>();
     if (!LoadNeHeader(rdr))
         throw new BadImageFormatException("Unable to read NE header.");
 }
 public WindowsDecompilerEventListener(IServiceProvider sp)
 {
     this.sp = sp;
     uiSvc = sp.GetService<IDecompilerShellUiService>();
     diagnosticSvc = sp.GetService<IDiagnosticsService>();
 }
 /// <summary>
 /// Initializes a new instance of the VBForumsMetroViewModelWorker class
 /// </summary>
 /// <param name="vbforumsWebService">VBForumsWebService provided by Caliburn.Micro</param>
 /// <param name="vbforumsSterlingService">VBForumsMetroSterlingService provided by Caliburn.Micro</param>
 /// <param name="navigationService">NavigationService provided by Caliburn.Micro</param>
 /// <param name="progressService">ProgressService provided by Caliburn.Micro</param>
 /// <param name="eventAggregator">EventAggregator provided by Caliburn.Micro</param>
 /// <param name="storageService">StorageService provided by Caliburn.Micro</param>
 /// <param name="navigationHelperService">NavigationHelperService provided by Caliburn.Micro</param>
 /// <param name="ratingService">RatingService provided by Caliburn.Micro</param>
 /// <param name="diagnosticsService">DiagnosticsService provided by Caliburn.Micro</param>
 public VBForumsMetroViewModelWorker(IVBForumsWebService vbforumsWebService, ISterlingService vbforumsSterlingService, INavigationService navigationService, IProgressService progressService, IEventAggregator eventAggregator, IStorageService storageService, INavigationHelperService navigationHelperService, IRatingService ratingService, IDiagnosticsService diagnosticsService)
     : base(navigationService, progressService, eventAggregator, storageService, navigationHelperService, ratingService, diagnosticsService)
 {
     this.vbforumsWebService = vbforumsWebService;
     this.vbforumsSterlingService = vbforumsSterlingService;
 }