本文整理汇总了C#中StructureType类的典型用法代码示例。如果您正苦于以下问题:C# StructureType类的具体用法?C# StructureType怎么用?C# StructureType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StructureType类属于命名空间,在下文中一共展示了StructureType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DontSimplifySegmentStruct
public void DontSimplifySegmentStruct()
{
StructureType s = new StructureType(null, 0) { Fields = { { 0, PrimitiveType.Int32 } } };
s.IsSegment = true;
DataType dt = s.Simplify();
Assert.AreEqual("(segment (0 int32 dw0000))", dt.ToString());
}
示例2: UnifyStructsSameSize
public void UnifyStructsSameSize()
{
StructureType s1 = new StructureType(null, 20);
StructureType s2 = new StructureType(null, 20);
StructureType m = (StructureType) un.Unify(s1, s2);
Assert.AreEqual(20, m.Size);
}
示例3: StrFldMerger_SingleMember
public void StrFldMerger_SingleMember()
{
StructureType str = new StructureType("foo", 0);
str.Fields.Add(4, PrimitiveType.Word16);
DataType dt = sfm.Merge(str);
Assert.AreEqual("(struct \"foo\" (4 word16 w0004))", dt.ToString());
}
示例4: VisitStructure
public override DataType VisitStructure(StructureType str)
{
if (visitedTypes.Contains(str))
return str;
visitedTypes.Add(str);
return base.VisitStructure(str);
}
示例5: AddStructure
public AddStructure(Position position, StructureType structureType, Facing frontFace)
: this()
{
Position = position;
StructureType = structureType;
FrontFace = frontFace;
}
示例6: CreateDataType
public DataType CreateDataType()
{
var str = new StructureType("foo", 0);
str.Fields.Add(0, PrimitiveType.Int32);
str.Fields.Add(4, new Pointer(str, 4));
return str;
}
示例7: Setup
public void Setup()
{
var image = new LoadedImage(Address.Ptr32(0x00100000), new byte[1024]);
var arch = new FakeArchitecture();
var program = new Program
{
Image = image,
Architecture = arch,
ImageMap = image.CreateImageMap(),
Platform = new DefaultPlatform(null, arch),
};
store = program.TypeStore;
factory = program.TypeFactory;
globals = program.Globals;
store.EnsureExpressionTypeVariable(factory, globals);
StructureType s = new StructureType(null, 0);
s.Fields.Add(0x00100000, PrimitiveType.Word32, null);
TypeVariable tvGlobals = store.EnsureExpressionTypeVariable(factory, globals);
EquivalenceClass eqGlobals = new EquivalenceClass(tvGlobals);
eqGlobals.DataType = s;
globals.TypeVariable.DataType = new Pointer(eqGlobals, 4);
globals.DataType = globals.TypeVariable.DataType;
tcr = new TypedConstantRewriter(program);
}
示例8: Setup
public void Setup()
{
mem = new MemoryArea(Address.Ptr32(0x00100000), new byte[1024]);
var arch = new FakeArchitecture();
this.program = new Program
{
Architecture = arch,
SegmentMap = new SegmentMap(
mem.BaseAddress,
new ImageSegment(".text", mem, AccessMode.ReadWriteExecute)),
Platform = new DefaultPlatform(null, arch),
};
store = program.TypeStore;
factory = program.TypeFactory;
globals = program.Globals;
store.EnsureExpressionTypeVariable(factory, globals);
StructureType s = new StructureType(null, 0);
s.Fields.Add(0x00100000, PrimitiveType.Word32, null);
TypeVariable tvGlobals = store.EnsureExpressionTypeVariable(factory, globals);
EquivalenceClass eqGlobals = new EquivalenceClass(tvGlobals);
eqGlobals.DataType = s;
globals.TypeVariable.DataType = new Pointer(eqGlobals, 4);
globals.DataType = globals.TypeVariable.DataType;
}
示例9: BlockStructure
public BlockStructure(string DefaultType) {
if (DefaultType == "Tree") {
MyBlocks.Size = new Vector3 (6, 9, 6);
MyType = StructureType.Tree;
}
MyBlocks.InitilizeData ();
UpdateBlockStructureWithType ();
}
示例10: UnifyStructs
public void UnifyStructs()
{
StructureType m1 = new StructureType { Fields = { { 4, PrimitiveType.Word32 } } };
StructureType m2 = new StructureType { Fields = { { 8, PrimitiveType.Word32 } } };
StructureType m = (StructureType) un.Unify(m1, m2);
Assert.AreEqual(2, m.Fields.Count);
}
示例11: MergeStaggeredArrays2
public void MergeStaggeredArrays2()
{
StructureType s = new StructureType(null, 0);
AddArrayField(s, 0, 8, PrimitiveType.Int32);
AddArrayField(s, 4, 8, PrimitiveType.Int32);
trans.MergeStaggeredArrays(s);
Assert.AreEqual("(struct (0 (arr (struct 0008 (0 int32 dw0000) (4 int32 dw0004))) a0000))", s.ToString());
}
示例12: BuildStaggeredArrays
private StructureType BuildStaggeredArrays()
{
StructureType s = new StructureType(null, 0);
s.Fields.Add(4, new ArrayType(new StructureType(null, 20) { Fields = { { 0, PrimitiveType.Int32 } } }, 0));
s.Fields.Add(8, new ArrayType(new StructureType(null, 20) { Fields = { { 0, PrimitiveType.Real64} } }, 0));
s.Fields.Add(12,new ArrayType(new StructureType(null, 20) { Fields = { { 0, PrimitiveType.Byte } } }, 0));
return s;
}
示例13: DTS_issue_113
public void DTS_issue_113()
{
// This recursive structure shoudn't blow up the stack.
var str = new StructureType("foo", 0);
str.Fields.Add(0, new Pointer(str, 4), "bar");
var sStr = str.Accept(new DataTypeSerializer());
Assert.AreEqual("struct(foo, (0, bar, ptr(struct(foo, ))))", sStr.ToString());
}
示例14: MergeOffsetStructures
public void MergeOffsetStructures()
{
StructureType s1 = new StructureType(null, 20);
s1.Fields.Add(0, PrimitiveType.Int32);
StructureType s2 = new StructureType(null, 20);
s2.Fields.Add(0, PrimitiveType.Real32);
DataType dt = trans.MergeOffsetStructures(s1, 4, s2, 8);
Assert.AreEqual("(struct 0014 (0 int32 dw0000) (4 real32 r0004))", dt.ToString());
}
示例15: Structure
public Structure(Vector2Int location, User owner, StructureType type)
{
_commands = new Dictionary<string, Command>();
Squads = new List<Squad>();
Enabled = true;
Location = location;
Owner = owner;
Type = type;
}