Пример #1
0
 public EntityProperty(string name, FoxDataType type, FoxContainerType container = FoxContainerType.StaticArray, bool isDynamic = false)
 {
     Name      = name;
     Type      = type;
     Container = container;
     IsDynamic = isDynamic;
 }
Пример #2
0
        public static IFoxContainer ReadFoxContainer(Stream input, FoxDataType dataType, FoxContainerType containerType,
                                                     short valueCount)
        {
            var container = CreateTypedContainer(dataType, containerType);

            container.Read(input, valueCount);
            return(container);
        }
Пример #3
0
        private static Type GetNativeType(FoxDataType foxType)
        {
            var result = EntityUtils.GetNativeTypeForFoxType(foxType);

            if (result != null)
            {
                return(result);
            }

            throw new NotImplementedException("Automatic mapping of type " + foxType + " has not been implemented.");
        }
Пример #4
0
        private static string MakeFieldAttribute(string propertyName, FoxDataType dataType, FoxContainerType containerType,
                                                 bool isDynamic)
        {
            var attributeStringBuilder = new StringBuilder("        [EntityProperty(\"");

            attributeStringBuilder.Append(propertyName);
            attributeStringBuilder.Append("\", FoxDataType.");
            attributeStringBuilder.Append(dataType);
            attributeStringBuilder.Append(", FoxContainerType.");
            attributeStringBuilder.Append(containerType);

            if (isDynamic)
            {
                attributeStringBuilder.Append(", true");
            }

            attributeStringBuilder.Append(")]");
            return(attributeStringBuilder.ToString());
        }
Пример #5
0
        public static IFoxContainer CreateTypedContainer(FoxDataType dataType, FoxContainerType containerType)
        {
            IFoxContainer container;

            switch (dataType)
            {
            case FoxDataType.FoxInt8:
                container = CreateContainer <FoxInt8>(containerType);
                break;

            case FoxDataType.FoxUInt8:
                container = CreateContainer <FoxUInt8>(containerType);
                break;

            case FoxDataType.FoxInt16:
                container = CreateContainer <FoxInt16>(containerType);
                break;

            case FoxDataType.FoxUInt16:
                container = CreateContainer <FoxUInt16>(containerType);
                break;

            case FoxDataType.FoxInt32:
                container = CreateContainer <FoxInt32>(containerType);
                break;

            case FoxDataType.FoxUInt32:
                container = CreateContainer <FoxUInt32>(containerType);
                break;

            case FoxDataType.FoxInt64:
                container = CreateContainer <FoxInt64>(containerType);
                break;

            case FoxDataType.FoxUInt64:
                container = CreateContainer <FoxUInt64>(containerType);
                break;

            case FoxDataType.FoxFloat:
                container = CreateContainer <FoxFloat>(containerType);
                break;

            case FoxDataType.FoxDouble:
                container = CreateContainer <FoxDouble>(containerType);
                break;

            case FoxDataType.FoxBool:
                container = CreateContainer <FoxBool>(containerType);
                break;

            case FoxDataType.FoxString:
                container = CreateContainer <FoxString>(containerType);
                break;

            case FoxDataType.FoxPath:
                container = CreateContainer <FoxPath>(containerType);
                break;

            case FoxDataType.FoxEntityPtr:
                container = CreateContainer <FoxEntityPtr>(containerType);
                break;

            case FoxDataType.FoxVector3:
                container = CreateContainer <FoxVector3>(containerType);
                break;

            case FoxDataType.FoxVector4:
                container = CreateContainer <FoxVector4>(containerType);
                break;

            case FoxDataType.FoxQuat:
                container = CreateContainer <FoxQuat>(containerType);
                break;

            case FoxDataType.FoxMatrix3:
                container = CreateContainer <FoxMatrix3>(containerType);
                break;

            case FoxDataType.FoxMatrix4:
                container = CreateContainer <FoxMatrix4>(containerType);
                break;

            case FoxDataType.FoxColor:
                container = CreateContainer <FoxColor>(containerType);
                break;

            case FoxDataType.FoxFilePtr:
                container = CreateContainer <FoxFilePtr>(containerType);
                break;

            case FoxDataType.FoxEntityHandle:
                container = CreateContainer <FoxEntityHandle>(containerType);
                break;

            case FoxDataType.FoxEntityLink:
                container = CreateContainer <FoxEntityLink>(containerType);
                break;

            case FoxDataType.FoxPropertyInfo:
                container = CreateContainer <FoxPropertyInfo>(containerType);
                break;

            case FoxDataType.FoxWideVector3:
                container = CreateContainer <FoxWideVector3>(containerType);
                break;

            default:
                throw new ArgumentOutOfRangeException("dataType");
            }
            return(container);
        }
Пример #6
0
 /// <summary>
 /// Gets the native type for a given Fox data type.
 /// </summary>
 /// <param name="foxType">The Fox data type to get the native property for.</param>
 /// <returns>The corresponding native type.</returns>
 public static Type GetNativeTypeForFoxType(FoxDataType foxType)
 {
     return(TypeMappingTable[foxType]);
 }
Пример #7
0
        internal static string ToXmlName(this FoxDataType type)
        {
            switch (type)
            {
            case FoxDataType.FoxInt8:
                return("int8");

            case FoxDataType.FoxUInt8:
                return("uint8");

            case FoxDataType.FoxInt16:
                return("int16");

            case FoxDataType.FoxUInt16:
                return("uint16");

            case FoxDataType.FoxInt32:
                return("int32");

            case FoxDataType.FoxUInt32:
                return("uint32");

            case FoxDataType.FoxInt64:
                return("int64");

            case FoxDataType.FoxUInt64:
                return("uint64");

            case FoxDataType.FoxFloat:
                return("float");

            case FoxDataType.FoxDouble:
                return("double");

            case FoxDataType.FoxBool:
                return("bool");

            case FoxDataType.FoxString:
                return("String");

            case FoxDataType.FoxPath:
                return("Path");

            case FoxDataType.FoxEntityPtr:
                return("EntityPtr");

            case FoxDataType.FoxVector3:
                return("Vector3");

            case FoxDataType.FoxVector4:
                return("Vector4");

            case FoxDataType.FoxQuat:
                return("Quat");

            case FoxDataType.FoxMatrix3:
                return("Matrix3");

            case FoxDataType.FoxMatrix4:
                return("Matrix4");

            case FoxDataType.FoxColor:
                return("Color");

            case FoxDataType.FoxFilePtr:
                return("FilePtr");

            case FoxDataType.FoxEntityHandle:
                return("EntityHandle");

            case FoxDataType.FoxEntityLink:
                return("EntityLink");

            case FoxDataType.FoxPropertyInfo:
                return("PropertyInfo");

            case FoxDataType.FoxWideVector3:
                return("WideVector3");

            default:
                throw new ArgumentOutOfRangeException("type");
            }
        }