33 lines
856 B
C#
33 lines
856 B
C#
using System.IO;
|
|
|
|
namespace OCES.Audio
|
|
{
|
|
/// <summary>
|
|
/// 文件操作类
|
|
/// </summary>
|
|
public static class FileManager
|
|
{
|
|
/// <summary>
|
|
/// 从内存流中读取二进制
|
|
/// </summary>
|
|
/// <param name="bytes"></param>
|
|
/// <param name="data"></param>
|
|
/// <returns></returns>
|
|
public static bool ReadBinaryDataFromBytes(byte[] bytes, ref IBinarySerializable data)
|
|
{
|
|
if (bytes == null)
|
|
return false;
|
|
using (MemoryStream memoryStream = new(bytes))
|
|
{
|
|
using (var br = new BinaryReader(memoryStream))
|
|
{
|
|
data.DeSerialize(br);
|
|
br.Close();
|
|
}
|
|
memoryStream.Close();
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|