// TODO - remove unnecessary variables public NetworkDisconnectService(Guid serviceIdentifier, TypeTag typetag, object service) : base("NetworkDisconnectService") { this.service = service; this.serviceIdentifier = serviceIdentifier; this.typetag = typetag; }
public Location(TypeTag typeTag, ClassId @class, MethodId method, ulong index) { TypeTag = typeTag; Class = @class; Method = method; Index = index; }
public Atom(byte[] value) { int32value = 0; float32value = 0; objvalue = value; typetag = TypeTag.OscBlob; }
public Atom(string value) { int32value = 0; float32value = 0; objvalue = value; typetag = TypeTag.OscString; }
public Atom(float value) { int32value = 0; objvalue = null; float32value = value; typetag = TypeTag.OscFloat32; }
public Atom(TypeTag type) { typetag = type; int32value = 0; float32value = 0; objvalue = null; }
public Atom(int value) { float32value = 0; objvalue = null; int32value = value; typetag = TypeTag.OscInt32; }
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"); } }
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; }
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; } }); }
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); } }
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); } }
public MyTag(TypeTag typeTag) { TypeTag = typeTag; if (typeTag == TypeTag.Menu) { Id = ++_innerid; } }
public ReferenceTypeData(TaggedReferenceTypeId type, string signature, string genericSignature, ClassStatus status) { ReferenceTypeTag = type.TypeTag; TypeId = type.TypeId; Signature = signature; GenericSignature = genericSignature; Status = status; }
public NetworkJoinService(Guid serviceIdentifier, TypeTag typetag, object service) : base("NetworkJoinService") { this.service = service; this.serviceIdentifier = serviceIdentifier; this.typetag = typetag; this.serviceType = service.GetType().AssemblyQualifiedName; }
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); }
public GameEntity(int id, string name, TypeTag tag) { Id = id; Name = name; Tags = new List<TypeTag>(); Tags.Add(tag); Components = new List<GameComponent>(); }
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"); } }
private Node AddNode(TypeTag tag, Node node) { switch (this) { case BranchNode n: return(n.WithChildren(n.Children.AddOrUpdate(tag, node))); default: return(this); } }
internal ReferenceType GetMirrorOf(TypeTag typeTag, ReferenceTypeId typeId) { if (typeTag == default(TypeTag) && typeId == default(ReferenceTypeId)) { return(null); } return(GetMirrorOf(new TaggedReferenceTypeId(typeTag, typeId))); }
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)); }
public Atom(long value) { unchecked { float32value = 0; objvalue = null; int32value = (int)value; typetag = TypeTag.OscInt32; } }
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); }
public TypeDefinition GetExistingTypeDef(ulong id, TypeTag tag) { var def = GetId <TypeDefinition>(id, tag); if (def.Tag == TypeTag.Unknown) { def.Tag = tag; } return(def); }
public Atom(double value) { unchecked { int32value = 0; objvalue = null; float32value = (float)value; typetag = TypeTag.OscFloat32; } }
/// <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); }
public ObtainGeneralObjectGoal(PsycheEnv psycheEnv, TypeTag typeTag) : base(psycheEnv) { x0 = new LocateToteableObjective(psycheEnv); x1 = new ObtainToteableObjective(psycheEnv); subGoals = new List <GoalNode>() { x0, x1 }; }
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)); }
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; }
/// <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()); }
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; }
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));
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)); }
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); }
public Type ReadType (BinaryReader reader, TypeTag code) { return ReadType (reader, code, true); }
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; } }
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(); }
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; }
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); }
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(); }
public static Type FromTag(TypeTag tag) { return Mapping[(int) tag]; }
internal ReferenceType GetMirrorOf(TypeTag typeTag, ReferenceTypeId typeId) { if (typeTag == default(TypeTag) && typeId == default(ReferenceTypeId)) return null; return GetMirrorOf(new TaggedReferenceTypeId(typeTag, typeId)); }
//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; } }
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"); } }
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; }
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; }
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() }; }