コード例 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ NullableId.GetHashCode();
         hashCode = (hashCode * 397) ^ Byte.GetHashCode();
         hashCode = (hashCode * 397) ^ Short.GetHashCode();
         hashCode = (hashCode * 397) ^ Int;
         hashCode = (hashCode * 397) ^ Long.GetHashCode();
         hashCode = (hashCode * 397) ^ UShort.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)UInt;
         hashCode = (hashCode * 397) ^ ULong.GetHashCode();
         hashCode = (hashCode * 397) ^ Float.GetHashCode();
         hashCode = (hashCode * 397) ^ Double.GetHashCode();
         hashCode = (hashCode * 397) ^ Decimal.GetHashCode();
         hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ TimeSpan.GetHashCode();
         hashCode = (hashCode * 397) ^ Guid.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableDateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableTimeSpan.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableGuid.GetHashCode();
         return(hashCode);
     }
 }
コード例 #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ NullableId.GetHashCode();
         hashCode = (hashCode * 397) ^ Byte.GetHashCode();
         hashCode = (hashCode * 397) ^ Short.GetHashCode();
         hashCode = (hashCode * 397) ^ Int;
         hashCode = (hashCode * 397) ^ Long.GetHashCode();
         hashCode = (hashCode * 397) ^ UShort.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)UInt;
         hashCode = (hashCode * 397) ^ ULong.GetHashCode();
         hashCode = (hashCode * 397) ^ Float.GetHashCode();
         hashCode = (hashCode * 397) ^ Double.GetHashCode();
         hashCode = (hashCode * 397) ^ Decimal.GetHashCode();
         hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ TimeSpan.GetHashCode();
         hashCode = (hashCode * 397) ^ DateTimeOffset.GetHashCode();
         hashCode = (hashCode * 397) ^ Guid.GetHashCode();
         hashCode = (hashCode * 397) ^ Char.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableDateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableTimeSpan.GetHashCode();
         hashCode = (hashCode * 397) ^ (StringList != null ? StringList.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StringArray != null ? StringArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StringMap != null ? StringMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IntStringMap != null ? IntStringMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SubType != null ? SubType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (GenericType != null ? GenericType.GetHashCode() : 0);
         return(hashCode);
     }
 }
コード例 #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = Sbyte.GetHashCode();
         hashCode = (hashCode * 397) ^ Short.GetHashCode();
         hashCode = (hashCode * 397) ^ Int;
         hashCode = (hashCode * 397) ^ Long.GetHashCode();
         hashCode = (hashCode * 397) ^ Byte.GetHashCode();
         hashCode = (hashCode * 397) ^ UShort.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)UInt;
         hashCode = (hashCode * 397) ^ ULong.GetHashCode();
         hashCode = (hashCode * 397) ^ Char.GetHashCode();
         hashCode = (hashCode * 397) ^ Float.GetHashCode();
         hashCode = (hashCode * 397) ^ Double.GetHashCode();
         hashCode = (hashCode * 397) ^ Decimal.GetHashCode();
         hashCode = (hashCode * 397) ^ Boolean.GetHashCode();
         hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ (Exception != null ? Exception.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)Enum;
         hashCode = (hashCode * 397) ^ Struct.GetHashCode();
         return(hashCode);
     }
 }
コード例 #4
0
        public override int GetHashCode()
        {
            var hashCode = 291051517;

            hashCode = hashCode * -1521134295 + Int.GetHashCode();
            hashCode = hashCode * -1521134295 + Long.GetHashCode();
            hashCode = hashCode * -1521134295 + Short.GetHashCode();
            hashCode = hashCode * -1521134295 + UInt.GetHashCode();
            hashCode = hashCode * -1521134295 + ULong.GetHashCode();
            hashCode = hashCode * -1521134295 + UShort.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <int?> .Default.GetHashCode(NullableInt);

            hashCode = hashCode * -1521134295 + Byte.GetHashCode();
            hashCode = hashCode * -1521134295 + SByte.GetHashCode();
            hashCode = hashCode * -1521134295 + Bool.GetHashCode();
            hashCode = hashCode * -1521134295 + Float.GetHashCode();
            hashCode = hashCode * -1521134295 + Double.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <byte[]> .Default.GetHashCode(ByteArray);

            hashCode = hashCode * -1521134295 + Decimal.GetHashCode();
            hashCode = hashCode * -1521134295 + DateTime.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(String);

            return(hashCode);
        }
コード例 #5
0
        public void GetUShortSetting()
        {
            var expected = SettingResponse <ushort> .Create(true, 9);

            var actual = UShort.TryGetUShortSetting();

            Assert.AreEqual(expected, actual);
        }
コード例 #6
0
        public void PackAndUnpack()
        {
            var data = UShort.Pack(1, 2);

            var(first, second) = data.Unpack();
            first.Should().Be(1);
            second.Should().Be(2);
        }
コード例 #7
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Byte.GetHashCode();
         hashCode = (hashCode * 397) ^ SByte.GetHashCode();
         hashCode = (hashCode * 397) ^ Short.GetHashCode();
         hashCode = (hashCode * 397) ^ UShort.GetHashCode();
         hashCode = (hashCode * 397) ^ Int.GetHashCode();
         hashCode = (hashCode * 397) ^ UInt.GetHashCode();
         hashCode = (hashCode * 397) ^ Long.GetHashCode();
         hashCode = (hashCode * 397) ^ ULong.GetHashCode();
         return(hashCode);
     }
 }
コード例 #8
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Byte != null ? Byte.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SByte != null ? SByte.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Short != null ? Short.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (UShort != null ? UShort.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Int != null ? Int.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (UInt != null ? UInt.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Long != null ? Long.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ULong != null ? ULong.GetHashCode() : 0);
         return(hashCode);
     }
 }
コード例 #9
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = Sbyte.GetHashCode();
         hashCode = (hashCode * 397) ^ Short.GetHashCode();
         hashCode = (hashCode * 397) ^ Int;
         hashCode = (hashCode * 397) ^ Long.GetHashCode();
         hashCode = (hashCode * 397) ^ Byte.GetHashCode();
         hashCode = (hashCode * 397) ^ UShort.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)UInt;
         hashCode = (hashCode * 397) ^ ULong.GetHashCode();
         hashCode = (hashCode * 397) ^ Char.GetHashCode();
         hashCode = (hashCode * 397) ^ Float.GetHashCode();
         hashCode = (hashCode * 397) ^ Double.GetHashCode();
         hashCode = (hashCode * 397) ^ Decimal.GetHashCode();
         hashCode = (hashCode * 397) ^ Boolean.GetHashCode();
         return(hashCode);
     }
 }
コード例 #10
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ NullableId.GetHashCode();
         hashCode = (hashCode * 397) ^ Byte.GetHashCode();
         hashCode = (hashCode * 397) ^ Short.GetHashCode();
         hashCode = (hashCode * 397) ^ Int;
         hashCode = (hashCode * 397) ^ Long.GetHashCode();
         hashCode = (hashCode * 397) ^ UShort.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)UInt;
         hashCode = (hashCode * 397) ^ ULong.GetHashCode();
         hashCode = (hashCode * 397) ^ Float.GetHashCode();
         hashCode = (hashCode * 397) ^ Double.GetHashCode();
         hashCode = (hashCode * 397) ^ Decimal.GetHashCode();
         hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ TimeSpan.GetHashCode();
         hashCode = (hashCode * 397) ^ DateTimeOffset.GetHashCode();
         hashCode = (hashCode * 397) ^ Guid.GetHashCode();
         hashCode = (hashCode * 397) ^ Bool.GetHashCode();
         hashCode = (hashCode * 397) ^ Char.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableDateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableTimeSpan.GetHashCode();
         hashCode = (hashCode * 397) ^ (ByteArray != null ? ByteArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CharArray != null ? CharArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StringArray != null ? StringArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IntArray != null ? IntArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LongArray != null ? LongArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StringList != null ? StringList.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StringMap != null ? StringMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IntStringMap != null ? IntStringMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SubType != null ? SubType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SubTypes != null ? SubTypes.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CustomText != null ? CustomText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MaxText != null ? MaxText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CustomDecimal.GetHashCode();
         return(hashCode);
     }
 }
コード例 #11
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Byte.GetHashCode();
         hashCode = (hashCode * 397) ^ SByte.GetHashCode();
         hashCode = (hashCode * 397) ^ Short.GetHashCode();
         hashCode = (hashCode * 397) ^ UShort.GetHashCode();
         hashCode = (hashCode * 397) ^ Int;
         hashCode = (hashCode * 397) ^ (int)UInt;
         hashCode = (hashCode * 397) ^ Long.GetHashCode();
         hashCode = (hashCode * 397) ^ ULong.GetHashCode();
         hashCode = (hashCode * 397) ^ Float.GetHashCode();
         hashCode = (hashCode * 397) ^ Double.GetHashCode();
         hashCode = (hashCode * 397) ^ Decimal.GetHashCode();
         hashCode = (hashCode * 397) ^ Guid.GetHashCode();
         hashCode = (hashCode * 397) ^ String.GetHashCode();
         hashCode = (hashCode * 397) ^ Key.GetHashCode();
         return(hashCode);
     }
 }
コード例 #12
0
        /// <summary>
        /// Serializes a JSON object.
        /// </summary>
        /// <param name="Object">The JSON object.</param>
        /// <returns></returns>
        public static string SerializeType(object Object)
        {
            // Prevent null-references
            if (Object == null)
            {
                return("null");
            }
            else if (Object is JsonObject JsonObject)
            {
                string Buffer = "{";

                // Loop through all keys
                var Keys = JsonObject.Keys;
                for (int i = 0; i < Keys.Length; i++)
                {
                    Buffer += SerializeType(Keys[i]) + ":" + SerializeType(JsonObject[Keys[i]]);
                    if (i != JsonObject.Length - 1)
                    {
                        Buffer += ",";
                    }
                }

                // End the object
                return(Buffer + "}");
            }
            else if (Object is JsonArray JsonArray)
            {
                string Buffer = "[";

                // Loop through all items
                for (int i = 0; i < JsonArray.Length; i++)
                {
                    Buffer += SerializeType(JsonArray[i]);
                    if (i != JsonArray.Length - 1)
                    {
                        Buffer += ",";
                    }
                }

                // End the object
                return(Buffer + "]");
            }
            else if (Object is string String)
            {
                // Loop though characters and using escaped versions of reserved or unicode characters
                string Buffer = "\"";
                foreach (var Character in String)
                {
                    bool IsReserved = false;

                    // Check for reserved characters, except of the solidus.
                    if (Character != '/')
                    {
                        foreach (var Reserve in Constants.ReservedEscapes)
                        {
                            if (Reserve.Value == Character)
                            {
                                Buffer    += "\\" + Reserve.Key;
                                IsReserved = true;
                                break;
                            }
                        }
                    }

                    // Check for character range
                    if (!IsReserved)
                    {
                        int Code = (int)Character;

                        // Out of meaningful ASCII range
                        if (Code < 32 || Code > 126)
                        {
                            Buffer += "\\u" + Code.ToString("X4");
                        }
                        else
                        {
                            Buffer += Character;
                        }
                    }
                }

                // End string and return;
                return(Buffer + "\"");
            }
            else if (Object is float || Object is double || Object is int || Object is byte || Object is sbyte || Object is ushort || Object is short)
            {
                // .NET likes to use the regional decimal character.
                if (Object is float Float)
                {
                    return(Float.ToString(System.Globalization.CultureInfo.InvariantCulture));
                }
                else if (Object is double Double)
                {
                    return(Double.ToString(System.Globalization.CultureInfo.InvariantCulture));
                }
                else if (Object is int Int)
                {
                    return(Int.ToString(System.Globalization.CultureInfo.InvariantCulture));
                }
                else if (Object is byte Byte)
                {
                    return(Byte.ToString(System.Globalization.CultureInfo.InvariantCulture));
                }
                else if (Object is sbyte SByte)
                {
                    return(SByte.ToString(System.Globalization.CultureInfo.InvariantCulture));
                }
                else if (Object is ushort UShort)
                {
                    return(UShort.ToString(System.Globalization.CultureInfo.InvariantCulture));
                }
                else if (Object is short Short)
                {
                    return(Short.ToString(System.Globalization.CultureInfo.InvariantCulture));
                }
                else
                {
                    throw new JsonTypeException("The type '" + Object.GetType().Name + "' can't be serialized.");
                }
            }
            else if (Object is bool Bool)
            {
                return((bool)Object ? "true" : "false");
            }
            else
            {
                throw new JsonTypeException("The type '" + Object.GetType().Name + "' can't be serialized.");
            }
        }
コード例 #13
0
 public void WriteUshort(ushort value)
 {
     Write(UShort.Encode(value));
 }
コード例 #14
0
 public ushort ReadUshort()
 {
     return(UShort.Decode(_buffer, out _buffer));
 }
コード例 #15
0
ファイル: RenderInterface.cs プロジェクト: d3x0r/Voxelarium
		void EmitFaces( ZVoxelType** VoxelTypeTable, UShort &VoxelType, UShort &prevVoxelType, int info
								  , int x, int y, int z
								  , int Sector_Display_x, int Sector_Display_y, int Sector_Display_z );