本文整理汇总了C#中FlatBuffers.ByteBuffer类的典型用法代码示例。如果您正苦于以下问题:C# ByteBuffer类的具体用法?C# ByteBuffer怎么用?C# ByteBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ByteBuffer类属于FlatBuffers命名空间,在下文中一共展示了ByteBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LocalPerformanceTest
static void LocalPerformanceTest()
{
byte[] data = System.IO.File.ReadAllBytes ("/Users/mzaks/Downloads/flatbuffers-master/samples/doge/gen/player_state.mon");
int length1 = data.Length, length2 = 0;
var byteBuffer = new FlatBuffers.ByteBuffer (data);
var gamestate = GameStateRoot.GetRootAsGameStateRoot (byteBuffer);
Stopwatch watch = new Stopwatch ();
int numberOfRuns = 100;
double[] m = new double[numberOfRuns];
for (int i = 0; i < numberOfRuns; i++) {
watch.Start ();
FBDeserializationService.singleton.Deserialize (gamestate);
createSomeGroups ();
FBSerialisationService.singleton.corePool = FBDeserializationService.singleton.corePool;
FBSerialisationService.singleton.metaPool = FBDeserializationService.singleton.metaPool;
data = FBSerialisationService.singleton.GenerateGameState ();
length2 = data.Length;
byteBuffer = new FlatBuffers.ByteBuffer (data);
gamestate = GameStateRoot.GetRootAsGameStateRoot (byteBuffer);
watch.Stop ();
m [i] = watch.Elapsed.TotalMilliseconds;
}
Console.WriteLine ("Hello World! " + gamestate.GameData1.PlayerName);
for (int i = 0; i < numberOfRuns; i++) {
Console.WriteLine ("Elapsed " + ((i == 0) ? m [i] : m [i] - m [i - 1]));
}
Console.WriteLine ("Elapsed AVG " + ((m [numberOfRuns - 1] - m [0]) / (numberOfRuns - 1)));
Console.WriteLine ("Number of core pool entities " + FBDeserializationService.singleton.corePool.Count);
Console.WriteLine ("Number of meta pool entities " + FBDeserializationService.singleton.metaPool.Count);
Console.WriteLine ("Length before: " + length1 + " after: " + length2);
System.IO.File.WriteAllBytes (@"/Users/mzaks/Downloads/flatbuffers-master/samples/doge/gen/player_state2.mon", data);
}
示例2: runTest
static byte[] runTest(byte[] data)
{
var byteBuffer = new FlatBuffers.ByteBuffer (data);
var gamestate = GameStateRoot.GetRootAsGameStateRoot (byteBuffer);
FBDeserializationService.singleton.Deserialize (gamestate);
createSomeGroups ();
//
FBSerialisationService.singleton.corePool = FBDeserializationService.singleton.corePool;
FBSerialisationService.singleton.metaPool = FBDeserializationService.singleton.metaPool;
//
FBSerialisationService.singleton.GenerateGameState ();
//
return data;
}
示例3: __init
public GameData __init(int _i, ByteBuffer _bb)
{
bb_pos = _i; bb = _bb; return this;
}
示例4: GetRootAsGameData
public static GameData GetRootAsGameData(ByteBuffer _bb)
{
return GetRootAsGameData(_bb, new GameData());
}
示例5: GetRootAsuvSwapItemMesh
public static uvSwapItemMesh GetRootAsuvSwapItemMesh(ByteBuffer _bb, uvSwapItemMesh obj)
{
return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb));
}
示例6: __init
public animation __init(int _i, ByteBuffer _bb)
{
bb_pos = _i; bb = _bb; return this;
}
示例7: GetRootAsanimation
public static animation GetRootAsanimation(ByteBuffer _bb)
{
return GetRootAsanimation(_bb, new animation());
}
示例8: GetRootAsListModulesResponse
public static ListModulesResponse GetRootAsListModulesResponse(ByteBuffer _bb, ListModulesResponse obj)
{
return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb));
}
示例9: GetRootAsTypeAmount
public static TypeAmount GetRootAsTypeAmount(ByteBuffer _bb)
{
return GetRootAsTypeAmount(_bb, new TypeAmount());
}
示例10: __init
public animationMeshTimeSample __init(int _i, ByteBuffer _bb)
{
bb_pos = _i; bb = _bb; return this;
}
示例11: GetRootAsanimationMeshTimeSample
public static animationMeshTimeSample GetRootAsanimationMeshTimeSample(ByteBuffer _bb, animationMeshTimeSample obj)
{
return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb));
}
示例12: GetRootAsActorData
public static ActorData GetRootAsActorData(ByteBuffer _bb)
{
return GetRootAsActorData(_bb, new ActorData());
}
示例13: __init
public BreakpointEvent __init(int _i, ByteBuffer _bb)
{
bb_pos = _i; bb = _bb; return this;
}
示例14: GetRootAsBreakpointEvent
public static BreakpointEvent GetRootAsBreakpointEvent(ByteBuffer _bb, BreakpointEvent obj)
{
return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb));
}
示例15: __init
public ListBreakpointsRequest __init(int _i, ByteBuffer _bb)
{
bb_pos = _i; bb = _bb; return this;
}