Exemplo n.º 1
0
        public void CanDetectFileOffsetIsRawOnly()
        {
            var  image       = Image.ReadFromFile("TestData/BeaEngine.dll");
            uint dataSection = 0x0003B000;
            uint virtualSize = 0x00002578;
            var  offset      = new ImageOffset(image, dataSection + virtualSize);

            try
            {
                offset.ToRVA();
                Assert.True(false, "Should have thrown an exception");
            }
            catch
            {
            }
            new ImageOffset(image, dataSection + virtualSize - 1).ToRVA();
        }
Exemplo n.º 2
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case MENU_LOCATION:
                string[] mapMoveMenuItems =
                {
                    "User Location On",
                    "User Location On, MapMoving Off",
                    "User Location+Heading On",
                    "User Location+Heading On, MapMoving Off",
                    "User Location+Heading On, MarkerHeading On, MapMoving Off",
                    "Off",
                    (isUsingCustomLocationMarker ? "Default" : "Custom") + " Location Marker",
                    "Show Location Marker",
                    "Hide Location Marker"
                };
                var dialog = new AlertDialog.Builder(this);
                dialog.SetTitle("Location");
                dialog.SetItems(mapMoveMenuItems, (sender, e) =>
                {
                    switch (e.Which)
                    {
                    case 0:         // User Location On
                        mMapView.SetCurrentLocationTrackingMode(CurrentLocationTrackingMode.TrackingModeOnWithoutHeading);
                        break;

                    case 1:         // User Location On, MapMoving Off
                        mMapView.SetCurrentLocationTrackingMode(CurrentLocationTrackingMode.TrackingModeOnWithoutHeadingWithoutMapMoving);
                        break;

                    case 2:         // User Location+Heading On
                        mMapView.SetCurrentLocationTrackingMode(CurrentLocationTrackingMode.TrackingModeOnWithHeading);
                        break;

                    case 3:         // User Location+Heading On, MapMoving Off
                        mMapView.SetCurrentLocationTrackingMode(CurrentLocationTrackingMode.TrackingModeOnWithHeadingWithoutMapMoving);
                        break;

                    case 4:         // "User Location+Heading On, MarkerHeading On, MapMoving Off",
                        mMapView.SetCurrentLocationTrackingMode(CurrentLocationTrackingMode.TrackingModeOnWithMarkerHeadingWithoutMapMoving);
                        mMapView.SetCurrentLocationRadius(0);
                        break;

                    case 5:         // Off
                        mMapView.SetCurrentLocationTrackingMode(CurrentLocationTrackingMode.TrackingModeOff);
                        mMapView.SetShowCurrentLocationMarker(false);
                        break;

                    case 6:         // Default/Custom Location Marker
                        if (isUsingCustomLocationMarker)
                        {
                            mMapView.SetCurrentLocationRadius(0);
                            mMapView.SetDefaultCurrentLocationMarker();
                        }
                        else
                        {
                            mMapView.SetCurrentLocationRadius(100);         // meter
                            mMapView.SetCurrentLocationRadiusFillColor(Color.Argb(77, 255, 255, 0));
                            mMapView.SetCurrentLocationRadiusStrokeColor(Color.Argb(77, 255, 165, 0));

                            var trackingImageAnchorPointOffset  = new ImageOffset(28, 28);        // 좌하단(0,0) 기준 앵커포인트 오프셋
                            var directionImageAnchorPointOffset = new ImageOffset(65, 65);
                            var offImageAnchorPointOffset       = new ImageOffset(15, 15);
                            mMapView.SetCustomCurrentLocationMarkerTrackingImage(Resource.Drawable.custom_arrow_map_present_tracking, trackingImageAnchorPointOffset);
                            mMapView.SetCustomCurrentLocationMarkerDirectionImage(Resource.Drawable.custom_map_present_direction, directionImageAnchorPointOffset);
                            mMapView.SetCustomCurrentLocationMarkerImage(Resource.Drawable.custom_map_present, offImageAnchorPointOffset);
                        }
                        isUsingCustomLocationMarker = !isUsingCustomLocationMarker;
                        break;

                    case 7:         // Show Location Marker
                        mMapView.SetShowCurrentLocationMarker(true);
                        break;

                    case 8:         // Hide Location Marker
                        if (mMapView.IsShowingCurrentLocationMarker)
                        {
                            mMapView.SetShowCurrentLocationMarker(false);
                        }
                        break;
                    }
                });
                dialog.Show();
                return(true);

            case MENU_REVERSE_GEO:
                var daumMapApikey = AppSettings.GetMetadata(this, AppSettings.DaumMapApiKeyName);
                mReverseGeoCoder = new MapReverseGeoCoder(daumMapApikey, mMapView.MapCenterPoint, this, this);
                mReverseGeoCoder.StartFindingAddress();
                return(true);
            }
            return(base.OnOptionsItemSelected(item));
        }