Esempio n. 1
0
        /// <summary>
        /// Sets the dst base field from the src base field by knowing it's type.
        /// </summary>
        /// <param name="type">The type name.</param>
        /// <param name="name">The name of the field.</param>
        /// <param name="src">The source format.</param>
        /// <param name="dst">The destination format.</param>
        /// <returns>True if the type was setted up, otherwise false.</returns>
        private static bool SetBaseType(string type, string name, IFormat src, IFormat dst)
        {
            if (type == "int32")
            {
                dst.Set(name, src.GetInt32(name));
                return(true);
            }
            else if (type == "uint32")
            {
                dst.Set(name, src.GetUint32(name));
                return(true);
            }
            else if (type == "int16")
            {
                dst.Set(name, src.GetInt16(name));
                return(true);
            }
            else if (type == "uint16")
            {
                dst.Set(name, src.GetUInt16(name));
                return(true);
            }
            else if (type == "int8" || type == "char")
            {
                dst.Set(name, src.GetInt8(name));
                return(true);
            }
            else if (type == "uint8" || type == "uchar" || type == "byte")
            {
                dst.Set(name, src.GetUInt8(name));
                return(true);
            }
            else if (type == "int64")
            {
                dst.Set(name, src.GetInt64(name));
                return(true);
            }
            else if (type == "uint64")
            {
                dst.Set(name, src.GetUInt64(name));
                return(true);
            }
            else if (type == "float")
            {
                dst.Set(name, src.GetFloat(name));
                return(true);
            }
            else if (type == "double")
            {
                dst.Set(name, src.GetDouble(name));
                return(true);
            }

            return(false);
        }