public string ResolveTableName(Table t) { List <string> Aliases = null; string alias = null; if (!TableNames.Keys.Contains(t.Name)) { Aliases = new List <string>(); alias = Next(); TableNames.Add(t.Name, Aliases); Aliases.Add(alias); } else { Aliases = TableNames[t.Name]; } if (t.BanDuplicates) { alias = Next(); Aliases.Add(alias); } else { alias = Aliases[0]; } return(alias); }
/// <summary> /// Generate a new info instance given a reflected property. /// </summary> /// <param name="toAutoGen">The property to use to seed the usage info</param> public ArgumentUsageInfo(PropertyInfo toAutoGen) : this() { Property = toAutoGen; Ignore = toAutoGen.HasAttr <ArgIgnoreAttribute>(); IsAction = toAutoGen.IsActionArgProperty(); IsActionArgs = toAutoGen.Name == Constants.ActionPropertyConventionName; Name = toAutoGen.GetArgumentName(); IsRequired = toAutoGen.HasAttr <ArgRequired>(); if (ArgShortcut.GetShortcut(toAutoGen) != null) { Aliases.Add("-" + ArgShortcut.GetShortcut(toAutoGen)); } Type = toAutoGen.PropertyType.Name; if (KnownTypeMappings.ContainsKey(Type)) { Type = KnownTypeMappings[Type]; } else { Type = Type.ToLower(); } Position = toAutoGen.HasAttr <ArgPosition>() ? new int?(toAutoGen.Attr <ArgPosition>().Position) : null; Description = ""; if (toAutoGen.HasAttr <ArgDescription>()) { Description = toAutoGen.Attr <ArgDescription>().Description; } }
public HelpCommand(ICommandProcessor processor) { _processor = processor; Aliases.Add("Commands"); Aliases.Add("?"); }
/// <summary> /// The object factory for a particular data collection instance. /// </summary> public virtual void CreateObjectsFromData(Aliases aliases, System.Data.DataSet data) { // Do nothing if we have nothing if (data == null || data.Tables.Count == 0 || data.Tables[0].Rows.Count == 0) { return; } // Create a local variable for the new instance. Alias newobj = null; // Create a local variable for the data row instance. System.Data.DataRow dr = null; // Iterate through the table rows for (int i = 0; i < data.Tables[0].Rows.Count; i++) { // Get a reference to the data row dr = data.Tables[0].Rows[i]; // Create a new object instance newobj = System.Activator.CreateInstance(aliases.ContainsType[0]) as Alias; // Let the instance set its own members newobj.SetMembers(ref dr); // Add the new object to the collection instance aliases.Add(newobj); } }
public Function(JToken JSON, bool magicMethod = false) : this(magicMethod) { this.StartLine = Int32.MinValue; this.EndLine = Int32.MinValue; this.Formats = new List <string>(); this.Name = (string)JSON.SelectToken(Keys.PHPDefinitionJSONKeys.GeneralKeys.Name); this.ParameterCount = (int)JSON.SelectToken(Keys.PHPDefinitionJSONKeys.GeneralKeys.ParameterCount); this.ReturnType = (string)JSON.SelectToken(Keys.PHPDefinitionJSONKeys.GeneralKeys.ReturnType); var formats = (JArray)JSON.SelectToken(Keys.PHPDefinitionJSONKeys.GeneralKeys.Formats); if (formats != null) { foreach (string format in formats) { this.Formats.Add(format); } } var aliasArray = (JArray)JSON.SelectToken(Keys.PHPDefinitionJSONKeys.GeneralKeys.Aliases); if (aliasArray != null) { foreach (string alias in aliasArray) { Aliases.Add(alias); } } }
public ArgumentUsageInfo(PropertyInfo toAutoGen) : this() { Property = toAutoGen; Name = "-" + NameTranslators.CombineByPascalCase(toAutoGen.Name, "-").ToLower(); Aliases.Add("-" + Property.Name); if (Aliases.Count == 0) { Aliases.Add("-" + Name.ToLower()); } var argAliases = Property.HasAttr<ArgAliasAttribute>() ? Property.Attr<ArgAliasAttribute>().Aliases : null; if(argAliases != null) { Aliases.AddRange(argAliases.Select(x=> "-" + NameTranslators.CombineByPascalCase(x, "-"))); } Description = Property.HasAttr<ArgDescriptionAttribute>() ? Property.Attr<ArgDescriptionAttribute>().Description : ""; Group = Property.HasAttr<ArgDescriptionAttribute>() ? Property.Attr<ArgDescriptionAttribute>().Group : ""; if (Property.PropertyType.IsEnum) { foreach (var val in toAutoGen.PropertyType.GetFields().Where(v => v.IsSpecialName == false)) { var description = val.HasAttr<ArgDescriptionAttribute>() ? " - " + val.Attr<ArgDescriptionAttribute>().Description : ""; var valText = val.Name; PossibleValues.Add(valText + description); } } }
public ForcedStatCommand() { Aliases.Add("ForceStat"); Aliases.Add("FS"); Register(new ActionCommand("Reset", "Resets the forced stat", (user, args) => user.ModifyForcedStats(s => s.Reset()))); }
public NamedTableView(NamedTableReference namedTable) { this.Name = namedTable.GetName("dbo"); if (namedTable.Alias != null && !HasAlias(namedTable.Alias.Value)) { Aliases.Add(namedTable.Alias.Value); } }
public virtual ReleaseEventSeriesAlias CreateAlias(string alias) { var a = new ReleaseEventSeriesAlias(this, alias); Aliases.Add(a); return(a); }
public ListTaskInCategoryCommand(PyTaskDatabase db) : base("catinfo", "show list of tasks in category") { this.db = db; foreach (var x in db.CategoriesSet) { Aliases.Add(x); } }
private string AddTemporaryAlias(string command) { string alias = String.Format("a{0}", _temporaryAliases.Count); Aliases.Add(alias, command); _temporaryAliases.Add(alias); return(alias); }
public static void PopulateCommands() { var FullNames = Assembly.GetExecutingAssembly().GetTypes().Where(x => x.IsClass && x.Namespace == "socon.Commands.CP").Select(x => x).Where(x => x.Attributes == TypeAttributes.BeforeFieldInit); Debug.Assert(!FullNames.Select(x => x.Name).Contains("Alias")); ConfigObject commandsList = null; if (!(Settings.Global?.Commands is null) && Settings.GlobalNonDynamic != null) { commandsList = ((ConfigObject)Settings.GlobalNonDynamic["Commands"]); } FullNames.ToList().ForEach(x => AllCommands.Add(new Command(x))); /*foreach (var c in FullNames) { * Command toAdd = new Command(c); * if (commandsList != null && commandsList.ContainsKey(c)) { * dynamic properties = ((dynamic)commandsList[c]); * * try { * if (!(properties.Regex as string is null)) * toAdd.Regex = new Regex(properties.Regex, RegexOptions.Compiled); * } catch (Exception ex) { * Debug.WriteLine("Failed to compile regex (1):\n" + ex); * } * * try { * if (!(properties.UsageTrigger as string is null)) * toAdd.UsageTrigger = new Regex(properties.UsageTrigger, RegexOptions.Compiled); * } catch (Exception ex) { * Debug.WriteLine("Failed to compile regex (2):\n" + ex); * } * * toAdd.Usage = properties.Usage as string ?? ""; * } * AllCommands.Add(toAdd); * }*/ string key = ""; foreach (var kv in ((dynamic)commandsList)?.Alias) { if (key == "") { key = kv; } else { try { Aliases.Add(new Regex(key, RegexOptions.Compiled), kv); } catch (Exception ex) { Debug.WriteLine("Failed to compile regex (3):\n" + ex); } key = ""; } } }
public DiscordCommand AddAliases(params string[] newAliases) { foreach (string str in newAliases) { Aliases.Add(str.ToLower()); } return(this); }
public TaskInfoCommand(PyTaskDatabase db) : base("info", "give info about the task") { taskWrapper = new TaskWrapper(); this.db = db; foreach (var x in db.TasksNamesSet) { Aliases.Add(x); } }
public ItemCommand( ITemplateRepository <ItemStringTemplate> strings, ITemplateRepository <ItemTemplate> templates ) : base(templates) { _strings = strings; Aliases.Add("Create"); }
/// <summary> /// Initializes a new instance of the <see cref="FunctionAttribute" /> class. /// </summary> /// <param name="name">The name.</param> /// <param name="description">The description.</param> /// <param name="aliases">The aliases.</param> public FunctionAttribute(string name, string description, params string[] aliases) : this( name ) { Description = description; foreach (string alias in aliases) { Aliases.Add(alias); } }
/// <summary> /// Adds a command alias that will call the command's action. /// </summary> /// <param name="alias">Alias that will call the action (Ex: "help", "exit")</param> public Command AddAlias(string alias) { if (string.IsNullOrEmpty(alias)) { throw new ArgumentNullException("alias"); } Aliases.Add(alias.ToLower()); return(this); }
public ConsoleCommand HasAlias(string alias) { if (!String.IsNullOrEmpty(alias)) { if (Aliases == null) { Aliases = new List <string>(); } Aliases.Add(alias); } return(this); }
public void AddKeyword(string keyword, bool isDefault = false) { Keywords.Add(keyword); string alias = upperOnly.Replace(keyword, ""); Aliases.Add(alias); if (isDefault) { SetDefaultKeyword(keyword); } }
public FieldCommand( IFieldRepository repository, ITemplateRepository <FieldStringTemplate> strings, ITemplateRepository <FieldTemplate> templates ) : base(templates) { _repository = repository; _strings = strings; Aliases.Add("Map"); Aliases.Add("Warp"); }
/// <summary> /// Creates a command line argument of the given type and sets the first default alias. /// </summary> /// <param name="t">The CLR type of the argument</param> /// <param name="defaultAlias">The default name that users will use to specify this argument</param> /// <param name="ignoreCase">If true, the parser will match this argument even if the specifier doesn't match case. True by default.</param> public CommandLineArgument(Type t, string defaultAlias, bool ignoreCase = true) : this() { if (t == null) { throw new InvalidArgDefinitionException("Argument types cannot be null"); } ArgumentType = t; IgnoreCase = ignoreCase; Aliases.Add(defaultAlias); Metadata.AddRange(t.Attrs <IArgMetadata>().AssertAreAllInstanceOf <ICommandLineArgumentMetadata>()); }
/// <inheritdoc /> public virtual IDetachedFlowQuery <TSource> SetRootAlias <TAlias>(Expression <Func <TAlias> > alias) where TAlias : class { if (alias == null) { throw new ArgumentNullException("alias"); } string rootAliasName = ExpressionHelper.GetPropertyName(alias); Aliases.Add(rootAliasName, rootAliasName); return(this); }
public Alias GetOrCreateAlias(string aliasName) { var item = GetByName(aliasName); if (item != null) { return(item); } Aliases.Add(new Alias(aliasName)); SaveChanges(); item = GetByName(aliasName); return(item); Alias GetByName(string name) => Aliases.FirstOrDefault(x => x.Name.ToLower().Equals(name.ToLower())); }
protected void AddAlias(object sender, EventArgs e) { //Add a new empty rule and set the editrow to the new row var portalAlias = new PortalAliasInfo { PortalID = CurrentPortalId }; Aliases.Add(portalAlias); Grid.EditItemIndex = Aliases.Count - 1; //Set the AddMode to true AddMode = true; //Rebind the collection BindAliases(); }
/// <summary> /// Generate a new info instance given a reflected property. /// </summary> /// <param name="toAutoGen">The property to use to seed the usage info</param> public ArgumentUsageInfo(CommandLineArgument toAutoGen) : this() { this.Argument = toAutoGen; Property = toAutoGen.Source as PropertyInfo; Ignore = false; IsAction = toAutoGen.DefaultAlias == Constants.ActionPropertyConventionName; DefaultValue = toAutoGen.DefaultValue; IsRequired = toAutoGen.IsRequired; Name = "-" + toAutoGen.DefaultAlias; if (Name.EndsWith(Constants.ActionArgConventionSuffix)) { Name = Name.Substring(0, Name.Length - Constants.ActionArgConventionSuffix.Length); } Aliases.AddRange(toAutoGen.Aliases.Skip(1).Select(a => "-" + a)); if (Aliases.Count == 0) { //add shortcut alias Aliases.Add("-" + Name.ToLower()); } Type = toAutoGen.ArgumentType.Name; if (KnownTypeMappings.ContainsKey(Type)) { Type = KnownTypeMappings[Type]; } else { Type = Type.ToLower(); } Position = toAutoGen.Position >= 0 ? new int?(toAutoGen.Position) : null; Description = toAutoGen.Description ?? ""; Group = Property.HasAttr <ArgDescription>() ? Property.Attr <ArgDescription>().Group : ""; if (toAutoGen.ArgumentType.IsEnum) { foreach (var val in toAutoGen.ArgumentType.GetFields().Where(v => v.IsSpecialName == false)) { var description = val.HasAttr <ArgDescription>() ? " - " + val.Attr <ArgDescription>().Description : ""; var valText = val.Name; PossibleValues.Add(valText + description); } } }
/// <summary> /// Constructor. Aliases initialisation. /// </summary> public CSharpHelper() { Aliases.Add("System.Object", [email protected]()); Aliases.Add("System.Int16", [email protected]()); Aliases.Add("System.Int32", [email protected]()); Aliases.Add("System.Int64", [email protected]()); Aliases.Add("System.UInt16", [email protected]()); Aliases.Add("System.UInt32", [email protected]()); Aliases.Add("System.UInt64", [email protected]()); Aliases.Add("System.Boolean", [email protected]()); Aliases.Add("System.Char", [email protected]()); Aliases.Add("System.Decimal", [email protected]()); Aliases.Add("System.Double", [email protected]()); Aliases.Add("System.Single", [email protected]()); Aliases.Add("System.String", [email protected]()); Aliases.Add("System.Void", [email protected]()); }
/// <summary> /// Constructor. Aliases initialisation. /// </summary> public VisualBasicHelper() { Aliases.Add("System.Object", VisualBasicKeyword.Object.ToString()); Aliases.Add("System.Int16", VisualBasicKeyword.Short.ToString()); Aliases.Add("System.Int32", VisualBasicKeyword.Integer.ToString()); Aliases.Add("System.Int64", VisualBasicKeyword.Long.ToString()); Aliases.Add("System.UInt16", VisualBasicKeyword.UShort.ToString()); Aliases.Add("System.UInt32", VisualBasicKeyword.UInteger.ToString()); Aliases.Add("System.UInt64", VisualBasicKeyword.ULong.ToString()); Aliases.Add("System.Boolean", VisualBasicKeyword.Boolean.ToString()); Aliases.Add("System.Char", VisualBasicKeyword.Char.ToString()); Aliases.Add("System.Decimal", VisualBasicKeyword.Decimal.ToString()); Aliases.Add("System.Double", VisualBasicKeyword.Double.ToString()); Aliases.Add("System.Single", VisualBasicKeyword.Single.ToString()); Aliases.Add("System.String", VisualBasicKeyword.String.ToString()); Aliases.Add("[]", "()"); _displayConstraintsStack.Push(false); }
protected override void LoadViewState(object savedState) { var myState = (object[])savedState; if ((myState[0] != null)) { base.LoadViewState(myState[0]); } if ((myState[1] != null)) { var aliasCount = (int)myState[1]; Aliases.Clear(); for (int i = 0; i <= aliasCount - 1; i++) { string aliasString = Convert.ToString(myState[i + 2]); var sr = new StringReader(aliasString); Aliases.Add(CBO.DeserializeObject <PortalAliasInfo>(sr)); } } }
private void UpdateAliasesAndExtras() { Aliases.Clear(); Extras.Clear(); foreach (var a in AliasesOrdered) { if (Aliases.ContainsKey(a.Alias)) //deal with repeated aliases. { //Logger.Log("Repeated Alias\t" + t.Alias); if (!Extras.ContainsKey(a.Alias)) //initialize if needed. { Extras.Add(a.Alias, new List <OtoAlias>()); } Extras[a.Alias].Add(a); } else //normal case { Aliases.Add(a.Alias, a); } } }
// Cmd_Alias_f // Creates a new command that executes a command string (possibly ; seperated) private void Alias_f(CommandMessage msg) { if (msg.Parameters == null || msg.Parameters?.Length == 0) { ConsoleWrapper.Print("Current alias commands:\n"); foreach (var alias in Aliases) { ConsoleWrapper.Print($"{alias.Key} : {alias.Value}\n"); } return; } var name = msg.Parameters[0]; if (name.Length >= MAX_ALIAS_NAME) { ConsoleWrapper.Print("Alias name is too long\n"); return; } var args = String.Empty; // copy the rest of the command line if (msg.Parameters.Length > 1) { args = msg.ParametersFrom(1); } if (Aliases.ContainsKey(name)) { Aliases[name] = args; } else { Aliases.Add(name, args); } }