Exemplo n.º 1
0
		public Array ReadArray(IO.EndianReader reader, Array array)
		{
			switch (Type)
			{
				case EType.Null:
					return null;

				case EType.Bool:
					return reader.ReadFixedArray((bool[])array);

				case EType.Int:
				{
					if (IsUnsigned)
					{
						switch (Size)
						{
							case ESizeInBytes._1byte: return reader.ReadFixedArray((byte[])array);
							case ESizeInBytes._2byte: return reader.ReadFixedArray((ushort[])array);
							case ESizeInBytes._4byte: return reader.ReadFixedArray((uint[])array);
							case ESizeInBytes._8byte: return reader.ReadFixedArray((ulong[])array);
						}
					}
					else
					{
						switch (Size)
						{
							case ESizeInBytes._1byte: return reader.ReadFixedArray((sbyte[])array);
							case ESizeInBytes._2byte: return reader.ReadFixedArray((short[])array);
							case ESizeInBytes._4byte: return reader.ReadFixedArray((int[])array);
							case ESizeInBytes._8byte: return reader.ReadFixedArray((long[])array);
						}
					}
				} throw new KSoft.Debug.UnreachableException(this.ToString());

				case EType.Float:
				{
					switch (Size)
					{
						case ESizeInBytes._4byte: return reader.ReadFixedArray((float[])array);
						case ESizeInBytes._8byte: return reader.ReadFixedArray((double[])array);
					}
				} throw new KSoft.Debug.UnreachableException(this.ToString());

				case EType.String:
					throw new KSoft.Debug.UnreachableException(this.ToString());

				default:
					throw new KSoft.Debug.UnreachableException(this.ToString());
			}
		}