/*
 * auto generated by tools(注意:千万不要手动修改本文件)
 * MusicSegment
 */
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;

namespace OCES.Audio
{
[Serializable]
public partial class MusicSegment : IBinarySerializable
{
	/// <summary>
	/// 唯一ID
	/// </summary>
	public uint Id { get; set; }

	/// <summary>
	/// 指向的文件名
	/// </summary>
	public string Name { get; set; }


	public void DeSerialize(BinaryReader reader)
	{
		Id = reader.ReadUInt32();
		Name = reader.ReadString();
	}

	public void Serialize(BinaryWriter writer)
	{
		writer.Write(Id);
		writer.Write(Name);
	}
}

[Serializable]
public partial class MusicSegmentConfig : IBinarySerializable
{
	Dictionary<uint,MusicSegment> m_musicSegmentInfos = new();
	List<MusicSegment> m_musicSegmentInfoList;

	public List<MusicSegment> MusicSegmentList()
	{
		this.m_musicSegmentInfoList ??= new List<MusicSegment>(this.m_musicSegmentInfos.Values);
		return this.m_musicSegmentInfoList;
	}

	public void DeSerialize(BinaryReader reader)
	{
		int count = reader.ReadInt32();
		for (int i = 0; i < count; i++)
		{
			MusicSegment tempData = new();
			tempData.DeSerialize(reader);
			this.m_musicSegmentInfos.Add(tempData.Id, tempData);
		}
	}

	public void Serialize(BinaryWriter writer)
	{
		writer.Write(this.m_musicSegmentInfos.Count);
		foreach (MusicSegment musicSegment in this.m_musicSegmentInfos.Values)
		{
			musicSegment.Serialize(writer);
		}
	}

	public MusicSegment QueryById(uint id)
	{
		return this.m_musicSegmentInfos.GetValueOrDefault(id);
	}
}
}
