Exemplo n.º 1
0
        public void AddCommand(ICheatCommand InCommand, int HierarchiesIndex)
        {
            DebugHelper.Assert(InCommand != null);
            string[] GroupHierarchies = InCommand.command.groupHierarchies;

            DebugHelper.Assert(GroupHierarchies != null);

            if (HierarchiesIndex < GroupHierarchies.Length)
            {
                // should add to children group
                CheatCommandGroup Groups = null;
                if (!ChildrenGroups.TryGetValue(GroupHierarchies[HierarchiesIndex], out Groups))
                {
                    Groups = new CheatCommandGroup();
                    ChildrenGroups.Add(GroupHierarchies[HierarchiesIndex], Groups);
                }

                DebugHelper.Assert(Groups != null);

                Groups.AddCommand(InCommand, HierarchiesIndex + 1);
            }
            else
            {
                // add to this group
                Commands.Add(InCommand.command.baseName, InCommand);
            }
        }
Exemplo n.º 2
0
        public void RegisterCommand(ICheatCommand InCommand)
        {
            // 1.
            DebugHelper.Assert(InCommand != null && !HasCommand(InCommand.command.baseName));

            GeneralRepositories.Commands[InCommand.command.baseName.ToLower()] = InCommand;

            // 2.
            string[] GroupHierarchies = InCommand.command.groupHierarchies;

            DebugHelper.Assert(GroupHierarchies != null);

            string BaseGroup = GroupHierarchies[0];

            CheatCommandGroup Groups = null;

            if (!Repositories.TryGetValue(BaseGroup, out Groups))
            {
                Groups = new CheatCommandGroup();
                Repositories[BaseGroup] = Groups;
            }

            Groups.AddCommand(InCommand, 1);
        }