本文整理汇总了C#中StructureType类的典型用法代码示例。如果您正苦于以下问题:C# StructureType类的具体用法?C# StructureType怎么用?C# StructureType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StructureType类属于命名空间,在下文中一共展示了StructureType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
}
开发者ID:killbug2004,项目名称:reko,代码行数:7,代码来源:StructureTypeTests.cs
示例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);
}
开发者ID:gitter-badger,项目名称:reko,代码行数:7,代码来源:UnifierTests.cs
示例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());
}
开发者ID:killbug2004,项目名称:reko,代码行数:7,代码来源:StructureFieldMergerTests.cs
示例4: VisitStructure
public override DataType VisitStructure(StructureType str)
{
if (visitedTypes.Contains(str))
return str;
visitedTypes.Add(str);
return base.VisitStructure(str);
}
开发者ID:gitter-badger,项目名称:reko,代码行数:7,代码来源:TypeVariableReplacer.cs
示例5: AddStructure
public AddStructure(Position position, StructureType structureType, Facing frontFace)
: this()
{
Position = position;
StructureType = structureType;
FrontFace = frontFace;
}
开发者ID:MagistrAVSH,项目名称:voxelgame,代码行数:7,代码来源:AddStructure.cs
示例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;
}
开发者ID:gitter-badger,项目名称:reko,代码行数:7,代码来源:CodeViewerFrame.cs
示例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);
}
开发者ID:killbug2004,项目名称:reko,代码行数:27,代码来源:TypedConstantRewriterTests.cs
示例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;
}
开发者ID:relaxar,项目名称:reko,代码行数:26,代码来源:TypedConstantRewriterTests.cs
示例9: BlockStructure
public BlockStructure(string DefaultType) {
if (DefaultType == "Tree") {
MyBlocks.Size = new Vector3 (6, 9, 6);
MyType = StructureType.Tree;
}
MyBlocks.InitilizeData ();
UpdateBlockStructureWithType ();
}
开发者ID:Deus0,项目名称:Zeltex,代码行数:8,代码来源:BlockStructure.cs
示例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);
}
开发者ID:relaxar,项目名称:reko,代码行数:8,代码来源:UnifierTests.cs
示例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());
}
开发者ID:gitter-badger,项目名称:reko,代码行数:8,代码来源:TypeTransformArrayTests.cs
示例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;
}
开发者ID:gitter-badger,项目名称:reko,代码行数:8,代码来源:TypeTransformArrayTests.cs
示例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());
}
开发者ID:gitter-badger,项目名称:reko,代码行数:8,代码来源:DataTypeSerializerTests.cs
示例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());
}
开发者ID:gitter-badger,项目名称:reko,代码行数:9,代码来源:TypeTransformArrayTests.cs
示例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;
}
开发者ID:nug700,项目名称:WarWorldInfServer,代码行数:9,代码来源:Structure.cs
示例16: HasNoCoincidentFields
public void HasNoCoincidentFields()
{
StructureType s = new StructureType(null, 0);
s.Fields.Add(4, new TypeVariable(1));
s.Fields.Add(5, PrimitiveType.Word16);
Assert.AreEqual(2, s.Fields.Count);
TypeTransformer trans = new TypeTransformer(factory, null, null);
Assert.IsFalse(trans.HasCoincidentFields(s));
}
开发者ID:nemerle,项目名称:reko,代码行数:9,代码来源:TypeTransformTests.cs
示例17: Structure
public Structure(StructureType structureType, int _floor)
{
IronTowerDBContext db = new IronTowerDBContext();
// Game game = db.Games.FirstOrDefault();
// this.Game = game;
switch (structureType)
{
case StructureType.Laundry:
this.Floor = _floor;
this.Income = 1;
this.InitialCost = 1;
this.IsResidence = false;
this.PopulationCost = 1;
this.SupportedPopulation = 0;
this.Type = StructureType.Laundry;
this.UpKeep = 1;
break;
case StructureType.Restaurant:
this.Floor = _floor;
this.Income = 2;
this.InitialCost = 1;
this.IsResidence = false;
this.PopulationCost = 3;
this.SupportedPopulation = 0;
this.Type = StructureType.Restaurant;
this.UpKeep = 1;
break;
case StructureType.AmusementPark:
this.Floor = _floor;
this.Income = 3;
this.InitialCost = 3;
this.IsResidence = false;
this.PopulationCost = 1;
this.SupportedPopulation = 0;
this.Type = StructureType.AmusementPark;
this.UpKeep = 1;
break;
case StructureType.Residence:
this.Floor = _floor;
this.Income = 0;
this.InitialCost = 1;
this.IsResidence = true;
this.PopulationCost = 0;
this.SupportedPopulation = 5;
this.Type = StructureType.Residence;
this.UpKeep = 1;
break;
default:
break;
}
}
开发者ID:TIY-LR,项目名称:tower-server,代码行数:57,代码来源:Structure.cs
示例18: BuildDistinctArrays
private StructureType BuildDistinctArrays()
{
StructureType s = new StructureType(null, 0);
AddArrayField(s, 0, 20, PrimitiveType.Int32);
AddArrayField(s, 4, 20, PrimitiveType.Int32);
AddArrayField(s, 40, 20, PrimitiveType.Real32);
AddArrayField(s, 44, 20, PrimitiveType.Real32);
return s;
}
开发者ID:gitter-badger,项目名称:reko,代码行数:9,代码来源:TypeTransformArrayTests.cs
示例19: StrFldMerger_FindOverlappingCluster
public void StrFldMerger_FindOverlappingCluster()
{
StructureType str = new StructureType("foo", 0);
str.Fields.Add(2, PrimitiveType.Word32);
str.Fields.Add(4, PrimitiveType.Word32);
foreach (List<StructureField> cluster in sfm.GetOverlappingClusters(str.Fields))
{
Assert.AreEqual(2, cluster.Count);
}
}
开发者ID:nemerle,项目名称:reko,代码行数:10,代码来源:StructureFieldMergerTests.cs
示例20: CmpRecursiveEqualStructs
public void CmpRecursiveEqualStructs()
{
// struct str1{struct *str2} == struct str2{struct *str1}
StructureType s1 = new StructureType();
StructureType s2 = new StructureType();
s1.Fields.Add(0, new Pointer(s2, 4));
s2.Fields.Add(0, new Pointer(s1, 4));
DataTypeComparer c = new DataTypeComparer();
Assert.AreEqual(0, c.Compare(s1, s2));
}
开发者ID:gitter-badger,项目名称:reko,代码行数:10,代码来源:TypeComparerTests.cs
注:本文中的StructureType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论