/// <summary> /// Installs an installer. /// </summary> /// <typeparam name="T">The type of your installer.</typeparam> public InstallBuilder Register <T>() where T : IInstaller { var ib = new InstallBuilder(); Builders.Add(ib); return(ib.Register <T>()); }
private InstallBuilder OnGeneric(string destination = null) { var ib = new InstallBuilder(); Builders.Add(ib); return(ib.On(destination)); }
/// <summary> /// Gets the builder for the given Id /// </summary> /// <param name="id">The identifier.</param> /// <returns></returns> public IEntityBuilder Get(Id id) { BuilderInfo builder; if (id != Guid.Empty && !Ids.ContainsKey(id)) { Ids.Add(id, id); } if (Builders.TryGetValue(id, out builder)) { return(builder.Builder); } // Add the Entity to the mapper to make sure it can be created in the correct order EntityDependency.Mapper.Add(id); // Get the default Builder, or if no builder is defined, create a Generic Builder var constructor = (BuilderConstructorForEntity.ContainsKey(id) ? BuilderConstructorForEntity[id] : GetGenericConstructor(id)); builder = new BuilderInfo(id, (IEntityBuilder)constructor.Invoke(new object[] { id })); // Apply any Custom Actions ApplyCustomActions(id, builder); // Add the Builder to both Dictionaries (keyed by Id and Logical Name) BuildersByEntityType.AddOrAppend(id, builder); Builders.Add(id, builder); return(builder.Builder); }
/// <summary> /// Install the installer at a destination via function. /// </summary> /// <param name="func"></param> /// <returns></returns> public InstallBuilder On(Func <Scene, Context, DiContainer, bool> func) { var ib = new InstallBuilder(); Builders.Add(ib); return(ib.On(func)); }
async Task ExecuteLoadItemsCommand() { try { Stores.Clear(); var palletMaster = await DataStore.GetPalletMaterDataAsync(); foreach (var item in palletMaster.Stores) { Stores.Add(item); } Status.Clear(); foreach (var item in palletMaster.Status) { Status.Add(item); } Categories.Clear(); foreach (var item in palletMaster.Categories) { Categories.Add(item); } Wrappers.Clear(); foreach (var item in palletMaster.Wrappers) { Wrappers.Add(item); } Shippers.Clear(); foreach (var item in palletMaster.Shippers) { Shippers.Add(item); } Suppliers.Clear(); foreach (var item in palletMaster.Suppliers) { Suppliers.Add(item); } Builders.Clear(); foreach (var item in palletMaster.Builders) { Builders.Add(item); } PalletTypes.Clear(); foreach (var item in palletMaster.PalletTypes) { PalletTypes.Add(item); } } catch (Exception ex) { Debug.WriteLine(ex); } }
/// <summary> /// Add an Accessor. /// </summary> /// <param name="builderAction">Builder Action</param> /// <returns>Fluent Accessor Builders</returns> public IFluentAccessorBuilders <TService, TKey> AddAccessor(Action <IFluentAccessorBuilder <TService, TKey> > builderAction) { var builder = new FluentAccessorBuilder <TService, TKey>(this); builderAction(builder); Builders.Add(builder); return(this); }
/// <summary> /// Install your installer on the app installer (project context), any bindings made here are available throughout the entire game. /// </summary> /// <typeparam name="T">The type of your installer.</typeparam> public InstallBuilder OnApp <T>() where T : IInstaller { var ib = new InstallBuilder(typeof(T)); Builders.Add(ib); ib.On(typeof(PCAppInit).FullName); return(ib); }
/// <summary> /// Installs your installer on the menu scene. /// </summary> /// <typeparam name="T">The type of your installer.</typeparam> public InstallBuilder OnMenu <T>() where T : IInstaller { var ib = new InstallBuilder(typeof(T)); Builders.Add(ib); ib.On <MainSettingsMenuViewControllersInstaller>(); return(ib); }
public void BuildBy(Func <RequestData, TAttribute, HtmlTag> builder) { Builders.Add(new Builder(Condition, req => { var attribute = (TAttribute)req.Accessor.InnerProperty.GetCustomAttributes(typeof(TAttribute), true).First(); return(builder(req, attribute)); })); }
public IStageBuilder Add <TChildModule>(Action <StageBuilder <TChildModule> > builderDelegate) where TChildModule : IModule { var builder = new StageBuilder <TChildModule>(DataLayer, RunInfo, StagePath.CreateChild(++ChildIndex)); builderDelegate.Invoke(builder); Builders.Add(builder); return(this); }
public void BuildBy(Func <RequestData, TAttribute, IConventionPipeline, HtmlTag> builder) { Builders.Add(new Builder(Condition, (req, pipe) => { var attribute = (TAttribute)TagConventions.GetPropertyInfo(req.Accessor).GetCustomAttributes(typeof(TAttribute), true).First(); return(builder(req, attribute, pipe)); })); }
/// <summary> /// Installs your installer on the menu scene. /// </summary> /// <typeparam name="T">The type of your installer.</typeparam> public InstallBuilder OnMenu <T>() where T : IInstaller { var ib = new InstallBuilder(typeof(T)); Builders.Add(ib); ib.On("Menu"); return(ib); }
public void AddBuilder(int x, int y) { Builder builder = new Builder(x, y); TimeTickEvent += builder.TimeTick; Builders.Add(builder); SearchJob(builder); }
/// <summary> /// Installs your installer on the game scene. /// </summary> /// <typeparam name="T">The type of your installer.</typeparam> public InstallBuilder OnGame <T>() where T : IInstaller { var ib = new InstallBuilder(typeof(T)); Builders.Add(ib); ib.On(typeof(GameCoreSceneSetup).FullName); return(ib); }
/// <summary> /// Installs your installer as the game scene is setting up. /// </summary> /// <typeparam name="T">The type of your installer.</typeparam> /// <param name="onGameSetup">Whether or not the installer is installed along during the game core setup. If your objects depend on beatmap elements like the <see cref="AudioTimeSyncController"/> or <see cref="BeatmapObjectManager"/>, set this to false as they don't exist in setup in multiplayer.</param> public InstallBuilder OnGame <T>(bool onGameSetup = true) where T : IInstaller { var ib = new InstallBuilder(typeof(T)); Builders.Add(ib); ib.On(onGameSetup ? typeof(GameCoreSceneSetup).FullName : typeof(GameplayCoreInstaller).FullName); return(ib); }
/// <summary> /// Swaps the specified builder. /// </summary> /// <param name="builder">The builder.</param> /// <param name="newRocketFunctionBuilder">The new rocket function builder.</param> /// <returns>RocketFunctionHostBuilder.</returns> internal static RocketFunctionHostBuilder Swap( IRocketFunctionHostBuilder builder, RocketFunctionHostBuilder newRocketFunctionBuilder ) { Builders.Remove(builder.Builder); Builders.Add(builder.Builder, newRocketFunctionBuilder); return(newRocketFunctionBuilder); }
public IFluentRuleBuilder <T, TProperty> RuleFor <TProperty>(Expression <Func <T, TProperty> > expression) { ParamHelper.CheckParamNull(expression, "expression", "Can't be null"); var builder = Validation.Provider.GetService <IRuleBuilder <T, TProperty> >(); builder.SetValueGetter(expression); Builders.Add(builder as IValidateRuleBuilder); return(builder); }
private void CreateBuilder(IPayDay payDay) { if (PayDays[0].RecordId == payDay.RecordId) { Builders.Add(new PayPeriodBuilder(payDay, null)); return; } int previousItem = PayDays.FindIndex(pd => pd.RecordId == payDay.RecordId) - 1; Builders.Add(new PayPeriodBuilder(payDay, PayDays[previousItem].Date)); }
public void Register(ICommandBuilder command, IExtension extension) { Assert.IsNotNull(command); Assert.IsNotNull(extension); Command builded = command.Build(); Assert.IsNotNull(builded); Builders.Add(command, builded); RBuilders.Add(builded, command); Commands.Add(builded, extension); }
public QueryURLBuilder(Query query, bool queryForV1Connector = false) { this.query = query; Builders.Add(new HierarchicalPartBuilder(queryForV1Connector)); Builders.Add(new SelectionBuilder()); Builders.Add(new WhereBuilder()); Builders.Add(new SortBuilder()); Builders.Add(new PagingBuilder()); Builders.Add(new AsOfBuilder()); Builders.Add(new FindBuilder()); Builders.Add(new WithVariablesBuilder()); }
public QueryURLBuilder(Query query) { this.query = query; Builders.Add(new HierarchicalPartBuilder()); Builders.Add(new SelectionBuilder()); Builders.Add(new WhereBuilder()); Builders.Add(new SortBuilder()); Builders.Add(new PagingBuilder()); Builders.Add(new AsOfBuilder()); Builders.Add(new FindBuilder()); Builders.Add(new WithVariablesBuilder()); }
private BuilderInfo CreateBuilder(Id id, ConstructorInfo constructor) { // Add the Entity to the mapper to make sure it can be created in the correct order EntityDependency.Mapper.Add(id); var builder = new BuilderInfo(id, (IEntityBuilder)constructor.Invoke(new object[] { id })); ApplyCustomActions(id, builder.Builder); Builders.Add(id, builder); BuildersByEntityType.AddOrAppend(id, builder); return(builder); }
protected void SetDefaults(bool clear = true) { if (clear) { ValueTranslators.Clear(); Builders.Clear(); AppendCheckers.Clear(); PreAppendChecker = null; } // Translates string properties to string... duh! ValueTranslators.Add(typeof(string), (a, t, v) => v.ToString()); // Translates enum properties to string by using the name representing the enum value. ValueTranslators.Add(typeof(Enum), (a, t, v) => { string name = Enum.GetName(t, v); return(a.EnumCase == EnumCasePolicy.LOWERCASE ? name.ToLower() : a.EnumCase == EnumCasePolicy.UPPERCASE ? name.ToUpper() : name); }); // Only append flag if value isn't null. This is checked before any other registered append checkers. PreAppendChecker = (a, t, v) => v != null; // Only append boolean flags if the value is true. AppendCheckers.Add(typeof(bool), (a, t, v) => (bool)v); // Add bool flags if value isnt false. // Custom builder for string -> string dictionaries repeatedly adds flag with key-value pair seperated by colon. Builders.Add(typeof(Dictionary <string, string>), (a, t, v) => { string builtFlag = string.Empty; int count = 0; Dictionary <string, string> dic = (Dictionary <string, string>)v; foreach (KeyValuePair <string, string> entry in dic) { string value = string.Format("{0}:{1}", entry.Key, entry.Value); value = QuoteFlagValue(a.QuotePolicy, value); builtFlag += string.Format("{0}{1} ", (dic.Count > 1 && count > 0) ? (a.Flag + " ") : string.Empty, value); count++; } if (dic.Count > 0) { builtFlag = builtFlag.Remove(builtFlag.Length - 1, 1); } return(a.Template.Replace("{flag}", a.Flag).Replace("{value}", builtFlag)); }); }
public void CreateMapping <TSource, TTarget>() { var key = new MappingKey(typeof(TSource), typeof(TTarget)); if (Builders.ContainsKey(key)) { throw new MappingAlreadyExistsException("Another mapping already exists with the supplied types"); } var builder = new MappingBuilder <TSource, TTarget>(this); builder.CreateDefaultBindings(); Builders.Add(key, builder); BuilderDescriptors.Add(new BuilderDescriptor(typeof(TSource), typeof(TTarget), builder.Dependencies, true)); }
public void ToggleBuilder(ServerPlayer player) { lock (this) { if (!Members.Contains(player.Name)) { return; } if (!Builders.Contains(player.Name)) { Builders.Add(player.Name); } else { Builders.Remove(player.Name); } SyncToAllMembers(); player.SyncUnionInfo(); } }
/// <summary> /// Gets the or create builder. /// </summary> /// <param name="builder">The builder.</param> /// <returns>RocketHostBuilder.</returns> internal static RocketHostBuilder GetOrCreateBuilder(IHostBuilder builder) { if (!Builders.TryGetValue(builder, out var conventionalBuilder)) { var diagnosticSource = new DiagnosticListener("Rocket.Surgery.Hosting"); var dependencyContext = DependencyContext.Default; var logger = new DiagnosticLogger(diagnosticSource); var serviceProviderDictionary = new ServiceProviderDictionary(builder.Properties); serviceProviderDictionary.Set <ILogger>(logger); serviceProviderDictionary.Set(HostType.Live); var assemblyCandidateFinder = new DependencyContextAssemblyCandidateFinder(dependencyContext, logger); var assemblyProvider = new DependencyContextAssemblyProvider(dependencyContext, logger); var scanner = new SimpleConventionScanner(assemblyCandidateFinder, serviceProviderDictionary, logger); conventionalBuilder = new RocketHostBuilder( builder, scanner, assemblyCandidateFinder, assemblyProvider, diagnosticSource, serviceProviderDictionary ); conventionalBuilder.Set( new ConfigurationOptions { ApplicationConfiguration = { b => b.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true), b => b.AddYamlFile("appsettings.yml", optional: true, reloadOnChange: true), b => b.AddYamlFile("appsettings.yaml", optional: true, reloadOnChange: true), b => b.AddIniFile("appsettings.ini", optional: true, reloadOnChange: true) }, EnvironmentConfiguration = { (b, environmentName) => b.AddJsonFile( $"appsettings.{environmentName}.json", optional: true, reloadOnChange: true ), (b, environmentName) => b.AddYamlFile( $"appsettings.{environmentName}.yml", optional: true, reloadOnChange: true ), (b, environmentName) => b.AddYamlFile( $"appsettings.{environmentName}.yaml", optional: true, reloadOnChange: true ), (b, environmentName) => b.AddIniFile( $"appsettings.{environmentName}.ini", optional: true, reloadOnChange: true ) } } ); var host = new RocketContext(builder); builder .ConfigureHostConfiguration(host.ComposeHostingConvention) .ConfigureHostConfiguration(host.CaptureArguments) .ConfigureHostConfiguration(host.ConfigureCli) .ConfigureAppConfiguration(host.ReplaceArguments) .ConfigureAppConfiguration(host.ConfigureAppConfiguration) .ConfigureServices(host.ConfigureServices) .ConfigureServices(host.DefaultServices); Builders.Add(builder, conventionalBuilder); } return(conventionalBuilder); }
public NpcDataParser(Locale locale, int flags) : base(locale, flags) { this.Address = "npc={0}"; parsers = (SubParsers)flags; for (int i = 0; i < ((int)SubParsersType.Max - 1); ++i) { Builders.Add(new SqlBuilder(_builderSettings)); } if (parsers.HasFlag(SubParsers.Level)) { Builders[(int)SubParsersType.Level].Setup("creature_template", "entry", false, "minlevel", "maxlevel"); } if (parsers.HasFlag(SubParsers.Money)) { Builders[(int)SubParsersType.Money].Setup("creature_template", "entry", false, "mingold", "maxgold"); } if (parsers.HasFlag(SubParsers.Currency)) { Builders[(int)SubParsersType.Currency].Setup("creature_currency", "entry", false, "currencyId", "currencyAmount"); } if (parsers.HasFlag(SubParsers.Quotes)) { Builders[(int)SubParsersType.Quotes].Setup("creature_quotes", "entry", false, "id", "type", textFields[Locale]); } if (parsers.HasFlag(SubParsers.Health)) { Builders[(int)SubParsersType.Health].Setup("creature_power", "entry", false, "Normal", "Heroic", "Normal10", "Normal25", "Heroic10", "Heroic25", "RaidFinder25"); } if (parsers.HasFlag(SubParsers.Mana)) { Builders[(int)SubParsersType.Mana].Setup("creature_power", "entry", false, "Mana"); } if (parsers.HasFlag(SubParsers.Faction)) { Builders[(int)SubParsersType.Faction].Setup("creature_faction", "entry", false, "faction_a", "faction_h"); } if (parsers.HasFlag(SubParsers.QuestStart)) { Builders[(int)SubParsersType.QuestStart].Setup("creature_questrelation", "id", false, "quest"); } if (parsers.HasFlag(SubParsers.QuestEnd)) { Builders[(int)SubParsersType.QuestEnd].Setup("creature_involvedrelation", "id", false, "quest"); } #region Creature_currency if (parsers.HasFlag(SubParsers.Currency)) { Content.AppendLine( @"DROP TABLE IF EXISTS `creature_currency`; CREATE TABLE `creature_currency` ( `entry` int(10) NOT NULL, `currencyId` int(10) NOT NULL default '0', `currencyAmount` int(10) NOT NULL default '0', PRIMARY KEY (`entry`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;" ); } #endregion Content.AppendLine(); #region Creature_quotes if (parsers.HasFlag(SubParsers.Quotes)) { Content.AppendLine( @"DROP TABLE IF EXISTS `creature_quotes`; CREATE TABLE `creature_quotes` ( `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', `id` tinyint(3) unsigned NOT NULL DEFAULT '0', `type` tinyint(3) unsigned NOT NULL DEFAULT '0', `text` longtext, `text_loc1` longtext, `text_loc2` longtext, `text_loc3` longtext, `text_loc4` longtext, PRIMARY KEY (`entry`,`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" ); } #endregion Content.AppendLine(); #region Creature_power if (parsers.HasFlag(SubParsers.Health | SubParsers.Mana)) { Content.AppendLine( @"DROP TABLE IF EXISTS `creature_power`; CREATE TABLE `creature_power` ( `entry` int(10) NOT NULL, `Mana` int(10) NOT NULL default '0', `Normal` int(10) NOT NULL default '0', `Heroic` int(10) NOT NULL default '0', `Normal10` int(10) NOT NULL default '0', `Normal25` int(10) NOT NULL default '0', `Heroic10` int(10) NOT NULL default '0', `Heroic25` int(10) NOT NULL default '0', `RaidFinder25` int(10) NOT NULL default '0', PRIMARY KEY (`entry`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;" ); } #endregion Content.AppendLine(); #region Creature_faction if (parsers.HasFlag(SubParsers.Faction)) { Content.AppendLine( @"DROP TABLE IF EXISTS `creature_faction`; CREATE TABLE `creature_faction` ( `entry` int(10) NOT NULL, `faction_a` int(10) NOT NULL default '0', `faction_h` int(10) NOT NULL default '0', PRIMARY KEY (`entry`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;" ); } #endregion Content.AppendLine(); }
/// <summary> /// Sets this <see cref="CommandLineBuilder"/> to its default settings. /// </summary> public virtual void SetDefaults() { ValueTranslators.Clear(); Builders.Clear(); SerializationCheckers.Clear(); ArgumentSeperator = " "; Seperator = " "; // Only serialize flag if value isn't null. This is called before any other registered serialization checkers. CommonSerializationChecker = (a, t, v) => v != null; // Only serialize boolean flags if the value is true. SerializationCheckers.Add(typeof(bool), (a, t, v) => (bool)v); // Serialize boolean flags if value isn't false. // Only serialize dictionaries if they contain items. SerializationCheckers.Add(typeof(Dictionary <string, string>), (a, t, v) => ((Dictionary <string, string>)v).Count > 0); // Translates string properties to string... duh! ValueTranslators.Add(typeof(string), (a, t, v) => v.ToString()); // Translate DateTime objects to the format of "yyyyMMdd". ValueTranslators.Add(typeof(DateTime), (a, t, v) => ((DateTime)v).ToString("yyyyMMdd")); // Translates enum properties to string by using the name representing the enum value. ValueTranslators.Add(typeof(Enum), (a, t, v) => { string name = Enum.GetName(t, v); switch (a.EnumCase) { case EnumCasePolicy.Lowercase: return(name.ToLower()); case EnumCasePolicy.Uppercase: return(name.ToUpper()); case EnumCasePolicy.Default: default: return(name); } }); // Custom builder for string -> string dictionaries repeatedly adds flag with key-value pair seperated by colon. Builders.Add(typeof(Dictionary <string, string>), (argument, type, value) => { Dictionary <string, string> dictionary = (Dictionary <string, string>)value; if (dictionary.Count == 0) { return(null); // Returning null for a builder, or value translator ignores this argument. } StringBuilder sb = new StringBuilder(); foreach (KeyValuePair <string, string> entry in dictionary) { sb.Append(BuildFlag(argument, string.Format("{0}:{1}", entry.Key, entry.Value))).Append(ArgumentSeperator); } if (dictionary.Count > 1) { sb.Remove(sb.Length - ArgumentSeperator.Length, ArgumentSeperator.Length); } return(sb.ToString()); }); }
/// <summary> /// Gets the or create builder. /// </summary> /// <param name="builder">The builder.</param> /// <param name="startupInstance">The startup instance.</param> /// <param name="environment">The environment.</param> /// <returns>RocketFunctionHostBuilder.</returns> internal static RocketFunctionHostBuilder GetOrCreateBuilder( IWebJobsBuilder builder, object startupInstance, IRocketEnvironment?environment ) { if (!Builders.TryGetValue(builder, out var conventionalBuilder)) { var diagnosticSource = new DiagnosticListener("Rocket.Surgery.Hosting"); var functionsAssembly = startupInstance.GetType().Assembly; var location = Path.GetDirectoryName(functionsAssembly.Location); DependencyContext?dependencyContext = null; while (!string.IsNullOrEmpty(location)) { var depsFilePath = Path.Combine(location, functionsAssembly.GetName().Name + ".deps.json"); if (File.Exists(depsFilePath)) { using var stream = File.Open(depsFilePath, FileMode.Open, FileAccess.Read); using var reader = new DependencyContextJsonReader(); dependencyContext = reader.Read(stream); break; } location = Path.GetDirectoryName(location); } var logger = new DiagnosticLogger(diagnosticSource); var assemblyCandidateFinder = new DependencyContextAssemblyCandidateFinder(dependencyContext !, logger); var assemblyProvider = new DependencyContextAssemblyProvider(dependencyContext !, logger); var properties = new ServiceProviderDictionary(); properties.Set <ILogger>(logger); properties.Set(HostType.Live); var scanner = new SimpleConventionScanner(assemblyCandidateFinder, properties, logger); conventionalBuilder = new RocketFunctionHostBuilder( builder, functionsAssembly, startupInstance, environment !, scanner, assemblyCandidateFinder, assemblyProvider, diagnosticSource, properties ); conventionalBuilder.Set( new ConfigurationOptions { ApplicationConfiguration = { b => b.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true), b => b.AddYamlFile("appsettings.yml", optional: true, reloadOnChange: true), b => b.AddYamlFile("appsettings.yaml", optional: true, reloadOnChange: true), b => b.AddIniFile("appsettings.ini", optional: true, reloadOnChange: true) }, EnvironmentConfiguration = { (b, environmentName) => b.AddJsonFile( $"appsettings.{environmentName}.json", optional: true, reloadOnChange: true ), (b, environmentName) => b.AddYamlFile( $"appsettings.{environmentName}.yml", optional: true, reloadOnChange: true ), (b, environmentName) => b.AddYamlFile( $"appsettings.{environmentName}.yaml", optional: true, reloadOnChange: true ), (b, environmentName) => b.AddIniFile( $"appsettings.{environmentName}.ini", optional: true, reloadOnChange: true ) } } ); Builders.Add(builder, conventionalBuilder); } return(conventionalBuilder); }
public BuilderGroup(TransactionBuilder parent) { _Parent = parent; Builders.Add(SetChange); }