/// <summary> /// Initializes a new <see cref="DefaultScriptUsageAttribute"/> instance with the specified default script access setting. /// </summary> /// <param name="access">The default script access setting for type members.</param> public DefaultScriptUsageAttribute(ScriptAccess access) { this.access = access; }
private static bool IsScriptableExtensionMethod(MethodInfo method, Type accessContext, ScriptAccess defaultAccess) { return(method.IsScriptable(accessContext, defaultAccess) && method.IsDefined(typeof(ExtensionAttribute), false)); }
public override Invocability GetInvocability(BindingFlags bindFlags, ScriptAccess defaultAccess, bool ignoreDynamic) { return(Invocability.Delegate); }
public static IEnumerable <PropertyInfo> GetScriptableProperties(this Type type, string name, BindingFlags bindFlags, ScriptAccess defaultAccess) { return(type.GetScriptableProperties(bindFlags, defaultAccess).Where(property => property.GetScriptName() == name)); }
public static IEnumerable <Type> GetScriptableNestedTypes(this Type type, BindingFlags bindFlags, ScriptAccess defaultAccess) { return(type.GetNestedTypes(bindFlags).Where(nestedType => nestedType.IsScriptable(defaultAccess))); }
/// <summary> /// Initializes a new <see cref="ScriptMemberAttribute"/> instance with the specified name, script access setting, and script options. /// </summary> /// <param name="name">The name that script code will use to access the target type member.</param> /// <param name="access">The script access setting for the target type member.</param> /// <param name="flags">The script options for the target type member.</param> public ScriptMemberAttribute(string name, ScriptAccess access, ScriptMemberFlags flags) : base(access) { Name = name; Flags = flags; }
public static IEnumerable <PropertyInfo> GetScriptableProperties(this Type type, BindingFlags bindFlags, ScriptAccess defaultAccess) { var properties = type.GetProperties(bindFlags).AsEnumerable(); if (type.IsInterface) { properties = properties.Concat(type.GetInterfaces().SelectMany(interfaceType => interfaceType.GetScriptableProperties(bindFlags, defaultAccess))); } return(properties.Where(property => property.IsScriptable(defaultAccess))); }
public static bool IsReadOnlyForScript(this MemberInfo member, ScriptAccess defaultAccess) { return(member.GetScriptAccess(defaultAccess) == ScriptAccess.ReadOnly); }
public static bool IsScriptable(this PropertyInfo property, Type accessContext, ScriptAccess defaultAccess) { return(!property.IsSpecialName && !property.IsExplicitImplementation() && property.IsAccessible(accessContext) && !property.IsBlockedFromScript(defaultAccess)); }
public static bool IsScriptable(this MethodInfo method, Type accessContext, ScriptAccess defaultAccess) { return(!method.IsSpecialName && !method.IsExplicitImplementation() && method.IsAccessible(accessContext) && !method.IsBlockedFromScript(defaultAccess)); }
public static bool IsBlockedFromScript(this MemberInfo member, ScriptAccess defaultAccess, bool chain = true) { return(member.GetScriptAccess(defaultAccess, chain) == ScriptAccess.None); }
public static bool IsScriptable(this FieldInfo field, Type accessContext, ScriptAccess defaultAccess) { return(!field.IsSpecialName && field.IsAccessible(accessContext) && !field.IsBlockedFromScript(defaultAccess)); }
public static bool IsScriptable(this EventInfo eventInfo, Type accessContext, ScriptAccess defaultAccess) { return(!eventInfo.IsSpecialName && !eventInfo.IsExplicitImplementation() && eventInfo.IsAccessible(accessContext) && !eventInfo.IsBlockedFromScript(defaultAccess)); }
/// <summary> /// Initializes a new <see cref="ScriptMemberAttribute"/> instance with the specified script access setting. /// </summary> /// <param name="access">The script access setting for the type member.</param> public ScriptMemberAttribute(ScriptAccess access) : base(access) { }
private static bool IsScriptableExtensionMethod(MethodInfo method, ScriptAccess defaultAccess) { return method.IsScriptable(defaultAccess) && method.IsDefined(typeof(ExtensionAttribute), false); }
public static bool IsScriptable(this Type type, Type accessContext, ScriptAccess defaultAccess) { return(!type.IsSpecialName && type.IsAccessible(accessContext) && !type.IsBlockedFromScript(defaultAccess)); }
/// <summary> /// Initializes a new <see cref="ScriptMemberAttribute"/> instance with the specified name and script access setting. /// </summary> /// <param name="name">The name that script code will use to access the target type member.</param> /// <param name="access">The script access setting for the target type member.</param> public ScriptMemberAttribute(string name, ScriptAccess access) : base(access) { Name = name; }
protected override void RenderContents(System.Web.UI.HtmlTextWriter writer) { if (this.DesignMode) { //nothing to be done yet } else { WriteParam(writer, "movie", ResolveClientUrl(MovieUrl)); // choose a wmode and a bgcolor based on BackColor value. if (BackColor == System.Drawing.Color.Transparent) { WriteParam(writer, "wmode", "Transparent"); } else if (BackColor.Equals(System.Drawing.Color.Empty)) { //nothing to be done. } else { //Conversion.Hex string color = this.BackColor.ToArgb().ToString("x2"); if (!color.Equals("0")) { WriteParam(writer, "bgcolor", "#" + color.Substring(2)); } } WriteParam(writer, "menu", ShowMenu.ToString().ToLower()); if (!string.IsNullOrEmpty(FlashVars)) { WriteParam(writer, "flashVars", FlashVars); } if (this.Scale != FlashScale.ShowAll) { WriteParam(writer, "scale", Scale.ToString().ToLower()); } if (!Play) { WriteParam(writer, "play", "false"); } if (ScriptAccess != FlashScriptAccess.Default) { WriteParam(writer, "allowScriptAccess", ScriptAccess.ToString().ToLower()); } if (AllowFullScreen) { WriteParam(writer, "allowFullscreen", AllowFullScreen.ToString().ToLower()); } if (!@Loop) { WriteParam(writer, "loop", "false"); } WriteParam(writer, "quality", Quality.ToString().ToLower()); if (this.Alignment != FlashAlign.Center) { string align = ""; switch (Alignment) { case FlashAlign.Bottom: align = "b"; break; case FlashAlign.BottomLeft: align = "bl"; break; case FlashAlign.BottomRight: align = "br"; break; case FlashAlign.Left: align = "l"; break; case FlashAlign.Right: align = "r"; break; case FlashAlign.Top: align = "t"; break; case FlashAlign.TopLeft: align = "tl"; break; case FlashAlign.TopRight: align = "tr"; break; } WriteParam(writer, "salign", align); } if (!Unit.Equals(ExpandedWidth, Unit.Empty)) { writer.AddAttribute("width", this.ExpandedWidth.ToString()); } else { writer.AddAttribute("width", this.Width.ToString()); } if (!Unit.Equals(ExpandedHeight, Unit.Empty)) { writer.AddAttribute("height", this.ExpandedHeight.ToString()); } else { writer.AddAttribute("height", this.Height.ToString()); } writer.AddAttribute(HtmlTextWriterAttribute.Type, "application/x-shockwave-flash"); writer.AddAttribute("pluginspage", "http://www.macromedia.com/go/getflashplayer"); writer.RenderBeginTag(HtmlTextWriterTag.Embed); writer.RenderEndTag(); } }
/// <summary> /// Initializes a new <see cref="ScriptMemberAttribute"/> instance with the specified name, script access setting, and script options. /// </summary> /// <param name="name">The name that script code will use to access the type member.</param> /// <param name="access">The script access setting for the type member.</param> /// <param name="flags">The script options for the type member.</param> public ScriptMemberAttribute(string name, ScriptAccess access, ScriptMemberFlags flags) : base(access) { Name = name; Flags = flags; }
private void RenderFlashObject(HtmlTextWriter writer) { switch (RenderMode) { case FlashRenderMode.ObjectTag: writer.AddAttribute("data", ResolveClientUrl(MovieUrl)); writer.AddAttribute("classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"); writer.AddAttribute("codebase", "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + FlashVersion.Replace(".", ",")); if (!Unit.Equals(ExpandedWidth, Unit.Empty)) { writer.AddAttribute("width", this.ExpandedWidth.ToString()); } else { writer.AddAttribute("width", this.Width.ToString()); } if (!Unit.Equals(ExpandedHeight, Unit.Empty)) { writer.AddAttribute("height", this.ExpandedHeight.ToString()); } else { writer.AddAttribute("height", this.Height.ToString()); } writer.AddAttribute("type", "application/x-shockwave-flash"); writer.AddAttribute("viewastext", "viewastext"); writer.RenderBeginTag(HtmlTextWriterTag.Object); RenderContents(writer); writer.RenderEndTag(); break; case FlashRenderMode.ScriptTag: //Scripting attributes to the 'object' tag. if (!Unit.Equals(ExpandedWidth, Unit.Empty)) { _ScriptLine += ", \'" + this.ExpandedWidth.ToString() + "\'"; } else { _ScriptLine += ", \'" + this.Width.ToString() + "\'"; } if (!Unit.Equals(ExpandedHeight, Unit.Empty)) { _ScriptLine += ", \'" + this.ExpandedHeight.ToString() + "\'"; } else { _ScriptLine += ", \'" + this.Height.ToString() + "\'"; } _ScriptLine += ", \'" + ResolveClientUrl(MovieUrl) + "\'"; // choose a wmode and a bgcolor based on BackColor value. if (BackColor == System.Drawing.Color.Transparent) { _ScriptLine += ", \'#ffffff\'"; _ScriptLine += ", \'Transparent\'"; } else if (BackColor.Equals(System.Drawing.Color.Empty)) { //TODO: why i'm setting a bgcolor? guess that we cant do nothing here. _ScriptLine += ", \'#ffffff\'"; _ScriptLine += ", \'\'"; } else { //string color = Conversion.Hex(this.BackColor.ToArgb()); string color = this.BackColor.ToArgb().ToString("x2"); if (!color.Equals("0")) { _ScriptLine += ", \'#" + color.Substring(2) + "\'"; _ScriptLine += ", \'\'"; } } _ScriptLine += ", \'" + FlashVars + "\'"; if (this.ScriptAccess == FlashScriptAccess.Default) { _ScriptLine += ", null"; } else { _ScriptLine += ", \'" + ScriptAccess.ToString().ToLower() + "\'"; } if (AllowFullScreen) { _ScriptLine += ", true"; } else { _ScriptLine += ", false"; } string scale = "null"; if (this.Scale != FlashScale.ShowAll) { scale = "\'" + this.Scale.ToString().ToLower() + "\'"; } _ScriptLine += ", " + scale; string align = "null"; if (this.Alignment != FlashAlign.Center) { switch (Alignment) { case FlashAlign.Bottom: align = "\'b\'"; break; case FlashAlign.BottomLeft: align = "\'bl\'"; break; case FlashAlign.BottomRight: align = "\'br\'"; break; case FlashAlign.Left: align = "\'l\'"; break; case FlashAlign.Right: align = "\'r\'"; break; case FlashAlign.Top: align = "\'t\'"; break; case FlashAlign.TopLeft: align = "\'tl\'"; break; case FlashAlign.TopRight: align = "\'tr\'"; break; } } _ScriptLine += ", " + align; _ScriptLine += ");"; writer.AddAttribute("type", "text/javascript"); writer.RenderBeginTag(HtmlTextWriterTag.Script); writer.WriteLine(_ScriptLine); writer.RenderEndTag(); break; } }
public static IEnumerable <PropertyInfo> GetScriptableDefaultProperties(this Type type, BindingFlags bindFlags, ScriptAccess defaultAccess) { var properties = type.GetProperties(bindFlags).AsEnumerable(); if (type.IsInterface) { properties = properties.Concat(type.GetInterfaces().SelectMany(interfaceType => interfaceType.GetScriptableProperties(bindFlags, defaultAccess))); } var defaultMembers = type.GetDefaultMembers(); return(properties.Where(property => property.IsScriptable(defaultAccess) && (defaultMembers.Contains(property) || property.IsDispID(SpecialDispIDs.Default)))); }
public static IEnumerable <PropertyInfo> GetScriptableDefaultProperties(this Type type, BindingFlags bindFlags, ScriptAccess defaultAccess) { if (type.IsArray) { var property = typeof(IList <>).MakeSpecificType(type.GetElementType()).GetProperty("Item"); return((property != null) ? new[] { property } : ArrayHelpers.GetEmptyArray <PropertyInfo>()); } var properties = type.GetProperties(bindFlags).AsEnumerable(); if (type.IsInterface) { properties = properties.Concat(type.GetInterfaces().SelectMany(interfaceType => interfaceType.GetScriptableProperties(bindFlags, defaultAccess))); } var defaultMembers = type.GetDefaultMembers(); return(properties.Where(property => property.IsScriptable(defaultAccess) && (defaultMembers.Contains(property) || property.IsDispID(SpecialDispIDs.Default)))); }
public static PropertyInfo GetScriptableDefaultProperty(this Type type, BindingFlags bindFlags, object[] bindArgs, ScriptAccess defaultAccess) { var candidates = type.GetScriptableDefaultProperties(bindFlags, defaultAccess).Distinct(PropertySignatureComparer.Instance).ToArray(); return(SelectProperty(candidates, bindFlags, bindArgs)); }
public static Invocability GetInvocability(this Type type, BindingFlags bindFlags, ScriptAccess defaultAccess, bool ignoreDynamic) { return(invocabilityMap.GetOrAdd(Tuple.Create(type, bindFlags, defaultAccess, ignoreDynamic), GetInvocabilityInternal)); }
public override Invocability GetInvocability(BindingFlags bindFlags, Type accessContext, ScriptAccess defaultAccess, bool ignoreDynamic) { return(typeof(T).GetInvocability(bindFlags, accessContext, defaultAccess, ignoreDynamic)); }
public static IEnumerable <EventInfo> GetScriptableEvents(this Type type, BindingFlags bindFlags, ScriptAccess defaultAccess) { var events = type.GetEvents(bindFlags).AsEnumerable(); if (type.IsInterface) { events = events.Concat(type.GetInterfaces().SelectMany(interfaceType => interfaceType.GetScriptableEvents(bindFlags, defaultAccess))); } return(events.Where(eventInfo => eventInfo.IsScriptable(defaultAccess))); }
public abstract Invocability GetInvocability(BindingFlags bindFlags, Type accessContext, ScriptAccess defaultAccess, bool ignoreDynamic);
public static EventInfo GetScriptableEvent(this Type type, string name, BindingFlags bindFlags, ScriptAccess defaultAccess) { return(type.GetScriptableEvents(bindFlags, defaultAccess).FirstOrDefault(eventInfo => eventInfo.GetScriptName() == name)); }
public SharedHostObjectMemberData(Type accessContext, ScriptAccess defaultAccess) { AccessContext = accessContext; DefaultAccess = defaultAccess; }
public static IEnumerable <FieldInfo> GetScriptableFields(this Type type, BindingFlags bindFlags, ScriptAccess defaultAccess) { return(type.GetFields(bindFlags).Where(field => field.IsScriptable(defaultAccess))); }
public bool ProcessType(Type type, ScriptAccess defaultAccess) { Debug.Assert(type.IsSpecific()); if (!table.ContainsKey(type) && type.HasExtensionMethods()) { const BindingFlags bindFlags = BindingFlags.Public | BindingFlags.Static; table[type] = type.GetMethods(bindFlags).Where(method => IsScriptableExtensionMethod(method, defaultAccess)).ToArray(); summary = new ExtensionMethodSummary(table); return true; } return false; }
public static FieldInfo GetScriptableField(this Type type, string name, BindingFlags bindFlags, ScriptAccess defaultAccess) { return(type.GetScriptableFields(bindFlags, defaultAccess).FirstOrDefault(field => field.GetScriptName() == name)); }
/// <summary> /// Initializes a new <see cref="ScriptMemberAttribute"/> instance with the specified script access setting. /// </summary> /// <param name="access">The script access setting for the target type member.</param> public ScriptMemberAttribute(ScriptAccess access) : base(access) { }
public static IEnumerable <MethodInfo> GetScriptableMethods(this Type type, BindingFlags bindFlags, ScriptAccess defaultAccess) { var methods = type.GetMethods(bindFlags).AsEnumerable(); if (type.IsInterface) { methods = methods.Concat(type.GetInterfaces().SelectMany(interfaceType => interfaceType.GetScriptableMethods(bindFlags, defaultAccess))); methods = methods.Concat(typeof(object).GetScriptableMethods(bindFlags, defaultAccess)); } return(methods.Where(method => method.IsScriptable(defaultAccess))); }
/// <summary> /// Initializes a new <see cref="ScriptMemberAttribute"/> instance with the specified script access setting and script options. /// </summary> /// <param name="access">The script access setting for the target type member.</param> /// <param name="flags">The script options for the target type member.</param> public ScriptMemberAttribute(ScriptAccess access, ScriptMemberFlags flags) : base(access) { Flags = flags; }
public static IEnumerable <MethodInfo> GetScriptableMethods(this Type type, string name, BindingFlags bindFlags, ScriptAccess defaultAccess) { return(type.GetScriptableMethods(bindFlags, defaultAccess).Where(method => method.GetScriptName() == name)); }
/// <summary> /// Initializes a new <see cref="ScriptUsageAttribute"/> instance with the specified script access setting. /// </summary> /// <param name="access">The script access setting for the type member.</param> public ScriptUsageAttribute(ScriptAccess access) { this.access = access; }