public Configuration() { MOTD = ChatColor.Red + "Welcome to TrueCraft!"; Debug = new DebugConfiguration(); ServerPort = 25565; ServerAddress = "0.0.0.0"; }
public XAudio2Engine() { #if DEBUG XAudio2Flags flags = XAudio2Flags.DebugEngine; #else XAudio2Flags flags = XAudio2Flags.None; #endif XAudio2 = new XAudio2(flags, ProcessorSpecifier.DefaultProcessor); #if DEBUG DebugConfiguration debugConfig = new DebugConfiguration(); debugConfig.BreakMask = (int)LogType.Warnings; debugConfig.TraceMask = (int) (LogType.Errors | LogType.Warnings | LogType.Information | LogType.Detail | LogType.ApiCalls | LogType.FunctionCalls | LogType.Timing | LogType.Locks | LogType.Memory | LogType.Streaming); debugConfig.LogThreadID = new RawBool(true); debugConfig.LogFileline = new RawBool(true); debugConfig.LogFunctionName = new RawBool(true); debugConfig.LogTiming = new RawBool(true); XAudio2.SetDebugConfiguration(debugConfig, IntPtr.Zero); #endif XAudio2.CriticalError += (s, e) => Console.WriteLine("XAudio2: Critical Error. " + e.ToString()); MasteringVoice _masteringVoice = new MasteringVoice(XAudio2); X3DAudio = new X3DAudio(SharpDX.Multimedia.Speakers.Stereo); ResourceFactory = new XAudio2ResourceFactory(this); _x3dListener = new Listener(); _x3dListener.OrientFront = new RawVector3(0, 0, 1); _x3dListener.OrientTop = new RawVector3(0, 1, 0); }
public AccountController( UserResolver <TUser> userResolver, UserManager <TUser> userManager, SignInManager <TUser> signInManager, IIdentityServerInteractionService interaction, IClientStore clientStore, IAuthenticationSchemeProvider schemeProvider, IEventService events, IEmailSender emailSender, IGenericControllerLocalizer <AccountController <TUser, TKey> > localizer, LoginConfiguration loginConfiguration, RegisterConfiguration registerConfiguration, DebugConfiguration debugConfiguration) { _userResolver = userResolver; _userManager = userManager; _signInManager = signInManager; _interaction = interaction; _clientStore = clientStore; _schemeProvider = schemeProvider; _events = events; _emailSender = emailSender; _localizer = localizer; _loginConfiguration = loginConfiguration; _registerConfiguration = registerConfiguration; _debugConfiguration = debugConfiguration; }
/// <summary> /// Constructor /// </summary> internal GameAudio() { XAudio2Flags audio2Flags = XAudio2Flags.None; #if DEBUG audio2Flags = XAudio2Flags.DebugEngine; #endif this.device = new XAudio2(audio2Flags, ProcessorSpecifier.DefaultProcessor); #if DEBUG DebugConfiguration debugConfiguration = new DebugConfiguration() { TraceMask = (int)(LogType.Errors | LogType.Warnings), BreakMask = (int)(LogType.Errors), }; this.device.SetDebugConfiguration(debugConfiguration, IntPtr.Zero); #endif this.MasteringVoice = new MasteringVoice(this.device); this.MasteringVoice.GetChannelMask(out int channelMask); this.Speakers = (Speakers)channelMask; this.MasteringVoice.SetVolume(this.MasterVolume); }
public DebugConfigurationModifier(DebugConfiguration configuration, IHaveSendingModes haveSendingModes, IHaveLogCategories haveLogCategories, List <IHaveSendingConfiguration> haveSendingConfigurations) { this.configuration = configuration; this.haveSendingModes = haveSendingModes; this.haveLogCategories = haveLogCategories; this.haveSendingConfigurations = haveSendingConfigurations; }
public PesterConfiguration() { Run = new RunConfiguration(); Filter = new FilterConfiguration(); CodeCoverage = new CodeCoverageConfiguration(); TestResult = new TestResultConfiguration(); Should = new ShouldConfiguration(); Debug = new DebugConfiguration(); Output = new OutputConfiguration(); }
public static void AddDebuggingConfiguration(this IServiceCollection services, IConfiguration configuration, IHostingEnvironment environment) { DebugConfiguration config = new DebugConfiguration(); //config.ConfigurationDbConnection = configuration.GetConnectionString(ConfigurationConsts.ConfigurationDbConnectionStringKey); //config.PersistedGrantDbConnection = configuration.GetConnectionString(ConfigurationConsts.PersistedGrantDbConnectionStringKey); //config.IdentityDbConnection = configuration.GetConnectionString(ConfigurationConsts.IdentityDbConnectionStringKey); //config.LoggingDbConnection = configuration.GetConnectionString(ConfigurationConsts.SerilogDbConnectionStringKey); services.AddSingleton(config); }
public ServerConfiguration() { MOTD = "Welcome to TrueCraft!"; Debug = new DebugConfiguration(); ServerPort = 25565; ServerAddress = "0.0.0.0"; WorldSaveInterval = 30; Singleplayer = false; Query = true; QueryPort = 25566; }
public ServerConfiguration() { MOTD = "Welcome to TrueCraft!"; Debug = new DebugConfiguration(); ServerPort = 25565; ServerAddress = "0.0.0.0"; WorldSaveInterval = 30; Singleplayer = false; Query = true; QueryPort = 25566; }
public static DebugConfiguration RemoveAllExistingNamespaceElementsOnStartup(this DebugConfiguration debuggingConfiguration, string confirmation) { if (confirmation != _confirmationMessage) { throw new BusConfigurationException("RemoveAllExistingNamespaceElements", _requiresConfirmationMessage); } debuggingConfiguration.RemoveAllExistingNamespaceElements = new RemoveAllExistingNamespaceElementsSetting { Value = true }; return(debuggingConfiguration); }
public PesterConfiguration(IDictionary configuration) { if (configuration != null) { Run = new RunConfiguration(configuration.GetIDictionaryOrNull("Run")); Filter = new FilterConfiguration(configuration.GetIDictionaryOrNull("Filter")); CodeCoverage = new CodeCoverageConfiguration(configuration.GetIDictionaryOrNull("CodeCoverage")); TestResult = new TestResultConfiguration(configuration.GetIDictionaryOrNull("TestResult")); Should = new ShouldConfiguration(configuration.GetIDictionaryOrNull("Should")); Debug = new DebugConfiguration(configuration.GetIDictionaryOrNull("Debug")); Output = new OutputConfiguration(configuration.GetIDictionaryOrNull("Output")); } }
public static PesterConfiguration ShallowClone(PesterConfiguration configuration) { var cfg = Default; cfg.Run = RunConfiguration.ShallowClone(configuration.Run); cfg.Filter = FilterConfiguration.ShallowClone(configuration.Filter); cfg.CodeCoverage = CodeCoverageConfiguration.ShallowClone(configuration.CodeCoverage); cfg.TestResult = TestResultConfiguration.ShallowClone(configuration.TestResult); cfg.Should = ShouldConfiguration.ShallowClone(configuration.Should); cfg.Debug = DebugConfiguration.ShallowClone(configuration.Debug); cfg.Output = OutputConfiguration.ShallowClone(configuration.Output); return(cfg); }
public ServerConfiguration() { MOTD = "Welcome to TrueCraft!"; Debug = new DebugConfiguration(); ServerPort = 25565; ServerAddress = "0.0.0.0"; WorldSaveInterval = 30; Singleplayer = false; Query = true; QueryPort = 25566; EnableLighting = true; EnableEventLoading = true; DisabledEvents = new string[0]; }
private void ConstructDrawers() { DebugConfiguration debugConfiguration = DebugConfigurationProvider.Configuration; List <LogType> logTypesEnabledInEditor = debugConfiguration.LogsSendingDataEnabledInEditor.Where(logSendingData => logSendingData.LogCategory == drawnCategory) .Select(logSendingData => logSendingData.LogType).ToList(); List <LogType> logTypesEnabledInBuild = debugConfiguration.LogsSendingDataEnabledInBuild.Where(logSendingData => logSendingData.LogCategory == drawnCategory) .Select(logSendingData => logSendingData.LogType).ToList(); foreach (LogType logType in Enum.GetValues(typeof(LogType))) { typeConfigurationDrawers.Add(new LogSendingTypeDrawer(logType, logTypesEnabledInBuild.Contains(logType), logTypesEnabledInEditor.Contains(logType))); } }
public PesterConfiguration(IDictionary configuration) { if (configuration != null) { Run = new RunConfiguration(configuration.GetIDictionaryOrNull(nameof(Run))); Filter = new FilterConfiguration(configuration.GetIDictionaryOrNull(nameof(Filter))); CodeCoverage = new CodeCoverageConfiguration(configuration.GetIDictionaryOrNull(nameof(CodeCoverage))); TestResult = new TestResultConfiguration(configuration.GetIDictionaryOrNull(nameof(TestResult))); Should = new ShouldConfiguration(configuration.GetIDictionaryOrNull(nameof(Should))); Debug = new DebugConfiguration(configuration.GetIDictionaryOrNull(nameof(Debug))); Output = new OutputConfiguration(configuration.GetIDictionaryOrNull(nameof(Output))); TestDrive = new TestDriveConfiguration(configuration.GetIDictionaryOrNull(nameof(TestDrive))); TestRegistry = new TestRegistryConfiguration(configuration.GetIDictionaryOrNull(nameof(TestRegistry))); } }
public static void Send(Log log) { DebugConfiguration debugConfiguration = DebugConfigurationProvider.Configuration; if (CanSendLog(debugConfiguration.FileLogSendingMode)) { SendToFile(log, debugConfiguration.OutputFileDirectory); } if (CanSendLog(debugConfiguration.AnalyticsLogSendingMode)) { SendToAnalytics(log); } SendToConsole(log); }
private void ConstructServices() { DebugConfiguration configuration = DebugConfigurationProvider.Configuration; logCategoryModifier = new LogCategoryModifier(); sendingCategoryDrawers = new List <LogSendingCategoryDrawer>(); logCategoryDrawer = new LogCategoryDrawer(logCategoryModifier); logCategoryHeaderDrawer = new LogCategoryHeaderDrawer(); foreach (LogCategory logCategory in Enum.GetValues(typeof(LogCategory))) { sendingCategoryDrawers.Add(new LogSendingCategoryDrawer(logCategory)); } generalModesDrawer = new GeneralModesDrawer(configuration.OutputFileDirectory, configuration.AnalyticsLogSendingMode, configuration.FileLogSendingMode); debugConfigurationModifier = new DebugConfigurationModifier(configuration, generalModesDrawer, logCategoryModifier, new List <IHaveSendingConfiguration>(sendingCategoryDrawers)); }
private static void Log(string message, LogType type, LogCategory category, ObjectLog[] objectLogs) { DebugConfiguration debugConfiguration = DebugConfigurationProvider.Configuration; try { if (debugConfiguration.CanSendLogOfTypeAndCategory(type, category)) { Log log = new Log(message, type, objectLogs); LogSender.Send(log); } } catch (Exception caughtException) { Debug.Log(caughtException); throw; } }
private static DebugConfiguration LoadConfiguration() { #if UNITY_EDITOR string configurationPath = $"{ConfigurationFilePath}.asset"; if (File.Exists(configurationPath)) { return(Resources.Load <DebugConfiguration>(ConfigurationFileName)); } if (configuration == null) { configuration = ScriptableObject.CreateInstance <DebugConfiguration>(); } FileExtensions.CreateDirectoryForFile(configurationPath); AssetDatabase.CreateAsset(configuration, configurationPath); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); #endif return(Resources.Load <DebugConfiguration>(ConfigurationFileName) ?? ScriptableObject.CreateInstance <DebugConfiguration>()); }
public void GetValueAndGetValue() { "综合测试,用于断点调试配置项执行流程。".Test(() => { // Arrange var dictionary = new Dictionary <string, string>(StringComparer.Ordinal); var configuration = CreateConfiguration( key => dictionary.TryGetValue(key, out var value) ? value : string.Empty, (key, value) => dictionary[key] = value); var fake = configuration.Of <DebugConfiguration>(); // Act var isTested = fake.IsTested; var amount = fake.Amount; var offsetX = fake.OffsetX; var sizeX = fake.SizeX; var count = fake.Count; var count2 = fake.Count2; var length = fake.Length; var length2 = fake.Length2; var message = fake.Message; var methodImpl = fake.MethodImpl; var dateTime = fake.DateTime; var dateTimeOffset = fake.DateTimeOffset; //var bounds = fake.Bounds; //var color = fake.Color; // Assert Assert.AreEqual(null, isTested); Assert.AreEqual(null, amount); Assert.AreEqual(null, offsetX); Assert.AreEqual(null, sizeX); Assert.AreEqual(null, count); Assert.AreEqual(0, count2); Assert.AreEqual(null, length); Assert.AreEqual(0L, length2); Assert.AreEqual("", message); Assert.AreEqual(MethodImplOptions.AggressiveInlining, methodImpl); Assert.AreEqual(new DateTime(), dateTime); Assert.AreEqual(null, dateTimeOffset); //Assert.AreEqual(new Rect(10, 20, 100, 200), bounds); //Assert.AreEqual(null, color); Assert.AreEqual(0, dictionary.Count); // Act fake.IsTested = true; fake.Amount = 123.51243634523452345123514251m; fake.OffsetX = 100; fake.SizeX = 69.5f; fake.Count = 50; fake.Count2 = 50; fake.Length = 1230004132413241; fake.Length2 = 1230004132413241; fake.Message = "ABC"; fake.MethodImpl = MethodImplOptions.NoInlining; //fake.DateTime = new DateTime(2020, 12, 04, 16, 03, 49, 591, DateTimeKind.Local); fake.DateTimeOffset = new DateTimeOffset(2020, 12, 04, 16, 03, 49, 591, TimeSpan.FromHours(8)); //fake.Bounds = new Rect(10, 20, 200, 100); //fake.Color = Colors.Teal; // Assert Assert.AreEqual(true, fake.IsTested); Assert.AreEqual(123.51243634523452345123514251m, fake.Amount); Assert.AreEqual(100, fake.OffsetX); Assert.AreEqual(69.5f, fake.SizeX); Assert.AreEqual(50, fake.Count); Assert.AreEqual(50, fake.Count2); Assert.AreEqual(1230004132413241, fake.Length); Assert.AreEqual(1230004132413241, fake.Length2); Assert.AreEqual("ABC", fake.Message); //Assert.AreEqual(new DateTime(2020, 12, 04, 16, 03, 49, 591, DateTimeKind.Local), fake.DateTime); Assert.AreEqual(new DateTimeOffset(2020, 12, 04, 16, 03, 49, 591, TimeSpan.FromHours(8)), fake.DateTimeOffset); //Assert.AreEqual(new Rect(10, 20, 200, 100), fake.Bounds); Assert.AreEqual("True", dictionary["Debug.IsTested"]); Assert.AreEqual("123.51243634523452345123514251", dictionary["Debug.Amount"]); Assert.AreEqual("100", dictionary["Debug.OffsetX"]); Assert.AreEqual("69.5", dictionary["Debug.SizeX"]); Assert.AreEqual("50", dictionary["Debug.Count"]); Assert.AreEqual("50", dictionary["Debug.Count2"]); Assert.AreEqual("1230004132413241", dictionary["Debug.Length"]); Assert.AreEqual("1230004132413241", dictionary["Debug.Length2"]); Assert.AreEqual("ABC", dictionary["Debug.Message"]); Assert.AreEqual("NoInlining", dictionary["Debug.MethodImpl"]); //Assert.AreEqual("2020-12-04T16:03:49.5910000Z", dictionary["Debug.DateTime"]); Assert.AreEqual("2020-12-04T16:03:49.5910000+08:00", dictionary["Debug.DateTimeOffset"]); //Assert.AreEqual("10,20,200,100", dictionary["Debug.Bounds"]); //Assert.AreEqual("#FF008080", dictionary["Debug.Color"]); // Act //fake.Bounds = new Rect(10, 20, 100, 200); //Assert.AreEqual(null, dictionary["Debug.Bounds"]); }); "不允许使用 new 创建 Configuration,如果使用,则后续使用抛出异常。".Test(() => { // Arrange var configuration = new DebugConfiguration(); // Act & Assert // ReSharper disable once ExplicitCallerInfoArgument Assert.ThrowsException <InvalidOperationException>(() => configuration.GetValue("Foo")); // ReSharper disable once ExplicitCallerInfoArgument Assert.ThrowsException <InvalidOperationException>(() => configuration.SetValue("Bar", "Foo")); }); "默认的配置不带前缀。".Test(() => { // Arrange var dictionary = new Dictionary <string, string>(); var configuration = CreateConfiguration( key => dictionary.TryGetValue(key, out var value) ? value : string.Empty, (key, value) => dictionary[key] = value); var @default = configuration.Default; // Act string defaultFoo = @default["Foo"]; @default["Foo"] = "Bar"; // Assert Assert.AreEqual("", defaultFoo); Assert.AreEqual("Bar", dictionary["Foo"]); }); "同一份配置组只会有一个实例。".Test(() => { // Arrange // ReSharper disable once RedundantArgumentDefaultValue // ReSharper disable once RedundantArgumentDefaultValue var configuration = CreateConfiguration(null, null); // Act var @default0 = configuration.Of <DefaultConfiguration>(); var @default1 = configuration.Of <DefaultConfiguration>(); // Assert Assert.AreSame(default0, default1); }); "配置允许引用类型存入 null 值。".Test(() => { // Arrange var configuration = CreateConfiguration(); var @default = configuration.Default; // Act & Assert @default["Foo"] = null; }); "配置允许值类型存入 null 值,取出时也为 null 值。".Test(() => { // Arrange var dictionary = new Dictionary <string, string>(); var configuration = CreateConfiguration( key => dictionary.TryGetValue(key, out var value) ? value : string.Empty, (key, value) => dictionary[key] = value); var fake = configuration.Of <DebugConfiguration>(); // Act fake.OffsetX = null; // Assert Assert.AreEqual(null, fake.OffsetX); }); }
/// <summary> /// Initializes the configuration. /// </summary> /// <param name="database">The database to use as a key-value store for the chain, if none is provided, a new one is created.</param> /// <param name="version">An optional version we can supply to override the version numbers derived from our current block number, and the starting block number for a new version.</param> /// <param name="genesisBlockHeader">An optional genesis block header to use instead of the default. Expected to have no transactions or uncles.</param> /// <param name="genesisState">An optional genesis state to use instead of the default. If this is provided, the genesis block's state root hash will be replaced with this state's root hash, and the database argument should be this genesis state's database, so lookups will resolve to any modified genesis state trie objects.</param> public Configuration(BaseDB database = null, EthereumRelease?version = null, BlockHeader genesisBlockHeader = null, State genesisState = null) { // Set our database, or create one if we don't have a provided one. Database = database ?? new BaseDB(); // Initialize our debug items DebugConfiguration = new DebugConfiguration(); CodeCoverage = new CodeCoverage(); // We set our timestamp offset as zero CurrentTimestampOffset = TimeSpan.Zero; #region Versioning // Create our block number lookup. EthereumReleaseBlockStart = new Dictionary <EthereumRelease, BigInteger>(); // If our version to operate under is non-null, then we set it. if (version != null) { SetEthereumReleaseBlockStarts((EthereumRelease)version); } else { // Otherwise we initialize with default parameters. EthereumReleaseBlockStart[EthereumRelease.Frontier] = 0; // This is actually 1, but to avoid future logic errors, we'll include the genesis block. EthereumReleaseBlockStart[EthereumRelease.Homestead] = 1150000; EthereumReleaseBlockStart[EthereumRelease.DAO] = 1920000; EthereumReleaseBlockStart[EthereumRelease.TangerineWhistle] = 2463000; EthereumReleaseBlockStart[EthereumRelease.SpuriousDragon] = 2675000; EthereumReleaseBlockStart[EthereumRelease.Byzantium] = 4370000; EthereumReleaseBlockStart[EthereumRelease.WIP_Constantinople] = EVMDefinitions.UINT256_MAX_VALUE; // Work in progress EthereumReleaseBlockStart[EthereumRelease.WIP_Serenity] = EVMDefinitions.UINT256_MAX_VALUE; // Work in progress } #endregion #region Genesis Block/State // Set up our genesis state if we don't have one. if (genesisState == null) { // We create a genesis state from this state. genesisState = new State(this); } else { // We override our given genesis state configuration with this one. genesisState.Configuration = this; } // Set up our genesis block header if we don't have one. if (genesisBlockHeader == null) { genesisBlockHeader = new BlockHeader( new byte[KeccakHash.HASH_SIZE], // previous hash new byte[KeccakHash.HASH_SIZE], // uncles hash (recalculated later) new Address(0), // coinbase Trie.BLANK_NODE_HASH, // state root hash (taken from our genesis state) Trie.BLANK_NODE_HASH, // transaction root hash Trie.BLANK_NODE_HASH, // receipts root hash 0, // bloom 1145132613, // difficulty 0, // block number 1296127060, // gas limit 0, // gas used 709953967, // timestamp "506F6B6F72612F4C6974746C652028486F73686F2047726F757029".HexToBytes(), // extra data new byte[KeccakHash.HASH_SIZE], // mix hash new byte[KeccakHash.HASH_SIZE]); // nonce } // We set our genesis state trie root hash for our genesis block header genesisBlockHeader.StateRootHash = genesisState.Trie.GetRootNodeHash(); // Initialize our genesis block GenesisBlock = new Block(genesisBlockHeader, Array.Empty <Transaction>(), Array.Empty <BlockHeader>()); GenesisBlock.Header.UpdateUnclesHash(GenesisBlock.Uncles); // Set our genesis state snapshot GenesisStateSnapshot = genesisState.Snapshot(); #endregion // Accounts InitialAccountNonce = 0; // Blocks PreviousHashDepth = 256; // Uncles MaxUncles = 2; MaxUncleDepth = 6; UncleDepthPenaltyFactor = 8; // Block Rewards BlockReward = 5000 * BigInteger.Pow(10, 15); NephewReward = 5000 * BigInteger.Pow(10, 15) / 32; BlockRewardByzantium = 3000 * BigInteger.Pow(10, 15); NephewRewardByzantium = 3000 * BigInteger.Pow(10, 15) / 32; // Block Difficulty MinDifficulty = 131072; DifficultyFactor = 2048; DifficultyAdjustmentCutOff = 13; DifficultyAdjustmentCutOffByzantium = 9; DifficultyAdjustmentCutOffHomestead = 10; DifficultyExponentialPeriod = 100000; DifficultyExponentialFreePeriods = 2; DifficultyExponentialFreePeriodsByzantium = 30; // Gas limits MinGasLimit = 5000; MaxGasLimit = BigInteger.Pow(2, 63) - 1; GasLimitExponentialMovingAverageFactor = 1024; GasLimitAdjustmentMaxFactor = 1024; GasLimitFactorNumerator = 3; GasLimitFactorDenominator = 2; // By default we want to validate ethash. IgnoreEthashVerification = false; // Set our extra data for our dao fork blocks. DAOForkBlockExtraData = Encoding.UTF8.GetBytes("dao-hard-fork"); }
public static DebugConfiguration RemoveAllExistingNamespaceElementsOnStartup(this DebugConfiguration debuggingConfiguration) { throw new BusConfigurationException("RemoveAllExistingNamespaceElements", _requiresConfirmationMessage); }