예제 #1
0
        private static string GetEnvValueString(ArgumentType arg, EnvType env)
        {
            var result = Environment.GetEnvironmentVariable(env.ToString());

            if (!string.IsNullOrEmpty(result))
            {
                Warn($"Missing Argument : {arg.ToString()}, overriding with existing Env Value. Env Key : {env}");
            }
            else
            {
                Log($"Missing Argument : {arg.ToString()}, you can override with Env Value. Env Key : {env}");
            }
            return(result);
        }
예제 #2
0
        private string ArgTypeConverter(ArgumentType type)
        {
            switch (type)
            {
            case ArgumentType.boolean:
                return("Boolean");

            case ArgumentType.text:
                return("Text");

            case ArgumentType.number:
                return("Number");

            case ArgumentType.datetime:
                return("DateTime");

            case ArgumentType.collection:
                return("Text Collection");

            case ArgumentType.unknown:
                return("A magic type!");

            default:
                break;
            }
            throw new InvalidOperationException(type.ToString());
        }
예제 #3
0
        public override string ToString()
        {
            string display;

            if (Optional)
            {
                display = "[";
            }
            else
            {
                display = "<";
            }

            display += StringUtil.ToUppercaseFirst(ArgumentType.ToString());

            if (Optional)
            {
                display += "]";
            }
            else
            {
                display += ">";
            }

            return(display);
        }
예제 #4
0
 public override string ToString()
 {
     return(string.Format(
                "[ArgumentDef(shortName: '{0}', longName: \"{1}\", dataType: {2}, argType: {3}, argStatus: {4}, consumption: {5})]",
                ShortName == nullChar ? "\\0" : ShortName.ToString(),
                LongName,
                DataType.FullName,
                ArgType.ToString(),
                ArgStatus.ToString(),
                Consumption
                ));
 }
예제 #5
0
        /// <summary>
        /// Generates this instance.
        /// </summary>
        /// <returns></returns>
        public string Generate()
        {
            StringBuilder result = new StringBuilder();

            XmlDocument xDoc     = new XmlDocument();
            XmlElement  rootNode = xDoc.CreateElement(string.Concat(ArgumentType.ToString(), "s"));


            foreach (IDev2Definition def in Definitions)
            {
                XmlElement tmp = xDoc.CreateElement(ArgumentType.ToString());
                tmp.SetAttribute(_nameAttribute, def.Name);

                tmp.SetAttribute(ArgumentType != enDev2ArgumentType.Input ? _mapsToAttribute : _sourceAttribute, def.MapsTo);

                if (ArgumentType != enDev2ArgumentType.Input)
                {
                    tmp.SetAttribute(_valueAttribute, def.Value);
                }

                tmp.SetAttribute("IsObject", def.IsObject.ToString());

                if (def.RecordSetName.Length > 0)
                {
                    tmp.SetAttribute(_recordsetAttribute, def.RecordSetName);
                }

                if (def.DefaultValue.Length > 0 && ArgumentType == enDev2ArgumentType.Input)
                {
                    tmp.SetAttribute(_defaultValueAttribute, def.DefaultValue);
                }

                if (def.IsRequired && ArgumentType == enDev2ArgumentType.Input)
                {
                    XmlElement requiredElm = xDoc.CreateElement(_validateTag);
                    requiredElm.SetAttribute(_typeAttribute, _requiredValue);
                    tmp.AppendChild(requiredElm);
                }
                rootNode.AppendChild(tmp);
            }

            xDoc.AppendChild(rootNode);

            result.Append(xDoc.OuterXml);

            return(result.ToString());
        }
예제 #6
0
        private string ArgTypeConverter(ArgumentType type)
        {
            switch (type)
            {
            case ArgumentType.Boolean:
                return("Boolean");

            case ArgumentType.Text:
                return("Text");

            case ArgumentType.Number:
                return("Number");

            case ArgumentType.Datetime:
                return("DateTime");

            case ArgumentType.Collection:
                return("Text Collection");

            case ArgumentType.Unknown:
                return("A magic type!");
            }
            throw new InvalidOperationException(type.ToString());
        }
예제 #7
0
        public override string ToString()
        {
            StringBuilder buf = new StringBuilder();

            if (NameNode is TypedIdentifierNode)
            {
                buf.AppendLine(NameNode.ToString());
            }
            else if (NameNode is IdentifierNode)
            {
                buf.Append(NameNode.ToString());
                string argType = ArgumentType.ToString();
                if (!string.IsNullOrEmpty(argType))
                {
                    buf.Append(" : " + argType);
                }
            }
            else
            {
                buf.Append(NameNode.ToString());
            }

            return(buf.ToString());
        }
예제 #8
0
 private void Dir(ArgumentType type)
 {
     Write("<");
     Write(type.ToString(), ConsoleColor.Magenta);
     Write(">");
 }
예제 #9
0
 public static bool ShouldHaveResult(this ArgumentType type)
 {
     return(type.GetType().GetField(type.ToString())?.GetCustomAttribute <InnerReturnTypesAttribute>() == null);
 }
예제 #10
0
 /// <summary>
 ///		Comrpueba si una cadena se corresponde con un argumento de entrada
 /// </summary>
 private static bool IsArgument(string argument, ArgumentType type)
 {
     return(argument.Equals($"-{type.ToString()}", StringComparison.CurrentCultureIgnoreCase) ||
            argument.Equals($"--{type.ToString()}", StringComparison.CurrentCultureIgnoreCase));
 }
예제 #11
0
파일: Argument.cs 프로젝트: kerwon/dlr
 public override string ToString()
 {
     return(_name == null?_kind.ToString() : _kind.ToString() + ":" + _name);
 }
예제 #12
0
 public override string ToString()
 {
     return(_name == SymbolId.Empty ? _kind.ToString() : _kind.ToString() + ":" + SymbolTable.IdToString(_name));
 }
예제 #13
0
파일: CPU.cs 프로젝트: DINKIN/snes
        public void StackPush(int value, ArgumentType argType)
        {
            switch (argType)
            {
                case ArgumentType.I1:
                    CurrentStackBin.WriteInt1(SP, (byte)value);
                    SP--;
                    break;
                case ArgumentType.I2:
                    CurrentStackBin.WriteInt1(SP, (byte)value);
                    SP--;

                    CurrentStackBin.WriteInt1(SP, (byte)(value >> 8));
                    SP--;
                    break;
                case ArgumentType.I3:
                case ArgumentType.None:
                default:
                    throw new NotSupportedException(argType.ToString());
            }
        }
예제 #14
0
파일: CPU.cs 프로젝트: DINKIN/snes
        public int StackPull(ArgumentType argType)
        {
            switch (argType)
            {
                case ArgumentType.I1:
                    SP++;
                    return CurrentStackBin.ReadInt1(SP);
                case ArgumentType.I2:
                    SP++;
                    int tmp = CurrentStackBin.ReadInt1(SP) << 8;

                    SP++;
                    tmp |= CurrentStackBin.ReadInt1(SP);

                    return tmp;
                case ArgumentType.I3:
                case ArgumentType.None:
                default:
                    throw new NotSupportedException(argType.ToString());
            }
        }
예제 #15
0
파일: CPU.cs 프로젝트: DINKIN/snes
 public int StackPeek(ArgumentType argType, int offset = 0)
 {
     switch (argType)
     {
         case ArgumentType.I1:
             return CurrentStackBin.ReadInt1(SP + 1 + offset);
         case ArgumentType.I2:
             return CurrentStackBin.ReadInt1(SP + 1 + offset) << 8 | CurrentStackBin.ReadInt1(SP + 2 + offset);
         case ArgumentType.I3:
         case ArgumentType.None:
         default:
             throw new NotSupportedException(argType.ToString());
     }
 }
예제 #16
0
 public static ArgumentReturnType ReturnType(this ArgumentType type)
 {
     return(type.GetType().GetField(type.ToString())?.GetCustomAttribute <ReturnTypeAttribute>()
            ?.ReturnType ?? ArgumentReturnType.Default);
 }
예제 #17
0
 public static ArgumentReturnType[] InnerReturnTypes(this ArgumentType type)
 {
     return(type.GetType().GetField(type.ToString())?.GetCustomAttribute <InnerReturnTypesAttribute>()
            ?.InnerReturnTypes);
 }