/// <summary> /// Creates a new provider used to strip source control bindings. /// </summary> /// <param name="context">An <see cref="ApplicationContext"/> object containing contextual information.</param> /// <returns>A new <see cref="StripSccBindingsProvider"/> object.</returns> public static StripSccBindingsProviderBase CreateProvider(ApplicationContext context) { StripSccBindingsProviderBase provider = null; StripSccBindingsSection section = (StripSccBindingsSection)ConfigurationManager.GetSection(StripSccBindingsSection.SectionName); if (section == null) { throw new Exception("Could not find the provider section configuration in the application configuration file."); } else { ProviderSettings settings = section.Providers[context.Provider]; if (settings == null) { throw new Exception(string.Format("Could not find the provider '{0}' specified in the application configuration file.", context.Provider)); } AssemblyQualifiedTypeNameConverter converter = new AssemblyQualifiedTypeNameConverter(); Type type = (Type)converter.ConvertFrom(settings.Type); if (type != null) { provider = (StripSccBindingsProviderBase)Activator.CreateInstance(type); provider.Context = context; // Initialize the provider based on the configuration file. provider.Initialize(settings.Name, settings.Parameters); } } return(provider); }
/// <summary> /// Performs the main process of the application. /// </summary> /// <param name="args">An array of strings containing arguments from the command line.</param> private static void Go(string[] args) { if (args == null || args.Length == 0) { // The user did not include any arguments, assume the help information should be displayed. DisplayHelp(); return; } ApplicationContext context = ApplicationContextFactory.Create(args); if (context == null) { return; } else { StripSccBindingsProviderBase provider = StripSccBindingsProviderFactory.CreateProvider(context); if (provider == null) { throw new Exception("The provider could not be located."); } else { provider.Start(); } } }