summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XUtliPoolLib/SeqRef.cs
blob: 582eebb6b1f955f365954dcab0d3cb78083ced46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;

namespace XUtliPoolLib
{
	public struct SeqRef<T> : ISeqRef<T>, ISeqRef
	{
		public T this[int key]
		{
			get
			{
				return this.bufferRef[(int)this.startOffset + key];
			}
		}

		public static CVSReader.ValueParse<T> parser;

		public T[] bufferRef;

		public ushort startOffset;

		public SeqRef(T[] buffer)
		{
			this.bufferRef = buffer;
			this.startOffset = 0;
		}

		public void Read(XBinaryReader stream, DataHandler dh)
		{
			ushort num = stream.ReadUInt16();
			this.bufferRef = SeqRef<T>.parser.GetBuffer(dh);
			this.startOffset = num;
		}

		public override string ToString()
		{
			return string.Format("{0}={1}", this[0], this[1]);
		}
	}
}