Ejemplo n.º 1
0
        public static void SetGlobalSettings(Configuration config, Settings settings)
        {
            if (config.Items.ContainsKey("PG_SPAWFM_SETTINGS"))
            {
                XmlNode snode = config.Items["PG_SPAWFM_SETTINGS"].XmlNode.SelectSingleNode("settings");
                XmlDocument conf_doc = snode.OwnerDocument;

                snode.RemoveAll();

                XmlAttribute name_attr = conf_doc.CreateAttribute("name");
                name_attr.Value = "PG_SPAWFM_SETTINGS";
                snode.Attributes.Append(name_attr);
            //'DBB:begin
                XmlAttribute ftpServer_attr = conf_doc.CreateAttribute("ftpServer");
                ftpServer_attr.Value = settings.FTPServer;
                snode.Attributes.Append(ftpServer_attr);

                XmlAttribute ftpUserID_attr = conf_doc.CreateAttribute("ftpUserID");
                ftpUserID_attr.Value = settings.FTPUserID;
                snode.Attributes.Append(ftpUserID_attr);

                XmlAttribute ftpPassword_attr = conf_doc.CreateAttribute("ftpPassword");
                ftpPassword_attr.Value = settings.FTPPassword;
                snode.Attributes.Append(ftpPassword_attr);
            //'DBB:begin
                XmlAttribute allowModify_attr = conf_doc.CreateAttribute("allowModify");
                allowModify_attr.Value = settings.AllowModify.ToString().ToLower();
                snode.Attributes.Append(allowModify_attr);

                XmlAttribute allowUpload_attr = conf_doc.CreateAttribute("allowUpload");
                allowUpload_attr.Value = settings.AllowUpload.ToString().ToLower();
                snode.Attributes.Append(allowUpload_attr);

                XmlAttribute maxUploadFilesize_attr = conf_doc.CreateAttribute("maxUploadFilesize");
                maxUploadFilesize_attr.Value = settings.MaxUploadFilesize.ToString();
                snode.Attributes.Append(maxUploadFilesize_attr);

                XmlAttribute maxImgWidth_attr = conf_doc.CreateAttribute("maxImgWidth");
                maxImgWidth_attr.Value = settings.MaxImageWidth.ToString();
                snode.Attributes.Append(maxImgWidth_attr);

                XmlAttribute maxImgHeight_attr = conf_doc.CreateAttribute("maxImgHeight");
                maxImgHeight_attr.Value = settings.MaxImageHeight.ToString();
                snode.Attributes.Append(maxImgHeight_attr);

                XmlAttribute recursive_attr = conf_doc.CreateAttribute("recursive");
                recursive_attr.Value = settings.Recursive.ToString().ToLower();
                snode.Attributes.Append(recursive_attr);

                XmlAttribute allowModifySubdirectories_attr = conf_doc.CreateAttribute("allowModifySubdirectories");
                allowModifySubdirectories_attr.Value = settings.AllowModifySubdirectories.ToString().ToLower();
                snode.Attributes.Append(allowModifySubdirectories_attr);

                XmlAttribute allowCreateSubdirectories_attr = conf_doc.CreateAttribute("allowCreateSubdirectories");
                allowCreateSubdirectories_attr.Value = settings.AllowCreateSubdirectories.ToString().ToLower();
                snode.Attributes.Append(allowCreateSubdirectories_attr);
            }
        }
Ejemplo n.º 2
0
        public static Settings GetGlobalSettings(Configuration config)
        {
            Settings result = new Settings();
            result._configuration = config;
            if (config == null)
                config = Configuration.GetConfiguration();

            if (config.Items.ContainsKey("PG_SPAWFM_SETTINGS"))
            {
                result.LoadData(config["PG_SPAWFM_SETTINGS"].XmlNode);
            }

            return result;
        }