/// <summary> /// Initializes a new instance of the <see cref="FileWatcherBasedPackageUploader"/> class. /// </summary> /// <param name="packageQueue">The object that queues packages that need to be processed.</param> /// <param name="configuration">The configuration.</param> /// <param name="diagnostics">The object providing the diagnostics methods for the application.</param> internal FileWatcherBasedPackageUploader( IQueueSymbolPackages packageQueue, IConfiguration configuration, SystemDiagnostics diagnostics) { { Lokad.Enforce.Argument(() => packageQueue); Lokad.Enforce.Argument(() => configuration); Lokad.Enforce.Argument(() => diagnostics); Lokad.Enforce.With<ArgumentException>( configuration.HasValueFor(CoreConfigurationKeys.s_UploadPath), Resources.Exceptions_Messages_MissingConfigurationValue_WithKey, CoreConfigurationKeys.s_UploadPath); } m_Queue = packageQueue; m_Diagnostics = diagnostics; var uploadPath = configuration.Value<string>(CoreConfigurationKeys.s_UploadPath); m_Watcher = new FileSystemWatcher { Path = uploadPath, Filter = "*.symbols.nupkg", EnableRaisingEvents = false, NotifyFilter = NotifyFilters.FileName | NotifyFilters.CreationTime, }; m_Watcher.Created += HandleFileCreated; }
/// <summary> /// Initializes a new instance of the <see cref="SymbolIndexer"/> class. /// </summary> /// <param name="packageQueue">The object that queues packages that need to be processed.</param> /// <param name="configuration">The configuration.</param> /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param> public SymbolIndexer( IQueueSymbolPackages packageQueue, IConfiguration configuration, SystemDiagnostics diagnostics) { { Lokad.Enforce.Argument(() => packageQueue); Lokad.Enforce.Argument(() => configuration); Lokad.Enforce.Argument(() => diagnostics); Lokad.Enforce.With<ArgumentException>( configuration.HasValueFor(CoreConfigurationKeys.s_SourceIndexUncPath), Resources.Exceptions_Messages_MissingConfigurationValue_WithKey, CoreConfigurationKeys.s_SourceIndexUncPath); Lokad.Enforce.With<ArgumentException>( configuration.HasValueFor(CoreConfigurationKeys.s_SymbolsIndexUncPath), Resources.Exceptions_Messages_MissingConfigurationValue_WithKey, CoreConfigurationKeys.s_SymbolsIndexUncPath); Lokad.Enforce.With<ArgumentException>( configuration.HasValueFor(CoreConfigurationKeys.s_ProcessedPackagesPath), Resources.Exceptions_Messages_MissingConfigurationValue_WithKey, CoreConfigurationKeys.s_ProcessedPackagesPath); } m_Diagnostics = diagnostics; m_Queue = packageQueue; m_Queue.OnEnqueue += HandleOnEnqueue; var debuggingToolsDirectory = configuration.HasValueFor(CoreConfigurationKeys.s_DebuggingToolsDirectory) ? configuration.Value<string>(CoreConfigurationKeys.s_DebuggingToolsDirectory) : DefaultSymbolServerToolsDirectory(); m_SymStorePath = Path.Combine(debuggingToolsDirectory, "symstore.exe"); m_SrcToolPath = Path.Combine(debuggingToolsDirectory, "srcsrv", "srctool.exe"); m_PdbStrPath = Path.Combine(debuggingToolsDirectory, "srcsrv", "pdbstr.exe"); m_SourceUncPath = configuration.Value<string>(CoreConfigurationKeys.s_SourceIndexUncPath); m_SymbolsUncPath = configuration.Value<string>(CoreConfigurationKeys.s_SymbolsIndexUncPath); m_ProcessedPackagesPath = configuration.Value<string>(CoreConfigurationKeys.s_ProcessedPackagesPath); }