Exemple #1
0
 private static void Foreach(Action <ApiItem> action, ApiItem config)
 {
     if (config != null)
     {
         action(config);
     }
 }
Exemple #2
0
        private void FindApiClientArg(EntityConfig friend, ApiItem item, ProjectConfig apiProject)
        {
            var entity = GetEntity(p => p != friend && p.ReferenceKey == friend.Key);
            var count  = friend.Properties.Count(p => p.Name != "ClientNo");

            switch (count)
            {
            case 0:
                item.ResultArg = null;
                if (entity != null)
                {
                    entity.Option.IsDelete = true;
                }
                return;

            case 1:
                item.ResultArg =
                    CppTypeHelper.CppTypeToCsType(friend.Properties.FirstOrDefault(p => p.Name != "ClientNo"));
                if (entity != null)
                {
                    entity.Option.IsDelete = true;
                }
                return;
            }
            if (entity == null)
            {
                entity = new EntityConfig
                {
                    Parent  = apiProject,
                    Project = apiProject.Name,
                    CppName = item.CallArg,
                    Name    = ToClientName(item.CallArg),
                    Tag     = friend.Tag
                };
                apiProject.Add(entity);
            }
            entity.NoDataBase   = true;
            entity.ReferenceKey = friend.Key;
            entity.Caption      = item.Caption + "命令调用参数";
            entity.Description  = item.Caption + "命令调用参数";
            item.ResultArg      = entity.Name;

            foreach (var property in friend.Properties)
            {
                var fp = entity.Properties.FirstOrDefault(p => p.ReferenceKey == property.Key)
                         ?? entity.Properties.FirstOrDefault(p => p.Name == property.Name);
                if (fp == null)
                {
                    fp = new PropertyConfig();
                    fp.CopyFrom(property);
                    fp.Parent = entity;
                    entity.Add(fp);
                }
                fp.Parent = entity;
                fp.Option.ReferenceKey = property.Option.Key;
                fp.Caption             = property.Caption;
                fp.Tag = entity.Tag + "," + property.Name;
            }
        }
 /// <summary>
 /// 加入
 /// </summary>
 /// <param name="api"></param>
 internal void Add(ApiItem api)
 {
     if (!ApiList.Contains(api))
     {
         ApiList.Add(api);
     }
     GlobalConfig.Add(api);
 }
        private void FindApiClientArg(EntityConfig friend, ApiItem item, ProjectConfig apiProject)
        {
            var entity = GlobalConfig.GetEntity(p => p != friend && p.Tag == friend.Tag);
            var count  = friend.Properties.Count(p => p.Name != "ClientNo");

            switch (count)
            {
            case 0:
                item.ResultArg = null;
                if (entity != null)
                {
                    entity.IsDelete = true;
                }
                return;

            case 1:
                item.ResultArg =
                    CppTypeHelper.CppTypeToCsType(friend.Properties.FirstOrDefault(p => p.Name != "ClientNo"));
                if (entity != null)
                {
                    entity.IsDelete = true;
                }
                return;
            }
            if (entity == null)
            {
                entity = new EntityConfig
                {
                    Parent  = apiProject,
                    Project = apiProject.Name,
                    CppName = item.CallArg,
                    Name    = ToClientName(item.CallArg)
                };
                apiProject.Entities.Add(entity);
                Solution.Entities.Add(entity);
            }
            entity.IsClass     = true;
            entity.Tag         = friend.Tag;
            entity.Caption     = item.Caption + "命令调用参数";
            entity.Description = item.Caption + "命令调用参数";
            item.ResultArg     = entity.Name;

            foreach (var property in friend.Properties)
            {
                property.CsType = CppTypeHelper.CppTypeToCsType(property);
                if (property.Name == "ClientNo")
                {
                    continue;
                }
                property.Tag = friend.Tag + "," + property.Name;
                var fp = entity.Properties.FirstOrDefault(p => p.Tag != null && p.Tag == property.Tag)
                         ?? entity.Properties.FirstOrDefault(p => p.Name == property.Name);
                if (fp == null)
                {
                    fp = new PropertyConfig();
                    fp.CopyFrom(property);
                    fp.Parent = entity;
                    entity.Properties.Add(fp);
                }
                fp.Parent  = entity;
                fp.Tag     = property.Tag;
                fp.Caption = property.Caption;
            }
        }
Exemple #5
0
 private static void Foreach(Func <ApiItem, bool> condition, Action <ApiItem> action, ApiItem config)
 {
     if (config != null && condition(config))
     {
         action(config);
     }
 }
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="api"></param>
 internal void Remove(ApiItem api)
 {
     ApiList.Remove(api);
     GlobalConfig.Remove(api);
 }