コード例 #1
0
 // TODO - remove unnecessary variables
 public NetworkDisconnectService(Guid serviceIdentifier, TypeTag typetag, object service)
     : base("NetworkDisconnectService")
 {
     this.service = service;
     this.serviceIdentifier = serviceIdentifier;
     this.typetag = typetag;
 }
コード例 #2
0
ファイル: Location.cs プロジェクト: fjnogueira/JavaForVS
 public Location(TypeTag typeTag, ClassId @class, MethodId method, ulong index)
 {
     TypeTag = typeTag;
     Class = @class;
     Method = method;
     Index = index;
 }
コード例 #3
0
ファイル: Atom.cs プロジェクト: daniel-bytes/osc.net
 public Atom(byte[] value)
 {
     int32value   = 0;
     float32value = 0;
     objvalue     = value;
     typetag      = TypeTag.OscBlob;
 }
コード例 #4
0
ファイル: Atom.cs プロジェクト: daniel-bytes/osc.net
 public Atom(string value)
 {
     int32value   = 0;
     float32value = 0;
     objvalue     = value;
     typetag      = TypeTag.OscString;
 }
コード例 #5
0
ファイル: Atom.cs プロジェクト: daniel-bytes/osc.net
 public Atom(float value)
 {
     int32value   = 0;
     objvalue     = null;
     float32value = value;
     typetag      = TypeTag.OscFloat32;
 }
コード例 #6
0
ファイル: Atom.cs プロジェクト: daniel-bytes/osc.net
 public Atom(TypeTag type)
 {
     typetag      = type;
     int32value   = 0;
     float32value = 0;
     objvalue     = null;
 }
コード例 #7
0
ファイル: Atom.cs プロジェクト: daniel-bytes/osc.net
 public Atom(int value)
 {
     float32value = 0;
     objvalue     = null;
     int32value   = value;
     typetag      = TypeTag.OscInt32;
 }
コード例 #8
0
ファイル: ObjectReader.cs プロジェクト: raj581/Marvin
        public Type ReadType(BinaryReader reader, TypeTag code)
        {
            switch (code)
            {
            case TypeTag.PrimitiveType:
                return(BinaryCommon.GetTypeFromCode(reader.ReadByte()));

            case TypeTag.String:
                return(typeof(string));

            case TypeTag.ObjectType:
                return(typeof(object));

            case TypeTag.RuntimeType:
            {
                string name = reader.ReadString();
#if NET_2_0
                // map MS.NET's System.RuntimeType to System.MonoType
                if (_context.State == StreamingContextStates.Remoting)
                {
                    if (name == "System.RuntimeType")
                    {
                        return(typeof(MonoType));
                    }
                    else if (name == "System.RuntimeType[]")
                    {
                        return(typeof(MonoType[]));
                    }
                }
#endif
                Type t = Type.GetType(name);
                if (t != null)
                {
                    return(t);
                }

                throw new SerializationException(String.Format("Could not find type '{0}'.", name));
            }

            case TypeTag.GenericType:
            {
                string name  = reader.ReadString();
                long   asmid = (long)reader.ReadUInt32();
                return(GetDeserializationType(asmid, name));
            }

            case TypeTag.ArrayOfObject:
                return(typeof(object[]));

            case TypeTag.ArrayOfString:
                return(typeof(string[]));

            case TypeTag.ArrayOfPrimitiveType:
                Type elementType = BinaryCommon.GetTypeFromCode(reader.ReadByte());
                return(Type.GetType(elementType.FullName + "[]"));

            default:
                throw new NotSupportedException("Unknow type tag");
            }
        }
コード例 #9
0
ファイル: Tree.cs プロジェクト: irpbc/mj
 public LiteralExpression(int beginLine, int beginCol, int endLine, int endCol, TypeTag typeTag,
                          object value)
     : base(beginLine, beginCol, endLine, endCol)
 {
     this.typeTag = typeTag;
     this.value   = value;
 }
コード例 #10
0
ファイル: Location.cs プロジェクト: weizhengwei/LangSvcV2
 public Location(TypeTag typeTag, ClassId @class, MethodId method, ulong index)
 {
     TypeTag = typeTag;
     Class   = @class;
     Method  = method;
     Index   = index;
 }
コード例 #11
0
    public override void Initialize(LDBlock _data)
    {
        GridPos            = (Vector2Int)Grid.WorldToCell(transform.position);
        transform.position = Grid.CellToWorld((Vector3Int)GridPos);
        Grid.setOccupied((Vector3Int)GridPos, true);

        Animator      = GetComponentInChildren <Animator>();
        AbilitySystem = new AbilitySystem(this);

        CharacterDataTemplate Data = CharacterDataTemplate.Load();

        Data.GetMonsterStartingAttributes(Role)
        .ForEach(Entry => AbilitySystem.RegisterAttribute(Entry.Attribute, Entry.Value));
        Data.GetMonsterAbilities(Role)
        .ForEach(Ability => AbilitySystem.GrantAbility(Ability));
        Data.GetMonsterStartingEffects(Role)
        .ForEach(Effect => AbilitySystem.TryApplyEffectToSelf(Effect));


        AbilitySystem.RegisterOnAttributeChanged(Attribute.Health, OnDamageTaken);
        CurrentHealth = AbilitySystem.GetAttributeValue(Attribute.Health).Value;

        AbilitySystem.RegisterOnAttributeChanged(Attribute.MaxHealth, UpdateMaxHealth);
        MaxHealth = AbilitySystem.GetAttributeValue(Attribute.MaxHealth).Value;

        AbilitySystem
        .GetGrantedAbilityTypes()
        .ForEach(Ability =>
        {
            if (!Ability.Is(TypeTag.MoveAbility))
            {
                MainAbility = Ability;
            }
        });
    }
コード例 #12
0
        public static bool IsSupported(this TypeTag tag)
        {
            switch (tag)
            {
            case TypeTag.False:
            case TypeTag.Infinitum:
            case TypeTag.Nil:
            case TypeTag.AltTypeString:
            case TypeTag.True:
            case TypeTag.Blob:
            case TypeTag.AsciiChar32:
            case TypeTag.Float64:
            case TypeTag.Float32:
            case TypeTag.Int64:
            case TypeTag.Int32:
            case TypeTag.MIDI:
            case TypeTag.Color32:
            case TypeTag.String:
            case TypeTag.TimeTag:
            case TypeTag.ArrayStart:
            case TypeTag.ArrayEnd:
                return(true);

            default:
                return(false);
            }
        }
コード例 #13
0
ファイル: Symtab.cs プロジェクト: irpbc/mj
        public PrimitiveType typeForTag(TypeTag tag)
        {
            switch (tag)
            {
            case TypeTag.INT:
                return(intType);

            case TypeTag.LONG:
                return(longType);

            case TypeTag.FLOAT:
                return(floatType);

            case TypeTag.DOUBLE:
                return(doubleType);

            case TypeTag.BOOLEAN:
                return(booleanType);

            case TypeTag.CHAR:
                return(charType);

            case TypeTag.C_STRING:
                return(cStringType);

            case TypeTag.VOID:
                return(voidType);

            default:
                throw new ArgumentOutOfRangeException(nameof(tag), tag, null);
            }
        }
コード例 #14
0
 public MyTag(TypeTag typeTag)
 {
     TypeTag = typeTag;
     if (typeTag == TypeTag.Menu)
     {
         Id = ++_innerid;
     }
 }
コード例 #15
0
 public ReferenceTypeData(TaggedReferenceTypeId type, string signature, string genericSignature, ClassStatus status)
 {
     ReferenceTypeTag = type.TypeTag;
     TypeId           = type.TypeId;
     Signature        = signature;
     GenericSignature = genericSignature;
     Status           = status;
 }
コード例 #16
0
 public ReferenceTypeData(TaggedReferenceTypeId type, string signature, string genericSignature, ClassStatus status)
 {
     ReferenceTypeTag = type.TypeTag;
     TypeId = type.TypeId;
     Signature = signature;
     GenericSignature = genericSignature;
     Status = status;
 }
コード例 #17
0
 public NetworkJoinService(Guid serviceIdentifier, TypeTag typetag, object service)
     : base("NetworkJoinService")
 {
     this.service = service;
     this.serviceIdentifier = serviceIdentifier;
     this.typetag = typetag;
     this.serviceType = service.GetType().AssemblyQualifiedName;
 }
コード例 #18
0
        public bool AddEntity(ScriptEntityDescription entity, Vector2 position, TypeTag tag)
        {
            var e = _scriptEntityFactory.LoadEntity(Content, entity, position);

            e.Tag    = tag;
            Entities = Entities.Add(e);
            return(true);
        }
コード例 #19
0
ファイル: GameEntity.cs プロジェクト: arlenner/EnterTheArena
 public GameEntity(int id, string name, TypeTag tag)
 {
     Id = id;
     Name = name;
     Tags = new List<TypeTag>();
     Tags.Add(tag);
     Components = new List<GameComponent>();
 }
コード例 #20
0
        public Type ReadType(BinaryReader reader, TypeTag code)
        {
            switch (code)
            {
            case TypeTag.PrimitiveType:
                return(BinaryCommon.GetTypeFromCode((int)reader.ReadByte()));

            case TypeTag.String:
                return(typeof(string));

            case TypeTag.ObjectType:
                return(typeof(object));

            case TypeTag.RuntimeType:
            {
                string text = reader.ReadString();
                if (this._context.State == StreamingContextStates.Remoting)
                {
                    if (text == "System.RuntimeType")
                    {
                        return(typeof(MonoType));
                    }
                    if (text == "System.RuntimeType[]")
                    {
                        return(typeof(MonoType[]));
                    }
                }
                Type type = Type.GetType(text);
                if (type != null)
                {
                    return(type);
                }
                throw new SerializationException(string.Format("Could not find type '{0}'.", text));
            }

            case TypeTag.GenericType:
            {
                string className  = reader.ReadString();
                long   assemblyId = (long)((ulong)reader.ReadUInt32());
                return(this.GetDeserializationType(assemblyId, className));
            }

            case TypeTag.ArrayOfObject:
                return(typeof(object[]));

            case TypeTag.ArrayOfString:
                return(typeof(string[]));

            case TypeTag.ArrayOfPrimitiveType:
            {
                Type typeFromCode = BinaryCommon.GetTypeFromCode((int)reader.ReadByte());
                return(Type.GetType(typeFromCode.FullName + "[]"));
            }

            default:
                throw new NotSupportedException("Unknow type tag");
            }
        }
コード例 #21
0
ファイル: Node.cs プロジェクト: Stephanvs/Mingle
        private Node AddNode(TypeTag tag, Node node)
        {
            switch (this)
            {
            case BranchNode n: return(n.WithChildren(n.Children.AddOrUpdate(tag, node)));

            default: return(this);
            }
        }
コード例 #22
0
        internal ReferenceType GetMirrorOf(TypeTag typeTag, ReferenceTypeId typeId)
        {
            if (typeTag == default(TypeTag) && typeId == default(ReferenceTypeId))
            {
                return(null);
            }

            return(GetMirrorOf(new TaggedReferenceTypeId(typeTag, typeId)));
        }
コード例 #23
0
        private OperatorSymbol unary(Tag tag, TypeTag argType, TypeTag result, LLVMOpcode opcode = default)
        {
            FuncType funcType = new FuncType(
                CollectionUtils.singletonList <Type>(symtab.typeForTag(argType)),
                symtab.typeForTag(result)
                );

            return(new OperatorSymbol(operatorNames[tag.operatorIndex()], symtab.noSymbol, funcType, opcode));
        }
コード例 #24
0
ファイル: Atom.cs プロジェクト: daniel-bytes/osc.net
 public Atom(long value) {
     unchecked
     {
         float32value = 0;
         objvalue = null;
         int32value = (int)value;
         typetag = TypeTag.OscInt32;
     }
 }
コード例 #25
0
ファイル: Item.cs プロジェクト: arlenner/EnterTheArena
 public Item(int id, string name, TypeTag Tag, Rarity rare)
 {
     Id = id;
     Name = name;
     Tags = new List<TypeTag>();
     Tags.Add(Tag);
     Rare = new List<Rarity>();
     Rare.Add(rare);
 }
コード例 #26
0
        public TypeDefinition GetExistingTypeDef(ulong id, TypeTag tag)
        {
            var def = GetId <TypeDefinition>(id, tag);

            if (def.Tag == TypeTag.Unknown)
            {
                def.Tag = tag;
            }
            return(def);
        }
コード例 #27
0
ファイル: Atom.cs プロジェクト: daniel-bytes/osc.net
 public Atom(double value)
 {
     unchecked
     {
         int32value   = 0;
         objvalue     = null;
         float32value = (float)value;
         typetag      = TypeTag.OscFloat32;
     }
 }
コード例 #28
0
ファイル: Atom.cs プロジェクト: daniel-bytes/osc.net
 public Atom(long value)
 {
     unchecked
     {
         float32value = 0;
         objvalue     = null;
         int32value   = (int)value;
         typetag      = TypeTag.OscInt32;
     }
 }
コード例 #29
0
        /// <summary>
        /// Obtiene un valor que indica si se permite escribir un determinado tipo.
        /// </summary>
        /// <remarks>
        ///     Registro de versiones:
        ///
        ///         1.0 10/04/2016 Marcos Abraham Hernández Bravo (Ada Ltda.): versión inicial.
        /// </remarks>
        /// <param name="tipo">Tipo a logear.</param>
        /// <returns><value>true</value> en caso de permitirse, o <value>false</value> de lo contrario.</returns>
        public virtual bool PermiteTipo(Tipo tipo)
        {
            TypeTag tipoTag = ObtenerTipo(tipo);

            if (tipoTag != null)
            {
                return(tipoTag.Modo == Modo.On);
            }

            return(false);
        }
コード例 #30
0
    public ObtainGeneralObjectGoal(PsycheEnv psycheEnv, TypeTag typeTag) : base(psycheEnv)
    {
        x0 = new LocateToteableObjective(psycheEnv);
        x1 = new ObtainToteableObjective(psycheEnv);

        subGoals = new List <GoalNode>()
        {
            x0,
            x1
        };
    }
コード例 #31
0
        private OperatorSymbol binary(Tag tag, TypeTag left, TypeTag right, TypeTag result, LLVMOpcode opcode,
                                      int predicate = 0)
        {
            FuncType funcType = new FuncType(
                new Type[] { symtab.typeForTag(left), symtab.typeForTag(right) },
                symtab.typeForTag(result)
                );

            return(new OperatorSymbol(operatorNames[tag.operatorIndex()], symtab.noSymbol, funcType, opcode,
                                      predicate));
        }
コード例 #32
0
ファイル: PlayableAgent.cs プロジェクト: molvin/LD48
 public override void Tick(int CurrentFrame, bool Scrum)
 {
     AbilitySystem.IsScrumming = Scrum;
     TypeTag Action = Conversion.LDToGameplayTag(TimeLine[CurrentFrame].action);
     int X = GameStateManager.Instance.GetGridManager().xWidth;
     Vector2Int TargetPos = new Vector2Int(TimeLine[CurrentFrame].cell % X, TimeLine[CurrentFrame].cell / X);
     AbilitySystem.CurrentTarget = TargetPos;
     AbilitySystem.TryActivateAbilityByTag(Action);
     AbilitySystem.Tick();
     AbilitySystem.IsScrumming = false;
 }
コード例 #33
0
        /// <summary>
        /// Get shootable entities.
        /// </summary>
        /// <returns>Entities this entity can shoot.</returns>
        public EntityInfo[] GetShootableEntities()
        {
            if (Tag != TypeTag.Player && Tag != TypeTag.Enemy)
            {
                return(null);
            }

            TypeTag target = Tag == TypeTag.Player ? TypeTag.Enemy : TypeTag.Player;

            return(GetNeighbours(target).OrderBy(e => GetDistanceFrom(e)).ToArray());
        }
コード例 #34
0
        private void ReadGenericArray(BinaryReader reader, out long objectId, out object val)
        {
            objectId = (long)((ulong)reader.ReadUInt32());
            reader.ReadByte();
            int  num  = reader.ReadInt32();
            bool flag = false;

            int[] array = new int[num];
            for (int i = 0; i < num; i++)
            {
                array[i] = reader.ReadInt32();
                if (array[i] == 0)
                {
                    flag = true;
                }
            }
            TypeTag code   = (TypeTag)reader.ReadByte();
            Type    type   = this.ReadType(reader, code);
            Array   array2 = Array.CreateInstance(type, array);

            if (flag)
            {
                val = array2;
                return;
            }
            int[] array3 = new int[num];
            for (int j = num - 1; j >= 0; j--)
            {
                array3[j] = array2.GetLowerBound(j);
            }
            bool flag2 = false;

            while (!flag2)
            {
                this.ReadValue(reader, array2, objectId, null, type, null, null, array3);
                int k = array2.Rank - 1;
                while (k >= 0)
                {
                    array3[k]++;
                    if (array3[k] > array2.GetUpperBound(k))
                    {
                        if (k > 0)
                        {
                            array3[k] = array2.GetLowerBound(k);
                            k--;
                            continue;
                        }
                        flag2 = true;
                    }
                    break;
                }
            }
            val = array2;
        }
コード例 #35
0
ファイル: Node.cs プロジェクト: Stephanvs/Mingle
 private (Node, Set <Id>) Clear(Set <Id> deps, TypeTag tag)
 => FindChild(tag)
 .Match(
     Some: node =>
 {
     switch (node)
     {
     case RegNode rn:
         {
             var concurrent = rn.RegValues.Filter((id, lv) => !deps.Contains(id));
             var retNode    = AddNode(tag, new RegNode(concurrent));
             return(retNode, new Set <Id>(concurrent.Keys));
コード例 #36
0
        public bool AddEntity(string entityFile, Vector2 position, TypeTag tag)
        {
            var entity = _scriptEntityFactory
                         .AvailableEntities(Content)
                         .FirstOrDefault(e => System.IO.Path.GetFileName(e.File) == entityFile);

            if (entity == null)
            {
                return(false);
            }

            return(AddEntity(entity, position, tag));
        }
コード例 #37
0
        static OscMessageValues FromBytes(byte[] bytes, int count, TypeTag tag, int byteSize = 4)
        {
            var values = new OscMessageValues(bytes, count);

            for (int i = 0; i < count; i++)
            {
                values.Offsets[i] = i * byteSize;
                values.Tags[i]    = tag;
            }

            values.ElementCount = count;
            return(values);
        }
コード例 #38
0
ファイル: ObjectReader.cs プロジェクト: corngood/mono
		public Type ReadType (BinaryReader reader, TypeTag code)
		{
			return ReadType (reader, code, true);
		}
コード例 #39
0
        public Error GetObjectReferenceType(ObjectId objectId, out TypeTag typeTag, out ReferenceTypeId typeId)
        {
            typeTag = default(TypeTag);
            typeId = default(ReferenceTypeId);

            JniEnvironment nativeEnvironment;
            JvmtiEnvironment environment;
            jvmtiError error = GetEnvironment(out environment, out nativeEnvironment);
            if (error != jvmtiError.None)
                return GetStandardError(error);

            using (var objectHandle = VirtualMachine.GetLocalReferenceForObject(nativeEnvironment, objectId))
            {
                if (!objectHandle.IsAlive)
                    return Error.InvalidObject;

                jclass @class = nativeEnvironment.GetObjectClass(objectHandle.Value);
                TaggedReferenceTypeId result = VirtualMachine.TrackLocalClassReference(@class, environment, nativeEnvironment, true);
                typeTag = result.TypeTag;
                typeId = result.TypeId;
                return Error.None;
            }
        }
コード例 #40
0
ファイル: Program.cs プロジェクト: daniel-bytes/osc.net
        static string GetTypeTagsString(TypeTag[] tags) {
            var builder = new StringBuilder();

            foreach (var tag in tags) {
                byte b = (byte)tag;
                char c = (char)b;
                builder.Append(c);
            }

            return builder.ToString();
        }
コード例 #41
0
ファイル: Atom.cs プロジェクト: daniel-bytes/osc.net
 public Atom(string value) {
     int32value = 0;
     float32value = 0;
     objvalue = value;
     typetag = TypeTag.OscString;
 }
コード例 #42
0
ファイル: ObjectReader.cs プロジェクト: runefs/Marvin
		private TypeMetadata ReadTypeMetadata (BinaryReader reader, bool isRuntimeObject, bool hasTypeInfo)
		{
			TypeMetadata metadata = new TypeMetadata();

			string className = reader.ReadString ();
			int fieldCount = reader.ReadInt32 ();

			Type[] types = new Type[fieldCount];
			string[] names = new string[fieldCount];

			for (int n=0; n<fieldCount; n++)
				names [n] = reader.ReadString ();

			if (hasTypeInfo)
			{
				TypeTag[] codes = new TypeTag[fieldCount];

				for (int n=0; n<fieldCount; n++)
					codes [n] = (TypeTag) reader.ReadByte ();
	
				for (int n=0; n<fieldCount; n++)
					types [n] = ReadType (reader, codes[n]);
			}
			
			// Gets the type

			if (!isRuntimeObject) 
			{
				long assemblyId = (long)reader.ReadUInt32();
				metadata.Type = GetDeserializationType (assemblyId, className);
			}
			else
				metadata.Type = Type.GetType (className, true);

			metadata.MemberTypes = types;
			metadata.MemberNames = names;
			metadata.FieldCount = names.Length;

			// Now check if this objects needs a SerializationInfo struct for deserialziation.
			// SerializationInfo is needed if the object has to be deserialized using
			// a serialization surrogate, or if it implements ISerializable.

			if (_surrogateSelector != null)
			{
				// check if the surrogate selector handles objects of the given type. 
				ISurrogateSelector selector;
				ISerializationSurrogate surrogate = _surrogateSelector.GetSurrogate (metadata.Type, _context, out selector);
				metadata.NeedsSerializationInfo = (surrogate != null);
			}

			if (!metadata.NeedsSerializationInfo)
			{
				// Check if the object is marked with the Serializable attribute

				if (!metadata.Type.IsSerializable)
					throw new SerializationException("Serializable objects must be marked with the Serializable attribute");

				metadata.NeedsSerializationInfo = typeof (ISerializable).IsAssignableFrom (metadata.Type);
				if (!metadata.NeedsSerializationInfo)
				{
					metadata.MemberInfos = new MemberInfo [fieldCount];
					for (int n=0; n<fieldCount; n++)
					{
						FieldInfo field = null;
						string memberName = names[n];
						
						int i = memberName.IndexOf ('+');
						if (i != -1) {
							string baseTypeName = names[n].Substring (0,i);
							memberName = names[n].Substring (i+1);
							Type t = metadata.Type.BaseType;
							while (t != null) {
								if (t.Name == baseTypeName) {
									field = t.GetField (memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
									break;
								}
								else
									t = t.BaseType;
							}
						}
						else
							field = metadata.Type.GetField (memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
							
						if (field == null) throw new SerializationException ("Field \"" + names[n] + "\" not found in class " + metadata.Type.FullName);
						metadata.MemberInfos [n] = field;
						
						if (!hasTypeInfo) {
							types [n] = field.FieldType;
						}
					}
					metadata.MemberNames = null;	// Info now in MemberInfos
				}
			}

			// Registers the type's metadata so it can be reused later if
			// a RefTypeObject element is found

			if (!_typeMetadataCache.ContainsKey (metadata.Type))
				_typeMetadataCache [metadata.Type] = metadata;

			return metadata;
		}
コード例 #43
0
ファイル: Atom.cs プロジェクト: daniel-bytes/osc.net
 public Atom(double value) {
     unchecked
     {
         int32value = 0;
         objvalue = null;
         float32value = (float)value;
         typetag = TypeTag.OscFloat32;
     }
 }
コード例 #44
0
ファイル: Atom.cs プロジェクト: daniel-bytes/osc.net
 public Atom(float value) {
     int32value = 0;
     objvalue = null;
     float32value = value;
     typetag = TypeTag.OscFloat32;
 }
コード例 #45
0
ファイル: Atom.cs プロジェクト: daniel-bytes/osc.net
 public Atom(int value) {
     float32value = 0;
     objvalue = null;
     int32value = value;
     typetag = TypeTag.OscInt32;
 }
コード例 #46
0
ファイル: Atom.cs プロジェクト: daniel-bytes/osc.net
 public Atom(TypeTag type) {
     typetag = type;
     int32value = 0;
     float32value = 0;
     objvalue = null;
 }
コード例 #47
0
ファイル: Atom.cs プロジェクト: daniel-bytes/osc.net
 public Atom(byte[] value) {
     int32value = 0;
     float32value = 0;
     objvalue = value;
     typetag = TypeTag.OscBlob;
 }
コード例 #48
0
 public void ClassPrepare(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId threadId, TypeTag typeTag, ReferenceTypeId typeId, string signature, ClassStatus status)
 {
     ThreadReference thread = VirtualMachine.GetMirrorOf(threadId);
     EventRequest request = VirtualMachine.EventRequestManager.GetEventRequest(EventKind.ClassPrepare, requestId);
     ReferenceType type = VirtualMachine.GetMirrorOf(typeTag, typeId);
     ClassPrepareEventArgs e = new ClassPrepareEventArgs(VirtualMachine, (SuspendPolicy)suspendPolicy, request, thread, signature, type);
     VirtualMachine.EventQueue.OnClassPrepare(e);
 }
コード例 #49
0
 public void FieldModification(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId thread, Types.Location location, TypeTag typeTag, ReferenceTypeId typeId, FieldId field, TaggedObjectId @object, Types.Value newValue)
 {
     throw new NotImplementedException();
 }
コード例 #50
0
ファイル: TypeTag.cs プロジェクト: sciyoshi/netgir
 public static Type FromTag(TypeTag tag)
 {
     return Mapping[(int) tag];
 }
コード例 #51
0
ファイル: VirtualMachine.cs プロジェクト: Kav2018/JavaForVS
        internal ReferenceType GetMirrorOf(TypeTag typeTag, ReferenceTypeId typeId)
        {
            if (typeTag == default(TypeTag) && typeId == default(ReferenceTypeId))
                return null;

            return GetMirrorOf(new TaggedReferenceTypeId(typeTag, typeId));
        }
コード例 #52
0
 //returns created entity for convenience
 public GameEntity CreateEntity(string name, TypeTag tag = TypeTag.None)
 {
     if(LowestAvailableId == 0)
     {
         Console.WriteLine("Entity List not initialized, load entities first.");
         return null;
     }
     if (LowestAvailableId < int.MaxValue)
     {
         var e1 = new GameEntity(LowestAvailableId++, name, tag);
         EntityCollection.Entities.Add(e1);
         Console.WriteLine("Entity added.");
         return e1;
     }
     else
     {
         for (var i = 1; i < int.MaxValue; ++i)
         {
             if (!EntityCollection.Entities.Exists(e => e.Id == i))
             {
                 var e2 = new GameEntity(i, name, tag);
                 EntityCollection.Entities.Add(e2);
                 Console.WriteLine("Entity added.");
                 return e2;
             }
         }
         Console.WriteLine("No ID's Available!");
         return null;
     }
 }
コード例 #53
0
ファイル: ObjectReader.cs プロジェクト: runefs/Marvin
		public Type ReadType (BinaryReader reader, TypeTag code)
		{
			switch (code)
			{
				case TypeTag.PrimitiveType:
					return BinaryCommon.GetTypeFromCode (reader.ReadByte());

				case TypeTag.String:
					return typeof(string);

				case TypeTag.ObjectType:
					return typeof(object);

				case TypeTag.RuntimeType:
				{
					string name = reader.ReadString ();
#if NET_2_0
					// map MS.NET's System.RuntimeType to System.MonoType
					if (_context.State == StreamingContextStates.Remoting)
						if (name == "System.RuntimeType")
							return typeof (MonoType);
						else if (name == "System.RuntimeType[]")
							return typeof (MonoType[]);
#endif
					Type t = Type.GetType (name);
					if (t != null)
						return t;

					throw new SerializationException (String.Format ("Could not find type '{0}'.", name));
				}

				case TypeTag.GenericType:
				{
					string name = reader.ReadString ();
					long asmid = (long) reader.ReadUInt32();
					return GetDeserializationType (asmid, name);
				}

				case TypeTag.ArrayOfObject:
					return typeof(object[]);

				case TypeTag.ArrayOfString:
					return typeof(string[]);

				case TypeTag.ArrayOfPrimitiveType:
					Type elementType = BinaryCommon.GetTypeFromCode (reader.ReadByte());
					return Type.GetType(elementType.FullName + "[]");

				default:
					throw new NotSupportedException ("Unknow type tag");
			}
		}
コード例 #54
0
        public Error GetReflectedType(ClassObjectId classObjectId, out TypeTag typeTag, out ReferenceTypeId typeId)
        {
            typeTag = default(TypeTag);
            typeId = default(ReferenceTypeId);

            JniEnvironment nativeEnvironment;
            JvmtiEnvironment environment;
            jvmtiError error = GetEnvironment(out environment, out nativeEnvironment);
            if (error != jvmtiError.None)
                return GetStandardError(error);

            TaggedReferenceTypeId[] classes;
            error = environment.GetLoadedClasses(nativeEnvironment, out classes);
            if (error != jvmtiError.None)
                return GetStandardError(error);

            jmethodID getNameMethod = nativeEnvironment.GetMethodId(VirtualMachine.ClassClass, "getName", "()Ljava/lang/String;");

            using (var classObject = VirtualMachine.GetLocalReferenceForObject(nativeEnvironment, classObjectId))
            {
                if (!classObject.IsAlive)
                    return Error.InvalidObject;

                jobject nameObject = nativeEnvironment.CallObjectMethodA(classObject.Value, getNameMethod);
                int length = nativeEnvironment.GetStringUTFLength(nameObject);
                byte[] buffer = new byte[length + 1];
                nativeEnvironment.GetStringUTFRegion(nameObject, 0, length, buffer);
                string name = ModifiedUTF8Encoding.GetString(buffer, 0, length);
                nativeEnvironment.DeleteLocalReference(nameObject);

                string signature;

                switch (name)
                {
                case "boolean":
                case "byte":
                case "char":
                case "double":
                case "float":
                case "int":
                case "long":
                case "short":
                case "void":
                    return Error.IllegalArgument;

                default:
                    signature = name.Replace('.', '/');
                    if (name[0] != '[')
                        signature = 'L' + signature + ';';

                    break;
                }

                foreach (var loadedTypeId in classes)
                {
                    using (var loadedType = VirtualMachine.GetLocalReferenceForClass(nativeEnvironment, loadedTypeId.TypeId))
                    {
                        if (!loadedType.IsAlive)
                            continue;

                        string loadedTypeSignature;
                        string loadedTypeGenericSignature;
                        error = environment.GetClassSignature(loadedType.Value, out loadedTypeSignature, out loadedTypeGenericSignature);
                        if (error == jvmtiError.None && loadedTypeSignature == signature)
                        {
                            typeTag = loadedTypeId.TypeTag;
                            typeId = loadedTypeId.TypeId;
                            return Error.None;
                        }
                    }
                }
            }

            return Error.InvalidClass;
        }
コード例 #55
0
        public Error GetReflectedType(out TypeTag typeTag, out ReferenceTypeId typeId, ClassObjectId classObject)
        {
            byte[] packet = new byte[HeaderSize + ObjectIdSize];
            int id = GetMessageId();
            SerializeHeader(packet, id, ClassObjectReferenceCommand.ReflectedType);
            WriteObjectId(packet, HeaderSize, classObject);

            byte[] response = SendPacket(id, packet);
            Error errorCode = ReadErrorCode(response);
            if (errorCode != Error.None)
            {
                typeTag = default(TypeTag);
                typeId = default(ReferenceTypeId);
                return errorCode;
            }

            int offset = HeaderSize;
            typeTag = (TypeTag)ReadByte(response, ref offset);
            typeId = ReadReferenceTypeId(response, ref offset);
            return Error.None;
        }
コード例 #56
0
        public Message ToMessage() {
            var typetags = new TypeTag[atoms.Count];
            
            for (int i = 0; i < atoms.Count; i++) {
                typetags[i] = atoms[i].TypeTag;
            }

            return new Message {
                Address = address,
                TypeTags = typetags,
                Atoms = atoms.ToArray()
            };
        }