예제 #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Error != 0)
            {
                hash ^= Error.GetHashCode();
            }
            if (UserId != 0)
            {
                hash ^= UserId.GetHashCode();
            }
            if (Nickname.Length != 0)
            {
                hash ^= Nickname.GetHashCode();
            }
            if (Sex != 0)
            {
                hash ^= Sex.GetHashCode();
            }
            if (HeadId != 0)
            {
                hash ^= HeadId.GetHashCode();
            }
            if (Coin != 0)
            {
                hash ^= Coin.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
 /// <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 (Fullname != null)
         {
             hashCode = hashCode * 59 + Fullname.GetHashCode();
         }
         if (Firstname != null)
         {
             hashCode = hashCode * 59 + Firstname.GetHashCode();
         }
         if (Lastname != null)
         {
             hashCode = hashCode * 59 + Lastname.GetHashCode();
         }
         if (Nickname != null)
         {
             hashCode = hashCode * 59 + Nickname.GetHashCode();
         }
         if (Systemuserid != null)
         {
             hashCode = hashCode * 59 + Systemuserid.GetHashCode();
         }
         if (Ownerid != null)
         {
             hashCode = hashCode * 59 + Ownerid.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #3
0
파일: Micro.cs 프로젝트: zxbe/Anno.Core
    public override int GetHashCode()
    {
        int hashcode = 157;

        unchecked {
            if (__isset.ip)
            {
                hashcode = (hashcode * 397) + Ip.GetHashCode();
            }
            if (__isset.port)
            {
                hashcode = (hashcode * 397) + Port.GetHashCode();
            }
            if (__isset.timeout)
            {
                hashcode = (hashcode * 397) + Timeout.GetHashCode();
            }
            if (__isset.name)
            {
                hashcode = (hashcode * 397) + Name.GetHashCode();
            }
            if (__isset.nickname)
            {
                hashcode = (hashcode * 397) + Nickname.GetHashCode();
            }
            if (__isset.weight)
            {
                hashcode = (hashcode * 397) + Weight.GetHashCode();
            }
        }
        return(hashcode);
    }
예제 #4
0
        /// <summary>
        /// Compares the current instance with another <see cref="System.Object"/> and returns an integer that indicates
        /// whether the current instance precedes, follows, or occurs in the same position in the sort
        /// order as the specified <see cref="System.Object"/>.
        /// </summary>
        /// <param name="obj">An object that evalutes to a <see cref="Irc.User"/>.</param>
        /// <returns>An integer that indicates whether the current instance precedoes, follow or occurs
        /// in the same position in the sort order as the specified <see cref="Irc.User"/></returns>
        /// <exception cref="System.ArgumentException">Thrown if obj is not a <see cref="Irc.User"/>.</exception>
        public virtual int CompareTo(object obj)
        {
            if (!(obj is User))
            {
                throw new ArgumentException("Object must be of type Irc.User.");
            }


            /**
             * If objects are equal: return 0
             * If this object occurs before the parameter: return less than 0
             * If this object occurs after the parameter: return greater than 0
             *
             */

            int retVal = 1;

            if (obj != null)
            {
                User other = (User)obj;
                retVal = Nickname.CompareTo(other.Nickname);
            }

            return(retVal);
        }
예제 #5
0
파일: PKM.cs 프로젝트: Arch9SK7/PKHeX
        public PKM convertPK1toPK7()
        {
            if (Format != 1)
            {
                return(null);
            }
            if (Species > 151)
            {
                return(null);
            }

            var pk = new PK7();

            TransferPropertiesWithReflection(this, pk);
            pk.EVs    = new int[6];
            pk.Nature = IVs.Sum() % 25;
            pk.IVs    = new[] { 31, 31, 31, 31, 31, 31 };
            pk.RefreshChecksum();
            if (!IsNicknamed)
            {
                pk.Nickname = Nickname.ToLower();
            }
            pk.Version = -1;
            pk.Ability = PersonalTable.SM[Species].Abilities[0];
            do
            {
                PID = PKX.getRandomPID(Species, Gender, Version, Nature, AltForm, PID);
            } while (!IsShiny);
            return(pk);
        }
예제 #6
0
        /// <summary>
        /// Returns true if OutputAddressInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of OutputAddressInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OutputAddressInfo other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Address == other.Address ||
                     Address != null &&
                     Address.Equals(other.Address)
                     ) &&
                 (
                     Memo == other.Memo ||
                     Memo != null &&
                     Memo.Equals(other.Memo)
                 ) &&
                 (
                     Nickname == other.Nickname ||
                     Nickname != null &&
                     Nickname.Equals(other.Nickname)
                 ) &&
                 (
                     WalletType == other.WalletType ||
                     WalletType != null &&
                     WalletType.Equals(other.WalletType)
                 ));
        }
예제 #7
0
        public static RegisterInfo GetRegisterInfo(string amiiboId, string nickname)
        {
            VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId);

            UtilityImpl utilityImpl = new UtilityImpl();
            CharInfo    charInfo    = new CharInfo();

            charInfo.SetFromStoreData(StoreData.BuildDefault(utilityImpl, 0));

            charInfo.Nickname = Nickname.FromString(nickname);

            RegisterInfo registerInfo = new RegisterInfo()
            {
                MiiCharInfo     = charInfo,
                FirstWriteYear  = (ushort)amiiboFile.FirstWriteDate.Year,
                FirstWriteMonth = (byte)amiiboFile.FirstWriteDate.Month,
                FirstWriteDay   = (byte)amiiboFile.FirstWriteDate.Day,
                FontRegion      = 0,
                Reserved1       = new Array64 <byte>(),
                Reserved2       = new Array58 <byte>()
            };

            Encoding.ASCII.GetBytes("Ryujinx").CopyTo(registerInfo.Nickname.ToSpan());

            return(registerInfo);
        }
예제 #8
0
 public override bool Equals(object obj)
 {
     if (obj == null)
     {
         return(false);
     }
     else
     {
         if (Nickname != null)
         {
             User f = obj as User;
             if (Nickname.Equals(f.Nickname))
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
 }
예제 #9
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 (PayeeId != null)
         {
             hashCode = hashCode * 59 + PayeeId.GetHashCode();
         }
         if (Nickname != null)
         {
             hashCode = hashCode * 59 + Nickname.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (CreationDate != null)
         {
             hashCode = hashCode * 59 + CreationDate.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #10
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Username.Length != 0)
            {
                hash ^= Username.GetHashCode();
            }
            if (Nickname.Length != 0)
            {
                hash ^= Nickname.GetHashCode();
            }
            if (Photo.Length != 0)
            {
                hash ^= Photo.GetHashCode();
            }
            if (Description.Length != 0)
            {
                hash ^= Description.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #11
0
        private static void Build(EntityTypeBuilder <User> builder)
        {
            builder
            .HasKey(x => x.Id)
            .HasName("PK_Users");
            builder.Property(x => x.Id)
            .ValueGeneratedNever()
            .HasConversion(x => x.Value, x => new UserId(x))
            .HasColumnName("UserId");

            builder.OwnsOne(x => x.Email, e =>
            {
                e.Property(x => x.Value).HasColumnName("Email").IsRequired();
            });
            builder
            .Property(x => x.PasswordHash).IsRequired();
            builder.Property(x => x.IsVerified).IsRequired();
            builder.Property(x => x.Nickname)
            .HasConversion(x => x.Value, x => Nickname.Create(x))
            .IsRequired(false);
            builder.OwnsOne(
                u => u.Avatar,
                b =>
            {
                b.Property(x => x.Value).IsRequired().HasColumnName("Avatar");
            }
                );
        }
예제 #12
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Customer other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) &&
                   ((Cards == null && other.Cards == null) || (Cards?.Equals(other.Cards) == true)) &&
                   ((GivenName == null && other.GivenName == null) || (GivenName?.Equals(other.GivenName) == true)) &&
                   ((FamilyName == null && other.FamilyName == null) || (FamilyName?.Equals(other.FamilyName) == true)) &&
                   ((Nickname == null && other.Nickname == null) || (Nickname?.Equals(other.Nickname) == true)) &&
                   ((CompanyName == null && other.CompanyName == null) || (CompanyName?.Equals(other.CompanyName) == true)) &&
                   ((EmailAddress == null && other.EmailAddress == null) || (EmailAddress?.Equals(other.EmailAddress) == true)) &&
                   ((Address == null && other.Address == null) || (Address?.Equals(other.Address) == true)) &&
                   ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) &&
                   ((Birthday == null && other.Birthday == null) || (Birthday?.Equals(other.Birthday) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) &&
                   ((Preferences == null && other.Preferences == null) || (Preferences?.Equals(other.Preferences) == true)) &&
                   ((Groups == null && other.Groups == null) || (Groups?.Equals(other.Groups) == true)) &&
                   ((CreationSource == null && other.CreationSource == null) || (CreationSource?.Equals(other.CreationSource) == true)) &&
                   ((GroupIds == null && other.GroupIds == null) || (GroupIds?.Equals(other.GroupIds) == true)) &&
                   ((SegmentIds == null && other.SegmentIds == null) || (SegmentIds?.Equals(other.SegmentIds) == true)));
        }
예제 #13
0
        public override int GetHashCode()
        {
            int num = 1;

            if (Nickname.Length != 0)
            {
                num ^= Nickname.GetHashCode();
            }
            if (God != 0)
            {
                num ^= God.GetHashCode();
            }
            if (WeaponId != 0)
            {
                num ^= WeaponId.GetHashCode();
            }
            if (Skin != 0)
            {
                num ^= Skin.GetHashCode();
            }
            if (_unknownFields != null)
            {
                num ^= ((object)_unknownFields).GetHashCode();
            }
            return(num);
        }
예제 #14
0
        /// <summary>
        /// Returns true if OutputAddressesModel1 instances are equal
        /// </summary>
        /// <param name="other">Instance of OutputAddressesModel1 to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OutputAddressesModel1 other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;

            return 
                (
                    Address == other.Address ||
                    Address != null &&
                    Address.Equals(other.Address)
                ) && 
                (
                    Memo == other.Memo ||
                    Memo != null &&
                    Memo.Equals(other.Memo)
                ) && 
                (
                    Nickname == other.Nickname ||
                    Nickname != null &&
                    Nickname.Equals(other.Nickname)
                ) && 
                (
                    WalletType == other.WalletType ||
                    WalletType != null &&
                    WalletType.Equals(other.WalletType)
                ) && 
                (
                    SessionToken == other.SessionToken ||
                    SessionToken != null &&
                    SessionToken.Equals(other.SessionToken)
                );
        }
예제 #15
0
        public void EqualOperatorWhenTestSameNicknameUpperized()
        {
            var nickname1 = Nickname.Parse("nicolas");
            var nickname2 = Nickname.Parse("NICOLAS");

            Assert.IsTrue(nickname1 == nickname2);
        }
예제 #16
0
        public async Task <IActionResult> ViewTeam(string teamName)
        {
            var teams = await Team.GetByTeamNameAsync(teamName, _azureSQL);

            var team = teams.FirstOrDefault();

            var entries = await Step.GetByTeamAsync(team?.TeamName, _azureSQL);

            var uniqueNames = entries.Select(x => x.Nickname).Distinct();

            var nicknames = new List <Nickname>();

            foreach (var name in uniqueNames)
            {
                var results = await Nickname.GetByNicknameAsync(name, _azureSQL);

                if (!(results is null))
                {
                    nicknames.Add(results.FirstOrDefault());
                }
            }

            return(View("Team", new TeamResult
            {
                Team = team,
                Nicknames = nicknames,
                Steps = entries
            }));
        }
예제 #17
0
        public void NotEqualOperatorWhenTestDifferentNickname()
        {
            var nickname1 = Nickname.Parse("nicolas");
            var nickname2 = Nickname.Parse("nicol");

            Assert.IsTrue(nickname1 != nickname2);
        }
예제 #18
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((Nickname?.GetHashCode() ?? 0) * 397) ^ (Color?.GetHashCode() ?? 0));
     }
 }
예제 #19
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 (Address != null)
         {
             hashCode = hashCode * 59 + Address.GetHashCode();
         }
         if (Memo != null)
         {
             hashCode = hashCode * 59 + Memo.GetHashCode();
         }
         if (Nickname != null)
         {
             hashCode = hashCode * 59 + Nickname.GetHashCode();
         }
         if (WalletType != null)
         {
             hashCode = hashCode * 59 + WalletType.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #20
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((Nickname != null ? Nickname.GetHashCode() : 0) * 397) ^ (PlayerId != null ? PlayerId.GetHashCode() : 0));
     }
 }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CreateCustomerRequest other &&
                   ((IdempotencyKey == null && other.IdempotencyKey == null) || (IdempotencyKey?.Equals(other.IdempotencyKey) == true)) &&
                   ((GivenName == null && other.GivenName == null) || (GivenName?.Equals(other.GivenName) == true)) &&
                   ((FamilyName == null && other.FamilyName == null) || (FamilyName?.Equals(other.FamilyName) == true)) &&
                   ((CompanyName == null && other.CompanyName == null) || (CompanyName?.Equals(other.CompanyName) == true)) &&
                   ((Nickname == null && other.Nickname == null) || (Nickname?.Equals(other.Nickname) == true)) &&
                   ((EmailAddress == null && other.EmailAddress == null) || (EmailAddress?.Equals(other.EmailAddress) == true)) &&
                   ((Address == null && other.Address == null) || (Address?.Equals(other.Address) == true)) &&
                   ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) &&
                   ((Birthday == null && other.Birthday == null) || (Birthday?.Equals(other.Birthday) == true)));
        }
예제 #22
0
        public async Task GetAllNicknames()
        {
            var results = await Nickname.GetAllAsync(_azureSql);

            Assert.NotNull(results);
            Assert.True(results.Any());
        }
예제 #23
0
            public static void SetNickname(string nickname, System.Action <bool> callback)
            {
                var post = new Nickname();

                post.nickname = nickname;
                DownloadData <string>("profile-set-nickname.php", post, (success, res) => callback(success));
            }
예제 #24
0
        public void EqualWhenTestSameNickname()
        {
            var nickname1 = Nickname.Parse("nicolas");
            var nickname2 = Nickname.Parse("nicolas");

            Assert.AreEqual(nickname1, nickname2);
        }
        public async Task <IActionResult> UpdateNameAsync([Bind("NicknameId,Name,Bio")] Nickname newNickname)
        {
            if (newNickname != null &&
                !string.IsNullOrWhiteSpace(newNickname.Name) &&
                newNickname.Name.Length <= 100 &&
                !string.IsNullOrWhiteSpace(newNickname.Bio) &&
                newNickname.Bio.Length <= 300)
            {
                newNickname.Active = true;

                var nickname = await Nickname.GetByIdAsync(newNickname.NicknameId, _azureSQL);

                nickname.Bio = newNickname.Bio.Trim();
                // Without implementing cascading changes in the Steps table for all entries with this Nickname there's no value in allow the user to change their nickname. They are better off just making another.
                //nickname.Name = newNickname.Name.Trim();

                var checkCreate = await nickname.PutAsync(_azureSQL);

                if (checkCreate)
                {
                    return(Redirect($"/Nicknames/{nickname.Name}"));
                }
            }

            return(Redirect($"/Nicknames/{newNickname.Name}"));
        }
예제 #26
0
        public void EqualWhenTestSameNicknameUpperized()
        {
            var nickname1 = Nickname.Parse("nicolas");
            var nickname2 = Nickname.Parse("NICOLAS");

            Assert.AreEqual(nickname1, nickname2);
        }
예제 #27
0
        private void UpdateChecks()
        {
            PIDEC.Verify(this);
            Nickname.Verify(this);
            Language.Verify(this);
            Trainer.Verify(this);
            IndividualValues.Verify(this);
            EffortValues.Verify(this);
            Level.Verify(this);
            Ribbon.Verify(this);
            Ability.Verify(this);
            Ball.Verify(this);
            Form.Verify(this);
            Misc.Verify(this);
            Gender.Verify(this);
            Item.Verify(this);
            if (pkm.Format <= 6 && pkm.Format >= 4)
            {
                EncounterType.Verify(this); // Gen 6->7 transfer deletes encounter type data
            }
            if (pkm.Format < 6)
            {
                return;
            }

            Memory.Verify(this);
            Medal.Verify(this);
            ConsoleRegion.Verify(this);

            if (pkm.Format >= 7)
            {
                HyperTraining.Verify(this);
                Misc.VerifyVersionEvolution(this);
            }
        }
예제 #28
0
        public void NotEqualWhenTestDifferentNickname()
        {
            var nickname1 = Nickname.Parse("nicolas");
            var nickname2 = Nickname.Parse("nicol");

            Assert.AreNotEqual(nickname1, nickname2);
        }
예제 #29
0
        // override object.Equals
        public override bool Equals(object obj)
        {
            //
            // See the full list of guidelines at
            //   http://go.microsoft.com/fwlink/?LinkID=85237
            // and also the guidance for operator== at
            //   http://go.microsoft.com/fwlink/?LinkId=85238
            //

            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            var other = obj as Player;

            // Note: when nickname == "" -> shallow compare.
            if (Nickname.Equals("") && other.Nickname.Equals(""))
            {
                return(this == other);
            }

            return
                (other != null &&
                 CurrentState == other.CurrentState &&
                 Nickname.Equals(other.Nickname)
                 //&& this.PrivateCards.Equals(other.PrivateCards) //TODO override card.equals
                 && _wallet.AmountOfMoney.Equals(other._wallet.AmountOfMoney)
                );
        }
예제 #30
0
        public void Should_Convert_Nickname_To_String()
        {
            var    nick = "nick";
            string sut  = Nickname.Create(nick).Value;

            sut.Should().Be(nick);
        }