Inheritance: System.Dynamic.DynamicObject
コード例 #1
0
ファイル: PropertySheet.cs プロジェクト: virmitio/devtools
        /// <summary>
        /// Gets a rule by the selector criteria. If the rule doesn't exists, it creates it and adds it to the propertysheet.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="parameter"></param>
        /// <param name="class"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public Rule GetRule( string name = "*" , string parameter = null, string @class = null , string id = null )
        {
            var r = (from rule in Rules
            where rule.Name == name &&
                (string.IsNullOrEmpty(parameter) ? null : parameter) == rule.Parameter &&
                    (string.IsNullOrEmpty(@class) ? null : @class) == rule.Class &&
                        (string.IsNullOrEmpty(id) ? null : id) == rule.Id
            select rule).FirstOrDefault();

            if( r == null ) {
                _rules.Add(r = new Rule(this) {
                    Name = name,
                    Parameter = parameter,
                    Class = @class,
                    Id = id,
                });
            }

            return r;
        }
コード例 #2
0
ファイル: PropertySheet.cs プロジェクト: ericschultz/devtools
 public Rule AddRule(string name = "*", string parameter = null, string @class = null, string id = null)
 {
     Rule result;
     _rules.Insert(0, result = new Rule(this) {
         Name = name,
         Parameter = parameter,
         Class = @class,
         Id = id,
     });
     return result;
 }
コード例 #3
0
 /// <summary>
 ///   RuleProperty object must be created by the Rule.
 /// </summary>
 /// <param name="parent"> </param>
 /// <param name="name"> </param>
 internal PropertyRule(Rule parent, string name)
 {
     ParentRule = parent;
     Name = name;
 }
コード例 #4
0
 public EndUserRuleException(Rule rule, string errorcode, string message, params object[] parameters)
     : base("{0}({1},{2}):{3}:{4}".format(rule.SourceLocation.SourceFile, rule.SourceLocation.Row, rule.SourceLocation.Column, errorcode, message.format(parameters)))
 {
     Rule = rule;
 }
コード例 #5
0
ファイル: PropertyRule.cs プロジェクト: ericschultz/devtools
 protected PropertyRule(Rule parent, string name)
 {
     ParentRule = parent;
     Name = name;
 }
コード例 #6
0
ファイル: PropertyRule.cs プロジェクト: ericschultz/devtools
 /// <summary>
 ///   RuleProperty object must be created by the Rule.
 /// </summary>
 /// <param name="parent"> </param>
 /// <param name="name"> </param>
 internal StandardPropertyRule(Rule parent, string name)
     : base(parent, name)
 {
 }
コード例 #7
0
 internal ScriptedPropertyRule(Rule parent, string name, string scriptType, string scriptText, string sourceText )
     : base(parent, name)
 {
     ScriptType = scriptType;
     ScriptText = scriptText;
 }