private void ExportToMiniMap() { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type LightingEngine.\u003C\u003Ec__DisplayClass24_0 cDisplayClass240 = new LightingEngine.\u003C\u003Ec__DisplayClass24_0(); // ISSUE: reference to a compiler-generated field cDisplayClass240.\u003C\u003E4__this = this; if (!Main.mapEnabled || this._activeProcessedArea.Width <= 0 || this._activeProcessedArea.Height <= 0) { return; } // ISSUE: reference to a compiler-generated field cDisplayClass240.area = new Rectangle(this._activeProcessedArea.X + 28, this._activeProcessedArea.Y + 28, this._activeProcessedArea.Width - 56, this._activeProcessedArea.Height - 56); Rectangle rectangle = new Rectangle(0, 0, Main.maxTilesX, Main.maxTilesY); rectangle.Inflate(-Main.Map.BlackEdgeWidth, -Main.Map.BlackEdgeWidth); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field cDisplayClass240.area = Rectangle.Intersect(cDisplayClass240.area, rectangle); // ISSUE: reference to a compiler-generated field Main.mapMinX = cDisplayClass240.area.Left; // ISSUE: reference to a compiler-generated field Main.mapMinY = cDisplayClass240.area.Top; // ISSUE: reference to a compiler-generated field Main.mapMaxX = cDisplayClass240.area.Right; // ISSUE: reference to a compiler-generated field Main.mapMaxY = cDisplayClass240.area.Bottom; // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: method pointer FastParallel.For(cDisplayClass240.area.Left, cDisplayClass240.area.Right, new ParallelForAction((object)cDisplayClass240, __methodptr(\u003CExportToMiniMap\u003Eb__0)), (object)null); Main.updateMap = true; }
private void ExportToMiniMap() { //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown if (Main.mapEnabled && _activeProcessedArea.Width > 0 && _activeProcessedArea.Height > 0) { Rectangle area = new Rectangle(_activeProcessedArea.X + 28, _activeProcessedArea.Y + 28, _activeProcessedArea.Width - 56, _activeProcessedArea.Height - 56); Rectangle value = new Rectangle(0, 0, Main.maxTilesX, Main.maxTilesY); value.Inflate(-Main.Map.BlackEdgeWidth, -Main.Map.BlackEdgeWidth); area = Rectangle.Intersect(area, value); Main.mapMinX = area.Left; Main.mapMinY = area.Top; Main.mapMaxX = area.Right; Main.mapMaxY = area.Bottom; FastParallel.For(area.Left, area.Right, (ParallelForAction)(object)(ParallelForAction) delegate(int start, int end, object context) { for (int i = start; i < end; i++) { for (int j = area.Top; j < area.Bottom; j++) { Vector3 vector = _activeLightMap[i - _activeProcessedArea.X, j - _activeProcessedArea.Y]; float num = Math.Max(Math.Max(vector.X, vector.Y), vector.Z); byte light = (byte)Math.Min(255, (int)(num * 255f)); Main.Map.UpdateLighting(i, j, light); } } }, (object)null); Main.updateMap = true; } }
private void BlurPass() { // ISSUE: method pointer FastParallel.For(0, this.Width, new ParallelForAction((object)this, __methodptr(\u003CBlurPass\u003Eb__42_0)), (object)null); // ISSUE: method pointer FastParallel.For(0, this.Height, new ParallelForAction((object)this, __methodptr(\u003CBlurPass\u003Eb__42_1)), (object)null); }
private void BlurPass() { // really hard to figure out what these two lines are meant to be // ISSUE: method pointer FastParallel.For(0, this.Width, new ParallelForAction((startIndex, endIndex, context) => BlurLine(startIndex, endIndex, (int)context))); // ISSUE: method pointer FastParallel.For(0, this.Height, new ParallelForAction((startIndex, endIndex, context) => BlurLine(startIndex, endIndex, (int)context))); }
public void FastParallelMapToArrayErrors() { var a = new int[1]; var b = new int[2]; Assert.Throws <ArgumentNullException>(() => FastParallel.MapToArray <int, int>(null, a, null, i => i)); Assert.Throws <ArgumentNullException>(() => FastParallel.MapToArray(a, null, null, i => i)); Assert.Throws <ArgumentNullException>(() => FastParallel.MapToArray(a, a, null, null)); Assert.Throws <ArgumentException>(() => FastParallel.MapToArray(a, a, 0, i => i)); Assert.Throws <ArgumentException>(() => FastParallel.MapToArray(a, b, 0, i => i)); }
public void FastParallelMapToArray(int?maxThreads, int count) { var inArray = new int[count]; foreach (var index in Enumerable.Range(0, count)) { inArray[index] = index; } var outArray = new int[count]; FastParallel.MapToArray(inArray, outArray, maxThreads, value => value + 1); foreach (var index in Enumerable.Range(0, count)) { Assert.AreEqual(index, inArray[index]); Assert.AreEqual(inArray[index] + 1, outArray[index]); } }
public void FastParallelMapToArrayIndexed(int?maxThreads, int count) { var inArray = new int[count]; foreach (var index in Enumerable.Range(0, count)) { inArray[index] = index + 1; } var outArray = new int[count]; FastParallel.MapToArrayIndexed(inArray, outArray, maxThreads, (value, index) => value + index * 2); foreach (var index in Enumerable.Range(0, count)) { Assert.AreEqual(index + 1, inArray[index]); Assert.AreEqual(inArray[index] + index * 2, outArray[index]); } }
public void FastParallelLoop(int?maxThreads) { FastParallel.Loop(0, maxThreads, _ => Assert.Fail("When count is empty, no action should be called")); foreach (var count in Enumerable.Range(1, 20)) { var executed = new ConcurrentBag <int>(); FastParallel.Loop(count, maxThreads, index => { if (executed.Contains(index)) { Assert.Fail($"Action for index {index} has been called already."); } executed.Add(index); }); var expected = Enumerable.Range(0, count).ToArray(); var actual = executed.ToArray(); Array.Sort(actual); Assert.AreEqual(expected, actual, $"count = {count}: The set of executed actions is wrong"); } }
private void BlurPass() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown FastParallel.For(0, Width, (ParallelForAction) delegate(int start, int end, object context) { for (int j = start; j < end; j++) { BlurLine(IndexOf(j, 0), IndexOf(j, Height - 1 - NonVisiblePadding), 1); BlurLine(IndexOf(j, Height - 1), IndexOf(j, NonVisiblePadding), -1); } }, (object)null); FastParallel.For(0, Height, (ParallelForAction) delegate(int start, int end, object context) { for (int i = start; i < end; i++) { BlurLine(IndexOf(0, i), IndexOf(Width - 1 - NonVisiblePadding, i), Height); BlurLine(IndexOf(Width - 1, i), IndexOf(NonVisiblePadding, i), -Height); } }, (object)null); }
// maxThreads == null should run a plain vanilla for loop. public void FastParallelLoopErrors() { Assert.Throws <ArgumentException>(() => FastParallel.Loop(0, 0, i => { })); Assert.Throws <ArgumentNullException>(() => FastParallel.Loop(0, 0, null)); }
public void FastParallelBatchBoundariesErrors(int count, int currentBatch, int totalBatches) { Assert.Throws <ArgumentException>(() => FastParallel.BatchBoundaries(count, currentBatch, totalBatches)); }
public void FastParallelBatchBoundaries(int count, int currentBatch, int totalBatches, int expectedStart, int expectedEnd) { var(firstIndex, lastIndex) = FastParallel.BatchBoundaries(count, currentBatch, totalBatches); Assert.AreEqual(expectedStart, firstIndex, "firstIndex"); Assert.AreEqual(expectedEnd, lastIndex, "lastIndex"); }