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); }
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()); }
public override string ToString() { string display; if (Optional) { display = "["; } else { display = "<"; } display += StringUtil.ToUppercaseFirst(ArgumentType.ToString()); if (Optional) { display += "]"; } else { display += ">"; } return(display); }
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 )); }
/// <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()); }
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()); }
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()); }
private void Dir(ArgumentType type) { Write("<"); Write(type.ToString(), ConsoleColor.Magenta); Write(">"); }
public static bool ShouldHaveResult(this ArgumentType type) { return(type.GetType().GetField(type.ToString())?.GetCustomAttribute <InnerReturnTypesAttribute>() == null); }
/// <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)); }
public override string ToString() { return(_name == null?_kind.ToString() : _kind.ToString() + ":" + _name); }
public override string ToString() { return(_name == SymbolId.Empty ? _kind.ToString() : _kind.ToString() + ":" + SymbolTable.IdToString(_name)); }
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()); } }
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()); } }
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()); } }
public static ArgumentReturnType ReturnType(this ArgumentType type) { return(type.GetType().GetField(type.ToString())?.GetCustomAttribute <ReturnTypeAttribute>() ?.ReturnType ?? ArgumentReturnType.Default); }
public static ArgumentReturnType[] InnerReturnTypes(this ArgumentType type) { return(type.GetType().GetField(type.ToString())?.GetCustomAttribute <InnerReturnTypesAttribute>() ?.InnerReturnTypes); }