protected void Initialize() { _options = new CoreOptions(); _mill = new LoggerFactory(); Mapper = new AutoMapper.MapperConfiguration(cfg => { cfg.AddTopoMojoMaps(); }).CreateMapper(); Cache = new StubDistributedCache(); MemoryCache = new StubMemoryCache(); _dbOptions = new DbContextOptionsBuilder <TopoMojoDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; using (TopoMojoDbContext ctx = new TopoMojoDbContext(_dbOptions)) { ctx.Database.EnsureDeleted(); ctx.Database.EnsureCreated(); _user = new TopoMojo.Models.User { Id = 1, Name = "tester" }; _ur = new IdentityResolver(_user); } }
static AntiDupl() { // Since we are in a different directory to normal, AntiDupl.NET can't find the native DLL so preload it here. LoadLibrary(Path.Combine(Paths.AntiDuplDir, (IntPtr.Size == 8) ? "AntiDupl64.dll" : "AntiDupl32.dll")); Resources.UserPath = Paths.AntiDuplData; core = new CoreLib(Resources.UserPath); options = Options.Load(); coreOptions = CoreOptions.Load(options.coreOptionsFileName, core, options.onePath); var search = coreOptions.searchPath; if (search.Length != 1 || !search.Any(v => Path.GetFullPath(v.path) == Paths.Sources)) { coreOptions.compareOptions.algorithmComparing = CoreDll.AlgorithmComparing.SSIM; coreOptions.compareOptions.thresholdDifference = 15; coreOptions.searchPath = new[] { new CorePathWithSubFolder(Paths.Sources, true) }; coreOptions.Save(options.coreOptionsFileName); } core.Load(CoreDll.FileType.MistakeDataBase, Options.GetMistakeDataBaseFileName(), true); core.Load(CoreDll.FileType.Result, options.GetResultsFileName(), true); }
public TestSession( TopoMojoDbContext ctx, CoreOptions options, ILoggerFactory mill, IMapper mapper, IDistributedCache cache, IMemoryCache memoryCache ) { _ctx = ctx; _coreOptions = new CoreOptions(); _mill = mill; _mapper = mapper; _cache = cache; _memoryCache = memoryCache; _proman = new TopoMojo.Services.IdentityService(_mapper, new UserStore(_ctx, memoryCache, cache)); // _proman = new ProfileManager( // new ProfileRepository(_ctx), // _mill, // _coreOptions, // new IdentityResolver(new Profile // { // Name = "admin@test", // IsAdmin = true // }), // // new MemoryCache() // ); AddUser("tester@test", true, true); }
public ChallengeGateService( ILogger <ChallengeGateService> logger, IMapper mapper, CoreOptions options, IChallengeGateStore store ) : base(logger, mapper, options) { Store = store; }
/// <summary> /// Initializes a new instance of the CoreApiDirect.Url.QueryString class. /// </summary> /// <param name="options">The CoreApiDirect.Options.CoreOptions.</param> public QueryString(CoreOptions options) { _options = options; ValidateRoute = options.ValidateRoute; ValidateQueryString = options.ValidateQueryString; CaseSensitiveSearch = options.CaseSensitiveSearch; _relatedDataLevel = options.RelatedDataLevel; _pageSize = options.PageSize; }
public void CoreOptions_ConstructorInitializeWithDefaultValuesDefaultLicenseHeaderNotExistent_ReturnsDefaultLicenseHeader() { _options = new CoreOptions(); Assert.That( _options.LicenseHeaderFileText, Is.EqualTo( "extensions: designer.cs generated.cs\r\nextensions: .cs .cpp .h\r\n// Copyright (c) 2011 rubicon IT GmbH\r\nextensions: .aspx .ascx\r\n<%-- \r\nCopyright (c) 2011 rubicon IT GmbH\r\n--%>\r\nextensions: .vb\r\n'Sample license text.\r\nextensions: .xml .config .xsd\r\n<!--\r\nSample license text.\r\n-->")); }
public void RequiredKeywordsAsEnumerable_ValidInput_ReturnsListOfRequiredKeywords() { IEnumerable <string> keywords = new List <string> { "license", "copyright", "test", "(c)", "©" }; var actual = CoreOptions.RequiredKeywordsAsEnumerable("license, copyright,test,(c), ©"); Assert.That(keywords, Is.EqualTo(actual)); }
public SponsorService( ILogger <SponsorService> logger, IMapper mapper, CoreOptions options, ISponsorStore store ) : base(logger, mapper, options) { Store = store; }
public QueryStringParser( IOptions <CoreOptions> options, IPropertyProvider propertyProvider, IParameterParserFactory parameterParserFactory) { _options = options.Value; _queryString = new QueryString(options.Value); _propertyProvider = propertyProvider; _parameterParserFactory = parameterParserFactory; }
public UserService( ILogger <WorkspaceService> logger, IMapper mapper, CoreOptions options, IUserStore userStore, IMemoryCache userCache ) : base(logger, mapper, options) { _store = userStore; _cache = userCache; }
public GameService( ILogger <GameService> logger, IMapper mapper, CoreOptions options, Defaults defaults, IGameStore store ) : base(logger, mapper, options) { Store = store; Defaults = defaults; }
public ChallengeSpecService( ILogger <ChallengeSpecService> logger, IMapper mapper, CoreOptions options, IChallengeSpecStore store, ITopoMojoApiClient mojo ) : base(logger, mapper, options) { Store = store; Mojo = mojo; }
public UserService( IUserStore userStore, IMemoryCache userCache, ILogger <WorkspaceService> logger, IMapper mapper, CoreOptions options, IIdentityResolver identityResolver ) : base(logger, mapper, options, identityResolver) { _userStore = userStore; _userCache = userCache; }
public ReportService( ILogger <ReportService> logger, IMapper mapper, CoreOptions options, GameboardDbContext store, ChallengeService challengeService, GameService gameService ) : base(logger, mapper, options) { Store = store; _challengeService = challengeService; }
public FeedbackService( ILogger <FeedbackService> logger, IMapper mapper, CoreOptions options, IChallengeStore challenegeStore, IFeedbackStore store, IMemoryCache localcache ) : base(logger, mapper, options) { Store = store; _localcache = localcache; }
public ChatService( TopoMojoDbContext dbContext, IMemoryCache memoryCache, ILogger <ChatService> logger, IMapper mapper, CoreOptions options, IIdentityResolver identityResolver ) : base(logger, mapper, options, identityResolver) { _dbContext = dbContext; _cache = memoryCache; }
public SponsorController( ILogger <SponsorController> logger, IDistributedCache cache, SponsorValidator validator, SponsorService sponsorService, CoreOptions options ) : base(logger, cache, validator) { _logger = logger; SponsorService = sponsorService; Options = options; }
public _Service( ILogger logger, IMapper mapper, CoreOptions options, IIdentityResolver identityResolver ) { _logger = logger; _options = options; _identityResolver = identityResolver; Mapper = mapper; }
public TemplateService( ITemplateStore templateStore, IHypervisorService podService, ILogger <TemplateService> logger, IMapper mapper, CoreOptions options ) : base(logger, mapper, options) { _store = templateStore; _pod = podService; }
public WorkspaceService( IWorkspaceStore workspaceStore, IGamespaceStore gamespaceStore, IHypervisorService podService, ILogger <WorkspaceService> logger, IMapper mapper, CoreOptions options ) : base(logger, mapper, options) { _store = workspaceStore; _gamespaceStore = gamespaceStore; _pod = podService; }
public UserController( ILogger <UserController> logger, IDistributedCache cache, UserValidator validator, UserService userService, CoreOptions options, IHubContext <AppHub, IAppHubEvent> hub ) : base(logger, cache, validator) { UserService = userService; Options = options; Hub = hub; }
public GameController( ILogger <GameController> logger, IDistributedCache cache, GameService gameService, GameValidator validator, CoreOptions options, IHostEnvironment env ) : base(logger, cache, validator) { GameService = gameService; Options = options; Env = env; }
public WorkspaceService( IWorkspaceStore workspaceStore, IGamespaceStore gamespaceStore, IHypervisorService podService, ILogger <WorkspaceService> logger, IMapper mapper, CoreOptions options, IIdentityResolver identityResolver ) : base(logger, mapper, options, identityResolver) { _workspaceStore = workspaceStore; _gamespaceStore = gamespaceStore; _pod = podService; }
public JanitorService( ILogger <JanitorService> logger, CoreOptions options, IHypervisorService pod, IWorkspaceStore workspaceStore, IGamespaceStore gamespaceStore ) { _logger = logger; _options = options; _pod = pod; _workspaceStore = workspaceStore; _gamespaceStore = gamespaceStore; }
public VmController( ILogger <AdminController> logger, IHubContext <AppHub, IHubEvent> hub, VmValidator validator, TemplateService templateService, UserService userService, IHypervisorService podService, CoreOptions options ) : base(logger, hub, validator) { _templateService = templateService; _userService = userService; _pod = podService; _options = options; }
public ChallengeService( ILogger <ChallengeService> logger, IMapper mapper, CoreOptions options, IChallengeStore store, ITopoMojoApiClient mojo, IMemoryCache localcache, ConsoleActorMap actorMap ) : base(logger, mapper, options) { Store = store; Mojo = mojo; _localcache = localcache; _actorMap = actorMap; }
public StylisedPeakOptions(Core core) { CoreOptions visualOptions = core.Options; this.ShowRanges = visualOptions.ShowVariableRanges; this.ShowMinMax = visualOptions.ShowVariableMinMax; this.ViewGroups = visualOptions.ViewTypes; this.ViewBatches = core.Batches; this.ConditionsSideBySide = visualOptions.ConditionsSideBySide; this.ShowPoints = visualOptions.ShowPoints; this.ShowTrend = visualOptions.ShowTrend; this.ShowAcqisition = visualOptions.ViewAcquisition; this.ShowVariableMean = visualOptions.ShowVariableMean; this.DrawExperimentalGroupAxisLabels = visualOptions.DrawExperimentalGroupAxisLabels; this.SelectedTrend = visualOptions.SelectedTrend; }
public TemplateService( ITemplateStore templateStore, IWorkspaceStore workspaceStore, IHypervisorService podService, ILogger <TemplateService> logger, IMapper mapper, CoreOptions options, IIdentityResolver identityResolver ) : base(logger, mapper, options, identityResolver) { _templateStore = templateStore; _workspaceStore = workspaceStore; _pod = podService; }
public TransferService( IUserStore userStore, IWorkspaceStore workspaceStore, ITemplateStore templateStore, ILogger <TransferService> logger, IMapper mapper, CoreOptions options ) : base(logger, mapper, options) { _workspaceStore = workspaceStore; _templateStore = templateStore; _userStore = userStore; jsonSerializerSettings = new JsonSerializerOptions { WriteIndented = true }; }
/// <summary> /// 使 <see cref="IServiceCollection"/> 能够使用 Fireasy 框架中的配置。 /// </summary> /// <param name="services"></param> /// <param name="configuration"></param> /// <param name="setupAction"></param> /// <returns></returns> public static IServiceCollection AddFireasy(this IServiceCollection services, IConfiguration configuration, Action <CoreOptions> setupAction = null) { Guard.ArgumentNull(services, nameof(services)); Guard.ArgumentNull(configuration, nameof(configuration)); var options = new CoreOptions(); setupAction?.Invoke(options); Tracer.Disabled = configuration.GetSection("appSettings:DisableTracer").Value.To <bool>(); configuration.Initialize(Assembly.GetCallingAssembly(), services, options.AssemblyFilter); services.AddTransient(typeof(IOptionsFactory <>), typeof(ConfiguredOptionsFactory <>)); return(services); }
public void DrawZones(CoreOptions c) { if (c.zones == null) c.zones = new List<DBZone>(); List<DBZone> zones = c.zones; GUILayout.BeginHorizontal("box"); GUILayout.BeginVertical(); //1st column: list of all zones GUI.skin.label.fontStyle = FontStyle.Bold; GUILayout.Label("Zones", GUILayout.Width(90)); if (zones.Count > 0) //displaying the zones' table { GUI.skin.label.alignment = TextAnchor.MiddleCenter; GUILayout.BeginHorizontal(); GUILayout.Label("name",GUILayout.MinWidth(150), GUILayout.MaxWidth(300)); GUILayout.EndHorizontal(); GUI.skin.label.fontStyle = FontStyle.Normal; for (int i = 0; i < zones.Count; i++) { DBZone currentzone = zones[i]; if (currentzone.Name!="Grid") { GUILayout.BeginHorizontal(); if (GUILayout.Button(currentzone.Name,GUILayout.MinWidth(150), GUILayout.MaxWidth(300))) viewed_zone = currentzone; if (!currentzone.Default && GUILayout.Button("Delete",GUILayout.Width(100))) zones.RemoveAt(i); //deleting GUILayout.EndHorizontal(); } } } if (GUILayout.Button("new zone",GUILayout.Width(100)) ) { DBZone newzone = new DBZone("New zone"); zones.Add(newzone); viewed_zone = zones[zones.Count-1]; //DBZone enemyzone = new DBZone(newzone.Name); //c.enemy_zones.Add(enemyzone); } GUILayout.EndVertical(); GUILayout.BeginVertical(); GUI.skin.label.fontStyle = FontStyle.Bold; GUILayout.Label("Edit zone"); GUI.skin.label.fontStyle = FontStyle.Normal; GUILayout.BeginVertical("box"); if (viewed_zone != null) //displaying the detailed info { GUILayout.BeginVertical(); if (ViewZone(viewed_zone)) zones.Remove(viewed_zone); //deleting card from db GUILayout.EndVertical(); } GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); if (currentSettings.core.UseGrid) { currentSettings.core.UseGrid = EditorGUILayout.Toggle("Use grid", currentSettings.core.UseGrid); rows = EditorGUILayout.IntField("rows:", rows); columns = EditorGUILayout.IntField("columns:", columns); offset = EditorGUILayout.FloatField("distance between cells:", offset); if (GUILayout.Button("Create hex grid",GUILayout.Width(100)) ) CreateHexGrid(rows, columns, offset); } }
public void DrawCoreOptions(CoreOptions o) { EditorGUIUtility.labelWidth = 250; o.OptionStartingLife = EditorGUILayout.IntField ("Starting life:", o.OptionStartingLife, GUILayout.MaxWidth(400)); o.MaxHandSize = EditorGUILayout.IntField ("Maximum hand size:", o.MaxHandSize, GUILayout.MaxWidth(400)); o.OptionFirstTurnSickness = EditorGUILayout.Toggle ("First turn sickness:", o.OptionFirstTurnSickness); o.OptionGraveyard = EditorGUILayout.Toggle ("Graveyard:",o.OptionGraveyard); o.OptionManaDoesntReset = EditorGUILayout.Toggle ("Mana doesn't reset each turn:", o.OptionManaDoesntReset); o.OptionManaAutoIncrementsEachTurn = EditorGUILayout.Toggle ("Mana autoincrements each turn:", o.OptionManaAutoIncrementsEachTurn); if (o.OptionManaAutoIncrementsEachTurn) o.OptionManaMaxIncrement = EditorGUILayout.IntField ("Max mana gain in a turn:", o.OptionManaMaxIncrement, GUILayout.MaxWidth(400)); o.OptionCantAttackPlayerThatHasHeroes = EditorGUILayout.Toggle ("Can't attack a player if he has a hero:", o.OptionCantAttackPlayerThatHasHeroes); o.OptionGameLostIfHeroDead = EditorGUILayout.Toggle ("Lose condition: if the player's hero is dead", o.OptionGameLostIfHeroDead); o.OptionRetaliate = EditorGUILayout.Toggle ("Defending creature deals damage back:", o.OptionRetaliate); if (!o.OptionRetaliate) { o.OptionKillOrDoNothing = EditorGUILayout.Toggle ("Kill opponent or deal no damage:", o.OptionKillOrDoNothing); } o.OptionOneCombatStatForCreatures = EditorGUILayout.Toggle ("Attack and defense are a single stat:",o.OptionOneCombatStatForCreatures); o.OptionGameMusic = EditorGUILayout.Toggle ("Play music in game:", o.OptionGameMusic); o.OptionPlayerTurnPopup = EditorGUILayout.Toggle ("Display \"your turn\" popup:", o.OptionPlayerTurnPopup); o.OptionTurnDegrees = EditorGUILayout.FloatField("Turned cards' angle:", o.OptionTurnDegrees, GUILayout.MaxWidth(400)); o.UseCardColors = EditorGUILayout.Toggle ("Use card colors", o.UseCardColors); if (o.UseCardColors) { o.UseManaColors = EditorGUILayout.Toggle ("Use colors in mana costs", o.UseManaColors); GUI.skin.label.fontStyle = FontStyle.Bold; GUILayout.BeginVertical ("box"); GUILayout.Label ("Mana colors", GUILayout.Width (90)); GUILayout.BeginHorizontal (); GUILayout.Label ("Name", GUILayout.Width (150)); GUILayout.Label ("Icon", GUILayout.Width (200)); GUILayout.EndHorizontal (); GUI.skin.label.fontStyle = FontStyle.Normal; int i = 0; ManaColor color_to_delete = null; foreach (ManaColor mcolor in o.colors) { GUILayout.BeginHorizontal (); GUILayout.Label (mcolor.name, GUILayout.Width (150)); Sprite m_icon = EditorGUILayout.ObjectField (mcolor.icon, typeof(Sprite), false, GUILayout.Width (200)) as Sprite; if (m_icon != null) { if (!mcolor.icon_texture || m_icon != mcolor.icon) mcolor.icon_texture = MainMenu.SpriteToTexture (m_icon); //prepare a new texture to display GUILayout.Label (mcolor.icon_texture, GUILayout.Width (50), GUILayout.Height (50)); } mcolor.icon = m_icon; if (!mcolor.Default && GUILayout.Button ("X", GUILayout.Width (30))) color_to_delete = mcolor; //it's the way to do it because otherwise we'll get "collection was modified" error GUILayout.EndHorizontal (); i++; } if (color_to_delete != null) { //removing this color from all cards' and effects' costs o.colors.Remove (color_to_delete); foreach (DbCard foundcard in Current.cards) { if (foundcard.cost.Contains (color_to_delete)) foundcard.cost.RemoveAll (obj => obj == color_to_delete); foreach (Effect foundeffect in foundcard.effects) if (foundeffect.cost.Contains (color_to_delete)) foundeffect.cost.RemoveAll (obj => obj == color_to_delete); } } GUILayout.BeginHorizontal (); color_name = EditorGUILayout.TextField ("Add new color:", color_name, GUILayout.MaxWidth (500)); if (GUILayout.Button ("Add", GUILayout.Width (70))) { o.colors.Add (new ManaColor (color_name)); color_name = ""; } GUILayout.EndHorizontal (); GUILayout.EndVertical (); //box end } else o.UseManaColors = false; //GUILayout.BeginVertical ("box"); DrawZones (o); //GUILayout.EndVertical (); }