コード例 #1
0
        private static object DeserializeTag(NbtTag tag, Type type)
        {
            switch (tag.Type)
            {
            case NbtTagType.Byte:
            case NbtTagType.Double:
            case NbtTagType.Float:
            case NbtTagType.Int:
            case NbtTagType.Long:
            case NbtTagType.Short:
            case NbtTagType.String:
                return(Convert.ChangeType(tag.GetValue(), type));

            case NbtTagType.ByteArray:
                break;

            case NbtTagType.Compound:
                return(DeserializeCompound(tag as NbtCompound, type));

            case NbtTagType.IntArray:
                break;

            case NbtTagType.List:
                return(DeserializeList(tag as NbtList, type));

            default:
                throw new ArgumentOutOfRangeException();
            }

            throw new NotImplementedException();
        }
コード例 #2
0
		private static object DeserializeTag(NbtTag tag, Type type)
		{
			switch (tag.Type)
			{
				case NbtTagType.Byte:
				case NbtTagType.Double:
				case NbtTagType.Float:
				case NbtTagType.Int:
				case NbtTagType.Long:
				case NbtTagType.Short:
				case NbtTagType.String:
					return Convert.ChangeType(tag.GetValue(), type);
				case NbtTagType.ByteArray:
					break;
				case NbtTagType.Compound:
					return DeserializeCompound(tag as NbtCompound, type);
				case NbtTagType.IntArray:
					break;
				case NbtTagType.List:
					return DeserializeList(tag as NbtList, type);
				default:
					throw new ArgumentOutOfRangeException();
			}

			throw new NotImplementedException();
		}