public static List <CastSpellAction> GetCastSpellActionList(Component pa)
        {
            if (pa is CastSpellAction)
            {
                return new List <CastSpellAction> {
                           (pa as CastSpellAction)
                }
            }
            ;

            List <CastSpellAction> ret = null;
            var composite = pa as Composite;

            if (composite != null)
            {
                foreach (var child in composite.Children)
                {
                    List <CastSpellAction> tmp = GetCastSpellActionList(child);
                    if (tmp != null)
                    {
                        // lets create a list only if we need to... (optimization)
                        if (ret == null)
                        {
                            ret = new List <CastSpellAction>();
                        }
                        ret.AddRange(tmp);
                    }
                }
            }
            return(ret);
        }
    }
Exemple #2
0
        internal static void GetHbprofiles(string pbProfilePath, Component comp, List <LoadProfileAction> list)
        {
            var loadProfileAction = comp as LoadProfileAction;

            if (loadProfileAction != null && !string.IsNullOrEmpty(loadProfileAction.Path) &&
                loadProfileAction.ProfileType == LoadProfileType.Honorbuddy)
            {
                list.Add(loadProfileAction);
            }
            var composite = comp as Composite;

            if (composite != null)
            {
                foreach (var c in composite.Children)
                {
                    GetHbprofiles(pbProfilePath, c, list);
                }
            }
        }
Exemple #3
0
        private void PrintComposite(Component comp, int cnt)
        {
            var composite = comp as Composite;

            var pbComp = composite as IPBComponent;

            if (pbComp != null)
            {
                string name = pbComp.Title;
                Logging.Write(
                    "{0}{1} IsDone:{2}",
                    new string(' ', cnt * 4),
                    name,
                    pbComp.IsDone);
            }
            if (composite != null)
            {
                foreach (var child in composite.Children)
                {
                    PrintComposite(child, cnt + 1);
                }
            }
        }
        private static SubRoutineComposite GetSubRoutineMyNameInternal(string subRoutineName, Component comp)
        {
            if (comp is SubRoutineComposite && ((SubRoutineComposite)comp).SubRoutineName == subRoutineName)
            {
                return((SubRoutineComposite)comp);
            }
            var composite = comp as Composite;

            if (composite != null)
            {
                return(composite.Children.Select(c => GetSubRoutineMyNameInternal(subRoutineName, c)).
                       FirstOrDefault(temp => temp != null));
            }
            return(null);
        }