コード例 #1
0
            internal AuthenticationScheme GetAuthenticationScheme()
            {
                string authVal = _blogCredentials.GetCustomValue(AUTH_SCHEME);
                AuthenticationScheme authSceme = AuthenticationScheme.Http;

                if (authVal != null && authVal.Length > 0)
                {
                    try
                    {
                        authSceme = (AuthenticationScheme)AuthenticationScheme.Parse(typeof(AuthenticationScheme), authVal);
                    }
                    catch (Exception) {}                   //unknown authscheme detected
                }
                return(authSceme);
            }
コード例 #2
0
 /// <summary>
 /// Load front matter keys configuration from blog credentials
 /// </summary>
 /// <param name="creds">An IBlogCredentialsAccessor</param>
 public void LoadFromCredentials(IBlogCredentialsAccessor creds)
 {
     if (creds.GetCustomValue(CONFIG_ID_KEY) != string.Empty)
     {
         IdKey = creds.GetCustomValue(CONFIG_ID_KEY);
     }
     if (creds.GetCustomValue(CONFIG_TITLE_KEY) != string.Empty)
     {
         TitleKey = creds.GetCustomValue(CONFIG_TITLE_KEY);
     }
     if (creds.GetCustomValue(CONFIG_DATE_KEY) != string.Empty)
     {
         DateKey = creds.GetCustomValue(CONFIG_DATE_KEY);
     }
     if (creds.GetCustomValue(CONFIG_LAYOUT_KEY) != string.Empty)
     {
         LayoutKey = creds.GetCustomValue(CONFIG_LAYOUT_KEY);
     }
     if (creds.GetCustomValue(CONFIG_TAGS_KEY) != string.Empty)
     {
         TagsKey = creds.GetCustomValue(CONFIG_TAGS_KEY);
     }
     if (creds.GetCustomValue(CONFIG_PARENT_ID_KEY) != string.Empty)
     {
         ParentIdKey = creds.GetCustomValue(CONFIG_PARENT_ID_KEY);
     }
     if (creds.GetCustomValue(CONFIG_PERMALINK_KEY) != string.Empty)
     {
         PermalinkKey = creds.GetCustomValue(CONFIG_PERMALINK_KEY);
     }
 }
コード例 #3
0
        /// <summary>
        /// Load site configuration from blog credentials
        /// </summary>
        /// <param name="creds">An IBlogCredentialsAccessor</param>
        public void LoadFromCredentials(IBlogCredentialsAccessor creds)
        {
            LocalSitePath = creds.Username;
            PostsPath     = creds.GetCustomValue(CONFIG_POSTS_PATH);

            PagesEnabled = creds.GetCustomValue(CONFIG_PAGES_ENABLED) == "1";
            PagesPath    = creds.GetCustomValue(CONFIG_PAGES_PATH);

            DraftsEnabled = creds.GetCustomValue(CONFIG_DRAFTS_ENABLED) == "1";
            DraftsPath    = creds.GetCustomValue(CONFIG_DRAFTS_PATH);

            ImagesEnabled = creds.GetCustomValue(CONFIG_IMAGES_ENABLED) == "1";
            ImagesPath    = creds.GetCustomValue(CONFIG_IMAGES_PATH);

            BuildingEnabled = creds.GetCustomValue(CONFIG_BUILDING_ENABLED) == "1";
            OutputPath      = creds.GetCustomValue(CONFIG_OUTPUT_PATH);
            BuildCommand    = creds.GetCustomValue(CONFIG_BUILD_COMMAND);

            PublishCommand = creds.GetCustomValue(CONFIG_PUBLISH_COMMAND);

            SiteUrl = creds.GetCustomValue(CONFIG_SITE_URL); // This will be overidden in LoadFromBlogSettings, HomepageUrl is considered a more accurate source of truth

            ShowCmdWindows = creds.GetCustomValue(CONFIG_SHOW_CMD_WINDOWS) == "1";
            if (creds.GetCustomValue(CONFIG_CMD_TIMEOUT_MS) != string.Empty)
            {
                CmdTimeoutMs = int.Parse(creds.GetCustomValue(CONFIG_CMD_TIMEOUT_MS));
            }
            Initialised = creds.GetCustomValue(CONFIG_INITIALISED) == "1";

            // Load FrontMatterKeys
            FrontMatterKeys = StaticSiteConfigFrontMatterKeys.LoadKeysFromCredentials(creds);
        }