public void Refresh(MemoryProvider master)
 {
     if (IsDirty && master.Scanner.Enabled && Signature != string.Empty)
     {
         Offset = master.Scanner.Scan<int>(MemoryRegionType.EXECUTE, Signature);
         IsDirty = false;
     }
 }
Exemplo n.º 2
0
        private void InitializeProviders()
        {
            listThreads.BeginUpdate();
            _threadP = new ThreadProvider(_pid);
            Program.SecondarySharedThreadProvider.Add(_threadP);
            _threadP.Interval = Properties.Settings.Default.RefreshInterval;
            _threadP.Updated += new ThreadProvider.ProviderUpdateOnce(_threadP_Updated);
            listThreads.Provider = _threadP;

            listModules.BeginUpdate();
            _moduleP = new ModuleProvider(_pid);
            Program.SecondarySharedThreadProvider.Add(_moduleP);
            _moduleP.Interval = Properties.Settings.Default.RefreshInterval;
            _moduleP.Updated += new ModuleProvider.ProviderUpdateOnce(_moduleP_Updated);
            listModules.Provider = _moduleP;

            listMemory.BeginUpdate();
            _memoryP = new MemoryProvider(_pid);
            Program.SecondarySharedThreadProvider.Add(_memoryP);
            _memoryP.IgnoreFreeRegions = true;
            _memoryP.Interval = Properties.Settings.Default.RefreshInterval;
            _memoryP.Updated += new MemoryProvider.ProviderUpdateOnce(_memoryP_Updated);
            listMemory.Provider = _memoryP;

            listHandles.BeginUpdate();
            _handleP = new HandleProvider(_pid);
            Program.SecondarySharedThreadProvider.Add(_handleP);
            _handleP.HideHandlesWithNoName = Properties.Settings.Default.HideHandlesWithNoName;
            _handleP.Interval = Properties.Settings.Default.RefreshInterval;
            _handleP.Updated += new HandleProvider.ProviderUpdateOnce(_handleP_Updated);
            listHandles.Provider = _handleP;

            listThreads.List.SetTheme("explorer");
            listModules.List.SetTheme("explorer");
            listMemory.List.SetTheme("explorer");
            listHandles.List.SetTheme("explorer");

            this.InitializeShortcuts();
        }
Exemplo n.º 3
0
        public void PoolDynamic()
        {
            InitTest();

            var driversPool = new MemoryPool("Drivers", MemoryAddress.Static, 0x315298, 0x200);

            var provider = new MemoryProvider(reader);

            provider.Add(driversPool);
            provider.Refresh();

            Assert.AreEqual("Drivers", driversPool.Name);
            Assert.AreEqual(MemoryAddress.Static, driversPool.AddressType);
            Assert.AreEqual(0x315298, driversPool.Address);
            Assert.AreEqual(0x200, driversPool.Size);
            Assert.AreEqual(0, driversPool.Offset);
            Assert.False(driversPool.IsDynamic);
            Assert.False(driversPool.IsConstant);
            Assert.True(driversPool.IsStatic);
            Assert.False(driversPool.IsSignature);
            Assert.False(driversPool.IsTemplate);

            Assert.AreEqual(1, actionLogbook.Count);

            Assert.AreEqual(0x715298, actionLogbook[0].Address);
            Assert.AreEqual(0x200, actionLogbook[0].Size);

            var driver1 = new MemoryPool("Driver1", MemoryAddress.Dynamic, driversPool, 0x0, 0x6000);
            var driver2 = new MemoryPool("Driver2", MemoryAddress.Dynamic, driversPool, 0x4, 0x6000);

            provider.Add(driver1);
            provider.Add(driver2);
            provider.Refresh();

            Assert.AreEqual("Driver1", driver1.Name);
            Assert.AreEqual(MemoryAddress.Dynamic, driver1.AddressType);
            Assert.AreEqual(0, driver1.Address);
            Assert.AreEqual(0x6000, driver1.Size);
            Assert.AreEqual(0, driver1.Offset);
            Assert.AreEqual(driversPool, driver1.Pool);
            Assert.True(driver1.IsDynamic);
            Assert.False(driver1.IsConstant);
            Assert.False(driver1.IsStatic);
            Assert.False(driver1.IsSignature);
            Assert.False(driver1.IsTemplate);

            Assert.AreEqual("Driver2", driver2.Name);
            Assert.AreEqual(MemoryAddress.Dynamic, driver2.AddressType);
            Assert.AreEqual(0, driver2.Address);
            Assert.AreEqual(0x6000, driver2.Size);
            Assert.AreEqual(4, driver2.Offset);
            Assert.AreEqual(driversPool, driver2.Pool);
            Assert.True(driver2.IsDynamic);
            Assert.False(driver2.IsConstant);
            Assert.False(driver2.IsStatic);
            Assert.False(driver2.IsSignature);
            Assert.False(driver2.IsTemplate);

            Assert.AreEqual(4, actionLogbook.Count);

            Assert.AreEqual(0x715298, actionLogbook[0].Address);
            Assert.AreEqual(0x200, actionLogbook[0].Size);
            Assert.AreEqual(0x715298, actionLogbook[1].Address);
            Assert.AreEqual(0x200, actionLogbook[1].Size);
            Assert.AreEqual(0x7154c0, actionLogbook[2].Address);
            Assert.AreEqual(0x6000, actionLogbook[2].Size);
            Assert.AreEqual(0x71b408, actionLogbook[3].Address);
            Assert.AreEqual(0x6000, actionLogbook[3].Size);
        }
Exemplo n.º 4
0
 public Layer(string layername)
 {
     LayerName = layername;
     cache     = new MemoryProvider();
 }
Exemplo n.º 5
0
 public ConnectionProvider(IPAddress loginServer, int basePort, MemoryProvider manager, int processID)
     : this(manager, processID)
 {
     iPLoginServer = loginServer;
     this.basePort = basePort;
 }
Exemplo n.º 6
0
 public ConnectionProvider(MemoryProvider manager, int processID)
 {
     memory = manager;
     Initialize();
 }
Exemplo n.º 7
0
        private static MemoryProvider <IFeature> CreateProviderWithLabels()
        {
            var features = new List <IFeature>
            {
                new PointFeature(new MPoint(100, 100))
                {
                    Styles = new[] { new VectorStyle {
                                         Fill = new Brush(Color.Gray), Outline = new Pen(Color.Black)
                                     } }
                },
                new PointFeature(new MPoint(100, 200))
                {
                    Styles = new[] { new LabelStyle {
                                         Text = "Black Text", BackColor = null
                                     } }
                },
                new PointFeature(new MPoint(100, 300))
                {
                    Styles = new[]
                    {
                        new LabelStyle
                        {
                            Text      = "Gray Backcolor",
                            BackColor = new Brush(Color.Gray),
                            ForeColor = Color.White
                        }
                    }
                },
                new PointFeature(new MPoint(300, 100))
                {
                    Styles =
                        new[]
                    {
                        new LabelStyle
                        {
                            Text      = "Black Halo",
                            ForeColor = Color.White,
                            Halo      = new Pen(Color.Black),
                            BackColor = null
                        }
                    }
                },
                new PointFeature(new MPoint(300, 200))
                {
                    Styles = new[]
                    {
                        new LabelStyle
                        {
                            Text        = string.Empty,
                            BackColor   = new Brush(Color.Black),
                            ForeColor   = Color.White,
                            LabelMethod = f => null
                        }
                    }
                },
                new PointFeature(new MPoint(300, 300))
                {
                    Styles = new[]
                    {
                        new LabelStyle
                        {
                            Text                = "Multiline\nText",
                            BackColor           = new Brush(Color.Gray),
                            ForeColor           = Color.Black,
                            HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Center,
                        }
                    }
                },
                new PointFeature(new MPoint(250, 150))
                {
                    Styles = new[]
                    {
                        new LabelStyle
                        {
                            Text            = "Border",
                            BackColor       = new Brush(Color.Gray),
                            ForeColor       = Color.Black,
                            BorderColor     = Color.Blue,
                            BorderThickness = 7, // Thick borders are needed to fail test
                        }
                    }
                },
                new PointFeature(new MPoint(250, 50))
                {
                    Styles = new[]
                    {
                        new LabelStyle
                        {
                            Text            = "Sharp corners",
                            BackColor       = new Brush(Color.Gray),
                            ForeColor       = Color.Black,
                            BorderColor     = Color.Black,
                            BorderThickness = 7,
                            CornerRounding  = 0,
                        }
                    }
                }
            };
            var provider = new MemoryProvider <IFeature>(features);

            return(provider);
        }
Exemplo n.º 8
0
        private static MemoryProvider CreateLineProvider()
        {
            var features = new Features();
            var feature  = new Feature
            {
                Geometry = Geometry.GeomFromText(
                    "LINESTRING (-642227.831499647 5123550.9224083, -1241640.47423265 5037920.54487501, -1584161.9843658 4923746.70816396, -1869596.57614342 4923746.70816396, -2012313.87203223 4838116.33063068, -2326291.92298761 4809572.87145292, -2583183.05558747 4723942.49391963, -3211139.15749824 4695399.03474187, -3468030.2900981 4552681.73885306, -3610747.58598691 4524138.27967529, -3753464.88187572 4409964.44296425, -3810551.80023124 4409964.44296425, -4124529.85118663 4095986.39200886, -4181616.76954215 4095986.39200886, -4267247.14707544 4010356.01447558, -4467051.36131977 3924725.63694229, -4524138.2796753 3839095.259409, -4923746.70816397 3553660.66763138, -5066464.00405278 3525117.20845362, -5152094.38158606 3439486.83092033, -5237724.75911935 3268226.07585376, -5466072.43254144 3125508.77996495, -5523159.35089697 2982791.48407614, -5780050.48349683 2668813.43312076, -5979854.69774116 2354835.38216537, -6008398.15691892 2240661.54545433, -6065485.07527445 2183574.6270988, -6122571.99362997 1898140.03532118, -6236745.83034102 1755422.73943237, -6265289.28951878 1612705.44354356, -6322376.20787431 842032.045743983, -6322376.20787431 -642227.831499647, -6265289.28951878 -1041836.25998832, -6151115.45280774 -1527075.06601027, -5865680.86103011 -2240661.54545433, -5751507.02431907 -2383378.84134314, -5694420.10596354 -2526096.13723195, -5551702.81007473 -2668813.43312076, -5523159.35089697 -2754443.81065404, -5009377.08569725 -3239682.616676, -4781029.41227515 -3353856.45338705, -4609768.65720858 -3382399.91256481, -4295790.6062532 -3553660.66763138, -3525117.20845362 -3810551.80023124, -3325312.99420929 -3953269.09612005, -2554639.59640971 -4153073.31036439, -2069400.79038775 -4324334.06543096, -984749.341632795 -4524138.27967529, -670771.29067741 -4609768.65720858, -185532.484655455 -4809572.87145291, 271162.862188738 -4895203.2489862, 870575.504921742 -5180637.84076382, 1641248.90272132 -5437528.97336368, 1869596.57614342 -5551702.81007473, 2297748.46380985 -5637333.18760802, 2725900.35147628 -5637333.18760802, 3353856.45338705 -5694420.10596354, 4980833.62651949 -5722963.5651413, 4980833.62651949 -5694420.10596354, 5180637.84076382 -5665876.64678578, 5237724.75911935 -5608789.72843025, 5665876.64678578 -5523159.35089697, 5922767.77938564 -5323355.13665263, 6293832.74869654 -5209181.29994159, 6465093.50376312 -5095007.46323054, 6579267.34047417 -5095007.46323054, 6779071.5547185 -5009377.08569725, 6893245.39142955 -4895203.2489862, 7321397.27909598 -4866659.78980844, 7492658.03416255 -4809572.87145291, 7749549.16676241 -4809572.87145291, 8377505.26867318 -4638312.11638634, 8891287.53387289 -4609768.65720858, 9262352.5031838 -4723942.49391963, 9604874.01331695 -5037920.54487501, 9690504.39085023 -5066464.00405278, 9861765.14591681 -5266268.21829711, 10204286.65605 -5494615.89171921, 10946416.5946718 -5751507.02431907, 11888350.7475379 -5922767.77938564, 12830284.9004041 -5979854.69774116, 14971044.3387362 -5979854.69774116, 15427739.6855804 -5894224.32020788, 15741717.7365358 -5751507.02431907, 15770261.1957136 -5694420.10596354, 15827348.1140691 -5694420.10596354, 16226956.5425578 -5180637.84076382, 16369673.8384466 -4524138.27967529, 16483847.6751576 -4295790.6062532, 16512391.1343354 -4295790.6062532, 16540934.5935131 -4153073.31036439, 16598021.5118687 -4067442.9328311, 16626564.9710464 -3867638.71858677, 16769282.2669352 -3610747.58598691, 16797825.726113 -2811530.72900957, 16854912.6444685 -2611726.51476523, 16854912.6444685 -2383378.84134314, 16911999.5628241 -2240661.54545433, 16940543.0220018 -1726879.28025461, 17026173.3995351 -1555618.52518803, 17140347.2362461 -1469988.14765475, 17197434.1546017 -1327270.85176594, 17654129.5014459 -727858.209032934, 17739759.8789792 -528053.994788598, 17739759.8789792 -356793.239722027)")
            };

            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Violet, 5)
            });
            features.Add(feature);
            // Add some dashed lines
            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (-7000000 12000000, -1000000 12000000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Red)
                {
                    PenStyle = PenStyle.Dash
                }
            });
            features.Add(feature);
            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (00000 12000000, 6000000 12000000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Green)
                {
                    PenStyle = PenStyle.ShortDash
                }
            });
            features.Add(feature);
            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (7000000 12000000, 13000000 12000000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Blue)
                {
                    PenStyle = PenStyle.DashDot
                }
            });
            features.Add(feature);
            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (14000000 12000000, 20000000 12000000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Red)
                {
                    PenStyle = PenStyle.ShortDashDot
                }
            });
            features.Add(feature);
            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (-7000000 11000000, -1000000 11000000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Green)
                {
                    PenStyle = PenStyle.DashDotDot
                }
            });
            features.Add(feature);
            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (000000 11000000, 6000000 11000000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Blue)
                {
                    PenStyle = PenStyle.ShortDashDotDot
                }
            });
            features.Add(feature);
            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (7000000 11000000, 13000000 11000000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Red)
                {
                    PenStyle = PenStyle.Dot
                }
            });
            features.Add(feature);
            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (14000000 11000000, 20000000 11000000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Green)
                {
                    PenStyle = PenStyle.ShortDot
                }
            });
            features.Add(feature);
            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (-7000000 10000000, -1000000 10000000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Blue)
                {
                    PenStyle = PenStyle.LongDash
                }
            });
            features.Add(feature);
            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (00000 10000000, 6000000 10000000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Red)
                {
                    PenStyle = PenStyle.UserDefined, DashArray = new float[] { 6, 4, 12, 4, 2, 4, 12, 4 }
                }
            });
            features.Add(feature);
            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (7000000 10000000, 13000000 10000000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Green)
                {
                    PenStyle = PenStyle.LongDashDot
                }
            });
            features.Add(feature);
            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (14000000 10000000, 20000000 10000000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Blue)
                {
                    PenStyle = PenStyle.Solid
                }
            });
            features.Add(feature);

            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (-7000000 7500000, -3725000 7500000, -3725000 6500000, -1000000 6500000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Gray, 15)
                {
                    PenStyle = PenStyle.Solid, PenStrokeCap = PenStrokeCap.Butt, StrokeJoin = StrokeJoin.Bevel, StrokeMiterLimit = 1
                }
            });
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Red)
                {
                    PenStyle = PenStyle.Solid, PenStrokeCap = PenStrokeCap.Butt
                }
            });
            features.Add(feature);
            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (000000 7500000, 3000000 7500000, 3000000 6500000, 6000000 6500000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Gray, 15)
                {
                    PenStyle = PenStyle.Solid, PenStrokeCap = PenStrokeCap.Round, StrokeJoin = StrokeJoin.Round, StrokeMiterLimit = 1
                }
            });
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Red)
                {
                    PenStyle = PenStyle.Solid, PenStrokeCap = PenStrokeCap.Butt
                }
            });
            features.Add(feature);
            feature = new Feature {
                Geometry = Geometry.GeomFromText("LINESTRING (7500000 7500000, 10000000 7500000, 10000000 6500000, 12500000 6500000)")
            };
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Gray, 15)
                {
                    PenStyle = PenStyle.Solid, PenStrokeCap = PenStrokeCap.Square, StrokeJoin = StrokeJoin.Miter
                }
            });
            feature.Styles.Add(new VectorStyle {
                Line = new Pen(Color.Red)
                {
                    PenStyle = PenStyle.Solid, PenStrokeCap = PenStrokeCap.Butt
                }
            });
            features.Add(feature);

            var provider = new MemoryProvider(features);

            return(provider);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Mapsui.UI.Objects.MyLocationLayer"/> class.
        /// </summary>
        /// <param name="view">MapView, to which this layer belongs</param>
        public MyLocationLayer(MapView view)
        {
            if (view == null)
            {
                throw new ArgumentNullException("MapView shouldn't be null");
            }

            mapView = view;

            Enabled = false;

            if (bitmapMovingId == -1)
            {
                var bitmapMoving = Utilities.EmbeddedResourceLoader.Load($"Images.MyLocationMoving.svg", typeof(MyLocationLayer));

                if (bitmapMoving != null)
                {
                    // Register bitmap
                    bitmapMovingId = BitmapRegistry.Instance.Register(bitmapMoving);
                }
            }

            if (bitmapStillId == -1)
            {
                var bitmapStill = Utilities.EmbeddedResourceLoader.Load($"Images.MyLocationStill.svg", typeof(MyLocationLayer));

                if (bitmapStill != null)
                {
                    // Register bitmap
                    bitmapStillId = BitmapRegistry.Instance.Register(bitmapStill);
                }
            }

            if (bitmapDirId == -1)
            {
                var bitmapDir = Utilities.EmbeddedResourceLoader.Load($"Images.MyLocationDir.svg", typeof(MyLocationLayer));

                if (bitmapDir != null)
                {
                    // Register bitmap
                    bitmapDirId = BitmapRegistry.Instance.Register(bitmapDir);
                }
            }

            feature = new Feature
            {
                Geometry  = myLocation.ToMapsui(),
                ["Label"] = "MyLocation moving",
            };

            feature.Styles.Clear();
            feature.Styles.Add(new SymbolStyle
            {
                Enabled        = true,
                BitmapId       = bitmapStillId,
                SymbolScale    = Scale,
                SymbolRotation = Direction,
                SymbolOffset   = new Offset(0, 0),
                Opacity        = 1,
            });

            featureDir = new Feature
            {
                Geometry  = myLocation.ToMapsui(),
                ["Label"] = "My view direction",
            };

            featureDir.Styles.Clear();
            featureDir.Styles.Add(new SymbolStyle
            {
                Enabled        = false,
                BitmapId       = bitmapDirId,
                SymbolScale    = 0.2,
                SymbolRotation = 0,
                SymbolOffset   = new Offset(0, 0),
                Opacity        = 1,
            });

            DataSource = new MemoryProvider(new List <Feature> {
                featureDir, feature
            });
            Style = null;
        }
Exemplo n.º 10
0
        public static ILayer CreateLayer()
        {
            var memoryProvider = new MemoryProvider();

            var featureWithDefaultStyle = new Feature {
                Geometry = new Point(0, 0)
            };

            featureWithDefaultStyle.Styles.Add(new LabelStyle {
                Text = "Default Label"
            });
            memoryProvider.Features.Add(featureWithDefaultStyle);


            var featureWithRightAlignedStyle = new Feature {
                Geometry = new Point(0, -2000000)
            };

            featureWithRightAlignedStyle.Styles.Add(new LabelStyle
            {
                Text                = "Right Aligned",
                BackColor           = new Brush(Color.Gray),
                HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Right
            });
            memoryProvider.Features.Add(featureWithRightAlignedStyle);

            var featureWithBottomAlignedStyle = new Feature {
                Geometry = new Point(0, -4000000)
            };

            featureWithBottomAlignedStyle.Styles.Add(new LabelStyle
            {
                Text              = "Right Aligned",
                BackColor         = new Brush(Color.Gray),
                VerticalAlignment = LabelStyle.VerticalAlignmentEnum.Bottom
            });
            memoryProvider.Features.Add(featureWithBottomAlignedStyle);

            var polygon = new Feature {
                Geometry = Geometry.GeomFromText("POLYGON((-1000000 -10000000, 1000000 -10000000, 1000000 -8000000, -1000000 -8000000, -1000000 -10000000))")
            };

            polygon.Styles.Add(new LabelStyle
            {
                Text                = "Polygon",
                BackColor           = new Brush(Color.Gray),
                HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Center
            });
            memoryProvider.Features.Add(polygon);

            var featureWithColors = new Feature {
                Geometry = new Point(0, -6000000)
            };

            featureWithColors.Styles.Add(CreateColoredLabelStyle());
            memoryProvider.Features.Add(featureWithColors);

            return(new MemoryLayer {
                Name = "Points with labels", DataSource = memoryProvider
            });
        }
Exemplo n.º 11
0
        public void AddTripTrails(Trip trip)
        {
            if (_tripTrailLayer != null)
            {
                _map.Layers.Remove(_tripTrailLayer);
            }

            if (_tripInfoLayer != null)
            {
                _map.Layers.Remove(_tripInfoLayer);
            }

            Features trailFeatures = new Features();
            Features infoFeatures  = new Features();

            int          lastSpeedColorIndex = -1;
            Point        lastPoint           = null;
            List <Point> points = new List <Point>();

            double?firstLat = null;
            double?firstLon = null;

            foreach (Video video in trip.Videos)
            {
                foreach (KeyValuePair <int, TrailItem> kvp in video.TrailItems.ToList())
                {
                    var item = kvp.Value;

                    if (item.Longitude == 0 && item.Latitude == 0)
                    {
                        continue;
                    }

                    if (firstLat == null)
                    {
                        firstLat = item.Latitude;
                        firstLon = item.Longitude;
                    }

                    var location = SphericalMercator.FromLonLat(item.Longitude, item.Latitude);

                    if (lastPoint != null && location.Distance(lastPoint) < 35)
                    {
                        continue;
                    }

                    infoFeatures.Add(new Feature()
                    {
                        Geometry    = location,
                        ["Video"]   = video,
                        ["Seconds"] = kvp.Key
                    });

                    lastPoint = location;
                    int index = MapColors.GetStyleIndexFromSpeed(item.SpeedMph);

                    if (index != lastSpeedColorIndex)
                    {
                        if (lastSpeedColorIndex != -1)
                        {
                            points.Add(location);
                        }

                        if (points.Count > 0)
                        {
                            List <IStyle> styleList = new List <IStyle> {
                                MapColors.LineStyles[lastSpeedColorIndex]
                            };
                            trailFeatures.Add(new Feature()
                            {
                                Geometry = new LineString(points),
                                Styles   = styleList
                            });
                        }
                        points.Clear();
                    }

                    points.Add(location);
                    lastSpeedColorIndex = index;
                }
            }

            _tripTrailLayer = new MemoryLayer
            {
                DataSource = new MemoryProvider()
                {
                    Features = trailFeatures
                },
                Name  = "TripLayer",
                Style = null
            };

            _tripInfoLayer = new MemoryLayer
            {
                DataSource = new MemoryProvider()
                {
                    Features = infoFeatures
                },
                Name  = "MoviesLayer",
                Style = new SymbolStyle
                {
                    SymbolScale  = 0.5,
                    SymbolOffset = new Offset(0, 0),
                    SymbolType   = SymbolType.Ellipse,
                    //Line = new Pen(Color.Black, 2),
                    //Fill = new Brush(Color.White),
                    //Opacity = 0.1
                    Line    = new Pen(Color.White, 0),
                    Fill    = new Brush(Color.Transparent),
                    Opacity = 0.0
                }
            };

            _map.Layers.Insert(1, _tripTrailLayer);

            //_map.Layers.Insert(1, _tripInfoLayer);
            _map.InfoLayers.Add(_tripInfoLayer);

            if (_positionLayer != null)
            {
                MemoryProvider dataSource = ((MemoryProvider)((MemoryLayer)_positionLayer).DataSource);
                dataSource.Features.Clear();
            }

            if (firstLat != null && firstLon != null)
            {
                MoveToArea((double)firstLat, (double)firstLon, 0.001);
            }

            MapControl.RefreshData();
        }
Exemplo n.º 12
0
        public void LapTests()
        {
            var lapsRecorded = new List <Lap>();

            GlobalEvents.Hook <TelemetryLapComplete>(lap => lapsRecorded.Add(lap.Lap), true);

            float[] rpmWave;
            float[] speedWave;
            GetWaves(out rpmWave, out speedWave);
            int index = 0;

            var provider = new MemoryProvider(null);
            var fakePool = new MemoryPool("Driver", MemoryAddress.StaticAbsolute, 0, 0);

            fakePool.Add(new MemoryFieldFunc <float>("Speed", (pool) => speedWave[index], true));
            fakePool.Add(new MemoryFieldFunc <float>("RPM", (pool) => rpmWave[index++], true));
            fakePool.Add(new MemoryFieldFunc <float>("Laps", (pool) =>
            {
                if (index <= 100)
                {
                    return(0);
                }
                if (index > 100 && index <= 225)
                {
                    return(1);
                }
                if (index > 225 && index <= 325)
                {
                    return(2);
                }
                if (index > 325 && index <= 500)
                {
                    return(3);
                }
                if (index > 500 && index <= 575)
                {
                    return(4);
                }
                if (index > 575 && index <= 1024)
                {
                    return(5);
                }

                return(-1);
            }, true));
            fakePool.Add(new MemoryFieldConstant <bool>("IsAI", false));
            fakePool.Add(new MemoryFieldConstant <bool>("IsPlayer", true));
            provider.Add(fakePool);

            var fakeDriver  = new TelemetryDriver(fakePool);
            var fakeDrivers = new List <TelemetryDriver>(new[] { fakeDriver });

            var logger = new TelemetryLogger("testSim", new TelemetryLoggerConfiguration(true, true, true, true));

            logger.SetDatasource(provider);
            //logger.SetAnnotater(new TelemetryArchive());
            GlobalEvents.Fire(new SessionStarted(), true);
            GlobalEvents.Fire(new DriversAdded(null, fakeDrivers), true);

            for (int i = 0; i < 1024; i++)
            {
                logger.Update(i * 25);
            }

            GlobalEvents.Fire(new SessionStopped(), true);
            Thread.Sleep(500);

            Assert.AreEqual(6, lapsRecorded.Count);
            Assert.AreEqual(0, lapsRecorded[0].LapNumber);
            Assert.AreEqual(1, lapsRecorded[1].LapNumber);
            Assert.AreEqual(2, lapsRecorded[2].LapNumber);
            Assert.AreEqual(3, lapsRecorded[3].LapNumber);
            Assert.AreEqual(4, lapsRecorded[4].LapNumber);
            Assert.AreEqual(5, lapsRecorded[5].LapNumber);

            Assert.AreEqual(100, lapsRecorded[0].Total);
            Assert.AreEqual(125, lapsRecorded[1].Total);
            Assert.AreEqual(100, lapsRecorded[2].Total);
            Assert.AreEqual(175, lapsRecorded[3].Total);
            Assert.AreEqual(75, lapsRecorded[4].Total);
            Assert.AreEqual(-1, lapsRecorded[5].Total);
        }
Exemplo n.º 13
0
 public InMemoryLayer(MemoryProvider memoryProvider)
 {
     MemoryProvider = memoryProvider;
 }
Exemplo n.º 14
0
 public InMemoryLayer()
 {
     MemoryProvider = new MemoryProvider();
 }
Exemplo n.º 15
0
 public bool CheckDriverQuick(MemoryProvider provider, int ptr)
 {
     return(false);
 }
Exemplo n.º 16
0
        public static MemoryProvider CreatePolygonProvider()
        {
            var features = new Features();

            var feature = new Feature
            {
                Geometry = Geometry.GeomFromText(
                    "POLYGON ((-1955226.9536767 4267247.14707544, -2183574.6270988 4267247.14707544, -2611726.51476523 4095986.39200886, -2868617.64736509 4067442.9328311, -3268226.07585376 3896182.17776453, -3667834.50434243 3839095.259409, -4067442.9328311 3639291.04516467, -4495594.82049753 3525117.20845362, -4809572.87145292 3068421.86160943, -5066464.00405278 2954248.02489838, -5266268.21829711 2668813.43312076, -5780050.48349683 2240661.54545433, -6008398.15691892 1612705.44354356, -6265289.28951878 1070379.71916608, -6293832.74869655 813488.586566221, -6408006.58540759 642227.831499647, -6579267.34047417 -299706.321366502, -6779071.5547185 -984749.341632793, -6893245.39142955 -1755422.73943237, -6921788.85060731 -2982791.48407614, -6978875.76896284 -3296769.53503152, -6950332.30978507 -4866659.78980844, -6750528.09554074 -5922767.77938564, -6522180.42211864 -6522180.42211864, -6408006.58540759 -6721984.63636298, -6122571.99362997 -6950332.30978507, -6008398.15691892 -7378484.1974515, -5751507.02431907 -7692462.24840689, -5152094.38158606 -8234787.97278437, -4923746.70816397 -8348961.80949542, -3667834.50434243 -8634396.40127304, -2954248.02489838 -8720026.77880632, -899118.964099508 -8777113.69716185, -156989.025477692 -8834200.61551737, 1213097.01505489 -8834200.61551737, 2697356.89229852 -8777113.69716185, 3810551.80023124 -8634396.40127304, 4552681.73885306 -8291874.89113989, 4838116.33063068 -8120614.13607332, 5209181.29994158 -8006440.29936227, 5351898.5958304 -7920809.92182898, 5551702.81007473 -7635375.33005136, 5780050.48349683 -7521201.49334032, 5922767.77938564 -7292853.81991822, 6094028.53445221 -7150136.52402941, 6322376.20787431 -7035962.68731836, 6607810.79965193 -6779071.5547185, 6721984.63636298 -6522180.42211864, 7064506.14649612 -6065485.07527445, 7093049.60567388 -5894224.32020788, 7178679.98320717 -5694420.10596354, 7178679.98320717 -4923746.70816396, 7093049.60567388 -3981812.55529781, 6978875.76896283 -3496573.74927586, 6921788.85060731 -2925704.56572062, 6921788.85060731 -2611726.51476523, 7007419.2281406 -2497552.67805418, 7007419.2281406 -2440465.75969866, 8291874.89113989 -2155031.16792104, 10118656.2785167 -1898140.03532118, 11288938.1048049 -1555618.52518803, 12116698.42096 -870575.504921744, 12230872.2576711 -613684.372321885, 12373589.5535599 -442423.617255311, 12516306.8494487 -99902.1071221679, 12544850.3086264 642227.831499647, 12544850.3086264 4838116.33063068, 12573393.7678042 5009377.08569725, 12687567.6045153 5380442.05500816, 12915915.2779374 5665876.64678578, 13058632.5738262 5780050.48349683, 13429697.5431371 6293832.74869655, 13515327.9206704 6664897.71800745, 13515327.9206704 7035962.68731836, 13258436.7880705 7464114.57498479, 13030089.1146484 7492658.03416255, 12744654.5228708 7635375.33005136, 12544850.3086264 7692462.24840689, 11060590.4313828 7721005.70758465, 10889329.6763162 7635375.33005136, 10689525.4620719 7492658.03416255, 10575351.6253609 7292853.81991822, 10489721.2478276 7007419.2281406, 10375547.4111165 6864701.93225179, 10289917.0335832 6550723.8812964, 10204286.65605 6408006.58540759, 9947395.5234501 5437528.97336368, 9661960.93167247 4695399.03474187, 9604874.01331695 4381420.98378648, 9148178.66647276 4038899.47365334, 8948374.45222842 3953269.09612005, 8605852.94209528 3724921.42269796, 8206244.5136066 3667834.50434243, 7835179.5442957 3553660.66763138, 7606831.8708736 3553660.66763138, 7407027.65662927 3439486.83092033, 7150136.52402941 3382399.91256481, 6522180.42211864 3325312.99420929, 5951311.2385634 3154052.23914271, 4010356.01447558 3154052.23914271, 3239682.616676 3325312.99420929, 2811530.72900957 3353856.45338705, 2697356.89229852 3410943.37174257, 2212118.08627656 3496573.74927586, 2012313.87203223 3582204.12680915, 1469988.14765475 3639291.04516467, 1327270.85176594 3724921.42269796, 956205.882455029 3753464.88187572, 585140.913144123 3867638.71858677, -528053.994788598 3924725.63694229, -984749.341632795 4067442.9328311, -1070379.71916608 4124529.85118663, -1156010.09669936 4124529.85118663, -1156010.09669936 4153073.31036439, -1612705.44354356 4153073.31036439, -1869596.57614342 4210160.22871991, -1955226.9536767 4267247.14707544, -1955226.9536767 4267247.14707544))")
            };

            feature.Styles.Add(new VectorStyle
            {
                Enabled = true,
                Fill    = CreateBrush(new Color(255, 0, 0, 120), FillStyle.BitmapRotated, _bitmapId),
                Outline = CreatePen(new Color(255, 255, 0), 2, PenStyle.DashDot),
                Line    = null
            });

            features.Add(feature);

            feature = new Feature {
                Geometry = Geometry.GeomFromText("POLYGON ((2000000 10000000, 2000000 8000000, 10000000 8000000, 10000000 10000000, 2000000 10000000))")
            };
            feature.Styles.Add(new VectorStyle
            {
                Enabled = true,
                Fill    = CreateBrush(Color.Blue, FillStyle.BackwardDiagonal),
                Outline = CreatePen(Color.Blue, 2, PenStyle.Solid),
                Line    = null
            });
            features.Add(feature);

            feature = new Feature
            {
                Geometry = Geometry.GeomFromText("POLYGON ((-8000000 10000000, 0000000 10000000, 0000000 8000000, -8000000 8000000, -8000000 10000000))")
            };
            feature.Styles.Add(new VectorStyle
            {
                Enabled = true,
                Fill    = CreateBrush(Color.Red, FillStyle.Cross),
                Outline = CreatePen(Color.Red, 2, PenStyle.Solid),
                Line    = null
            });
            features.Add(feature);

            feature = new Feature
            {
                Geometry = Geometry.GeomFromText("POLYGON ((-18000000 10000000, -10000000 10000000, -10000000 8000000, -18000000 8000000, -18000000 10000000))")
            };
            feature.Styles.Add(new VectorStyle
            {
                Enabled = true,
                Fill    = CreateBrush(Color.Gray, FillStyle.DiagonalCross),
                Outline = CreatePen(Color.Gray, 2, PenStyle.Solid),
                Line    = null
            });
            features.Add(feature);

            feature = new Feature
            {
                Geometry = Geometry.GeomFromText("POLYGON ((-18000000 6000000, -10000000 6000000, -10000000 4000000, -18000000 4000000, -18000000 6000000))")
            };
            feature.Styles.Add(new VectorStyle
            {
                Enabled = true,
                Fill    = CreateBrush(Color.Gray, FillStyle.Dotted),
                Outline = CreatePen(Color.Gray, 2, PenStyle.Solid),
                Line    = null
            });
            features.Add(feature);

            feature = new Feature
            {
                Geometry = Geometry.GeomFromText("POLYGON ((-18000000 2000000, -10000000 2000000, -10000000 000000, -18000000 000000, -18000000 2000000))")
            };
            feature.Styles.Add(new VectorStyle
            {
                Enabled = true,
                Fill    = CreateBrush(Color.Green, FillStyle.ForwardDiagonal),
                Outline = CreatePen(Color.Green, 2, PenStyle.Solid),
                Line    = null
            });
            features.Add(feature);

            feature = new Feature
            {
                Geometry = Geometry.GeomFromText("POLYGON ((-18000000 -2000000, -10000000 -2000000, -10000000 -4000000, -18000000 -4000000, -18000000 -2000000))")
            };
            feature.Styles.Add(new VectorStyle
            {
                Enabled = true,
                Fill    = CreateBrush(Color.Cyan, FillStyle.Hollow),
                Outline = CreatePen(Color.Cyan, 2, PenStyle.Solid),
                Line    = null
            });
            features.Add(feature);

            feature = new Feature
            {
                Geometry = Geometry.GeomFromText("POLYGON ((-18000000 -6000000, -10000000 -6000000, -10000000 -8000000, -18000000 -8000000, -18000000 -6000000))")
            };
            feature.Styles.Add(new VectorStyle
            {
                Enabled = true,
                Fill    = CreateBrush(Color.Indigo, FillStyle.Horizontal),
                Outline = CreatePen(Color.Indigo, 2, PenStyle.Solid),
                Line    = null
            });
            features.Add(feature);

            feature = new Feature
            {
                Geometry = Geometry.GeomFromText("POLYGON ((-18000000 -10000000, -10000000 -10000000, -10000000 -12000000, -18000000 -12000000, -18000000 -10000000))")
            };
            feature.Styles.Add(new VectorStyle
            {
                Enabled = true,
                Fill    = CreateBrush(Color.Orange, FillStyle.Solid),
                Outline = CreatePen(Color.Orange, 2, PenStyle.Solid),
                Line    = null
            });
            features.Add(feature);

            feature = new Feature
            {
                Geometry = Geometry.GeomFromText("POLYGON ((-8000000 -10000000, 0000000 -10000000, 0000000 -12000000, -8000000 -12000000, -8000000 -10000000))")
            };
            feature.Styles.Add(new VectorStyle
            {
                Enabled = true,
                Fill    = CreateBrush(Color.Violet, FillStyle.Vertical),
                Outline = CreatePen(Color.Violet, 2, PenStyle.Solid),
                Line    = null
            });
            features.Add(feature);

            var provider = new MemoryProvider(features);

            return(provider);
        }
Exemplo n.º 17
0
 public void Initialize(MemoryProvider provider)
 {
 }
Exemplo n.º 18
0
        private static MemoryProvider CreateProviderWithLabels()
        {
            var features = new Features
            {
                new Feature
                {
                    Geometry = new Point(50, 50),
                    Styles   = new[] { new VectorStyle {
                                           Fill = new Brush(Color.Gray), Outline = new Pen(Color.Black)
                                       } }
                },
                new Feature
                {
                    Geometry = new Point(50, 150),
                    Styles   = new[] { new LabelStyle {
                                           Text = "Black Text", BackColor = null
                                       } }
                },
                new Feature
                {
                    Geometry = new Point(150, 50),
                    Styles   =
                        new[]
                    {
                        new LabelStyle
                        {
                            Text      = "Gray Backcolor",
                            BackColor = new Brush(Color.Gray),
                            ForeColor = Color.White
                        }
                    }
                },
                new Feature
                {
                    Geometry = new Point(150, 150),
                    Styles   =
                        new[]
                    {
                        new LabelStyle
                        {
                            Text      = "Black Halo",
                            ForeColor = Color.White,
                            Halo      = new Pen(Color.Black),
                            BackColor = null
                        }
                    }
                },
                new Feature
                {
                    Geometry = new Point(50, -50),
                    Styles   = new[]
                    {
                        new LabelStyle
                        {
                            Text        = string.Empty,
                            BackColor   = new Brush(Color.Black),
                            ForeColor   = Color.White,
                            LabelMethod = f => null
                        }
                    }
                },
                new Feature
                {
                    Geometry = new Point(100, 100),
                    Styles   = new[]
                    {
                        new LabelStyle
                        {
                            Text                = "Multiline\nText",
                            BackColor           = new Brush(Color.Gray),
                            ForeColor           = Color.Black,
                            HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Center,
                        }
                    }
                },
            };
            var provider = new MemoryProvider(features);

            return(provider);
        }
Exemplo n.º 19
0
        // todo: Check whether busy and modified state are set correctly in all stages

        public FeatureFetchDispatcher(MemoryProvider cache, Transformer transformer)
        {
            _cache       = cache;
            _transformer = transformer;
        }
Exemplo n.º 20
0
        public MapViewModel(MapModuleConfiguration config)
        {
            _config = config;

            this.ViewSettings = new MapViewSettings(_config);

            _layerLoadedGpxFiles            = new MemoryLayer();
            _layerLoadedGpxFilesProvider    = new MemoryProvider();
            _layerLoadedGpxFiles.DataSource = _layerLoadedGpxFilesProvider;
            _loadedTours = new List <ILoadedGpxFileTourInfo>();

            _layerSelectedGpxFiles            = new MemoryLayer();
            _layerSelectedGpxFilesProvider    = new MemoryProvider();
            _layerSelectedGpxFiles.DataSource = _layerSelectedGpxFilesProvider;
            _selectedTours = new List <ILoadedGpxFileTourInfo>();

            _layerPoints            = new MemoryLayer();
            _layerPointsProvider    = new MemoryProvider();
            _layerPoints.DataSource = _layerPointsProvider;
            _layerPoints.Style      = new SymbolStyle()
            {
                BitmapId = BitmapRegistry.Instance.Register(
                    new AssemblyResourceLink(typeof(MapModule), "Assets", "TourStartGray.png").OpenRead()),
                SymbolScale  = 0.15,
                Opacity      = 0.9f,
                SymbolOffset = new Offset(0, 88)
            };

            _lineStyleInitial = new VectorStyle
            {
                Fill    = null,
                Outline = null,
                Line    = { Color = Color.Gray, Width = 4 }
            };
            _lineStylePlanned = new VectorStyle()
            {
                Fill    = null,
                Outline = null,
                Line    = { Color = Color.Yellow, Width = 4 }
            };
            _lineStyleSucceeded = new VectorStyle
            {
                Fill    = null,
                Outline = null,
                Line    = { Color = Color.Green, Width = 4 }
            };
            _lineStyleSelected = new VectorStyle
            {
                Fill    = null,
                Outline = null,
                Line    = { Color = Color.Blue, Width = 6 }
            };

            this.Command_ResetCamera       = new DelegateCommand(this.OnCommand_ResetCamera);
            this.Command_FocusSelectedTour = new DelegateCommand(
                this.OnCommand_FocusSelectedTour,
                () => _selectedTours.Count > 0);

            this.AdditionalMapLayers = new ObservableCollection <ILayer>();
            this.AdditionalMapLayers.Add(_layerSelectedGpxFiles);
            this.AdditionalMapLayers.Add(_layerLoadedGpxFiles);
            this.AdditionalMapLayers.Add(_layerPoints);
        }
Exemplo n.º 21
0
        private void InitializeProviders()
        {
            listThreads.BeginUpdate();
            _threadP = new ThreadProvider(_pid);
            Program.SecondaryProviderThread.Add(_threadP);
            _threadP.Updated += this._threadP_Updated;
            listThreads.Provider = _threadP;

            listModules.BeginUpdate();
            _moduleP = new ModuleProvider(_pid);
            Program.SecondaryProviderThread.Add(_moduleP);
            _moduleP.Updated += this._moduleP_Updated;
            listModules.Provider = _moduleP;

            listMemory.BeginUpdate();
            _memoryP = new MemoryProvider(_pid);
            Program.SecondaryProviderThread.Add(_memoryP);
            _memoryP.IgnoreFreeRegions = true;
            _memoryP.Updated += this._memoryP_Updated;
            listMemory.Provider = _memoryP;

            listHandles.BeginUpdate();
            _handleP = new HandleProvider(_pid);
            Program.SecondaryProviderThread.Add(_handleP);
            _handleP.HideHandlesWithNoName = Settings.Instance.HideHandlesWithNoName;
            _handleP.Updated += this._handleP_Updated;
            listHandles.Provider = _handleP;

            this.InitializeShortcuts();
        }
Exemplo n.º 22
0
        public void PoolStaticAbsolutePointerSignature()
        {
            InitTest();

            var p = new MemoryPool("MyPool", MemoryAddress.StaticAbsolute, 0x715298,
                                   new[]
            {
                new MemoryFieldSignaturePointer(0, false),
                new MemoryFieldSignaturePointer("7CD5D9XX????????518BCFD91C24E8", true),
            }, 0x4);

            var provider = new MemoryProvider(reader);

            provider.Add(p);
            provider.Scanner.Enable();
            provider.Refresh();
            provider.Scanner.Disable();

            Assert.AreEqual("MyPool", p.Name);
            Assert.AreEqual(MemoryAddress.StaticAbsolute, p.AddressType);
            Assert.AreEqual(0x715298, p.Address);
            Assert.AreEqual(0x4, p.Size);
            Assert.AreEqual(0, p.Offset);
            Assert.AreEqual(2, p.Pointers.Count());
            Assert.AreEqual(0, p.Pointers.FirstOrDefault().Offset);
            Assert.AreEqual(0x317C, p.Pointers.ToList()[1].Offset);
            Assert.False(p.IsDynamic);
            Assert.False(p.IsConstant);
            Assert.True(p.IsStatic);
            Assert.False(p.IsSignature);
            Assert.False(p.IsTemplate);
            Assert.AreEqual(3, p.AddressTree.Length);
            Assert.AreEqual(0x715298, p.AddressTree[0]);
            Assert.AreEqual(0x7154C0, p.AddressTree[1]);
            Assert.AreEqual(0x71863C, p.AddressTree[2]);

            Assert.Greater(actionLogbook.Count, 2);
            int preLogBookSize = actionLogbook.Count;

            Assert.AreEqual(0x715298, actionLogbook[actionLogbook.Count - 2].Address);
            Assert.AreEqual(0x71863C, actionLogbook[actionLogbook.Count - 1].Address);

            Assert.AreEqual(0x4, actionLogbook[actionLogbook.Count - 2].Size);
            Assert.AreEqual(0x4, actionLogbook[actionLogbook.Count - 1].Size);

            // re-read
            // it will follow the pointer every refresh cycle.
            provider.Refresh();
            int postLogBookSize = actionLogbook.Count;

            Assert.AreEqual(postLogBookSize - preLogBookSize, 2);

            Assert.AreEqual(0x715298, actionLogbook[actionLogbook.Count - 4].Address);
            Assert.AreEqual(0x71863C, actionLogbook[actionLogbook.Count - 3].Address);
            Assert.AreEqual(0x715298, actionLogbook[actionLogbook.Count - 2].Address);
            Assert.AreEqual(0x71863C, actionLogbook[actionLogbook.Count - 1].Address);

            Assert.AreEqual(0x4, actionLogbook[actionLogbook.Count - 4].Size);
            Assert.AreEqual(0x4, actionLogbook[actionLogbook.Count - 3].Size);
            Assert.AreEqual(0x4, actionLogbook[actionLogbook.Count - 2].Size);
            Assert.AreEqual(0x4, actionLogbook[actionLogbook.Count - 1].Size);
        }
Exemplo n.º 23
0
 public ConnectionProvider(IPAddress loginServer, MemoryProvider manager, int processID, bool isOTServer)
     : this(manager, processID)
 {
     isOtServer = isOTServer;
     iPLoginServer = loginServer;
 }
Exemplo n.º 24
0
        public void PoolSignaturePointerWithSignature()
        {
            InitTest();

            var p = new MemoryPool("MyPool", MemoryAddress.StaticAbsolute,
                                   "A0XXXXXXXX8B0D????????F6D81BC0",
                                   new[]
            {
                new MemoryFieldSignaturePointer(0, false),
                new MemoryFieldSignaturePointer("7CD5D9XX????????518BCFD91C24E8", true),
            }, 0x4);

            var provider = new MemoryProvider(reader);

            provider.Add(p);
            provider.Scanner.Enable();
            provider.Refresh();
            provider.Scanner.Disable();

            Assert.AreEqual("MyPool", p.Name);
            Assert.AreEqual(MemoryAddress.StaticAbsolute, p.AddressType);
            Assert.AreEqual(0x71528C, p.Address);
            Assert.AreEqual(0x4, p.Size);
            Assert.AreEqual(0, p.Offset);
            Assert.AreEqual(2, p.Pointers.Count());
            Assert.AreEqual(0, p.Pointers.FirstOrDefault().Offset);
            Assert.AreEqual(0x317C, p.Pointers.ToList()[1].Offset);
            Assert.False(p.IsDynamic);
            Assert.False(p.IsConstant);
            Assert.True(p.IsSignature);
            Assert.True(p.IsStatic);
            Assert.False(p.IsTemplate);
            Assert.AreEqual(3, p.AddressTree.Length);
            Assert.AreEqual(0x71528C, p.AddressTree[0]);
            Assert.AreEqual(0x7154c0, p.AddressTree[1]);
            Assert.AreEqual(0x71863C, p.AddressTree[2]);

            Assert.Greater(actionLogbook.Count, 2);
            var preRefreshCount = actionLogbook.Count;

            Assert.AreEqual(0x71528C, actionLogbook[actionLogbook.Count - 2].Address);
            Assert.AreEqual(0x71863C, actionLogbook[actionLogbook.Count - 1].Address);

            Assert.AreEqual(0x4, actionLogbook[actionLogbook.Count - 2].Size);
            Assert.AreEqual(0x4, actionLogbook[actionLogbook.Count - 1].Size);

            // re-read
            // it will only read what was initially found by the signatures.
            provider.Refresh();

            var postRefreshCount = actionLogbook.Count;

            Assert.AreEqual(2, postRefreshCount - preRefreshCount);

            Assert.AreEqual(0x71528C, actionLogbook[actionLogbook.Count - 4].Address);
            Assert.AreEqual(0x71863C, actionLogbook[actionLogbook.Count - 3].Address);
            Assert.AreEqual(0x71528C, actionLogbook[actionLogbook.Count - 2].Address);
            Assert.AreEqual(0x71863C, actionLogbook[actionLogbook.Count - 1].Address);

            Assert.AreEqual(0x4, actionLogbook[actionLogbook.Count - 4].Size);
            Assert.AreEqual(0x4, actionLogbook[actionLogbook.Count - 3].Size);
            Assert.AreEqual(0x4, actionLogbook[actionLogbook.Count - 2].Size);
            Assert.AreEqual(0x4, actionLogbook[actionLogbook.Count - 1].Size);
        }
Exemplo n.º 25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DatReader"/> class.
 /// </summary>
 /// <param name="memory">The memory.</param>
 public DatReader(MemoryProvider memory)
 {
     Memory = memory;
     BaseAddr = (uint)Memory.Reader.Uint(Memory.Addresses.Client.DatPointer);
     ItemInfoAddr = (uint)Memory.Reader.Uint(BaseAddr + 8);
 }
Exemplo n.º 26
0
 public LandDemandLayer(string name)
     : base(name)
 {
     source     = new MemoryProvider();
     DataSource = source;
 }