public override bool Connect(IDomain domain, IArea rootArea, IArea currentArea, IObject currentObject) { IResource Resource = HtmlResource; IObject Object = HtmlObject; IObjectProperty ObjectProperty = HtmlObjectProperty; IDeclarationSource ObjectPropertyKey = HtmlKey; bool IsConnected = HtmlProperty.ConnectToResourceOrObject(domain, currentArea, currentObject, ref Resource, ref Object, ref ObjectProperty, ref ObjectPropertyKey); if (!(ObjectProperty is IObjectPropertyReadonlyString) && !(ObjectProperty is IObjectPropertyStringDictionary)) { throw new ParsingException(0, Source.Source, $"Invalid type for property '{Source.Name}'."); } HtmlResource = Resource; HtmlObject = Object; HtmlObjectProperty = ObjectProperty; HtmlKey = ObjectPropertyKey; HtmlObjectProperty?.SetIsRead(); return(IsConnected); }
set => SetValue(HtmlProperty, value);
/// <summary> /// Sets a property. /// </summary> /// <param name="property">The HTML property.</param> /// <param name="value">The value to set.</param> public void SetProperty(HtmlProperty property, object value) { SetProperty(property.ScriptPropertyName(), value); }
/// <summary> /// Returns the ScriptProperty name. This is a camel-case value. Only /// alters the first character. /// </summary> /// <param name="property">The property name.</param> /// <returns>Returns the value, as a string, with the first letter /// capitalized.</returns> public static string ScriptPropertyName(this HtmlProperty property) { return(CamelCase(property.ToString())); }
/// <summary> /// Gets a property. /// </summary> /// <param name="property">The HTML property.</param> /// <returns>Returns the value.</returns> public object GetProperty(HtmlProperty property) { return GetProperty(property.ScriptPropertyName()); }
/// <summary> /// Get a property value as an integer. /// </summary> /// <param name="property">The ScriptObject property name.</param> /// <returns>Returns the property value.</returns> protected int GetPropertyNumber(HtmlProperty property) { return GetPropertyNumber(property.ScriptPropertyName()); }
/// <summary> /// Gets a property. /// </summary> /// <param name="property">The HTML property.</param> /// <returns>Returns the value.</returns> public object GetProperty(HtmlProperty property) { return(GetProperty(property.ScriptPropertyName())); }
/// <summary> /// Get a property value as an integer. /// </summary> /// <param name="property">The ScriptObject property name.</param> /// <returns>Returns the property value.</returns> protected int GetPropertyNumber(HtmlProperty property) { return(GetPropertyNumber(property.ScriptPropertyName())); }