Ejemplo n.º 1
0
        private bool ShouldSkip(ArgumentDescriptionAttribute InArgAttr, ref string[] ExistsValues)
        {
            DebugHelper.Assert(InArgAttr.isOptional);

            DependencyDescription[] Dependencies = InArgAttr.depends;

            for (int i = 0; i < Dependencies.Length; ++i)
            {
                DependencyDescription Depend = Dependencies[i];

                string ExistsValue = ExistsValues[Depend.dependsIndex];

                var DependType = CheatCommand.argumentsTypes[Depend.dependsIndex].argumentType;

                var ArgDescInterface = ArgumentDescriptionRepository.instance.GetDescription(DependType);

                DebugHelper.Assert(ArgDescInterface != null);

                ExistsValue = ArgDescInterface.GetValue(DependType, ExistsValue);

                if (Depend.ShouldBackOff(ExistsValue))
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
        protected virtual bool CheckDependencies(
            ArgumentDescriptionAttribute InArugmentDescription,
            DependencyDescription[] InDependencies,
            string[] InArguments,
            out string OutMessage
            )
        {
            OutMessage = "";

            if (InArguments == null)
            {
                OutMessage = "Missing parameters";
                return(false);
            }

            for (int i = 0; i < InDependencies.Length; ++i)
            {
                DependencyDescription CurDependency = InDependencies[i];

                DebugHelper.Assert(CurDependency.dependsIndex >= 0 && CurDependency.dependsIndex < argumentsTypes.Length, "maybe internal error, can't find depend argument description.");

                if (CurDependency.dependsIndex < 0 || CurDependency.dependsIndex >= argumentsTypes.Length)
                {
                    OutMessage = "maybe internal error, can't find depend argument description.";

                    return(false);
                }

                DebugHelper.Assert(CurDependency.dependsIndex < InArguments.Length);

                // try convert to actual value
                string CurDependValue = InArguments[CurDependency.dependsIndex];

                Type DependType = argumentsTypes[CurDependency.dependsIndex].argumentType;
                var  ArgDescriptionInterface = ArgumentDescriptionRepository.instance.GetDescription(DependType);

                DebugHelper.Assert(ArgDescriptionInterface != null);

                CurDependValue = ArgDescriptionInterface.GetValue(DependType, CurDependValue);

                if (CurDependency.ShouldBackOff(CurDependValue))
                {
                    OutMessage = string.Format(
                        "you must provide parameter <{2}>, because <{0}>=\"{1}\"",
                        argumentsTypes[CurDependency.dependsIndex].name,
                        CurDependValue,
                        InArugmentDescription.name
                        );

                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 3
0
        private bool ShouldSkip(ArgumentDescriptionAttribute InArgAttr, ref string[] ExistsValues)
        {
            DebugHelper.Assert(InArgAttr.isOptional);

            DependencyDescription[] Dependencies = InArgAttr.depends;

            for (int i = 0; i < Dependencies.Length; ++i)
            {
                DependencyDescription Depend = Dependencies[i];

                string ExistsValue = ExistsValues[Depend.dependsIndex];

                if (Depend.ShouldBackOff(ExistsValue))
                {
                    return(false);
                }
            }

            return(true);
        }