public static Dictionary <string, Dictionary <string, string> > ConvertFromString(string values)
        {
            Dictionary <string, Dictionary <string, string> > result = new Dictionary <string, Dictionary <string, string> >();

            string[] fields = values.Split("#".ToCharArray());

            foreach (string field in fields)
            {
                if (!string.IsNullOrEmpty(field))
                {
                    string[] detailValues = field.Split("|".ToCharArray());
                    string   fieldValue   = detailValues[0];
                    string   modeValue    = detailValues[1];
                    string   value        = detailValues[2];

                    if (!result.ContainsKey(fieldValue))
                    {
                        result.Add(fieldValue, new Dictionary <string, string>());
                    }

                    result[fieldValue].Add(modeValue, value);
                }
            }

            return(result);

            API.PropertyHash p = new API.PropertyHash("D");
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            SPWeb web = SPContext.Current.Web;

            web.Site.CatchAccessDeniedException = false;
            web.AllowUnsafeUpdates = true;


            CoreFunctions.setConfigSetting(web, "EPMLiveResourceURL", HttpUtility.UrlDecode(txtResourceURL.Text.Replace("default.aspx", "")));
            //CoreFunctions.setConfigSetting(web, "EPMLiveTimePhasedURL", HttpUtility.UrlDecode(txtMasterURL.Text.Replace("default.aspx", "")));
            CoreFunctions.setConfigSetting(web, "ResToolsReportURL", HttpUtility.UrlDecode(txtResToolReportURL.Text));
            CoreFunctions.setConfigSetting(web, "EPMLiveTemplateGalleryURL", HttpUtility.UrlDecode(txtGalleryUrl.Text.Replace("default.aspx", "")));

            //CoreFunctions.setConfigSetting(web, "EPMLiveDisablePublishing", chkDisablePublishing.Checked.ToString());

            CoreFunctions.setConfigSetting(web, "EPMLiveNewProjectWorkspaceType", ddlWorkspaceType.SelectedValue);
            CoreFunctions.setConfigSetting(web, "EPMLiveNewProjectNavigation", ddlNavigation.SelectedValue);
            CoreFunctions.setConfigSetting(web, "EPMLiveNewProjectPermissions", ddlPermissions.SelectedValue);

            if (web.Features[new Guid("ebc3f0dc-533c-4c72-8773-2aaf3eac1055")] != null)
            {
                CoreFunctions.setConfigSetting(web, "EPMLiveProjectServerURL", txtProjectServer.Text.Replace("default.aspx", ""));
            }

            //if (web.CurrentUser.IsSiteAdmin)
            //    CoreFunctions.setConfigSetting(web, "EPMLiveAllowListSynch", chkAllowSynch.Checked.ToString());

            CoreFunctions.setConfigSetting(web, "EPMLiveLockConfig", chkLockConfig.Checked.ToString());

            CoreFunctions.setConfigSetting(web, "EPMLiveGroupsPermAssignments", GetGroupsPermissionsAssignment());

            CoreFunctions.setConfigSetting(web, "EPMLiveNewProjectRoleOwners", ddlRoleOwners.SelectedValue);
            CoreFunctions.setConfigSetting(web, "EPMLiveNewProjectRoleMembers", ddlRoleMembers.SelectedValue);
            CoreFunctions.setConfigSetting(web, "EPMLiveNewProjectRoleVisitors", ddlRoleVisitors.SelectedValue);
            CoreFunctions.setConfigSetting(web, "EPMLiveUseWEPeoplePicker", chkUsePE.Checked.ToString());
            CoreFunctions.setConfigSetting(web, "EPMLiveUseLiveTemplates", chkLiveTemplates.Checked.ToString());

            string validtemplates = "";

            foreach (ListItem li in lstSelectedTemplates.Items)
            {
                validtemplates += "|" + li.Value;
            }
            if (validtemplates.Length > 1)
            {
                validtemplates = validtemplates.Substring(1);
            }
            CoreFunctions.setConfigSetting(web, "EPMLiveValidTemplates", validtemplates);

            API.PropertyHash props = new API.PropertyHash("", ";#", '|', '^');
            props.Update(0, "Default^" + ddlDefaultCreate.SelectedValue);
            props.Add("Online^" + chkCreateOptions.Items[0].Selected + "|Local^" + chkCreateOptions.Items[1].Selected + "|Existing^" + chkCreateOptions.Items[2].Selected);

            CoreFunctions.setConfigSetting(web, "EPMLiveCreateNewSettings", props.ToString());

            //web.MasterUrl = ddlMasterPages.SelectedValue.ToString();
            //web.Update();
            checkLocks(web);

            string url = web.ServerRelativeUrl;

            if (!String.IsNullOrEmpty(Request["Source"]))
            {
                Response.Redirect(Request["Source"]);
            }
            else
            {
                Microsoft.SharePoint.Utilities.SPUtility.Redirect("settings.aspx", Microsoft.SharePoint.Utilities.SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current);
            }
        }