Example #1
0
        public override int GetHashCode()
        {
            unchecked
            {
                // Choose large primes to avoid hashing collisions
                const int HashingBase       = (int)2166136261;
                const int HashingMultiplier = 16777619;

                int hash = HashingBase;
                hash = (hash * HashingMultiplier) ^ ByteProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ ShortByteProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ IntProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ UIntProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ ShortProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ UShortProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ LongProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ ULongProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ FloatPropertyOne.GetHashCode();
                hash = (hash * HashingMultiplier) ^ FloatPropertyTwo.GetHashCode();
                hash = (hash * HashingMultiplier) ^ DoublePropertyOne.GetHashCode();
                hash = (hash * HashingMultiplier) ^ DoublePropertyTwo.GetHashCode();
                hash = (hash * HashingMultiplier) ^ CharProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ BoolProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ DecimalProperty.GetHashCode();
                return(hash);
            }
        }
 protected MsmqInputMessage(int additionalPropertyCount, SizeQuota bufferSizeQuota)
     : base(12 + additionalPropertyCount)
 {
     this.maxBufferSize = bufferSizeQuota.MaxSize;
     this.body = new BufferProperty(this, UnsafeNativeMethods.PROPID_M_BODY,
         bufferSizeQuota.AllocIfAvailable(initialBodySize));
     this.bodyLength = new IntProperty(this, UnsafeNativeMethods.PROPID_M_BODY_SIZE);
     this.messageId = new BufferProperty(this, UnsafeNativeMethods.PROPID_M_MSGID,
         UnsafeNativeMethods.PROPID_M_MSGID_SIZE);
     this.lookupId = new LongProperty(this, UnsafeNativeMethods.PROPID_M_LOOKUPID);
     this.cls = new ShortProperty(this, UnsafeNativeMethods.PROPID_M_CLASS);
     this.senderId = new BufferProperty(this, UnsafeNativeMethods.PROPID_M_SENDERID, initialSenderIdSize);
     this.senderIdLength = new IntProperty(this, UnsafeNativeMethods.PROPID_M_SENDERID_LEN);
     this.senderCertificate = new BufferProperty(this, UnsafeNativeMethods.PROPID_M_SENDER_CERT,
         bufferSizeQuota.AllocIfAvailable(initialCertificateSize));
     this.senderCertificateLength = new IntProperty(this, UnsafeNativeMethods.PROPID_M_SENDER_CERT_LEN);
     if (Msmq.IsAdvancedPoisonHandlingSupported)
     {
         this.lastMovedTime = new IntProperty(this, UnsafeNativeMethods.PROPID_M_LAST_MOVE_TIME);
         this.abortCount = new IntProperty(this, UnsafeNativeMethods.PROPID_M_ABORT_COUNT);
         this.moveCount = new IntProperty(this, UnsafeNativeMethods.PROPID_M_MOVE_COUNT);
     }
 }
 protected MsmqInputMessage(int additionalPropertyCount, SizeQuota bufferSizeQuota)
     : base(12 + additionalPropertyCount)
 {
     this.maxBufferSize = bufferSizeQuota.MaxSize;
     this.body          = new BufferProperty(this, UnsafeNativeMethods.PROPID_M_BODY,
                                             bufferSizeQuota.AllocIfAvailable(initialBodySize));
     this.bodyLength = new IntProperty(this, UnsafeNativeMethods.PROPID_M_BODY_SIZE);
     this.messageId  = new BufferProperty(this, UnsafeNativeMethods.PROPID_M_MSGID,
                                          UnsafeNativeMethods.PROPID_M_MSGID_SIZE);
     this.lookupId          = new LongProperty(this, UnsafeNativeMethods.PROPID_M_LOOKUPID);
     this.cls               = new ShortProperty(this, UnsafeNativeMethods.PROPID_M_CLASS);
     this.senderId          = new BufferProperty(this, UnsafeNativeMethods.PROPID_M_SENDERID, initialSenderIdSize);
     this.senderIdLength    = new IntProperty(this, UnsafeNativeMethods.PROPID_M_SENDERID_LEN);
     this.senderCertificate = new BufferProperty(this, UnsafeNativeMethods.PROPID_M_SENDER_CERT,
                                                 bufferSizeQuota.AllocIfAvailable(initialCertificateSize));
     this.senderCertificateLength = new IntProperty(this, UnsafeNativeMethods.PROPID_M_SENDER_CERT_LEN);
     if (Msmq.IsAdvancedPoisonHandlingSupported)
     {
         this.lastMovedTime = new IntProperty(this, UnsafeNativeMethods.PROPID_M_LAST_MOVE_TIME);
         this.abortCount    = new IntProperty(this, UnsafeNativeMethods.PROPID_M_ABORT_COUNT);
         this.moveCount     = new IntProperty(this, UnsafeNativeMethods.PROPID_M_MOVE_COUNT);
     }
 }
Example #4
0
    public void SetValue(object value)
    {
        string typeName = value.GetType().ToString();

        switch (typeName)
        {
        case "byte":
        {
            if (type == EPropertyType.EPropertyType_Byte)
            {
                ByteProperty prop = this as ByteProperty;
                prop.SetValue((byte)value);
                return;
            }
        }
        break;

        case "bool":
        {
            if (type == EPropertyType.EPropertyType_Bool)
            {
                BoolProperty prop = this as BoolProperty;
                prop.SetValue((bool)value);
                return;
            }
        }
        break;

        case "short":
        {
            if (type == EPropertyType.EPropertyType_Short)
            {
                ShortProperty prop = this as ShortProperty;
                prop.SetValue((short)value);
                return;
            }
        }
        break;

        case "int":
        {
            if (type == EPropertyType.EPropertyType_Int)
            {
                IntProperty prop = this as IntProperty;
                prop.SetValue((int)value);
                return;
            }
        }
        break;

        case "long":
        {
            if (type == EPropertyType.EPropertyType_Long)
            {
                LongProperty prop = this as LongProperty;
                prop.SetValue((long)value);
                return;
            }
        }
        break;

        case "float":
        {
            if (type == EPropertyType.EPropertyType_Float)
            {
                FloatProperty prop = this as FloatProperty;
                prop.SetValue((float)value);
                return;
            }
        }
        break;

        case "double":
        {
            if (type == EPropertyType.EPropertyType_Double)
            {
                DoubleProperty prop = this as DoubleProperty;
                prop.SetValue((double)value);
                return;
            }
        }
        break;

        case "Vector2":
        {
            if (type == EPropertyType.EPropertyType_Vector2)
            {
                Vector2Property prop = this as Vector2Property;
                prop.SetValue((Vector2)value);
                return;
            }
        }
        break;

        case "Vector3":
        {
            if (type == EPropertyType.EPropertyType_Vector3)
            {
                Vector3Property prop = this as Vector3Property;
                prop.SetValue((Vector3)value);
                return;
            }
        }
        break;

        case "Vector4":
        {
            if (type == EPropertyType.EPropertyType_Vector4)
            {
                Vector4Property prop = this as Vector4Property;
                prop.SetValue((Vector4)value);
                return;
            }
        }
        break;

        case "Quaternion":
        {
            if (type == EPropertyType.EPropertyType_Quaternion)
            {
                QuaternionProperty prop = this as QuaternionProperty;
                prop.SetValue((Quaternion)value);
                return;
            }
        }
        break;

        case "Matrix4x4":
        {
            if (type == EPropertyType.EPropertyType_Matrix4x4)
            {
                Matrix4x4Property prop = this as Matrix4x4Property;
                prop.SetValue((Matrix4x4)value);
                return;
            }
        }
        break;

        case "Color":
        {
            if (type == EPropertyType.EPropertyType_Color)
            {
                ColorProperty prop = this as ColorProperty;
                prop.SetValue((Color)value);
                return;
            }
        }
        break;

        case "string":
        {
            if (type == EPropertyType.EPropertyType_String)
            {
                StringProperty prop = this as StringProperty;
                prop.SetValue((string)value);
                return;
            }
        }
        break;

        case "object":
        {
            if (type == EPropertyType.EPropertyType_Object)
            {
                m_value = value;
                return;
            }
        }
        break;
        }
        return;
    }
Example #5
0
 public bool equals(ShortProperty other)
 {
     return(this.GetValue() == other.GetValue());
 }