public static IBlogClient CreateClient(string clientType, string postApiUrl, IBlogCredentialsAccessor credentials, string providerId, IDictionary optionOverrides, IDictionary userOptionOverrides, IDictionary homepageOptionOverrides) { // create blog client reflecting the settings IBlogClient blogClient = CreateClient(clientType, postApiUrl, credentials); // if there is a provider associated with the client then use it to override options // as necessary for this provider IBlogProvider provider = BlogProviderManager.FindProvider(providerId); if (provider != null) { IBlogClientOptions providerOptions = provider.ConstructBlogOptions(blogClient.Options); blogClient.OverrideOptions(providerOptions); } if (homepageOptionOverrides != null) { OptionOverrideReader homepageOptionsReader = new OptionOverrideReader(homepageOptionOverrides); IBlogClientOptions homepageOptions = BlogClientOptions.ApplyOptionOverrides(new OptionReader(homepageOptionsReader.Read), blogClient.Options, true); blogClient.OverrideOptions(homepageOptions); } // if there are manifest overrides then apply them if (optionOverrides != null) { OptionOverrideReader manifestOptionsReader = new OptionOverrideReader(optionOverrides); IBlogClientOptions manifestOptions = BlogClientOptions.ApplyOptionOverrides(new OptionReader(manifestOptionsReader.Read), blogClient.Options, true); blogClient.OverrideOptions(manifestOptions); } // if there are user overrides then apply them if (userOptionOverrides != null) { OptionOverrideReader userOptionsReader = new OptionOverrideReader(userOptionOverrides); IBlogClientOptions userOptions = BlogClientOptions.ApplyOptionOverrides(new OptionReader(userOptionsReader.Read), blogClient.Options, true); blogClient.OverrideOptions(userOptions); } // return the blog client return(blogClient); }
public static IBlogClient CreateClient(string clientType, string postApiUrl, IBlogCredentialsAccessor credentials, string providerId, IDictionary optionOverrides, IDictionary userOptionOverrides, IDictionary homepageOptionOverrides) { // create blog client reflecting the settings IBlogClient blogClient = CreateClient(clientType, postApiUrl, credentials); // if there is a provider associated with the client then use it to override options // as necessary for this provider IBlogProvider provider = BlogProviderManager.FindProvider(providerId); if (provider != null) { IBlogClientOptions providerOptions = provider.ConstructBlogOptions(blogClient.Options); blogClient.OverrideOptions(providerOptions); } if (homepageOptionOverrides != null) { OptionOverrideReader homepageOptionsReader = new OptionOverrideReader(homepageOptionOverrides); IBlogClientOptions homepageOptions = BlogClientOptions.ApplyOptionOverrides(new OptionReader(homepageOptionsReader.Read), blogClient.Options, true); blogClient.OverrideOptions(homepageOptions); } // if there are manifest overrides then apply them if (optionOverrides != null) { OptionOverrideReader manifestOptionsReader = new OptionOverrideReader(optionOverrides); IBlogClientOptions manifestOptions = BlogClientOptions.ApplyOptionOverrides(new OptionReader(manifestOptionsReader.Read), blogClient.Options, true); blogClient.OverrideOptions(manifestOptions); } // if there are user overrides then apply them if (userOptionOverrides != null) { OptionOverrideReader userOptionsReader = new OptionOverrideReader(userOptionOverrides); IBlogClientOptions userOptions = BlogClientOptions.ApplyOptionOverrides(new OptionReader(userOptionsReader.Read), blogClient.Options, true); blogClient.OverrideOptions(userOptions); } // return the blog client return blogClient; }