コード例 #1
0
ファイル: RouteResolver.cs プロジェクト: etsangsplk/ck-core
            bool IRouteConfigurationContext.AddDeclaredAction(string name, string declaredName, bool fromMetaInsert)
            {
                var a = _protoRoute.FindDeclaredAction(declaredName);

                if (a == null)
                {
                    if (fromMetaInsert)
                    {
                        _monitor.SendLine(LogLevel.Warn, string.Format("Action declaration '{0}' not found. Action '{1}' can not be registered.", declaredName, name), null);
                    }
                    return(false);
                }
                ActionConfigurationResolved exists = _actionsByName.GetValueWithDefault(name, null);

                if (exists != null)
                {
                    _monitor.SendLine(LogLevel.Error, string.Format("Action '{0}' can not be added. An action with the same name already exists.", name), null);
                    return(false);
                }
                var added = ActionConfigurationResolved.Create(_monitor, a, true, _actionsByName.Count);

                _actionsByName.Add(name, added);
                _actions.Add(added);
                return(true);
            }
コード例 #2
0
 void AppendChildren(IActivityMonitor monitor, ActionCompositeConfiguration a, IReadOnlyList <string> childPath, bool flattenUselessComposite)
 {
     foreach (var child in a.Children)
     {
         ActionCompositeConfiguration composite = child as ActionCompositeConfiguration;
         if (flattenUselessComposite && composite != null && composite.IsParallel == a.IsParallel)
         {
             AppendChildren(monitor, composite, childPath = childPath.Append(composite.Name).ToArray(), true);
         }
         else
         {
             _children.Add(ActionConfigurationResolved.Create(monitor, child, flattenUselessComposite, _children.Count, childPath));
         }
     }
 }