private void dumpDetails(StringBuilder sb, ApplicationComponent cmp, int level) { if (level > 7) { return; //cyclical ref } var pfx = level <= 0?string.Empty : string.Empty.PadLeft(level) + "->"; sb.AppendLine(pfx + "<f color=white>SID: <f color=yellow> " + cmp.ComponentSID); sb.AppendLine(pfx + "<f color=gray>CommonName: <f color=magenta> " + cmp.ComponentCommonName); sb.AppendLine(pfx + "<f color=gray>Start Time (local): <f color=yellow> " + cmp.ComponentStartTime); sb.AppendLine(pfx + "<f color=gray>Type: <f color=yellow> " + cmp.GetType().FullName); sb.AppendLine(pfx + "<f color=gray>Assembly: <f color=yellow> " + cmp.GetType().Assembly.FullName); sb.AppendLine(pfx + "<f color=gray>Service: <f color=yellow> " + (cmp is Azos.Apps.Daemon ? "Yes" : "No")); if (cmp is INamed) { sb.AppendLine(pfx + "<f color=gray>Name: <f color=green> " + ((INamed)cmp).Name); } sb.AppendLine(pfx + "<f color=gray>Interfaces: <f color=yellow> " + cmp.GetType() .GetInterfaces() .OrderBy(it => it.FullName) .Aggregate("", (r, i) => r + (typeof(IExternallyParameterized).IsAssignableFrom(i) ? "<f color=cyan>{0}<f color=yellow>".Args(i.Name) : i.Name) + ", ")); sb.AppendLine(); sb.AppendLine(); sb.AppendLine(pfx + "Parameters: "); sb.AppendLine(); var pars = ExternalParameterAttribute.GetParametersWithAttrs(cmp.GetType()); foreach (var p in pars) { var nm = p.Item1; object val; if (!ExternalParameterAttribute.GetParameter(cmp.App, cmp, nm, out val)) { val = "?"; } var tp = p.Item2; var atr = p.Item3; sb.AppendLine(pfx + "<f color=gray>{0,-35}: <f color=white>{1,-10} <f color=darkyellow>({2}) <f color=darkgreen>{3}".Args( nm, val == null ? "<null>" : val, tp.DisplayNameWithExpandedGenericArgs().Replace('<', '(').Replace('>', ')') , atr.Groups == null?"*":atr.Groups.Aggregate("", (r, a) => r + a + ", "))); } sb.AppendLine(); var dir = cmp.ComponentDirector; sb.AppendLine(pfx + "<f color=gray>Director: <f color=magenta> " + (dir == null? " -none- " : dir.GetType().FullName)); if (dir is ApplicationComponent) { dumpDetails(sb, dir as ApplicationComponent, level + 1); } }
/// <summary> /// Gets external parameter value returning true if parameter was found /// </summary> public bool ExternalGetParameter(string name, out object value, params string[] groups) { if (name.StartsWith(TBL_PARAM_PREFIX) && name.Length > TBL_PARAM_PREFIX.Length) { var tname = name.Substring(TBL_PARAM_PREFIX.Length); var tbl = m_Tables[tname]; if (tbl == null) { value = null; return(false); } value = tbl.Options.AsExternalParameter; return(true); } else { return(ExternalParameterAttribute.GetParameter(this, name, out value, groups)); } }
/// <summary> /// Gets external parameter value returning true if parameter was found /// </summary> public bool ExternalGetParameter(string name, out object value, params string[] groups) { return(ExternalParameterAttribute.GetParameter(this, name, out value, groups)); }
protected virtual bool DoExternalGetParameter(string name, out object value, params string[] groups) { return(ExternalParameterAttribute.GetParameter(this, name, out value, groups)); }
public bool ExternalGetParameter(string name, out object value, params string[] groups) => ExternalParameterAttribute.GetParameter(App, this, name, out value, groups);
/// <summary> /// Gets external parameter value returning true if parameter was found /// </summary> public virtual bool ExternalGetParameter(string name, out object value, params string[] groups) { return ExternalParameterAttribute.GetParameter(App, this, name, out value, groups); }
protected virtual bool DoExternalGetParameter(string name, out object value, params string[] groups) => ExternalParameterAttribute.GetParameter(App, this, name, out value, groups);