本文整理汇总了C#中DataClass.Dump方法的典型用法代码示例。如果您正苦于以下问题:C# DataClass.Dump方法的具体用法?C# DataClass.Dump怎么用?C# DataClass.Dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataClass
的用法示例。
在下文中一共展示了DataClass.Dump方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
IEnumerator Parse(string url)
{
WWW www = new WWW(prefix + url);
yield return www;
if (string.IsNullOrEmpty(www.error))
{
this.status = url;
if (url == simpleUrl)
{
DataClass unpackData = new DataClass();
using (MemoryStream mem = new MemoryStream(www.bytes))
{
Unpacker unpacker = Unpacker.Create(mem);
unpackData.UnpackFromMessage(unpacker);
}
unpackData.Dump();
// MessagePackSerializer<DataClass> mps = MessagePackSerializer.Create<DataClass>();
// DataClass ret = mps.UnpackSingleObject(www.bytes);
//
// ret.Dump();
}
if (url == testUrl)
{
MessagePackSerializer<BaseClass> mps = MessagePackSerializer.Create<BaseClass>();
BaseClass ret = mps.UnpackSingleObject(www.bytes);
ret.Dump();
}
}
else
{
this.status = www.error;
}
}
示例2: TestLocalMessagePack
void TestLocalMessagePack()
{
byte[] bytes = null;
// pack
DataClass dc = new DataClass()
{
count = 120,
data = "hoge",
};
using ( MemoryStream mem = new MemoryStream())
{
Packer packer = Packer.Create(mem);
dc.PackToMessage(packer, null);
bytes = mem.ToArray();
}
File.WriteAllBytes(Application.dataPath + "/simple_packer.msgpack", bytes);
// unpack
DataClass unpackData = new DataClass();
using (MemoryStream mem = new MemoryStream(bytes))
{
Unpacker unpacker = Unpacker.Create(mem);
unpackData.UnpackFromMessage(unpacker);
}
unpackData.Dump();
// MessagePackSerializer<DataClass> mps = MessagePackSerializer.Create<DataClass>();
// bytes = mps.PackSingleObject(dc);
// File.WriteAllBytes(Application.dataPath + "/simple_serializer.msgpack", bytes);
// DataClass ret = mps.UnpackSingleObject(bytes);
// ret.Dump();
}