Пример #1
0
        internal override TargetObject GetElement(TargetMemoryAccess target, int[] indices)
        {
            int offset = GetArrayOffset(target, indices);

            TargetBlob     blob;
            TargetLocation dynamic_location;

            try {
                blob = Location.ReadMemory(target, Type.Size);
                GetDynamicSize(target, blob, Location, out dynamic_location);
            } catch (TargetException ex) {
                throw new LocationInvalidException(ex);
            }

            TargetLocation new_loc = dynamic_location.GetLocationAtOffset(offset);

            if (Type.ElementType.IsByRef)
            {
                new_loc = new_loc.GetDereferencedLocation();
            }

            if (new_loc.HasAddress && new_loc.GetAddress(target).IsNull)
            {
                return(new TargetNullObject(Type.ElementType));
            }

            return(Type.ElementType.GetObject(target, new_loc));
        }
Пример #2
0
        internal TargetObject GetInstanceField(TargetMemoryAccess target,
                                               TargetStructObject instance,
                                               TargetFieldInfo field)
        {
            GetFields(target);

            int        offset = field_offsets [field.Position];
            TargetType type   = field_types [field.Position];

            if (!Type.IsByRef)
            {
                offset -= 2 * target.TargetMemoryInfo.TargetAddressSize;
            }
            TargetLocation field_loc = instance.Location.GetLocationAtOffset(offset);

            TargetAddress orig_addr = field_loc.GetAddress(target);

            if (type.IsByRef)
            {
                field_loc = field_loc.GetDereferencedLocation();
            }

            TargetAddress addr = field_loc.GetAddress(target);

            if (field_loc.HasAddress && field_loc.GetAddress(target).IsNull)
            {
                return(new TargetNullObject(type));
            }

            return(type.GetObject(target, field_loc));
        }
Пример #3
0
    public void GenerateMission(int lastLocation)
    {
        if (UIManager.Instance)
        {
            int rand = Random.Range(0, m_Locations.Count);
            if (rand == lastLocation)
            {
                rand = (rand + 1) % m_Locations.Count;
            }

            TargetLocation = m_Locations[rand];
            TargetLocation.SetTarget(true);
            TargetLocation.Loop.Play();

            MissionTimer = m_MissionDuration;
            UIManager.Instance.ShowLocationMarker(TargetLocation);

            UIManager.Instance.UpdateMissionCounter(MissionCounter);
            if (MissionCounter > 0)
            {
                UIManager.Instance.Messages.ShowRandomMessage();
                GameManager.Instance.Player.SMS();
            }

            OnMissionStarted.Invoke(TargetLocation);
        }
    }
Пример #4
0
 public MonoClassObject(MonoClassType type, MonoClassInfo info,
                        TargetLocation location)
     : base(type, location)
 {
     this.type = type;
     this.info = info;
 }
Пример #5
0
        internal override void SetObject(TargetMemoryAccess target, TargetLocation location,
                                         TargetObject obj)
        {
            TargetLocation flag_loc = location.GetLocationAtOffset(ElementType.Size);

            byte[] buffer = new byte [1];

            if (obj is TargetNullObject)
            {
                buffer [0] = 0;
                flag_loc.WriteBuffer(target, buffer);
                return;
            }

            MonoNullableObject nobj = obj as MonoNullableObject;

            if (nobj != null)
            {
                if (!nobj.HasValue(target))
                {
                    buffer [0] = 0;
                    flag_loc.WriteBuffer(target, buffer);
                    return;
                }
                else
                {
                    obj = nobj.GetValue(target);
                }
            }

            buffer [0] = 1;
            flag_loc.WriteBuffer(target, buffer);

            ElementType.SetObject(target, location, obj);
        }
Пример #6
0
        public MonoClassObject(MonoClassType type, MonoClassInfo info,
					TargetLocation location)
            : base(type, location)
        {
            this.type = type;
            this.info = info;
        }
Пример #7
0
        internal TargetClassObject GetCurrentObject(TargetMemoryAccess target,
                                                    TargetLocation location)
        {
            // location.Address resolves to the address of the MonoObject,
            // dereferencing it once gives us the vtable, dereferencing it
            // twice the class.
            TargetAddress address;

            address = target.ReadAddress(location.GetAddress(target));
            address = target.ReadAddress(address);

            TargetType current = File.MonoLanguage.ReadMonoClass(target, address);

            if (current == null)
            {
                return(null);
            }

            if (IsByRef && !current.IsByRef)             // Unbox
            {
                location = location.GetLocationAtOffset(
                    2 * target.TargetMemoryInfo.TargetAddressSize);
            }

            return((TargetClassObject)current.GetObject(target, location));
        }
Пример #8
0
        internal override void SetObject(TargetMemoryAccess target, TargetLocation location,
						  TargetObject obj)
        {
            TargetLocation flag_loc = location.GetLocationAtOffset (ElementType.Size);
            byte[] buffer = new byte [1];

            if (obj is TargetNullObject) {
                buffer [0] = 0;
                flag_loc.WriteBuffer (target, buffer);
                return;
            }

            MonoNullableObject nobj = obj as MonoNullableObject;
            if (nobj != null) {
                if (!nobj.HasValue (target)) {
                    buffer [0] = 0;
                    flag_loc.WriteBuffer (target, buffer);
                    return;
                } else {
                    obj = nobj.GetValue (target);
                }
            }

            buffer [0] = 1;
            flag_loc.WriteBuffer (target, buffer);

            ElementType.SetObject (target, location, obj);
        }
        public async Task Migrate(IProjectSettings project, TargetLocation location)
        {
            project.EnsureAllDirectoriesExist();
            Dictionary <string, string> fromDisk;

            switch (location)
            {
            case TargetLocation.Directory:
                fromDisk = await ReadFromDirectory(project);

                break;

            case TargetLocation.ZipArchive:
                fromDisk = await ReadFromZip(project);

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(location), location, null);
            }
            var deserialized = await _stocksBulkDeserializer.DeserializeAsync(fromDisk);

            await _databaseManagementService.EnsureDbExists(project);

            _companyBulkInserter.BulkInsert(project.ConnectionString, nameof(Company), deserialized);
        }
Пример #10
0
        //public TargetLocation GetObjectLocation(EZ_B.AVM.TrainedObjectsContainer.TrainedObject trainedObject)
        //{
        //    TargetLocation targetLocation = TargetLocation.Unknown;
        //    camera.CameraAVMObjectDetection.AddObject(trainedObject);

        //    var objectLocation = camera.CameraAVMObjectDetection.GetDetectedObjects(true, true);

        //    targetLocation = GetTargetLocationFromObjectLocation(objectLocation);

        //}


        private TargetLocation GetTargetLocationFromObjectLocation(ObjectLocation objectLocation)
        {
            TargetLocation targetLocation = TargetLocation.Unknown;

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Left &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Bottom)
            {
                targetLocation = TargetLocation.BottomLeft;
            }

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Middle &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Bottom)
            {
                targetLocation = TargetLocation.BottomCenter;
            }

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Right &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Bottom)
            {
                targetLocation = TargetLocation.BottomRight;
            }

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Left &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Middle)
            {
                targetLocation = TargetLocation.CenterLeft;
            }

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Middle &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Middle)
            {
                targetLocation = TargetLocation.CenterCenter;
            }

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Right &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Middle)
            {
                targetLocation = TargetLocation.CenterRight;
            }
            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Left &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Top)
            {
                targetLocation = TargetLocation.TopLeft;
            }

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Middle &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Top)
            {
                targetLocation = TargetLocation.TopCenter;
            }

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Right &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Top)
            {
                targetLocation = TargetLocation.TopRight;
            }

            return(targetLocation);
        }
Пример #11
0
        protected string ReadString(TargetMemoryAccess target, TargetLocation start)
        {
            if (start.HasAddress && start.GetAddress(target).IsNull)
            {
                return("null");
            }

            StringBuilder sb   = new StringBuilder();
            bool          done = false;

            int offset = 0;

            while (!done && (offset < MaximumDynamicSize))
            {
                TargetLocation location = start.GetLocationAtOffset(offset);
                byte[]         buffer   = location.ReadBuffer(target, ChunkSize);

                int    pos         = 0;
                int    size        = buffer.Length;
                char[] char_buffer = new char [size * 3];
                for (int i = 0; i < size; i++)
                {
                    if (buffer [i] == 0)
                    {
                        done = true;
                        break;
                    }

                    char ch = (char)buffer [i];
                    if (Char.IsLetterOrDigit(ch) || Char.IsPunctuation(ch) ||
                        Char.IsWhiteSpace(ch) || (ch == '<') || (ch == '>'))
                    {
                        char_buffer [pos++] = ch;
                    }
                    else if (ch == '\\')
                    {
                        char_buffer [pos++] = '\\';
                        char_buffer [pos++] = '\\';
                    }
                    else if ((ch == '\'') || (ch == '`'))
                    {
                        char_buffer [pos++] = ch;
                    }
                    else
                    {
                        char_buffer [pos++] = '\\';
                        char_buffer [pos++] = hex_chars [(ch & 0xf0) >> 4];
                        char_buffer [pos++] = hex_chars [ch & 0x0f];
                    }
                }

                string str = new String(char_buffer, 0, pos);
                sb.Append(str);

                offset += size;
            }

            return(sb.ToString());
        }
Пример #12
0
        internal override long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
						       TargetLocation location,
						       out TargetLocation dynamic_location)
        {
            int element_size = Type.GetElementSize (target);
            dynamic_location = location.GetLocationAtOffset (Type.Size);
            return element_size * GetLength (target);
        }
Пример #13
0
 void Start()
 {
     location = this.GetComponent <TargetLocation>();
     timer    = FindObjectOfType <TimerController>();
     stiRateBar.fillAmount      = (location.STIRate + 10) / 100f;
     teenPregRateBar.fillAmount = (location.TeenPregRate + 10) / 100f;
     crimeRateBar.fillAmount    = (location.CrimeRate + 10) / 100f;
 }
Пример #14
0
 public void Read(GamePacketReader reader)
 {
     CastingId = reader.ReadUInt();
     Location.Read(reader);
     TargetUnitId = reader.ReadUInt();
     TargetLocation.Read(reader);
     Position.Read(reader);
 }
Пример #15
0
 // Use this for initialization
 void Start()
 {
     location = this.GetComponent<TargetLocation> ();
     timer = FindObjectOfType<TimerController> ();
     stiRateBar.fillAmount = location.STIRate / 100f;
     teenPregRateBar.fillAmount = location.TeenPregRate / 100f;
     commhealthBar.fillAmount = location.CommunityHealth/ 100f;
 }
Пример #16
0
        internal override long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
						       TargetLocation location,
						       out TargetLocation dynamic_location)
        {
            TargetBinaryReader reader = blob.GetReader ();
            reader.Position = Type.ObjectSize;
            dynamic_location = location.GetLocationAtOffset (Type.ObjectSize + 4);
            return reader.ReadInteger (4) * 2;
        }
Пример #17
0
        internal override long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
                                              TargetLocation location,
                                              out TargetLocation dynamic_location)
        {
            int element_size = Type.GetElementSize(target);

            dynamic_location = location.GetLocationAtOffset(Type.Size);
            return(element_size * GetLength(target));
        }
Пример #18
0
    public bool ValidateTarget(TargetLocation targetLocation)
    {
        if (GameManager.Instance.CurrentGameLevel.TilesByLocation.TryGetValue(targetLocation.TargetGridLocation, out Tile targetTile))
        {
            ObjectDirection direction = targetLocation.TargetDirection;

            if (targetTile.Walkable)
            {
                Tile        currentTile = GameManager.Instance.CurrentGameLevel.TilesByLocation[CurrentGridLocation];
                BridgePiece bridgePieceOnCurrentTile = currentTile.TryGetBridgePiece();
                BridgePiece bridgePieceOnTarget      = targetTile.TryGetBridgePiece(); // optimisation: keep bridge locations of the level in a separate list, so we don't have to go over all the tiles in the level

                // there are no bridges involved
                if (bridgePieceOnCurrentTile == null && bridgePieceOnTarget == null)
                {
                    return(true);
                }

                // Make sure we go in the correct bridge direction
                if (bridgePieceOnCurrentTile && bridgePieceOnTarget)
                {
                    if (bridgePieceOnCurrentTile.BridgePieceDirection == BridgePieceDirection.Horizontal &&
                        bridgePieceOnTarget.BridgePieceDirection == BridgePieceDirection.Horizontal &&
                        (direction == ObjectDirection.Left || direction == ObjectDirection.Right))
                    {
                        return(true);
                    }

                    if (bridgePieceOnCurrentTile.BridgePieceDirection == BridgePieceDirection.Vertical &&
                        bridgePieceOnTarget.BridgePieceDirection == BridgePieceDirection.Vertical &&
                        (direction == ObjectDirection.Up || direction == ObjectDirection.Down))
                    {
                        return(true);
                    }

                    return(false);
                }

                if ((bridgePieceOnCurrentTile?.BridgePieceDirection == BridgePieceDirection.Horizontal ||
                     bridgePieceOnTarget?.BridgePieceDirection == BridgePieceDirection.Horizontal) &&
                    (direction == ObjectDirection.Left || direction == ObjectDirection.Right))
                {
                    return(true);
                }

                if ((bridgePieceOnCurrentTile?.BridgePieceDirection == BridgePieceDirection.Vertical ||
                     bridgePieceOnTarget?.BridgePieceDirection == BridgePieceDirection.Vertical) &&
                    (direction == ObjectDirection.Up || direction == ObjectDirection.Down))
                {
                    return(true);
                }
                return(false);
            }
        }
        return(false);
    }
Пример #19
0
        internal NativeStructObject GetParentObject(TargetMemoryAccess target, TargetLocation location)
        {
            if (!HasParent)
            {
                throw new InvalidOperationException();
            }

            location = base_info.GetBaseLocation(target, location);
            return(new NativeStructObject(base_info.BaseType, location));
        }
Пример #20
0
        public void ParseQuantity_Returns_Valid_Number(string firstParam, int expectedValue)
        {
            var result = new TargetResult {
                FirstParameter = firstParam
            };

            var quantity = TargetLocation.ParseQuantity(result).Quantity;

            quantity.Should().Be(expectedValue);
        }
Пример #21
0
        internal override long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
                                              TargetLocation location,
                                              out TargetLocation dynamic_location)
        {
            TargetBinaryReader reader = blob.GetReader();

            reader.Position  = Type.ObjectSize;
            dynamic_location = location.GetLocationAtOffset(Type.ObjectSize + 4);
            return(reader.ReadInteger(4) * 2);
        }
Пример #22
0
    public void CompleteActiveMission()
    {
        ++MissionCounter;

        UIManager.Instance.ShowLocationMarker(null);
        TargetLocation.SetTarget(false);

        OnMissionCompleted.Invoke();
        GameManager.Instance.StartConcert(TargetLocation);
        TargetLocation = null;
    }
Пример #23
0
        private IEnumerable <TargetLocation> GetTargetLocationsWormholes()
        {
            var targetLocations = new List <TargetLocation>();

            foreach (Wormhole wormhole in game.GetAllWormholes().Where(wormhole => MakesSenseToPushWormhole(wormhole)))
            {
                var targetLocation = new TargetLocation(wormhole.Location, LocationType.Wormhole, GetWormholePriority(wormhole), wormhole, this);
                targetLocations.Add(targetLocation);
            }
            return(targetLocations);
        }
Пример #24
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
Пример #25
0
        public override string PrintLocation(StackFrame frame)
        {
            TargetLocation location = GetLocation(frame);

            if (location == null)
            {
                return(null);
            }

            return(location.Print());
        }
Пример #26
0
 /// <summary>
 /// Maps the target location to target location API dto.
 /// </summary>
 /// <returns>The target location to target location API dto.</returns>
 /// <param name="targetLocation">Target location.</param>
 public TargetLocationApiDto MapTargetLocationToTargetLocationApiDto(TargetLocation targetLocation)
 {
     return(new TargetLocationApiDto()
     {
         City = targetLocation.City,
         TargetLocationId = targetLocation.TargetLocationId,
         UserId = targetLocation.User.UserId,
         PostalCode = targetLocation.PostalCode,
         City2 = targetLocation.City2
     });
 }
Пример #27
0
 void Start()
 {
     _gameManager         = FindObjectOfType <GameManager>();
     _audioManager        = AudioManager.instance;
     OnHoverTool          = this.GetComponent <OnHover>();
     _theGSB              = FindObjectOfType <GlobalStatsBar>();
     _myTargetLocation    = this.transform.parent.GetComponentInParent <TargetLocation>();
     _myBoxCollider       = this.GetComponent <BoxCollider2D>();
     _mySpriteRenderer    = this.GetComponent <SpriteRenderer> ();
     BorderRenderer.color = _mySpriteRenderer.color;
     _ttManager           = FindObjectOfType <TutorialToolTipManager>();
 }
Пример #28
0
        internal void SetObject(StackFrame frame, TargetMemoryAccess target,
                                TargetObject obj)
        {
            TargetLocation location = GetLocation(frame, target);

            if (location == null)
            {
                throw new LocationInvalidException();
            }

            type.SetObject(target, location, (TargetObject)obj);
        }
Пример #29
0
 internal override TargetObject GetDereferencedObject(TargetMemoryAccess target)
 {
     if (Type.StaticType is TargetPointerType)
     {
         TargetLocation loc = GetDereferencedLocation();
         return(Type.StaticType.GetObject(target, loc));
     }
     else
     {
         return(Type.StaticType.GetObject(target, Location));
     }
 }
Пример #30
0
        public void Write(SpellTargetData data)
        {
            data.Flags = m_targetMask;

            if (m_targetMask.HasAnyFlag(SpellCastTargetFlags.Unit | SpellCastTargetFlags.CorpseAlly | SpellCastTargetFlags.Gameobject | SpellCastTargetFlags.CorpseEnemy | SpellCastTargetFlags.UnitMinipet))
            {
                data.Unit = m_objectTargetGUID;
            }

            if (m_targetMask.HasAnyFlag(SpellCastTargetFlags.Item | SpellCastTargetFlags.TradeItem) && m_itemTarget)
            {
                data.Item = m_itemTarget.GetGUID();
            }

            if (m_targetMask.HasAnyFlag(SpellCastTargetFlags.SourceLocation))
            {
                data.SrcLocation.HasValue = true;
                TargetLocation target = new TargetLocation();
                target.Transport = m_src.TransportGUID; // relative position guid here - transport for example
                if (!m_src.TransportGUID.IsEmpty())
                {
                    target.Location = m_src.TransportOffset;
                }
                else
                {
                    target.Location = m_src.Position;
                }

                data.SrcLocation.Value = target;
            }

            if (Convert.ToBoolean(m_targetMask & SpellCastTargetFlags.DestLocation))
            {
                data.DstLocation.HasValue = true;
                TargetLocation target = new TargetLocation();
                target.Transport = m_dst.TransportGUID; // relative position guid here - transport for example
                if (!m_dst.TransportGUID.IsEmpty())
                {
                    target.Location = m_dst.TransportOffset;
                }
                else
                {
                    target.Location = m_dst.Position;
                }

                data.DstLocation.Value = target;
            }

            if (Convert.ToBoolean(m_targetMask & SpellCastTargetFlags.String))
            {
                data.Name = m_strTarget;
            }
        }
Пример #31
0
 private void Start()
 {
     _title       = MessageBox.transform.Find("Title").GetComponent <Text>();
     _messageText = MessageBox.transform.Find("Title/MessageText").GetComponent <Text>();
     MessageBox.SetActive(false);
     _theGameManager = FindObjectOfType <GameManager>().GetComponent <GameManager>();
     _ashPark        = GameObject.Find("World Map/Ash Park").GetComponent <TargetLocation>();
     _freemason      = GameObject.Find("World Map/Freemason").GetComponent <TargetLocation>();
     _philmont       = GameObject.Find("World Map/Philmont").GetComponent <TargetLocation>();
     _quinnSquare    = GameObject.Find("World Map/Quinn Square").GetComponent <TargetLocation>();
     _eastBeaHeights = GameObject.Find("World Map/East Bea Heights").GetComponent <TargetLocation>();
     _theTTTMan      = FindObjectOfType <TutorialToolTipManager>();
 }
Пример #32
0
        internal override TargetObject GetElement(TargetMemoryAccess target, int[] indices)
        {
            int offset = GetArrayOffset(target, indices);

            TargetLocation new_location = Location.GetLocationAtOffset(offset);

            if (Type.ElementType.IsByRef)
            {
                new_location = new_location.GetDereferencedLocation();
            }

            return(Type.ElementType.GetObject(target, new_location));
        }
Пример #33
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = EnergyCost;
         hashCode = (hashCode * 397) ^ InstanceId;
         hashCode = (hashCode * 397) ^ PlayerIndex;
         hashCode = (hashCode * 397) ^ (PowerId?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ SupplyCost;
         hashCode = (hashCode * 397) ^ (TargetLocation != null ? TargetLocation.GetHashCode() : 0);
         return(hashCode);
     }
 }
Пример #34
0
    public override bool Move(GameObject target)
    {
        TargetLocation ameliaLocation = FindTarget(target);

        if (facingRight && ameliaLocation == TargetLocation.Left)
        {
            ChangeDirection();
        }
        else if (!facingRight && ameliaLocation == TargetLocation.Right)
        {
            ChangeDirection();
        }
        return(true);
    }
Пример #35
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ CardId.GetHashCode();
         hashCode = (hashCode * 397) ^ InstanceId;
         hashCode = (hashCode * 397) ^ ManaCost;
         hashCode = (hashCode * 397) ^ PlayerIndex;
         hashCode = (hashCode * 397) ^ ProvidedByScenario.GetHashCode();
         hashCode = (hashCode * 397) ^ SpawnAtBase.GetHashCode();
         hashCode = (hashCode * 397) ^ (TargetLocation != null ? TargetLocation.GetHashCode() : 0);
         return(hashCode);
     }
 }
Пример #36
0
        protected string ReadString(TargetMemoryAccess target, TargetLocation start)
        {
            if (start.HasAddress && start.GetAddress (target).IsNull)
                return "null";

            StringBuilder sb = new StringBuilder ();
            bool done = false;

            int offset = 0;

            while (!done && (offset < MaximumDynamicSize)) {
                TargetLocation location = start.GetLocationAtOffset (offset);
                byte[] buffer = location.ReadBuffer (target, ChunkSize);

                int pos = 0;
                int size = buffer.Length;
                char[] char_buffer = new char [size * 3];
                for (int i = 0; i < size; i++) {
                    if (buffer [i] == 0) {
                        done = true;
                        break;
                    }

                    char ch = (char) buffer [i];
                    if (Char.IsLetterOrDigit (ch) || Char.IsPunctuation (ch) ||
                        Char.IsWhiteSpace (ch) || (ch == '<') || (ch == '>'))
                        char_buffer [pos++] = ch;
                    else if (ch == '\\') {
                        char_buffer [pos++] = '\\';
                        char_buffer [pos++] = '\\';
                    } else if ((ch == '\'') || (ch == '`')) {
                        char_buffer [pos++] = ch;
                    } else {
                        char_buffer [pos++] = '\\';
                        char_buffer [pos++] = hex_chars [(ch & 0xf0) >> 4];
                        char_buffer [pos++] = hex_chars [ch & 0x0f];
                    }
                }

                string str = new String (char_buffer, 0, pos);
                sb.Append (str);

                offset += size;
            }

            return sb.ToString ();
        }
Пример #37
0
 public NativePointerObject(NativePointerType type, TargetLocation location)
     : base(type, location)
 {
 }
Пример #38
0
        protected override TargetObject DoGetObject(TargetMemoryAccess target,
							     TargetLocation location)
        {
            ResolveClass (target, true);
            return new MonoClassObject (this, class_info, location);
        }
Пример #39
0
        internal TargetClassObject GetCurrentObject(TargetMemoryAccess target,
							      TargetLocation location)
        {
            // location.Address resolves to the address of the MonoObject,
            // dereferencing it once gives us the vtable, dereferencing it
            // twice the class.
            TargetAddress address;
            address = target.ReadAddress (location.GetAddress (target));
            address = target.ReadAddress (address);

            TargetType current = File.MonoLanguage.ReadMonoClass (target, address);
            if (current == null)
                return null;

            if (IsByRef && !current.IsByRef) // Unbox
                location = location.GetLocationAtOffset (
                    2 * target.TargetMemoryInfo.TargetAddressSize);

            return (TargetClassObject) current.GetObject (target, location);
        }
Пример #40
0
 internal TargetStructObject(TargetStructType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }
Пример #41
0
        public MonoGenericInstanceObject(MonoGenericInstanceType type,
						  MonoClassInfo info, TargetLocation location)
            : base(type, location)
        {
            this.type = type;
        }
Пример #42
0
        protected override TargetObject DoGetObject(TargetMemoryAccess target,
							     TargetLocation location)
        {
            return new NativeFunctionObject (this, location);
        }
Пример #43
0
        protected override TargetObject DoGetObject(TargetMemoryAccess target,
							     TargetLocation location)
        {
            return new NativeArrayObject (this, location, bounds);
        }
Пример #44
0
 public MonoPointerObject(MonoPointerType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }
Пример #45
0
        internal override long GetDynamicSize(TargetMemoryAccess target, TargetBlob blob,
						       TargetLocation location,
						       out TargetLocation dynamic_location)
        {
            throw new InvalidOperationException ();
        }
Пример #46
0
 public NativeFunctionObject(NativeFunctionPointer type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }
 public PersonLocationMessage(TargetLocation personLocation)
 {
     targetLocation = personLocation;
 }
Пример #48
0
        internal TargetGenericInstanceObject(TargetGenericInstanceType type,
						      TargetLocation location)
            : base(type, location)
        {
            this.Type = type;
        }
Пример #49
0
 protected override TargetObject DoGetObject(TargetMemoryAccess target, TargetLocation location)
 {
     return new MonoPointerObject (this, location);
 }
Пример #50
0
        protected override TargetObject DoGetObject(TargetMemoryAccess target,
							     TargetLocation location)
        {
            throw new TargetException (TargetError.LocationInvalid,
                           "Cannot access variables of type `{0}'", Name);
        }
Пример #51
0
        XObject InsertTarget(TargetLocation target)
        {
            if (target.Position == TargetPosition.Undefined)
                return null;

            var sourceAttr = target.Source as XAttribute;
            if (sourceAttr != null)
            {
                var targetNode = target.Target as XElement;
                if (targetNode != null)
                {
                    var attr = targetNode.Attribute(sourceAttr.Name);
                    if (attr != null)
                    {
                        attr.Value = sourceAttr.Value;
                        return attr;
                    }

                    targetNode.Add(sourceAttr);
                    return sourceAttr;
                }

                var targetAttr = target.Target as XAttribute;
                if (targetAttr != null)
                {
                    if (target.Position == TargetPosition.Node)
                    {
                        targetAttr.Value = sourceAttr.Value;
                        return targetAttr;
                    }

                    if (target.Position == TargetPosition.Before)
                    {
                        throw new InvalidOperationException();
                    }

                    if (target.Position == TargetPosition.After)
                    {
                        throw new InvalidOperationException();
                    }
                }
            }

            var sourceNode = target.Source as XNode;
            if (sourceNode != null)
            {
                var targetCntr = target.Target as XContainer;
                if (targetCntr != null)
                {
                    if (target.Position == TargetPosition.Node)
                    {
                        targetCntr.Add(sourceNode);
                        return sourceNode;
                    }
                }

                var targetNode = target.Target as XNode;
                if (targetNode != null)
                {

                    if (target.Position == TargetPosition.Before)
                    {
                        targetNode.AddBeforeSelf(sourceNode);
                        return sourceNode;
                    }

                    if (target.Position == TargetPosition.After)
                    {
                        targetNode.AddAfterSelf(sourceNode);
                        return sourceNode;
                    }
                }
            }

            throw new InvalidOperationException();
        }
Пример #52
0
 public NativeStructObject(NativeStructType type, TargetLocation location)
     : base(type, location)
 {
     this.type = type;
 }
Пример #53
0
 internal TargetClassObject(TargetClassType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }
Пример #54
0
 public NativeOpaqueObject(NativeOpaqueType type, TargetLocation location)
     : base(type, location)
 {
 }
 public DangerLocationMessage(TargetLocation dangerLocation)
 {
     this.targetLocation = dangerLocation;
 }
Пример #56
0
        protected override TargetObject DoGetObject(TargetMemoryAccess target,
							     TargetLocation location)
        {
            throw new InvalidOperationException ();
        }
Пример #57
0
        protected override TargetObject DoGetObject(TargetMemoryAccess target,
							     TargetLocation location)
        {
            throw new InternalError ();
        }
Пример #58
0
        public NativeArrayObject(NativeArrayType type, TargetLocation location,
					  TargetArrayBounds bounds)
            : base(type, location)
        {
            this.bounds = bounds;
        }
Пример #59
0
 internal TargetPointerObject(TargetPointerType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }
Пример #60
0
 public MonoObjectObject(MonoObjectType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }