コード例 #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (DeviceId != 0)
            {
                hash ^= DeviceId.GetHashCode();
            }
            if (ResourceId != 0)
            {
                hash ^= ResourceId.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (TimestampPs != 0UL)
            {
                hash ^= TimestampPs.GetHashCode();
            }
            if (DurationPs != 0UL)
            {
                hash ^= DurationPs.GetHashCode();
            }
            hash ^= Args.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ResourceId != 0)
            {
                hash ^= ResourceId.GetHashCode();
            }
            if (Resource != 0)
            {
                hash ^= Resource.GetHashCode();
            }
            if (Num != 0)
            {
                hash ^= Num.GetHashCode();
            }
            if (CurrentNum != 0)
            {
                hash ^= CurrentNum.GetHashCode();
            }
            if (ActivityId != 0)
            {
                hash ^= ActivityId.GetHashCode();
            }
            return(hash);
        }
コード例 #3
0
        public void ReadInvalidGenericRecordTests(ResourceId resource, InvalidReadGenericRecord condition)
        {
            var recordHandler = new GenericRecordManager();
            var requestDic    = new Dictionary <string, object>()
            {
                ["resource"] = resource.GetHashCode(),
                ["idList"]   = new int[] { Common.ReadRecordsId(resource, FirstSystemRecord) },
                ["fields"]   = string.Format("{0}.P_PhaseDate,{1}.P_Name", resource.ToAlias(), resource.ToAlias())
            };

            if (condition == InvalidReadGenericRecord.NotLogin)
            {
                PrivateApiConnection.GetConnectionForCurrentTest().DeAuthenticate();
                var result = recordHandler.ReadRecord <ReadGenericRecordResponse.Error>(requestDic, HttpMethod.Post);
                PrivateApiConnection.GetConnectionForCurrentTest().Authenticate();
                PrAssert.That(result, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.Unauthorized));
            }
            else if (condition == InvalidReadGenericRecord.TransactionError)
            {
                // This case unable to reproduce at this time.
            }
            else if (condition == InvalidReadGenericRecord.WrongFieldId)
            {
                requestDic["idList"] = WrongId;
                var result = recordHandler.ReadRecord <ReadGenericRecordResponse.Error>(requestDic, HttpMethod.Post);
                PrAssert.That(result, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.InternalServerError));
            }
            else
            {
                requestDic["idList"] = null;
                var result = recordHandler.ReadRecord <ReadGenericRecordResponse.Error>(requestDic, HttpMethod.Post);
                PrAssert.That(result, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
            }
        }
コード例 #4
0
        public override int GetHashCode()
        {
            int hash = 0x7FFFF + (int)AudioType;

            hash = (hash * 0x1FFFF) + ResourceId.GetHashCode();
            return(hash);
        }
コード例 #5
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (ResourceId != null)
         {
             hashCode = hashCode * 59 + ResourceId.GetHashCode();
         }
         if (RoleId != null)
         {
             hashCode = hashCode * 59 + RoleId.GetHashCode();
         }
         if (PolicyId != null)
         {
             hashCode = hashCode * 59 + PolicyId.GetHashCode();
         }
         if (ScopeMap != null)
         {
             hashCode = hashCode * 59 + ScopeMap.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #6
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (currentUser_ != null)
            {
                hash ^= CurrentUser.GetHashCode();
            }
            if (user_ != null)
            {
                hash ^= User.GetHashCode();
            }
            if (ResourceType.Length != 0)
            {
                hash ^= ResourceType.GetHashCode();
            }
            if (ResourceId.Length != 0)
            {
                hash ^= ResourceId.GetHashCode();
            }
            if (Permission.Length != 0)
            {
                hash ^= Permission.GetHashCode();
            }
            return(hash);
        }
コード例 #7
0
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = (AudioType != null ? AudioType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ResourceId != null ? ResourceId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ResourceTitle != null ? ResourceTitle.GetHashCode() : 0);
         return(hashCode);
     }
 }
コード例 #8
0
        /// <summary>
        /// Overriding GetHashCode
        /// </summary>
        public override int GetHashCode()
        {
            int hash = 17;

            hash = hash * 23 + ResourceId.GetHashCode();
            hash = hash * 23 + ResultState.GetHashCode();
            hash = hash * 23 + Message.GetHashCode();

            return(hash);
        }
コード例 #9
0
ファイル: DismAppxPackage.cs プロジェクト: johnwtt/UUP
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>A hash code for the current <see cref="T:System.Object" />.</returns>
 public override int GetHashCode()
 {
     return(Architecture.GetHashCode()
            ^ DisplayName?.GetHashCode() ?? 0
            ^ InstallLocation?.GetHashCode() ?? 0
            ^ PackageName?.GetHashCode() ?? 0
            ^ PublisherId?.GetHashCode() ?? 0
            ^ ResourceId?.GetHashCode() ?? 0
            ^ Version.GetHashCode());
 }
コード例 #10
0
ファイル: Variant.cs プロジェクト: sebrandon1/HaloSharp
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Owner?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (int)OwnerType;
         hashCode = (hashCode * 397) ^ ResourceId.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)ResourceType;
         return(hashCode);
     }
 }
コード例 #11
0
        private static Dictionary <string, object> ValidDeleteGenericRecordRequest(ResourceId resource, ValidDeleteGenericRecord condition)
        {
            var data = new Dictionary <string, object>()
            {
                ["resource"] = resource.GetHashCode()
            };

            ValidDeleteGenericRecordMapper[condition](resource, new HrbcRecordCreator[] { FirstSystemRecord, SecondSystemRecord, FirstUserRecords, SecondUserRecords }, data);

            return(data);
        }
コード例 #12
0
        private static Dictionary <string, object> ValidReadGenericRecordRequest(ResourceId resource, ValidReadGenericRecord condition)
        {
            HrbcRecordCreator[] listRecords = new HrbcRecordCreator[] { FirstSystemRecord, SecondSystemRecord, FirstUserRecords, SecondUserRecords };
            var requestDic = new Dictionary <string, object>()
            {
                ["resource"] = resource.GetHashCode(),
            };

            ValidReadRecordMapper[condition](resource, listRecords, requestDic);
            ValidReadFieldsMapper[condition](resource, FieldCreator, requestDic);

            return(requestDic);
        }
コード例 #13
0
        public static bool CheckExistedRecordId(ResourceId resource, int[] recordId)
        {
            var requestDic = new Dictionary <string, object>()
            {
                ["resource"] = resource.GetHashCode(),
                ["idList"]   = new int[] { recordId.GetEnumerator().GetHashCode() },
                ["fields"]   = string.Format("{0}.P_Id,{1}.P_Name", resource.ToAlias(), resource.ToAlias())
            };

            var recordHandler = new GenericRecordManager();
            var result        = recordHandler.ReadRecord <ReadGenericRecordResponse.Success>(requestDic, HttpMethod.Post);

            return(result.IsSuccess ? false : true);
        }
コード例 #14
0
 /// <summary>
 /// Serves as a hash function for a <see cref="Province"/> object.
 /// </summary>
 /// <returns>A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a
 /// hash table.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         return(((Id != null ? Id.GetHashCode() : 0) * 397) ^
                (Name != null ? Name.GetHashCode() : 0) ^
                (Description != null ? Description.GetHashCode() : 0) ^
                (ResourceId != null ? ResourceId.GetHashCode() : 0) ^
                (FactionId != null ? FactionId.GetHashCode() : 0) ^
                (SovereignFactionId != null ? SovereignFactionId.GetHashCode() : 0) ^
                (Colour != null ? Colour.GetHashCode() : 0) ^
                Locked.GetHashCode() ^
                Type.GetHashCode());
     }
 }
コード例 #15
0
 public override int GetHashCode()
 {
     return(Subscription.GetHashCode() ^ ResourceId.GetHashCode() ^ WebsiteName.GetHashCode());
 }
コード例 #16
0
 public override int GetHashCode()
 {
     return(ResourceId.GetHashCode());
 }
コード例 #17
0
 public override int GetHashCode() => ResourceId.GetHashCode();