Exemple #1
0
 /// <summary>
 /// Adds a new attribute to edges
 /// </summary>
 /// <param name="a"></param>
 private void AppendEdgeAttribute(Attribute a)
 {
     Console.WriteLine(a.ToString());
     if (this.edgeattr == null)
         this.edgeattr = new LinkedList<Attribute>();
     this.edgeattr.AddLast(a);
 }
 public string this[Attribute attr]
 {
     get
     {
         try
         {
             return this.attributes[attr];
         }
         catch (KeyNotFoundException)
         {
             string message = String.Format("Attribute \"{0}\" not found in element <{1}>",
                 attr.ToString().ToLower(), this.tag.ToString().ToLower());
             throw new KeyNotFoundException(message);
         }
     }
 }
Exemple #3
0
        public static string Attribute(int indent, System.Attribute attribute, string stringAttribute)
        {
            var attributeString = string.Empty;
            var _attribute      = attribute.ToString();

            attributeString += Indent(indent);
            attributeString += "[";
            attributeString += _attribute;
            attributeString += "(";
            attributeString += @"""";
            attributeString += stringAttribute;
            attributeString += @"""";
            attributeString += ")";
            attributeString += "]";

            return(attributeString);
        }
Exemple #4
0
 /// <summary>
 /// Add all the properties that match an attribute to the list of properties to be displayed in the PropertyGrid.
 /// </summary>
 private void ShowAttribute(Attribute attribute) 
 {
     PropertyDescriptorCollection filteredoriginalpropertydescriptors = TypeDescriptor.GetProperties(m_Wrapper.SelectedObject,new Attribute[] { attribute });
     if (filteredoriginalpropertydescriptors == null || filteredoriginalpropertydescriptors.Count == 0) throw new ArgumentException("Attribute not found", attribute.ToString());
     foreach(PropertyDescriptor propertydescriptor in filteredoriginalpropertydescriptors) ShowProperty(propertydescriptor);
 }
		public int GetValueFromAttribute(Attribute attr) {
			return GetValueFromTag (attr.ToString ());
		}
		public void AddValueToAttribute(Attribute attr, int value) {
			AddValueToTag (attr.ToString (), value);
		}
 public AttributeWrapper(Attribute attribute)
 {
     _AttributeString = attribute.ToString();
 }
		public JObject AllocatePoints(Attribute attr, string charId)
		{
			return RunCommand("allocatepoints", attr.ToString().ToLowerInvariant(), charId);
		}
 private object ExecuteAttributeHandler(Attribute attr, PropertyInfo property)
 {
     var attributeHandler = SelectHandlerForNavigationAttribute(attr, property);
     var key = string.IsNullOrWhiteSpace(attr.ToString()) ? property.Name : attr.ToString();
     return attributeHandler.FindAllMatches(key, _driver);
 }
 public short GetShortAttribute(Attribute attr)
 {
     string value = this[attr];
     try
     {
         return Convert.ToInt16(value);
     }
     catch (FormatException)
     {
         string message = String.Format("Element <{0}>, attribute \"{1}\": expected short, found \"{2}\"",
             this.tag.ToString().ToLower(), attr.ToString().ToLower(), value);
         throw new FormatException(message);
     }
 }
 public decimal GetDecimalAttribute(Attribute attr)
 {
     string value = this[attr];
     try
     {
         return Convert.ToDecimal(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     catch (FormatException)
     {
         string message = String.Format("Element <{0}>, attribute \"{1}\": expected decimal, found \"{2}\"",
             this.tag.ToString().ToLower(), attr.ToString().ToLower(), value);
         throw new FormatException(message);
     }
 }
 public DateTime GetDateTimeAttribute(Attribute attr)
 {
     string value = this[attr];
     try
     {
         return DateTime.ParseExact(value, DateTimeFormat, System.Globalization.DateTimeFormatInfo.InvariantInfo);
     }
     catch (FormatException)
     {
         string message = String.Format("Element <{0}>, attribute \"{1}\": expected datetime, found \"{2}\"",
             this.tag.ToString().ToLower(), attr.ToString().ToLower(), value);
         throw new FormatException(message);
     }
 }