protected virtual object GetAssemblyTitle(HelpParts parts) { string title = EffectiveAssembly?.GetCustomAttributes <AssemblyTitleAttribute>().FirstOrDefault()?.Title ?? EffectiveAssembly?.GetName().Name; string version = EffectiveAssembly?.GetCustomAttributes <AssemblyInformationalVersionAttribute>().FirstOrDefault()?.InformationalVersion ?? EffectiveAssembly?.GetName().Version.ToString(); string line = string.Join(" ", parts.Has(HelpParts.AssemblyTitle) ? title : null, parts.Has(HelpParts.AssemblyVersion) ? version : null).Trim(); return(new Div(line)); }
private object GetOptionsCore(HelpParts parts) { if (!parts.Has(HelpParts.Options) || !Info.Parts.Has(HelpParts.Options) || !Info.Options.Any(IsOptionVisible(parts))) { return(null); } return(GetOptions(parts)); }
private object GetErrorsCore(HelpParts parts) { if (!parts.Has(HelpParts.Errors) || !Info.Parts.Has(HelpParts.Errors) || Info.Errors.All(e => e.Message == null)) { return(null); } return(GetErrors(parts)); }
private object GetExamplesCore(HelpParts parts) { if (!parts.Has(HelpParts.Examples) || !Info.Parts.Has(HelpParts.Examples) || !Info.Examples.SelectMany(e => e).Any()) { return(null); } return(GetExamples(parts)); }
private object GetUsageCore(HelpParts parts) { if (!parts.Has(HelpParts.AssemblyUsage)) { return(null); } return(GetUsage(parts)); }
private object GetAssemblyLicenseCore(HelpParts parts) { if (!parts.Has(HelpParts.AssemblyLicense)) { return(null); } return(GetAssemblyLicense(parts)); }
private object GetAssemblyCopyrightCore(HelpParts parts) { if (!parts.Has(HelpParts.AssemblyCopyright)) { return(null); } return(GetAssemblyCopyright(parts)); }
private object GetAssemblyTitleCore(HelpParts parts) { if (!parts.Has(HelpParts.AssemblyTitle | HelpParts.AssemblyVersion)) { return(null); } return(GetAssemblyTitle(parts)); }
protected virtual object GetOption(OptionInfo option, HelpParts parts, bool isSubOption) { var m = isSubOption ? SubOptionMargin : OptionMargin; var marginName = new Thickness(m.Left, m.Top, 1, m.Bottom); var marginText = new Thickness(0, m.Top, m.Right, m.Bottom); string values = parts.Has(HelpParts.OptionsValues) && option.HasHelpValues ? string.Join(", ", option.HelpValues) : null; string defaultValue = parts.Has(HelpParts.OptionsDefaultValue) && option.DefaultValue != null ? GetOptionDefault(option) : null; object subOptions = parts.Has(HelpParts.SubOptions) && option.SubOptions.Any(IsOptionVisible(parts)) ? GetSubOptions(option, parts) : null; return(new[] { new Div { Margin = marginName, Color = isSubOption ? SubOptionNameColor : OptionNameColor, TextWrap = TextWrap.WordWrapSpace, Children = { option.HelpNameWithValue } }, new Div { Margin = marginText, Color = OptionTextColor, Children = { option.HelpText, option.IsRequired ? " (Required)" : null, values != null ? $"\nValid values: {values}" : null, defaultValue != null ? $"\nDefault: {defaultValue}" : null } }, subOptions != null ? new Div { [Grid.ColumnSpanProperty] = 2, Children = { subOptions } } : null }); }
protected static Func <OptionInfo, bool> IsOptionVisible(HelpParts parts) => option => (option.IsVisible || parts.Has(HelpParts.HiddenOptions)) && (!option.IsBuiltIn || parts.Has(HelpParts.BuiltInOptions));