public void IsShouldAddPrimitiveMembers() { IdaStruct testStructure = Database.Structures.New(GenerateUniqName()); testStructure.Members.Add(new IdaStructMember { Name = "ByteMember", Type = "unsigned __int8" }); testStructure.Members.Add(new IdaStructMember { Name = "WordMember", Type = "unsigned __int16" }); testStructure.Members.Add(new IdaStructMember { Name = "DWordMember", Type = "unsigned __int32" }); testStructure.Members.Add(new IdaStructMember { Name = "ByteArray", Type = "unsigned __int8[2]" }); Assert.That(Database.Store(testStructure), Is.True); Reconnect(); testStructure = Database.Structures.First(s => s.Name == testStructure.Name); Assert.That(testStructure, HasMember("ByteMember", "unsigned __int8")); Assert.That(testStructure, HasMember("WordMember", "unsigned __int16")); Assert.That(testStructure, HasMember("DWordMember", "unsigned __int32")); Assert.That(testStructure, HasMember("ByteArray", "unsigned __int8[2]")); }
public void ItShouldCreateStructure() { string structureName = GenerateUniqName(); IdaStruct testStructure = Database.Structures.New(structureName); Assert.That(testStructure.Name, Is.EqualTo(structureName)); Assert.That(Database.Structures, Has.Member(testStructure)); testStructure.Members.Add(new IdaStructMember { Name = "Member1", Type = "int" }); Assert.That(Database.Structures.Store(testStructure), Is.True); Reconnect(); testStructure = Database.Structures.First(s => s.Name == structureName); Assert.That(testStructure.Members.FirstOrDefault(m => m.Name == "Member1"), Is.Not.Null); Assert.That(testStructure.Members.FirstOrDefault(m => m.Name == "Member2"), Is.Null); testStructure.Members.RemoveAll(m => m.Name == "Member1"); testStructure.Members.Add(new IdaStructMember { Name = "Member2", Type = "double" }); Assert.That(Database.Structures.Store(testStructure), Is.True); Reconnect(); testStructure = Database.Structures.First(s => s.Name == structureName); Assert.That(testStructure.Members.FirstOrDefault(m => m.Name == "Member1"), Is.Null); Assert.That(testStructure.Members.FirstOrDefault(m => m.Name == "Member2"), Is.Not.Null); }
public void ItShouldCreateUnion() { string unionName = GenerateUniqName(); IdaStruct testStructure = Database.Structures.New(unionName, isUnion: true); testStructure.Members.Add(new IdaStructMember { Name = "Member1", Type = "int" }); Database.Store(testStructure); testStructure = Database.Structures.New(unionName, isUnion: true); Assert.That(testStructure.Members.Exists(m => m.Name == "Member1"), Is.False); testStructure.Members.Add(new IdaStructMember { Name = "Member2", Type = "double" }); Database.Store(testStructure); Reconnect(); testStructure = Database.Structures.First(s => s.Name == unionName); Assert.That(testStructure.IsUnion, Is.True); Assert.That(testStructure.Members.Exists(m => m.Name == "Member1"), Is.False); Assert.That(testStructure.Members.Exists(m => m.Name == "Member2"), Is.True); }
public void ItShouldGetStructuresList() { IdaStruct devInfo = Database.Structures.First(s => s.Name == "TestStructure"); Assert.That(devInfo, Is.Not.Null); Assert.That(devInfo.Members.FirstOrDefault(m => m.Name == "IntField"), Is.Not.Null); }
public void ItShouldCreateStructureMembersWithEnumType() { string structureName = GenerateUniqName(); string enumName = GenerateUniqName(); ida_enum testEnum = Database.NewEnumeration(enumName, constants: new Dictionary <string, int> { { GenerateUniqName(), 0 } }); Database.Store(testEnum); IdaStruct testStructure = Database.Structures.New(structureName); testStructure.Members.Add(new IdaStructMember { Name = "EnumMember", Type = testEnum.Name }); Database.Store(testStructure); Reconnect(); Assert.That(Database.Structures[structureName].Members.First(m => m.Name == "EnumMember").Type, Is.EqualTo(testEnum.Name)); }
public void ItShouldCreateStructuresWithSpecialSymbols() { string fieldTypeName = "_MY_SYSTEM_INFO::$1593C2ABA4C275C0FBEC2498FA3B0937::$2"; IdaStruct fieldType = Database.Structures.New(fieldTypeName); fieldType.Members.Add(new IdaStructMember { Name = "SubMember1", Type = "int" }); Assert.That(Database.Store(fieldType), Is.True); string ownerName = "_MY_SYSTEM_INFO::$1593C2ABA4C275C0FBEC2498FA3B0937"; IdaStruct owner = Database.Structures.New(ownerName); owner.Members.Add(new IdaStructMember { Name = "Member1", Type = fieldType.Name }); Assert.That(Database.Store(owner), Is.True); Reconnect(); Assert.That( Database.Structures.First(s => s.Name == ownerName).Members.FirstOrDefault(m => m.Name == "Member1"), Is.Not.Null); }
public static IdaStructMember Get(this IdaStruct @struct, string name) { return(@struct.Members.Find(m => m.Name == name)); }
public static bool Store(this Database database, IdaStruct @struct) { return(database.Structures.Store(@struct)); }
public void send_storeStructure(IdaStruct _struct) #endif { oprot_.WriteMessageBegin(new TMessage("storeStructure", TMessageType.Call, seqid_)); storeStructure_args args = new storeStructure_args(); args._struct = _struct; args.Write(oprot_); oprot_.WriteMessageEnd(); #if SILVERLIGHT return oprot_.Transport.BeginFlush(callback, state); #else oprot_.Transport.Flush(); #endif }
public static void AddMember(this IdaStruct @struct, string name, string type) { @struct.Members.Add(new IdaStructMember { Name = name, Type = type }); }
public IAsyncResult send_storeStructure(AsyncCallback callback, object state, IdaStruct _struct)
public bool storeStructure(IdaStruct _struct) { #if !SILVERLIGHT send_storeStructure(_struct); return recv_storeStructure(); #else var asyncResult = Begin_storeStructure(null, null, _struct); return End_storeStructure(asyncResult); #endif }
public IAsyncResult Begin_storeStructure(AsyncCallback callback, object state, IdaStruct _struct) { return send_storeStructure(callback, state, _struct); }
public void Read (TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Structs = new List<IdaStruct>(); TList _list44 = iprot.ReadListBegin(); for( int _i45 = 0; _i45 < _list44.Count; ++_i45) { IdaStruct _elem46 = new IdaStruct(); _elem46 = new IdaStruct(); _elem46.Read(iprot); Structs.Add(_elem46); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void Read (TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Struct) { _struct = new IdaStruct(); _struct.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }