コード例 #1
0
        } // getArrayFromString

        private void LoadConfig(string strProfile)
        {
            string strConfig;
            XDocument objDoc;
            XElement objProfiles;

            strConfig = HttpContext.Current.Server.MapPath("~/web.config");
            objDoc = XDocument.Load(strConfig);
            objProfiles = objDoc.Element("configuration").Element("TFMProfiles");
            foreach (var objProfile in objProfiles.Descendants("profile"))
            {
                if (Convert.ToString(objProfile.Attribute("name").Value).ToLower() == strProfile.ToLower())
                {
                    pobjProfile = new clsProfile();
                    pobjProfile.AllowCreateFolder = Convert.ToBoolean(objProfile.Element("AllowCreateFolder").Value);
                    pobjProfile.AllowDeleteFile = Convert.ToBoolean(objProfile.Element("AllowDeleteFile").Value);
                    pobjProfile.AllowDeleteFolder = Convert.ToBoolean(objProfile.Element("AllowDeleteFolder").Value);
                    pobjProfile.AllowUploadFile = Convert.ToBoolean(objProfile.Element("AllowUploadFile").Value);
                    pobjProfile.AllowedFileExtensions = objProfile.Element("AllowedFileExtensions").Value;
                    pobjProfile.AllowedImageExtensions = objProfile.Element("AllowedImageExtensions").Value;
                    pobjProfile.AllowedMiscExtensions = objProfile.Element("AllowedMiscExtensions").Value;
                    pobjProfile.AllowedMusicExtensions = objProfile.Element("AllowedMusicExtensions").Value;
                    pobjProfile.AllowedVideoExtensions = objProfile.Element("AllowedVideoExtensions").Value;
                    pobjProfile.FillSelector = objProfile.Element("FillSelector").Value;
                    pobjProfile.MaxUploadSizeMb = Convert.ToInt16(objProfile.Element("MaxUploadSizeMb").Value);
                    pobjProfile.PopupCloseCode = objProfile.Element("PopupCloseCode").Value;
                    pobjProfile.RootPath = objProfile.Element("RootPath").Value;
                    pobjProfile.RootURL = objProfile.Element("RootURL").Value;
                    pobjProfile.ThumbPath = objProfile.Element("ThumbPath").Value;
                    pobjProfile.UploadPath = objProfile.Element("UploadPath").Value;
                    break;
                }
            } // foreach
        } // LoadConfig
コード例 #2
0
        }   // getArrayFromString

        private void LoadConfig(string strProfile)
        {
            string strConfig;
            XDocument objDoc;
            XElement objProfiles;

            strConfig = HttpContext.Current.Server.MapPath("web.config");
            objDoc = XDocument.Load(strConfig);
            objProfiles = objDoc.Element("configuration").Element("TFMProfiles");
            foreach (XElement objProfile in objProfiles.Descendants("profile"))
            {
                if (Convert.ToString(objProfile.Attribute("name").Value).ToLower() == strProfile.ToLower())
                {
                    this.pobjProfile = new clsProfile();
                    this.pobjProfile.AllowCreateFolder = Convert.ToBoolean(objProfile.Element("AllowCreateFolder").Value);
                    this.pobjProfile.AllowDeleteFile = Convert.ToBoolean(objProfile.Element("AllowDeleteFile").Value);
                    this.pobjProfile.AllowDeleteFolder = Convert.ToBoolean(objProfile.Element("AllowDeleteFolder").Value);
                    this.pobjProfile.AllowUploadFile = Convert.ToBoolean(objProfile.Element("AllowUploadFile").Value);
                    this.pobjProfile.AllowedFileExtensions = objProfile.Element("AllowedFileExtensions").Value;
                    this.pobjProfile.AllowedImageExtensions = objProfile.Element("AllowedImageExtensions").Value;
                    this.pobjProfile.AllowedMiscExtensions = objProfile.Element("AllowedMiscExtensions").Value;
                    this.pobjProfile.AllowedMusicExtensions = objProfile.Element("AllowedMusicExtensions").Value;
                    this.pobjProfile.AllowedVideoExtensions = objProfile.Element("AllowedVideoExtensions").Value;
                    this.pobjProfile.FillSelector = objProfile.Element("FillSelector").Value;
                    this.pobjProfile.MaxUploadSizeMb = Convert.ToInt16(objProfile.Element("MaxUploadSizeMb").Value);
                    this.pobjProfile.PopupCloseCode = objProfile.Element("PopupCloseCode").Value;
                    this.pobjProfile.RootPath = objProfile.Element("RootPath").Value;
                    this.pobjProfile.RootURL = objProfile.Element("RootURL").Value;
                    this.pobjProfile.ThumbPath = objProfile.Element("ThumbPath").Value;
                    this.pobjProfile.UploadPath = objProfile.Element("UploadPath").Value;
                    break;
                }
            }   // foreach
        }   // LoadConfig