private static ulong StartingFenceForContext(ExecutionContext context) => 0; // context switch //{ // // we do this to prevent conflicts when comparing markers // ExecutionContext.Copy => ulong.MaxValue / 4 * 0, // ExecutionContext.Compute => ulong.MaxValue / 4 * 1, // ExecutionContext.Graphics => ulong.MaxValue / 4 * 2, // _ => 0xFFFFFFFFFFFFFFFF //}; public CommandQueue( ComputeDevice device, ExecutionContext context, bool enableTdr ) { Debug.Assert(device is object); Type = context; _device = device; _queue = device.CreateQueue(context, enableTdr ? D3D12_COMMAND_QUEUE_FLAGS.D3D12_COMMAND_QUEUE_FLAG_NONE : D3D12_COMMAND_QUEUE_FLAGS.D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT); _fence = device.CreateFence(StartingFenceForContext(context)); _lastFence = _fence.Ptr->GetCompletedValue(); var name = GetListTypeName(context); this.SetName(name + " Queue"); DebugHelpers.SetName(_fence.Ptr, name + " Fence"); ulong frequency; int hr = _queue.Ptr->GetTimestampFrequency(&frequency); // E_FAIL is returned when the queue doesn't support timestamps if (SUCCEEDED(hr) || hr == E_FAIL) { Frequency = hr == E_FAIL ? 0 : frequency; } else { Frequency = 0; _device.ThrowIfFailed(hr, "_queue.Ptr->GetTimestampFrequency(&frequency)"); } }
public void MarkAsConstantMethod(MethodDefinition method, ConstantValue value) { if (!IsEnabled(ReportMode.Actions)) { return; } switch (value) { case ConstantValue.False: ActionList.GetMethod(method, true, MethodAction.ReturnFalse); break; case ConstantValue.True: ActionList.GetMethod(method, true, MethodAction.ReturnTrue); break; case ConstantValue.Null: ActionList.GetMethod(method, true, MethodAction.ReturnNull); break; case ConstantValue.Throw: ActionList.GetMethod(method, true, MethodAction.Throw); break; default: throw DebugHelpers.AssertFail($"Invalid constant value: `{value}`."); } }
bool IDkmRuntimeStepper.OwnsCurrentExecutionLocation(DkmRuntimeInstance runtimeInstance, DkmStepper stepper, DkmStepArbitrationReason reason) { var processData = DebugHelpers.GetOrCreateDataItem <NullcRemoteProcessDataItem>(runtimeInstance.Process); // Can't handle steps without an address if (stepper.StartingAddress == null) { return(false); } var instructionAddress = stepper.StartingAddress.CPUInstructionPart.InstructionPointer; if (DebugHelpers.useNativeInterfaces) { if (processData.nativeModuleInstance != null) { if (instructionAddress >= processData.nativeModuleInstance.BaseAddress && instructionAddress < processData.nativeModuleInstance.BaseAddress + processData.nativeModuleInstance.Size) { return(processData.bytecode.ConvertNativeAddressToInstruction(instructionAddress) != 0); } } } else { if (processData.moduleInstance != null) { if (instructionAddress >= processData.moduleInstance.BaseAddress && instructionAddress < processData.moduleInstance.BaseAddress + processData.moduleInstance.Size) { return(processData.bytecode.ConvertNativeAddressToInstruction(instructionAddress) != 0); } } } return(false); }
ulong GetReturnAddress(DkmThread thread) { // GetCurrentFrameInfo should provide the return address but the result is actually the current instruction address... so we have to go and lookup stack frame data at [ebp+4] var frameRegs = thread.GetCurrentRegisters(new DkmUnwoundRegister[0]); ulong address = 0; var x86Regs = frameRegs as DkmX86FrameRegisters; if (x86Regs != null) { byte[] ebpData = new byte[4]; if (x86Regs.GetRegisterValue(22, ebpData) == 4) { address = DebugHelpers.ReadPointerVariable(thread.Process, BitConverter.ToUInt32(ebpData, 0) + 4).GetValueOrDefault(0); } } if (address == 0) { thread.GetCurrentFrameInfo(out address, out _, out _); } return(address); }
void RewriteAsIsInst(ref BasicBlock block) { Scanner.LogDebug(1, $"REWRITE AS ISINST: {block.Count} {block}"); var reference = Assembly.MainModule.ImportReference(InstanceType); int index = 1; BlockList.InsertInstructionAt(ref block, index++, Instruction.Create(OpCodes.Isinst, reference)); BlockList.InsertInstructionAt(ref block, index++, Instruction.Create(OpCodes.Dup)); BlockList.ReplaceInstructionAt(ref block, index++, Instruction.Create(OpCodes.Stloc, Variable)); BlockList.RemoveInstructionAt(ref block, index); switch (block.BranchType) { case BranchType.False: case BranchType.True: break; case BranchType.None: case BranchType.Return: // Convert it into a bool. BlockList.InsertInstructionAt(ref block, index++, Instruction.Create(OpCodes.Ldnull)); BlockList.InsertInstructionAt(ref block, index++, Instruction.Create(OpCodes.Cgt_Un)); break; default: throw DebugHelpers.AssertFailUnexpected(Method, block, block.BranchType); } }
void IDkmRuntimeMonitorBreakpointHandler.DisableRuntimeBreakpoint(DkmRuntimeBreakpoint runtimeBreakpoint) { var breakpointData = runtimeBreakpoint.GetDataItem <NullcBreakpointDataItem>(); if (breakpointData != null) { var processData = DebugHelpers.GetOrCreateDataItem <NullcRemoteProcessDataItem>(runtimeBreakpoint.Process); var address = breakpointData.instructionAddress.CPUInstructionPart.InstructionPointer; runtimeBreakpoint.Process.InvisibleWriteMemory(breakpointData.instructionAddress.CPUInstructionPart.InstructionPointer, breakpointData.prevValue); // Skip internal breakpoints used in stepper if (runtimeBreakpoint.SourceId != DebugHelpers.NullcStepperBreakpointSourceId) { if (processData.activeBreakpointLocations.Contains(address)) { processData.activeBreakpointLocations.Remove(address); } // If we were planning to restore the breakpoint, forget about it if (processData.lastHitBreakpointLocation == address) { processData.lastHitBreakpointLocation = 0; } } } }
/// <summary> /// Executes a command and adds it to the command history if the command /// is undoable. /// </summary> /// <param name="command">The command to be executed.</param> public virtual void Insert(Command command) { DebugHelpers.CatchAndLog(() => { command.Execute(); if (command.HasUndo) { var newNode = new Node <Command>(command); newNode.Previous = FCurrentNode; FCurrentNode.Next = newNode; FCurrentNode = newNode; } else { FFirstNode.Next = null; FCurrentNode = FFirstNode; } Debug.WriteLine(string.Format("Command {0} executed.", command)); }, string.Format("Execution of command {0}", command)); OnCommandInserted(command); }
// For old configuration way. public static IConfigurationBuilder AddTyrConfiguration(this IConfigurationBuilder configurationBuilder) { var configuration = configurationBuilder.Build(); if (configuration.GetServiceId() == null) { // A hack to simpler get the service value if not set. var entryAssemblyName = Assembly.GetEntryAssembly()?.FullName; var parts = entryAssemblyName?.Split('.', ','); if (parts != null && parts.Length >= 3 && parts[0] == "TypingRealm" && parts[2] == "Api") { configurationBuilder.AddInMemoryCollection(new[] { new KeyValuePair <string, string>("ServiceId", parts[1].ToLowerInvariant()) }); } } if (!DebugHelpers.IsDeployment()) { configuration = configurationBuilder.Build(); // This prevents EF migration from working. var serviceId = configuration.GetServiceId(); if (string.IsNullOrWhiteSpace(serviceId)) { throw new InvalidOperationException("ServiceId should be specified for service."); } } return(configurationBuilder); }
static void Postfix(PartyBase party, float renownValueOfBattle, float contributionShare, ref ExplainedNumber result, ref float __result) { if ((BannerlordTweaksSettings.Instance is { } settings&& party.LeaderHero != null) && (settings.BattleRewardApplyToAI || party.LeaderHero == Hero.MainHero)) { float battleRenownMultiplier = settings.BattleRenownMultiplier; battleRenownMultiplier -= 1f; if (party.LeaderHero == Hero.MainHero && settings.BattleRewardShowDebug) { String BTTweak = ""; if ((float)Math.Round((double)battleRenownMultiplier * 100f, 2) > 0f) { BTTweak = "+"; } DebugHelpers.DebugMessage("Renown Value = " + (float)Math.Round((double)renownValueOfBattle, 2) + "| Your share = " + (float)Math.Round((double)renownValueOfBattle * contributionShare, 2) + "(" + (float)Math.Round((double)contributionShare * 100f, 1) + "%)" + "\nPerkBonus = " + (float)Math.Round((double)result.ResultNumber - result.BaseNumber, 2) + "(" + (float)Math.Round((double)(result.ResultNumber / result.BaseNumber - 1f) * 100f, 1) + "%)" + "\nSum = " + (float)Math.Round((double)result.ResultNumber, 2) + "\nBT Tweak = " + (float)Math.Round((double)battleRenownMultiplier * result.ResultNumber, 2) + "(" + BTTweak + (float)Math.Round((double)battleRenownMultiplier * 100f, 1) + "%)" + "\n\n"); } __result = result.ResultNumber + (battleRenownMultiplier * result.ResultNumber); result.Add(battleRenownMultiplier * result.ResultNumber, new TextObject("BT Renown Tweak"), null); } }
//////////////// private void Initialize(string msg) { string context = DebugHelpers.GetCurrentContext(3); var msgCount = ModHelpersMod.Instance.ExceptionMngr.MsgCount; int count = 0; lock (HamstarExceptionManager.MyLock) { if (msgCount.TryGetValue(msg, out count)) { if (count > 10 && (Math.Log10(count) % 1) != 0) { return; } } else { msgCount[msg] = 0; } msgCount[msg]++; } if (this.InnerException != null) { LogHelpers.Log("!" + context + " (E#" + count + ") - " + msg + " | " + this.InnerException.Message); } else { LogHelpers.Log("!" + context + " (E#" + count + ") - " + msg); } }
public Color GetTintColor() { var mymod = TheLunaticMod.Instance; Color color = Color.Black; float tintScale = MathHelper.Clamp(this.TintScale, 0f, 1f); float daySpike = (float)Math.Abs(WorldStateHelpers.GetDayOrNightPercentDone() - 0.5d); if (Main.dayTime) { tintScale *= 1f - daySpike; } else { tintScale *= (daySpike * 0.6f) + 0.2f; } color.R = (byte)(255f * tintScale); color.G = (byte)(128f * tintScale); color.A = (byte)(255f * tintScale); if (mymod.Config.DebugModeInfo) { DebugHelpers.Print("Sky", color.ToString(), 20); } return(color); }
//////////////// /// <summary> /// Draws to the main SpriteBatch by way of a callback. Attempts to resolve when to draw based on the SpriteBatch's /// `Begun()` state. /// </summary> /// <param name="draw"></param> /// <param name="isBegun">Indicates that the SpriteBatch was already `Begun()`.</param> /// <param name="forceDraw">Forces drawing even wehn the SpriteBatch is already `Begun()`.</param> /// <returns>`true` if no issues occurred with the drawing.</returns> public static bool DrawBatch(Action <SpriteBatch> draw, out bool isBegun, bool forceDraw = true) { if (!XNAHelpers.IsMainSpriteBatchBegun(out isBegun)) { return(false); // take no chances } if (!isBegun) { Main.spriteBatch.Begin(); try { draw(Main.spriteBatch); } catch (Exception e) { LogHelpers.WarnOnce(e.ToString()); } Main.spriteBatch.End(); } else { if (forceDraw) { LogHelpers.WarnOnce(DebugHelpers.GetCurrentContext(2) + " - SpriteBatch already begun. Drawing anyway..."); try { draw(Main.spriteBatch); } catch (Exception e) { LogHelpers.WarnOnce(e.ToString()); } } } return(true); }
//////////////// public override void PostDrawTiles() { //DataStore.Add( DebugHelpers.GetCurrentContext()+"_A", 1 ); Player player = Main.LocalPlayer; if (player == null) { return; } RasterizerState rasterizer = Main.gameMenu || (double)player.gravDir == 1.0 ? RasterizerState.CullCounterClockwise : RasterizerState.CullClockwise; bool _; XnaHelpers.DrawBatch( (sb) => { var mymod = (ModHelpersMod)this.mod; mymod.CustomEntMngr?.DrawPostTilesAll(sb); DebugHelpers.DrawAllRects(sb); }, SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, rasterizer, (Effect)null, Main.GameViewMatrix.TransformationMatrix, out _ ); //DataStore.Add( DebugHelpers.GetCurrentContext()+"_B", 1 ); }
internal void Update_Internal() { // Cleanup unclaimed cutscenes foreach (int plrWho in this._CutscenePerPlayer.Keys.ToArray()) { if (Main.netMode != NetmodeID.Server && CutsceneLibConfig.Instance.DebugModeInfo) { Cutscene cutscene = this._CutscenePerPlayer[plrWho]; DebugHelpers.Print( "cutscene_" + plrWho, cutscene.UniqueId.ToString() + ", " + cutscene?.CurrentScene.UniqueId.ToString() ); } if (Main.player[plrWho]?.active != true) { this.EndCutscene(this._CutscenePerPlayer[plrWho].UniqueId, plrWho, false); } } if (Main.netMode == NetmodeID.MultiplayerClient) { Cutscene cutscene = this.GetCurrentCutscene_Player(Main.LocalPlayer); cutscene?.UpdateCutscene_Internal(); } else { this.UpdateActivations_Host_Internal(); foreach (Cutscene cutscene in this._CutscenePerPlayer.Values.ToArray()) { cutscene.UpdateCutscene_Internal(); } } }
void ParseFile(string projectDirectory, string filePath, ConcurrentDictionary <string, TemplateItem> templateItems) { var referencePath = PathNormalizer.MakeRelativePath(projectDirectory, filePath); DebugHelpers.WriteLine("FileNuggetFinder.ParseFile -- {0}", filePath); // Lookup any/all nuggets in the file and for each add a new template item. using var fs = I18NUtility.Retry(() => File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read), 3); using var streamReader = new StreamReader(fs); _nuggetParser.ParseString(streamReader.ReadToEnd(), delegate(string nuggetString, int pos, Nugget nugget, string iEntity) { var referenceContext = _localizationOptions.DisableReferences ? ReferenceContext.Create("Disabled references", iEntity, 0) : ReferenceContext.Create(referencePath, iEntity, pos); var fileName = Path.GetFileNameWithoutExtension(filePath); // If we have a file like "myfile.aspx.vb" then the fileName will be "myfile.aspx" resulting in split // .pot files. So remove all extensions, so that we just have the actual name to deal with. fileName = fileName.IndexOf('.') > -1 ? fileName.Split('.')[0] : fileName; AddNewTemplateItem( fileName, referenceContext, nugget, templateItems); // Done. return(null); // null means we are not modifying the entity. }); }
protected static void SetTypeAction(XElement element, TypeAction action) { switch (action) { case TypeAction.None: break; case TypeAction.Debug: element.SetAttributeValue("action", "debug"); break; case TypeAction.Warn: element.SetAttributeValue("action", "warn"); break; case TypeAction.Fail: element.SetAttributeValue("action", "fail"); break; case TypeAction.Preserve: element.SetAttributeValue("action", "preserve"); break; case TypeAction.Size: element.SetAttributeValue("action", "size"); break; default: throw DebugHelpers.AssertFail($"Invalid type action: `{action}`."); } }
//// private void UpdateDebugInfo() { var config = PDYBConfig.Instance; if (!config.DebugModeInfo) { return; } var logic = PirateLogic.Instance; DebugHelpers.Print("pirate_negotiator_info", "Patience: " + logic.Patience + ", base demand: " + logic.PirateDemand + ", +demand%: " + logic.PirateDemandVariancePercent + ", computed demand: " + logic.ComputedDemand + ", TicksWhileNegotiatorAway: " + logic.TicksWhileNegotiatorAway + ", TicksUntilNextArrival: " + logic.TicksUntilNextArrival ); if (logic.IsRaiding) { DebugHelpers.Print("pirate_raid_info", "Elapsed ticks: " + logic.RaidElapsedTicks + ", percent done: " + ((float)logic.RaidElapsedTicks / (float)config.RaidDurationTicks).ToString() ); DebugHelpers.Print("pirate_raid_deaths", string.Join(", ", logic.KillsNearTownNPC.Select(kv => kv.Key + ": " + kv.Value)) ); } }
/// <summary> /// Handler for the ReleaseRequestState ASP.NET request pipeline event. /// This event occurs late on in the pipeline but prior to the response being filtered. /// We take the opportunity to inject our i8n post-processing of the response. /// </summary> private void OnReleaseRequestState(object sender, EventArgs e) { System.Web.HttpContextBase context = System.Web.HttpContext.Current.GetHttpContextBase(); DebugHelpers.WriteLine("LocalizingModule::OnReleaseRequestState -- sender: {0}, e:{1}, ContentType: {2},\n\tUrl: {3}\n\tRawUrl:{4}", sender, e, context.Response.ContentType, context.Request.Url, context.Request.RawUrl); LocalizedApplication.InstallResponseFilter(context, m_rootServices); }
static bool Prefix(Hero __instance, SkillObject skill, float xpAmount) { try { if (hdFieldInfo == null) { GetFieldInfo(); } HeroDeveloper hd = (HeroDeveloper)hdFieldInfo !.GetValue(__instance); if (!(BannerlordTweaksSettings.Instance is { } settings)) { return(true); } if (hd != null) { if (xpAmount > 0) { if (settings.HeroSkillExperienceMultiplierEnabled && hd.Hero.IsHumanPlayerCharacter) { if (settings.PerSkillBonusEnabled) { float PerSkillBonus = GetPerSkillBonus(skill, xpAmount); xpAmount = PerSkillBonus; } float newXpAmount = (int)Math.Ceiling(xpAmount * settings.HeroSkillExperienceMultiplier); hd.AddSkillXp(skill, newXpAmount, true, true); } else if (settings.CompanionSkillExperienceMultiplierEnabled && !hd.Hero.IsHumanPlayerCharacter && (hd.Hero.Clan == Hero.MainHero.Clan)) { if (settings.PerSkillBonusEnabled) { float PerSkillBonus = GetPerSkillBonus(skill, xpAmount); xpAmount = PerSkillBonus; } float newXpAmount = (int)Math.Ceiling(xpAmount * settings.CompanionSkillExperienceMultiplier); hd.AddSkillXp(skill, newXpAmount, true, true); } else { hd.AddSkillXp(skill, xpAmount, true, true); } } else { hd.AddSkillXp(skill, xpAmount, true, true); } } } catch (Exception ex) { DebugHelpers.ShowError("An exception occurred while trying to apply the hero xp multiplier.", "", ex); } return(false); }
/// <summary> /// Executes a command and adds it to the command history if the command /// is undoable and sends the command to the remote server. /// </summary> /// <param name="command">The command to be executed.</param> public override void Insert(Command command) { DebugHelpers.CatchAndLog( () => FCommandSender.SendCommandAsync(command), string.Format("SendCommandAsync: {0}", command)); base.Insert(command); Debug.WriteLine(string.Format("Executed on ClientCommandHistory for {0}", FIdItem.Name)); }
public FileEnumerator(IEnumerable <string> blackList) { _blackList = blackList; foreach (string str in blackList) { DebugHelpers.WriteLine(str); } }
public static void Trace_Match(string i_langtag_lhs, string i_langtag_rhs) { LanguageTag lhs = new LanguageTag(i_langtag_lhs); LanguageTag rhs = new LanguageTag(i_langtag_rhs); int score = lhs.Match(rhs); DebugHelpers.WriteLine("LanguageTag.Trace_Match -- Match({0}, {1}) = {2}", i_langtag_lhs, i_langtag_rhs, score.ToString()); }
public override void PreUpdate() { if (this.player.dead) { return; } var mymod = (EncumbranceMod)this.mod; float encumbrance = this.GaugeEncumbrance(); if (mymod.Config.DebugInfoMode) { DebugHelpers.Print("Encumbrance", "Capacity: " + this.GetCurrentCapacity() + ", Encumbrance: " + encumbrance, 20); } if (encumbrance > 0f) { this.player.AddBuff(ModContent.BuffType <EncumberedDebuff>(), 3); } if (this.ItemDropCooldown > 0) { this.ItemDropCooldown--; } if (this.ItemUseCooldown > 0) { this.ItemUseCooldown--; } switch (this.player.mount.Type) { case MountID.MineCart: case MountID.MineCartWood: case MountID.MineCartMech: break; default: if (this.player.mount.Active) { if (!this.IsMounted) { this.IsMounted = true; this.RunMountEffect(); } } else { this.IsMounted = false; } break; } if (this.QueuedDropAmount != 0) { this.DropCarriedItems(this.QueuedDropAmount); this.QueuedDropAmount = 0; } }
/// <summary> /// Goes through the Directories to scan recursively and starts a scan of each while that matches the whitelist. (both from settings) /// </summary> /// <returns>All found nuggets.</returns> public IDictionary <string, TemplateItem> ParseAll() { var whiteListItems = _localizationOptions.WhiteList.ToList(); var directoriesToSearchRecursively = _localizationOptions.DirectoriesToScan; var fileEnumerator = new FileEnumerator(_localizationOptions.BlackList.ToList()); var templateItems = new ConcurrentDictionary <string, TemplateItem>(); foreach (var directoryPath in directoriesToSearchRecursively) { foreach (var filePath in fileEnumerator.GetFiles(directoryPath)) { if (filePath.Length >= 260) { DebugHelpers.WriteLine("Path too long to process. Path: " + filePath); continue; } var currentFullPath = Path.GetDirectoryName(Path.GetFullPath(filePath)); var blacklistFound = _localizationOptions.BlackList.Any(blackItem => currentFullPath == null || currentFullPath.StartsWith(blackItem, StringComparison.OrdinalIgnoreCase)); if (blacklistFound) { continue; } foreach (var whiteListItem in whiteListItems) { if (whiteListItem.StartsWith("*.")) { var fileName = Path.GetFileName(filePath); var dotStartindex = fileName.IndexOf(".", StringComparison.Ordinal); if (dotStartindex == -1) { continue; } var extension = fileName.Substring(dotStartindex); if (!extension.Equals(whiteListItem.Substring(1), StringComparison.OrdinalIgnoreCase)) { continue; } ParseFile(_localizationOptions.ProjectDirectory, filePath, templateItems); break; } if (Path.GetFileName(filePath).Equals(whiteListItem, StringComparison.Ordinal)) { continue; } ParseFile(_localizationOptions.ProjectDirectory, filePath, templateItems); break; } } } return(templateItems); }
protected bool CastRareNpcDowse(Player player, Vector2 aiming_at, int tile_range) { var mymod = (DowsingMod)this.mod; var modplayer = player.GetModPlayer <DowsingPlayer>(); bool dowsed = false; var npc_poses = this.GetNpcPositions(); NPC npc = null; var rare_npc_type_list = WitchingTargetData.GetCurrentRareNpcTypes(); if (rare_npc_type_list.Count == 0) { return(false); } var rare_npc_type_set = new HashSet <int>(rare_npc_type_list); int traveled = 0; this.CurrentBeamTravelDistance = 0; this.CastDowseBeamWithinCone(player, aiming_at, new Utils.PerLinePoint(delegate(int tile_x, int tile_y) { if (!TileWorldHelpers.IsWithinMap(tile_x, tile_y) || traveled >= tile_range) { return(false); } if (npc_poses.ContainsKey(tile_x) && npc_poses[tile_x].ContainsKey(tile_y)) { npc = Main.npc[npc_poses[tile_x][tile_y]]; if (rare_npc_type_set.Contains(npc.type)) { dowsed = true; } } if (dowsed) { this.RenderRodHitFX(player, tile_x, tile_y); } else { traveled++; if (TileHelpers.IsSolid(Framing.GetTileSafely(tile_x, tile_y), false, false)) { traveled++; } } this.CurrentBeamTravelDistance = traveled; if ((mymod.DEBUGFLAGS & 1) != 0) { DebugHelpers.Print("current rare npcs", (this.III++) + " " + string.Join(",", rare_npc_type_set.ToArray()), 20); //var dust = Dust.NewDustPerfect( new Vector2( tile_x * 16, tile_y * 16 ), 259, Vector2.Zero, 0, Color.Red, 0.75f ); //dust.noGravity = true; } return(!dowsed); })); return(dowsed); }
protected void RewriteConditional(ref BasicBlock block, int stackDepth, ConstantValue constant) { if (constant == ConstantValue.Throw) { Scanner.Rewriter.ReplaceWithThrow(ref block, stackDepth); return; } /* * The conditional call can be replaced with a constant. */ switch (block.BranchType) { case BranchType.False: switch (constant) { case ConstantValue.False: case ConstantValue.Null: Scanner.Rewriter.ReplaceWithBranch(ref block, stackDepth, true); break; case ConstantValue.True: Scanner.Rewriter.ReplaceWithBranch(ref block, stackDepth, false); break; default: throw DebugHelpers.AssertFailUnexpected(Method, block, block.BranchType); } break; case BranchType.True: switch (constant) { case ConstantValue.False: case ConstantValue.Null: Scanner.Rewriter.ReplaceWithBranch(ref block, stackDepth, false); break; case ConstantValue.True: Scanner.Rewriter.ReplaceWithBranch(ref block, stackDepth, true); break; default: throw DebugHelpers.AssertFailUnexpected(Method, block, block.BranchType); } break; case BranchType.None: case BranchType.Return: Scanner.Rewriter.ReplaceWithConstant(ref block, stackDepth, constant); break; default: throw DebugHelpers.AssertFailUnexpected(Method, block, block.BranchType); } }
public void Init(System.Web.HttpApplication application) { DebugHelpers.WriteLine("LocalizingModule::Init -- application: {0}", application); // Wire up our event handlers into the ASP.NET pipeline. application.BeginRequest += OnBeginRequest; application.ReleaseRequestState += OnReleaseRequestState; application.PostRequestHandlerExecute += OnPostRequestHandlerExecute; }
public CommandProcessor() { if (Instance == null) { Instance = this; } DebugHelpers.SetDebugPath(); }
public void Test() { Entity e = new Entity(); var r = e.Extensions.CreateBusinessRule(en => en.Number + 4, en => en.Number2) .Start(); DebugHelpers h = new DebugHelpers(); h.LogRuleExecution(r); }
static void Postfix(MissionAgentSpawnLogic __instance, ref int ____battleSize) { if (BannerlordTweaksSettings.Instance is { } settings&& settings.BattleSize > 0) { ____battleSize = settings.BattleSize; DebugHelpers.ColorGreenMessage("Max Battle Size Modified to: " + settings.BattleSize); } return; }