using System; using System.Collections.Generic; using System.Reflection; namespace Apewer.Web { internal sealed class ApiApplication { internal Dictionary Functions = null; internal List Items = null; internal Type Type; internal string Module; // 主特性和主要属性。 internal ApiAttribute Attribute; internal string Name; internal string Lower; internal string Caption; internal string Description; // 附加特性。 internal bool Independent; internal bool Hidden; internal ApiFunction Get(string name) { if (string.IsNullOrEmpty(name)) return null; var lower = name.ToLower(); ApiFunction func; var exist = Functions.TryGetValue(lower, out func); return func; } internal Json ToJson(ApiOptions options) { if (Hidden) return null; var json = Json.NewObject(); json.SetProperty("name", Name); if (!string.IsNullOrEmpty(Caption)) json.SetProperty("caption", Caption); if (!string.IsNullOrEmpty(Description)) json.SetProperty("description", Description); if (options.WithTypeName) json.SetProperty("type", Type.FullName); if (options.WithModuleName) json.SetProperty("mudule", Module); return json; } } }