当前位置: 首页>>代码示例>>C#>>正文


C# XmlHelper.TryGetBoolean方法代码示例

本文整理汇总了C#中XmlHelper.TryGetBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# XmlHelper.TryGetBoolean方法的具体用法?C# XmlHelper.TryGetBoolean怎么用?C# XmlHelper.TryGetBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XmlHelper的用法示例。


在下文中一共展示了XmlHelper.TryGetBoolean方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Field

        internal Field(XmlElement fieldElement)
        {
            XmlHelper h = new XmlHelper(fieldElement);

            this.Source = fieldElement.GetAttribute("Source");
            this.Target = fieldElement.GetAttribute("Target");
            this.InputConverter = ConverterType.Parse(fieldElement.GetAttribute("InputConverter"));
            this.OutputConverter = ConverterType.Parse(fieldElement.GetAttribute("OutputConverter"));
            this.Quote = h.TryGetBoolean("@Quote", true);
            this.Mandatory = h.TryGetBoolean("@Mandatory", false);
            this.Alias = fieldElement.GetAttribute("Alias");
            this.Required = h.TryGetBoolean("@Required", false);
            this.AutoNumber = h.TryGetBoolean("@AutoNumber", false);

            SourceType sType = SourceType.Request;
            if (!Enum.TryParse<SourceType>(fieldElement.GetAttribute("SourceType"), true, out sType))
                sType = SourceType.Request;
            this.SourceType = sType;

            IOType iType = IOType.Element;
            if (!Enum.TryParse<IOType>(fieldElement.GetAttribute("InputType"), true, out iType))
                iType = IOType.Element;
            this.InputType = iType;

            IOType oType = IOType.Element;
            if (!Enum.TryParse<IOType>(fieldElement.GetAttribute("OutputType"), true, out oType))
                oType = IOType.Element;
            this.OutputType = oType;

        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:30,代码来源:Field.cs

示例2: SetDefinition

        public void SetDefinition(System.Xml.XmlElement definition)
        {
            XmlHelper h = new XmlHelper(definition);
            _initialized = false;

            //Check Basic Tab
            chkBasic.Checked = CheckEnable(h.GetElement("Authentication/Basic"), true);
            cbHashProvider.Text = h.GetText("Authentication/Basic/PasswordHashProvider/@DriverClass");
            txtGetUserDataQuery.Text = h.GetText("Authentication/Basic/UserInfoStorage/DBSchema/GetUserDataQuery");
            txtGetUserRoleQuery.Text = h.GetText("Authentication/Basic/UserInfoStorage/DBSchema/GetUserRolesQuery");

            //Check Session Tab
            chkSession.Checked = h.TryGetBoolean("Authentication/Session/@Enabled", true);
            txtTimeout.Text = h.TryGetInteger("Authentication/Session/@Timeout", 20).ToString();

            //Check Passport Tab
            chkPassport.Checked = CheckEnable(h.GetElement("Authentication/Passport"), false);
            txtIssuer.Text = h.GetText("Authentication/Passport/Issuer/@Name");
            txtCertProvider.Text = h.GetText("Authentication/Passport/Issuer/CertificateProvider");
            cbALTable.Text = h.GetText("Authentication/Passport/AccountLinking/TableName");
            cboMappingField.Text = h.GetText("Authentication/Passport/AccountLinking/MappingField");
            cbUserNameField.Text = h.GetText("Authentication/Passport/AccountLinking/UserNameField");

            dgExtProp.Rows.Clear();
            foreach (XmlElement pe in h.GetElements("Authentication/Passport/AccountLinking/Properties/Property"))
            {
                int index = dgExtProp.Rows.Add();
                DataGridViewRow row = dgExtProp.Rows[index];
                row.Cells[colAlias.Name].Value = pe.GetAttribute("Alias");
                row.Cells[colDBField.Name].Value = pe.GetAttribute("Field");
            }

            CheckTabs();
            _initialized = true;
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:35,代码来源:AdvAuthEditor.cs

示例3: Condition

        internal Condition(XmlElement conditionElement)
        {
            XmlHelper h = new XmlHelper(conditionElement);
            this.Comparer = conditionElement.GetAttribute("Comparer");
            this.EmptyReplacement = conditionElement.GetAttribute("EmptyReplacement");
            this.InputConverter = ConverterType.Parse(conditionElement.GetAttribute("InputConverter"));
            this.Quote = h.TryGetBoolean("@Quote", true);
            this.Required = h.TryGetBoolean("@Required", false);
            this.Source = conditionElement.GetAttribute("Source");

            SourceType sType = Service.SourceType.Request;
            if (!Enum.TryParse<SourceType>(conditionElement.GetAttribute("SourceType"), true, out sType))
                sType = Service.SourceType.Request;
            this.SourceType = sType;

            this.Target = conditionElement.GetAttribute("Target");
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:17,代码来源:Condition.cs

示例4: ContractHandler

        internal ContractHandler(XmlElement contractElement)
        {
            Name = contractElement.GetAttribute("Name");

            XmlHelper h = new XmlHelper(contractElement);
            Enabled = h.TryGetBoolean("@Enabled", true);
            this.InitDefinition(h.GetElement("Definition"));

            init();
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:10,代码来源:ContractHandler.cs

示例5: Pagination

        internal Pagination(XmlElement pageElement)
        {
            if (pageElement == null)
            {
                this.AllowPagination = true;
                this.MaxPageSize = 0;
                return;
            }

            XmlHelper h = new XmlHelper(pageElement);
            this.AllowPagination = h.TryGetBoolean("@Allow", true);
            this.MaxPageSize = h.TryGetInteger("MaxPageSize", 0);
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:13,代码来源:Pagination.cs

示例6: CheckEnable

 private bool CheckEnable(XmlElement xml, bool defaultValue)
 {
     if (xml == null) return false;
     XmlHelper h = new XmlHelper(xml);
     return h.TryGetBoolean("@Enabled", defaultValue);
 }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:6,代码来源:AdvAuthEditor.cs

示例7: btnStart_Click

        private void btnStart_Click(object sender, EventArgs e)
        {
            if (!File.Exists(txtPreVersion.Text))
            {
                MessageBox.Show("指定檔案不存在", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            XmlDocument doc = new XmlDocument();
            try
            {
                doc.Load(txtPreVersion.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show("載入檔案失敗 : " + ex.Message, "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            _datagrid.Rows.Clear();

            //取出目前專案的 UDT 資料表
            XmlHelper curHelper = new XmlHelper("<Content />");
            foreach (UDTTable table in MainForm.CurrentUDT.Tables)
                curHelper.AddElement(".", table.GetContent());

            XmlHelper preHelper = new XmlHelper(doc.DocumentElement);

            #region 比對欲新增之資料表
            foreach (XmlElement curTable in curHelper.GetElements("Table"))
            {
                string curTableName = curTable.GetAttribute("Name");
                XmlElement preTable = preHelper.GetElement("Table[@Name='" + curTableName + "']");

                if (preTable == null) //之前版本無此 table
                {
                    ImportTableCommand cmd = UDTCmdProvider.LoadXml<ImportTableCommand>(curTable);
                    AddCommand(cmd);
                    continue;
                }

                XmlHelper preTableHelper = new XmlHelper(preTable);
                XmlHelper curTableHelper = new XmlHelper(curTable);
                XmlElement tableNameElement = GenTableNameElement(curTableName);
                //比對欄位
                #region 比對欄位
                foreach (XmlElement curField in curTableHelper.GetElements("Field"))
                {
                    string curFieldName = curField.GetAttribute("Name");
                    XmlElement preField = preTableHelper.GetElement("Field[@Name='" + curFieldName + "']");

                    if (preField == null)
                    {
                        AddFieldCommand cmd = UDTCmdProvider.LoadXml<AddFieldCommand>(tableNameElement, curField);
                        AddCommand(cmd);
                        continue;
                    }

                    string curDataType = curField.GetAttribute("DataType");
                    string preDataType = preField.GetAttribute("DataType");
                    XmlElement fieldNameElement = this.GenFieldNameElement(curFieldName);
                    if (curDataType != preDataType)
                    {
                        AlterFieldDataTypeCommand cmd = UDTCmdProvider.LoadXml<AlterFieldDataTypeCommand>(tableNameElement, fieldNameElement, GenElement("DataType", curDataType));
                        AddCommand(cmd);
                    }

                    XmlHelper curFieldHelper = new XmlHelper(curField);
                    XmlHelper preFieldHelper = new XmlHelper(preField);

                    bool curIndex = curFieldHelper.TryGetBoolean("@Indexed", false);
                    bool preIndex = preFieldHelper.TryGetBoolean("@Indexed", false);
                    if (curIndex != preIndex)
                    {
                        AlterFieldIndexedCommand cmd = UDTCmdProvider.LoadXml<AlterFieldIndexedCommand>(tableNameElement, fieldNameElement, GenElement("Indexed", curIndex.ToString()));
                        AddCommand(cmd);
                    }

                    bool curAllowNull = curFieldHelper.TryGetBoolean("@AllowNull", true);
                    bool preAllowNull = preFieldHelper.TryGetBoolean("@AllowNull", true);
                    if (curAllowNull != preAllowNull)
                    {
                        AlterFieldAllowNullCommand cmd = UDTCmdProvider.LoadXml<AlterFieldAllowNullCommand>(tableNameElement, fieldNameElement, GenElement("AllowNull", curAllowNull.ToString()));
                        AddCommand(cmd);
                    }

                    string curDefault = curField.GetAttribute("Default");
                    string preDefault = preField.GetAttribute("Default");
                    if (curDefault != preDefault)
                    {
                        IUDTCommand cmd;
                        if (string.IsNullOrWhiteSpace(curDefault))
                            cmd = UDTCmdProvider.LoadXml<AlterFieldDropDefaultCommand>(tableNameElement, fieldNameElement);
                        else
                            cmd = UDTCmdProvider.LoadXml<AlterFieldSetDefaultCommand>(tableNameElement, fieldNameElement, GenElement("Default", curDefault));

                        AddCommand(cmd);
                    }
                }
                #endregion
//.........这里部分代码省略.........
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:101,代码来源:EditMatchForm.cs

示例8: InitDefinition

        private void InitDefinition(XmlElement definition)
        {
            this.Definition = definition;
            XmlHelper h = new XmlHelper(definition);

            string extType = h.GetText("Authentication/@Extends").ToLower();
            if (extType == ExtendType.admin.ToString())
                ExtendType = ExtendType.admin;
            else if (extType == ExtendType.sa.ToString())
                ExtendType = ExtendType.sa;
            else if (extType == ExtendType.ta.ToString())
                ExtendType = ExtendType.ta;
            else if (h.TryGetBoolean("Authentication/Public/@Enabled", false))
                ExtendType = ExtendType.open;
            else
                ExtendType = ExtendType.none;
        }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:17,代码来源:ContractHandler.cs


注:本文中的XmlHelper.TryGetBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。