//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 loyalsoft. All rights reserved.
// Homepage: http://www.game7000.com/
// Feedback: http://www.game7000.com/
//------------------------------------------------------------
using System.IO;
using System.Text;
namespace UnityGameFramework.Runtime
{
///
/// 内置版本资源列表序列化器。
///
public static partial class BuiltinVersionListSerializer
{
///
/// 尝试从可更新模式版本资源列表(版本 0)获取指定键的值回调函数。
///
/// 指定流。
/// 指定键。
/// 指定键的值。
/// 从可更新模式版本资源列表(版本 0)获取指定键的值是否成功。
public static bool UpdatableVersionListTryGetValueCallback_V0(Stream stream, string key, out object value)
{
value = null;
if (key != "InternalResourceVersion")
{
return false;
}
using (BinaryReader binaryReader = new BinaryReader(stream, Encoding.UTF8))
{
binaryReader.BaseStream.Position += CachedHashBytesLength;
byte stringLength = binaryReader.ReadByte();
binaryReader.BaseStream.Position += stringLength;
value = binaryReader.ReadInt32();
}
return true;
}
///
/// 尝试从可更新模式版本资源列表(版本 1 或版本 2)获取指定键的值回调函数。
///
/// 指定流。
/// 指定键。
/// 指定键的值。
/// 从可更新模式版本资源列表(版本 1 或版本 2)获取指定键的值是否成功。
public static bool UpdatableVersionListTryGetValueCallback_V1_V2(Stream stream, string key, out object value)
{
value = null;
if (key != "InternalResourceVersion")
{
return false;
}
using (BinaryReader binaryReader = new BinaryReader(stream, Encoding.UTF8))
{
binaryReader.BaseStream.Position += CachedHashBytesLength;
byte stringLength = binaryReader.ReadByte();
binaryReader.BaseStream.Position += stringLength;
value = binaryReader.Read7BitEncodedInt32();
}
return true;
}
}
}