/// <summary> /// Gets the new <see cref="IOutcomeOdds"/> instances /// </summary> /// <param name="sportEvent">The <see cref="ISportEvent"/> associated with the market</param> /// <param name="nameProvider">The <see cref="INameProvider"/> used to generate outcome name</param> /// <param name="mappingProvider">The <see cref="IMarketMappingProvider"/> used to provide market mapping</param> /// <param name="outcome">The <see cref="oddsChangeMarketOutcome"/> representing the outcome to be mapped</param> /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying languages the current instance supports</param> /// <param name="outcomeDefinition">The associated <see cref="IOutcomeDefinition"/></param> /// <returns>IOutcomeOdds</returns> protected virtual IOutcomeOdds GetOutcomeWithOdds(ISportEvent sportEvent, INameProvider nameProvider, IMarketMappingProvider mappingProvider, oddsChangeMarketOutcome outcome, IEnumerable <CultureInfo> cultures, IOutcomeDefinition outcomeDefinition) { var isValidPlayerOutcome = false; IMatch match = null; if (outcome.teamSpecified) { match = sportEvent as IMatch; isValidPlayerOutcome = !(match == null || outcome.team < 1 || outcome.team > 2); } var additionalProbabilities = new AdditionalProbabilities( outcome.win_probabilitiesSpecified ? outcome.win_probabilities : (double?)null, outcome.lose_probabilitiesSpecified ? outcome.lose_probabilities : (double?)null, outcome.half_win_probabilitiesSpecified ? outcome.half_win_probabilities : (double?)null, outcome.half_lose_probabilitiesSpecified ? outcome.half_lose_probabilities : (double?)null, outcome.refund_probabilitiesSpecified ? outcome.refund_probabilities : (double?)null); if (isValidPlayerOutcome) { return(new PlayerOutcomeOdds(outcome.id, outcome.activeSpecified ? (bool?)(outcome.active != 0) : null, outcome.odds, outcome.probabilitiesSpecified ? (double?)outcome.probabilities : null, nameProvider, mappingProvider, match, outcome.team, cultures, outcomeDefinition, additionalProbabilities)); } return(new OutcomeOdds(outcome.id, outcome.activeSpecified ? (bool?)(outcome.active != 0) : null, outcome.odds, outcome.probabilitiesSpecified ? (double?)outcome.probabilities : null, nameProvider, mappingProvider, cultures, outcomeDefinition, additionalProbabilities)); }
internal string SuffixWithOrElseGet(string suffix, INameProvider provider, string prefix) { // We actually do not need to generate processor names for operation if a name is specified. // But before returning, we still need to burn index for the operation to keep topology backward compatibility. if (!string.IsNullOrEmpty(name)) { provider.NewProcessorName(prefix); string suffixed = $"{name}{suffix}"; // Re-validate generated name as suffixed string could be too large. Validate(suffixed); return(suffixed); } else { return(provider.NewProcessorName(prefix)); } }
/// <summary>Initializes a new instance of the <see cref="OutcomeSettlement" /> class</summary> /// <param name="deadHeatFactor">a dead-head factor for the current <see cref="IOutcomeSettlement" /> instance.</param> /// <param name="id">the value uniquely identifying the current <see cref="IOutcomeSettlement" /></param> /// <param name="result">a value indicating whether the outcome associated with current <see cref="IOutcomeSettlement" /> is winning</param> /// <param name="voidFactor">the <see cref="VoidFactor" /> associated with a current <see cref="IOutcomeSettlement" /> or a null reference</param> /// <param name="nameProvider">A <see cref="INameProvider"/> used to generate the outcome name(s)</param> /// <param name="mappingProvider">A <see cref="IMarketMappingProvider"/> instance used for providing mapping ids of markets and outcomes</param> /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying languages the current instance supports</param> /// <param name="outcomeDefinition">The associated <see cref="IOutcomeDefinition"/></param> internal OutcomeSettlement(double?deadHeatFactor, string id, int result, VoidFactor?voidFactor, INameProvider nameProvider, IMarketMappingProvider mappingProvider, IEnumerable <CultureInfo> cultures, IOutcomeDefinition outcomeDefinition) : base(id, nameProvider, mappingProvider, cultures, outcomeDefinition) { DeadHeatFactor = deadHeatFactor; Result = result == 1; VoidFactor = voidFactor; OutcomeResult = result switch { 0 => OutcomeResult.Lost, 1 => OutcomeResult.Won, _ => OutcomeResult.UndecidedYet }; }
/// <summary> /// Initializes a new instance of the <see cref="Market" /> class /// </summary> /// <param name="id">a <see cref="int" /> value specifying the market type</param> /// <param name="specifiers">a <see cref="IReadOnlyDictionary{String, String}" /> containing market specifiers</param> /// <param name="additionalInfo">a <see cref="IReadOnlyDictionary{String, String}" /> containing additional market info</param> /// <param name="nameProvider">A <see cref="INameProvider"/> instance used to generate the market name(s) </param> /// <param name="mappingProvider">A <see cref="IMarketMappingProvider"/> instance used for providing mapping ids of markets and outcomes</param> /// <param name="marketDefinition">The associated market definition</param> /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying languages the current instance supports</param> internal Market(int id, IReadOnlyDictionary <string, string> specifiers, IReadOnlyDictionary <string, string> additionalInfo, INameProvider nameProvider, IMarketMappingProvider mappingProvider, IMarketDefinition marketDefinition, IEnumerable <CultureInfo> cultures) { Contract.Requires(nameProvider != null); Contract.Requires(cultures != null); Contract.Requires(cultures.Any()); Id = id; Specifiers = specifiers; AdditionalInfo = additionalInfo; _nameProvider = nameProvider; MappingProvider = mappingProvider; MarketDefinition = marketDefinition; _cultures = cultures; }
/// <summary> /// Initializes a new instance of the <see cref="MarketWithProbabilities"/> class /// </summary> /// <param name="id">a <see cref="int"/> value specifying the market type</param> /// <param name="specifiers">a <see cref="IReadOnlyDictionary{String, String}"/> containing market specifiers.</param> /// <param name="additionalInfo">a <see cref="IReadOnlyDictionary{String, String}"/> containing additional market info.</param> /// <param name="nameProvider">A <see cref="INameProvider"/> instance used to generate the market name(s) </param> /// <param name="mappingProvider">A <see cref="IMarketMappingProvider"/> instance used for providing mapped ids of markets and outcomes</param> /// <param name="status">a <see cref="MarketStatus"/> enum member specifying the status of the market associated with the current <see cref="IMarketWithProbabilities"/> instance</param> /// <param name="outcomeProbabilities">a <see cref="IEnumerable{IOutcomeProbabilities}"/> where each <see cref="IOutcomeProbabilities"/> instance specifies the odds /// for one outcome associated with the current <see cref="IMarketWithProbabilities"/> instance</param> /// <param name="marketDefinition">The associated market definition</param> /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying languages the current instance supports</param> /// <param name="cashoutStatus">A <see cref="CashoutStatus"/> enum member specifying the availability of cashout, or a null reference</param> internal MarketWithProbabilities(int id, IReadOnlyDictionary <string, string> specifiers, IReadOnlyDictionary <string, string> additionalInfo, INameProvider nameProvider, IMarketMappingProvider mappingProvider, MarketStatus status, IEnumerable <IOutcomeProbabilities> outcomeProbabilities, IMarketDefinition marketDefinition, IEnumerable <CultureInfo> cultures, CashoutStatus?cashoutStatus) : base(id, specifiers, additionalInfo, nameProvider, mappingProvider, marketDefinition, cultures) { Status = status; if (outcomeProbabilities != null) { OutcomeProbabilities = outcomeProbabilities as ReadOnlyCollection <IOutcomeProbabilities> ?? new ReadOnlyCollection <IOutcomeProbabilities>(outcomeProbabilities.ToList()); } CashoutStatus = cashoutStatus; }
/// <summary> /// Initializes a new instance of the <see cref="Market" /> class /// </summary> /// <param name="id">a <see cref="int" /> value specifying the market type</param> /// <param name="specifiers">a <see cref="IReadOnlyDictionary{String, String}" /> containing market specifiers</param> /// <param name="additionalInfo">a <see cref="IReadOnlyDictionary{String, String}" /> containing additional market info</param> /// <param name="nameProvider">A <see cref="INameProvider"/> instance used to generate the market name(s) </param> /// <param name="mappingProvider">A <see cref="IMarketMappingProvider"/> instance used for providing mapping ids of markets and outcomes</param> /// <param name="marketDefinition">The associated market definition</param> /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying languages the current instance supports</param> internal Market(int id, IReadOnlyDictionary <string, string> specifiers, IReadOnlyDictionary <string, string> additionalInfo, INameProvider nameProvider, IMarketMappingProvider mappingProvider, IMarketDefinition marketDefinition, IEnumerable <CultureInfo> cultures) { Guard.Argument(nameProvider, nameof(nameProvider)).NotNull(); Guard.Argument(cultures, nameof(cultures)).NotNull();//.NotEmpty(); if (!cultures.Any()) { throw new ArgumentOutOfRangeException(nameof(cultures)); } Id = id; Specifiers = specifiers; AdditionalInfo = additionalInfo; _nameProvider = nameProvider; MappingProvider = mappingProvider; MarketDefinition = marketDefinition; _cultures = cultures; }
public CodeManipulator(IWpfTextView view, INameProvider provider) { this.view = view; this.nameProvider = provider; }
public void NameProvider(INameProvider provider) { _config.Put(NameProviderKey, provider); }
public virtual void NameProvider(INameProvider provider) { _config.NameProvider(provider); }
/// <summary> /// Creates a JSON serializer specialized for objects of the specified type <typeparamref name="T"/>. /// </summary> /// <typeparam name="T">The type of the objects to serialize.</typeparam> /// <param name="provider">Name provider used to determine JSON object keys for properties and fields.</param> /// <param name="concurrencyMode">The intended concurrency usage pattern for a fast JSON serializer or deserializer.</param> /// <returns>A fast JSON serializer specified for objects of the specified type <typeparamref name="T"/>.</returns> public static IFastJsonSerializer <T> CreateSerializer <T>(INameProvider provider, FastJsonConcurrencyMode concurrencyMode) => CreateSerializer <T>(provider, new FastJsonSerializerSettings(concurrencyMode));
public ModuleExplorer(ModuleDefMD module, INameProvider nameProvider = null) { Module = module; NameProvider = nameProvider ?? MapperNameProvider.Instance; }
/// <summary> /// Initializes a new instance of the <see cref="AzureLeaseProvider"/> class. /// </summary> /// <param name="logger">The logger.</param> /// <param name="options">The configuration options.</param> /// <param name="nameProvider">The name provider service.</param> public AzureLeaseProvider(ILogger <ILeaseProvider> logger, AzureLeaseProviderOptions options, INameProvider nameProvider) { this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); this.options = options ?? throw new ArgumentNullException(nameof(options)); this.nameProvider = nameProvider ?? throw new ArgumentNullException(nameof(nameProvider)); }
private static void Initialize() { var lines = File.ReadAllLines(_osuPath); OsuPath = lines[0]; _osuHash = MD5Helper.ComputeFile(OsuPath); OsuAssembly = Assembly.LoadFrom(OsuPath); _obfOsuModule = ModuleDefMD.Load(OsuPath); _cleanOsuModule = ModuleDefMD.Load(Resource.clean); StringFixer.Fix(_obfOsuModule, OsuAssembly); // Fix troubles when NameMapper can't find name due to unsimilar opcodes. _nameStorage = InitializeNameMapper(); _config = new RConfig(); exp = new ModuleExplorer(_obfOsuModule, _nameStorage); if (_config.Profiles == string.Empty) { // hacky thing because cant read json array when we have only one object so we add two objects, maybe there's a way to do it in other way? var profiles = new List <Profile>(); profiles.Add(new Profile() { Name = "Default", UniqueId = GetRandomUniqueString(), UninstallID = Guid.NewGuid().ToString(), Adapters = GetRandomMacAddress() }); profiles.Add(new Profile() { Name = "Default2", UniqueId = GetRandomUniqueString(), UninstallID = Guid.NewGuid().ToString(), Adapters = GetRandomMacAddress() }); _config.Profiles = JsonConvert.SerializeObject(profiles); _config.SelectedProfile = "Default"; } Console.WriteLine(" --- Select Profile or use current one --- \n"); Console.WriteLine("--- 1) Select"); Console.WriteLine("--- 2) Use current one"); var key = Console.ReadKey(false).Key; Console.Clear(); switch (key) { case ConsoleKey.D1: var profiles = JsonConvert.DeserializeObject <List <Profile> >(_config.Profiles); for (var i = 0; i < profiles.Count; i++) { Console.WriteLine($"{i + 1}) {profiles[i].Name}"); } Console.WriteLine("Select one of them or press SPACE to generate new one."); var _key = Console.ReadKey(false).Key; // TODO: Add support for selecting profiles count more than 9 if (!(_key == ConsoleKey.Spacebar) && _key >= ConsoleKey.D1 && _key <= ConsoleKey.D9) { var number = Convert.ToInt32(_key.ToString().Replace("D", "")); Console.Clear(); _config.SelectedProfile = profiles[number - 1].Name; Console.WriteLine("Selected Profile: " + _config.SelectedProfile); Thread.Sleep(2000); Console.Clear(); } else if (_key == ConsoleKey.Spacebar) { Console.Clear(); Console.WriteLine(" --- Generation Process --- "); Console.Write("Please type name of profile: "); var profileName = Console.ReadLine(); Console.WriteLine("Started generating profile."); profiles.Add(new Profile() { Name = profileName, UniqueId = GetRandomUniqueString(), UninstallID = Guid.NewGuid().ToString(), Adapters = GetRandomMacAddress() }); _config.Profiles = JsonConvert.SerializeObject(profiles); _config.SelectedProfile = profileName; Console.Clear(); Console.WriteLine("Done!\n"); Console.WriteLine($"UniqueId: {_config.CurrentProfile.UniqueId}\nUninstallID: {_config.CurrentProfile.UninstallID}\nMAC Address: {_config.CurrentProfile.Adapters}\n"); Thread.Sleep(2000); Console.Clear(); } break; case ConsoleKey.D2: break; } Patch(); }
/// <summary> /// Initializes a new instance of the <see cref="RuleEngineContext<TSubject>"/> class. /// </summary> /// <param name="subject">Subject for the context.</param> /// <param name="nameProvider"><see cref="INameProvider">NameProvider</see> of the context.</param> /// <param name="parentContext">Optional Parent RuleEngineContext.</param> public RuleEngineContext(TSubject subject, INameProvider nameProvider, IRuleEngineContext parentContext = null) : this(subject, new RuleViolationCollection(), null, nameProvider, parentContext) { }
/// <summary> /// Initializes a new instance of the <see cref="RuleEngineContext<TSubject>"/> class. /// </summary> /// <param name="subject">Subject for the context.</param> /// <param name="ruleViolationReporter"><see cref="IRuleViolationReporter">RuleViolationReporter</see> of the context.</param> /// <param name="nameProvider"><see cref="INameProvider">NameProvider</see> of the context.</param> /// <param name="parentContext">Optional Parent RuleEngineContext.</param> public RuleEngineContext( TSubject subject, IRuleViolationReporter ruleViolationReporter, INameProvider nameProvider, IRuleEngineContext parentContext = null) : this(subject, ruleViolationReporter, null, nameProvider, parentContext) { }
public MyService1(INameProvider nameProvider) { this.nameProvider = nameProvider; }
public RabbitMqEventBus(ConnectionFactory connectionFactory, IHandlerProvider handlerProvider, IMessageProvider messageProvider = null, INameProvider nameProvider = null) { connectionProvider = new ConnectionProvider(connectionFactory); subscriptionManager = new SubscriptionManager(); this.handlerProvider = handlerProvider; this.messageProvider = messageProvider ?? new JsonMessageProvider(); this.nameProvider = nameProvider ?? new DefaultQueueNameProvider(); }
public NameExtractor(INameProvider provider) { }
public NamesController(INameProvider nameProvider) { _nameProvider = nameProvider; }
public MyClassAuto(IGreetingService greetingService, INameProvider nameProvider) { _greetingService = greetingService; _nameProvider = nameProvider; }
public TypeExplorer(IExplorerParent parent, TypeDef type, INameProvider nameProvider = null) { Parent = parent; Type = type; NameProvider = nameProvider ?? MapperNameProvider.Instance; }