public override void PreAnalysis(AnalysisContext analysisContext) { m_configurationService = analysisContext.TookitServiceContainer.GetService(typeof(ConfigurationService)) as ConfigurationService; if (m_configurationService == null) { throw new ArgumentNullException("ConfigurationService"); } m_serverPathTranslationService = (IServerPathTranslationService)((analysisContext.TookitServiceContainer.GetService(typeof(IServerPathTranslationService)) as IServerPathTranslationService)); if (m_serverPathTranslationService == null) { throw new ArgumentNullException("IServerPathTranslationService"); } m_vcTranslationService = (VCTranslationService)((analysisContext.TookitServiceContainer.GetService(typeof(ITranslationService)) as ITranslationService)); if (m_vcTranslationService == null) { throw new ArgumentNullException("ITranslationService"); } m_sourceId = new Guid(m_configurationService.MigrationSource.InternalUniqueId); // Get the configured output file path here (or use default) and make sure we can open it for writing Dictionary <string, string> addinCustomSettings = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); addinCustomSettings.Add(c_symbolLinkOutputFilePathKey, c_defaultSymbolLinkOutputFilePath); AddinCustomSettingsHelper.GetAddinCustomSettings(m_configurationService, ReferenceNameString, addinCustomSettings); m_symbolLinkOutputFilePath = addinCustomSettings[c_symbolLinkOutputFilePathKey]; try { using (StreamWriter streamWriter = new StreamWriter(m_symbolLinkOutputFilePath, false)) { } } catch (Exception e) { throw new MigrationException(string.Format(CultureInfo.InvariantCulture, ClearCaseSymbolicLinkMonitorAnalysisAddinResources.UnableToOpenOutputFile, m_symbolLinkOutputFilePath, e.Message)); } }
public override void PreAnalysis(AnalysisContext analysisContext) { m_configurationService = analysisContext.TookitServiceContainer.GetService(typeof(ConfigurationService)) as ConfigurationService; if (m_configurationService != null) { // Create a HWM and set the initial value m_hwmSemaphoreFile = new HighWaterMark <DateTime>(c_semaphoreFileHWNName); m_configurationService.RegisterHighWaterMarkWithSession(m_hwmSemaphoreFile); Dictionary <string, string> addinCustomSettings = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); addinCustomSettings.Add(c_semaphoreFilePath, null); addinCustomSettings.Add(c_excludeDateTimeFromLabelName, null); AddinCustomSettingsHelper.GetAddinCustomSettings(m_configurationService, ReferenceNameString, addinCustomSettings); m_semaphoreFilePath = addinCustomSettings[c_semaphoreFilePath]; if (string.IsNullOrEmpty(m_semaphoreFilePath)) { throw new MigrationException(SemaphoreFileAnalysisAddinResources.SemaphoreFilePathNotConfigured); } if (addinCustomSettings[c_excludeDateTimeFromLabelName] != null && string.Equals(addinCustomSettings[c_excludeDateTimeFromLabelName], "true", StringComparison.OrdinalIgnoreCase)) { m_excludeDateTimeFromLabelName = true; } } else { Debug.Fail("SemaphoreFileAnalysisAddin unable to get ConfigurationService"); throw new ArgumentNullException("ConfigurationService"); } m_vcTranslationService = analysisContext.TookitServiceContainer.GetService(typeof(ITranslationService)) as VCTranslationService; m_sourceId = new Guid(m_configurationService.MigrationSource.InternalUniqueId); }