示例#1
0
        //----------------------------------------------------------------------------
        //----------------------------------------------------------------------------
        public MHandle AddModel(Model model, Action <Model> customRenderCallback = null, AnimationPlayer animPlayer = null)
        {
            List <RenderData> data       = null;
            RenderData        renderData = new RenderData(model, customRenderCallback, animPlayer);
            int  nHashCode = model.GetHashCode();
            bool bFound    = false;

            if (m_Renderables.TryGetValue(nHashCode, out data))
            {
                /*data[renderData.RefNumber] = renderData;*/
                data.Add(renderData);
                renderData.RefNumber = data.FindIndex(0, test => test == renderData);
            }
            else
            {
                List <RenderData> newList = new List <RenderData>();
                newList.Add(renderData);
                m_Renderables.Add(nHashCode, newList);
            }

            return(new MHandle(nHashCode,
                               renderData.RefNumber,
                               renderData.Visible,
                               renderData.RenderCallback,
                               Vector3.Zero,
                               Quaternion.Identity,
                               renderData.CallbackChanged,
                               renderData.VisibilityChanged,
                               renderData.PositionChanged,
                               renderData.OrientationChanged));
        }
        public void GetHashCodeForValidObjectReturnsObjectHashCode()
        {
            var sut   = new GenericEqualityComparer <Model>();
            var model = new Model();

            Assert.Equal(model.GetHashCode(), sut.GetHashCode(model));
        }
示例#3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Make.Length != 0)
            {
                hash ^= Make.GetHashCode();
            }
            if (Model.Length != 0)
            {
                hash ^= Model.GetHashCode();
            }
            if (RegistrationYear != 0)
            {
                hash ^= RegistrationYear.GetHashCode();
            }
            if (Price != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Price);
            }
            if (OwnerEmail.Length != 0)
            {
                hash ^= OwnerEmail.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (header_ != null)
            {
                hash ^= Header.GetHashCode();
            }
            if (Model != 0)
            {
                hash ^= Model.GetHashCode();
            }
            if (Mode != 0)
            {
                hash ^= Mode.GetHashCode();
            }
            hash ^= firingPkts_.GetHashCode();
            hash ^= positioningPkts_.GetHashCode();
            if (Sn.Length != 0)
            {
                hash ^= Sn.GetHashCode();
            }
            if (Basetime != 0UL)
            {
                hash ^= Basetime.GetHashCode();
            }
            return(hash);
        }
示例#5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0)
            {
                hash ^= Id.GetHashCode();
            }
            hash ^= weapons_.GetHashCode();
            if (Model.Length != 0)
            {
                hash ^= Model.GetHashCode();
            }
            if (Icon.Length != 0)
            {
                hash ^= Icon.GetHashCode();
            }
            if (MachineType.Length != 0)
            {
                hash ^= MachineType.GetHashCode();
            }
            if (MapType.Length != 0)
            {
                hash ^= MapType.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#6
0
        public override int GetHashCode()
        {
            int hash = 13 * 2;

            hash += 7 * Model.GetHashCode();
            return(hash);
        }
示例#7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (model_ != null)
            {
                hash ^= Model.GetHashCode();
            }
            if (trainConfig_ != null)
            {
                hash ^= TrainConfig.GetHashCode();
            }
            if (trainInputReader_ != null)
            {
                hash ^= TrainInputReader.GetHashCode();
            }
            if (evalConfig_ != null)
            {
                hash ^= EvalConfig.GetHashCode();
            }
            hash ^= evalInputReader_.GetHashCode();
            if (graphRewriter_ != null)
            {
                hash ^= GraphRewriter.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#8
0
        public override int GetHashCode()
        {
            int hash = 1;

            hash ^= armament_.GetHashCode();
            if (Class.Length != 0)
            {
                hash ^= Class.GetHashCode();
            }
            hash ^= equipment_.GetHashCode();
            if (Height != 0)
            {
                hash ^= Height.GetHashCode();
            }
            if (Manufacturer.Length != 0)
            {
                hash ^= Manufacturer.GetHashCode();
            }
            if (Model.Length != 0)
            {
                hash ^= Model.GetHashCode();
            }
            hash ^= platingColor_.GetHashCode();
            if (Price != 0)
            {
                hash ^= Price.GetHashCode();
            }
            hash ^= sensorColor_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#9
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Type.Length != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (Vendor.Length != 0)
            {
                hash ^= Vendor.GetHashCode();
            }
            if (Model.Length != 0)
            {
                hash ^= Model.GetHashCode();
            }
            if (Frequency != 0L)
            {
                hash ^= Frequency.GetHashCode();
            }
            if (NumCores != 0L)
            {
                hash ^= NumCores.GetHashCode();
            }
            hash ^= Environment.GetHashCode();
            if (NumRegisters != 0L)
            {
                hash ^= NumRegisters.GetHashCode();
            }
            if (L1CacheSize != 0L)
            {
                hash ^= L1CacheSize.GetHashCode();
            }
            if (L2CacheSize != 0L)
            {
                hash ^= L2CacheSize.GetHashCode();
            }
            if (L3CacheSize != 0L)
            {
                hash ^= L3CacheSize.GetHashCode();
            }
            if (SharedMemorySizePerMultiprocessor != 0L)
            {
                hash ^= SharedMemorySizePerMultiprocessor.GetHashCode();
            }
            if (MemorySize != 0L)
            {
                hash ^= MemorySize.GetHashCode();
            }
            if (Bandwidth != 0L)
            {
                hash ^= Bandwidth.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#10
0
        public override int GetHashCode()
        {
            var res = Model != null?Model.GetHashCode() : 0;

            res = 31 * res + Version.GetHashCode();
            res = 31 * res + (Producer != null ? Producer.GetHashCode() : 0);
            return(res);
        }
示例#11
0
 /// <summary>
 /// Метод возвращает хэш-код объекта.
 /// </summary>
 /// <returns>Хэш-код объекта.</returns>
 public override int GetHashCode()
 {
     return
         (CarNumber.GetHashCode()
          + Model.GetHashCode()
          + ManufacturedYear.GetHashCode()
          + CarCost.GetHashCode()
          + EnginePower.GetHashCode());
 }
        public override int GetHashCode()
        {
            var result = (Model == null ? 0 : Model.GetHashCode());

            result += 17 * (SerialNumber == null ? 0 : SerialNumber.GetHashCode());
            result += 17 * 17 * Status.GetHashCode();
            result += PriceBought == null ? 0 : 17 * 17 * 17 * (int)Math.Min(int.MaxValue, PriceBought.Value);
            return(result);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         int result = (ClarifyGeneric != null ? ClarifyGeneric.GetHashCode() : 0);
         result = (result * 397) ^ (Model != null ? Model.GetHashCode() : 0);
         result = (result * 397) ^ (NewRoot != null ? NewRoot.GetHashCode() : 0);
         return(result);
     }
 }
示例#14
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (OsVersion != null ? OsVersion.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Manufacturer != null ? Manufacturer.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Model != null ? Model.GetHashCode() : 0);
         return(hashCode);
     }
 }
示例#15
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;

                // Suitable nullity checks
                hash = hash * 59 + Id.GetHashCode();

                if (EquipmentType != null)
                {
                    hash = hash * 59 + EquipmentType.GetHashCode();
                }

                if (OwnerName != null)
                {
                    hash = hash * 59 + OwnerName.GetHashCode();
                }

                if (OwnerId != null)
                {
                    hash = hash * 59 + OwnerId.GetHashCode();
                }

                hash = hash * 59 + IsHired.GetHashCode();

                if (Make != null)
                {
                    hash = hash * 59 + Make.GetHashCode();
                }

                if (Model != null)
                {
                    hash = hash * 59 + Model.GetHashCode();
                }

                if (Size != null)
                {
                    hash = hash * 59 + Size.GetHashCode();
                }

                hash = hash * 59 + AttachmentCount.GetHashCode();

                if (LastVerifiedDate != null)
                {
                    hash = hash * 59 + LastVerifiedDate.GetHashCode();
                }

                hash = hash * 59 + SenioritySortOrder.GetHashCode();

                return(hash);
            }
        }
示例#16
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Description.Length != 0)
            {
                hash ^= Description.GetHashCode();
            }
            if (Icon.Length != 0)
            {
                hash ^= Icon.GetHashCode();
            }
            if (Model.Length != 0)
            {
                hash ^= Model.GetHashCode();
            }
            if (CollectFx.Length != 0)
            {
                hash ^= CollectFx.GetHashCode();
            }
            if (CraftingFx.Length != 0)
            {
                hash ^= CraftingFx.GetHashCode();
            }
            if (RevealFx.Length != 0)
            {
                hash ^= RevealFx.GetHashCode();
            }
            if (primaryColor_ != null)
            {
                hash ^= PrimaryColor.GetHashCode();
            }
            if (secondaryColor_ != null)
            {
                hash ^= SecondaryColor.GetHashCode();
            }
            if (Index != 0)
            {
                hash ^= Index.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#17
0
        public override int GetHashCode()
        {
            int hash = 0;

            unchecked {
                hash += Model.GetHashCode();
                hash += AllowsEveryCaller.GetHashCode();
            }

            return(hash);
        }
示例#18
0
 public int GetHashCodeWithMembers()
 {
     unchecked
     {
         var hashCode = 397;
         hashCode = (hashCode * 397) ^ Type.GetHashCode();
         hashCode = (hashCode * 397) ^ (Model?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Rpm.GetHashCode();
         hashCode = (hashCode * 397) ^ Capacity.GetHashCode();
         return(hashCode);
     }
 }
        public override bool Equals(object obj)
        {
            var toCompare = obj as ModelSerialNumberStatusPriceBoughtGroup;

            if (toCompare == null)
            {
                return(false);
            }

            return(Model.GetHashCode() == toCompare.Model.GetHashCode() && SerialNumber == toCompare.SerialNumber &&
                   Status == toCompare.Status && PriceBought == toCompare.PriceBought);
        }
示例#20
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Id != null?Id.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (Brand != null ? Brand.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Model != null ? Model.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ Price.GetHashCode();
                return(hashCode);
            }
        }
示例#21
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (NumRejestracyjny != null ? NumRejestracyjny.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Marka != null ? Marka.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Model != null ? Model.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Stan != null ? Stan.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DataKontroli.GetHashCode();
         return(hashCode);
     }
 }
示例#22
0
        public ActionResult Create([Bind(Include = "ID,Name,Horsepower,MaxSpeed,Image,Price,ClassID")] Model model)
        {
            model.ID = model.GetHashCode();
            if (ModelState.IsValid)
            {
                db.Models.Add(model);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ClassID = new SelectList(db.Classes, "ID", "Name", model.ClassID);
            return(View(model));
        }
示例#23
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id.GetHashCode();
         hashCode = (hashCode * 397) ^ (Manufacturer?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Model?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Description?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ PurchasePrice.GetHashCode();
         hashCode = (hashCode * 397) ^ PurchaseDate.GetHashCode();
         return(hashCode);
     }
 }
示例#24
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 (Model != null)
         {
             hashCode = hashCode * 59 + Model.GetHashCode();
         }
         if (Year != null)
         {
             hashCode = hashCode * 59 + Year.GetHashCode();
         }
         if (Price != null)
         {
             hashCode = hashCode * 59 + Price.GetHashCode();
         }
         if (SerialNumber != null)
         {
             hashCode = hashCode * 59 + SerialNumber.GetHashCode();
         }
         if (SoldDateUtc != null)
         {
             hashCode = hashCode * 59 + SoldDateUtc.GetHashCode();
         }
         if (Comment != null)
         {
             hashCode = hashCode * 59 + Comment.GetHashCode();
         }
         if (Transmission != null)
         {
             hashCode = hashCode * 59 + Transmission.GetHashCode();
         }
         if (Motor != null)
         {
             hashCode = hashCode * 59 + Motor.GetHashCode();
         }
         if (GarageId != null)
         {
             hashCode = hashCode * 59 + GarageId.GetHashCode();
         }
         if (SellerId != null)
         {
             hashCode = hashCode * 59 + SellerId.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#25
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 (Model != null)
         {
             hashCode = hashCode * 59 + Model.GetHashCode();
         }
         if (Url != null)
         {
             hashCode = hashCode * 59 + Url.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#26
0
        public override int GetHashCode()
        {
            unchecked
            {
                int hash = 17;

                hash = (hash * 23) + Id.GetHashCode();
                hash = (hash * 23) + BrandName.GetHashCode();
                hash = (hash * 23) + Model.GetHashCode();
                hash = (hash * 23) + Horsepower.GetHashCode();
                hash = (hash * 23) + Generation.GetHashCode();
                hash = (hash * 23) + ProdutionDate.GetHashCode();
                hash = (hash * 23) + BrandId.GetHashCode();

                return(hash);
            }
        }
示例#27
0
        private async Task <bool> ChangePlayerSkin(Ped playerPed, Model model)
        {
            Vehicle     vehicle    = playerPed.CurrentVehicle;
            VehicleSeat playerSeat = VehicleSeat.None;

            // If in a vehicle, remember their seat so we can put them back in it
            if (vehicle != null)
            {
                int seatCount = API.GetVehicleModelNumberOfSeats((uint)vehicle.Model.Hash);

                for (var i = -1; i < seatCount; i++)
                {
                    VehicleSeat iSeat = (VehicleSeat)i;

                    if (vehicle.GetPedOnSeat(iSeat) == playerPed)
                    {
                        playerSeat = iSeat;
                        break;
                    }
                }
            }

            bool success = await Game.Player.ChangeModel(model);

            if (!success)
            {
                Trainer.AddNotification($"~r~Failed to load skin '{model}'!");
                return(false);
            }

            UpdateRecentSkinsList(model);

            BaseScript.TriggerEvent("playerSpawned");
            BaseScript.TriggerEvent("virakal:skinChange", model.GetHashCode());

            if (playerSeat != VehicleSeat.None)
            {
                playerPed = Game.Player.Character;
                playerPed.SetIntoVehicle(vehicle, playerSeat);
            }

            Trainer.AddNotification($"~g~Changed player skin to '{model}'.");

            return(true);
        }
示例#28
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Consumer.Length != 0)
            {
                hash ^= Consumer.GetHashCode();
            }
            if (DatasetName.Length != 0)
            {
                hash ^= DatasetName.GetHashCode();
            }
            if (DatasetType.Length != 0)
            {
                hash ^= DatasetType.GetHashCode();
            }
            if (DatasetId.Length != 0)
            {
                hash ^= DatasetId.GetHashCode();
            }
            hash ^= tags_.GetHashCode();
            if (data_ != null)
            {
                hash ^= Data.GetHashCode();
            }
            hash ^= targetValues_.GetHashCode();
            if (model_ != null)
            {
                hash ^= Model.GetHashCode();
            }
            hash ^= prediction_.GetHashCode();
            if (TimeAdded != 0UL)
            {
                hash ^= TimeAdded.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public void SynchronizeModel(Model model)
        {
            if (_model == null)
            {
                _model = model;
                _model.Save(_modelPath);
                return;
            }

            var newModelHash = model.GetHashCode();
            var oldModelHash = _model.GetHashCode();

            if (newModelHash == oldModelHash) return;

            model.CopyFrom(_model);
            _model = model;
            _model.Save(_modelPath);
        }
示例#30
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 (Vendor != null)
         {
             hashCode = hashCode * 59 + Vendor.GetHashCode();
         }
         if (HwRev != null)
         {
             hashCode = hashCode * 59 + HwRev.GetHashCode();
         }
         if (SwRev != null)
         {
             hashCode = hashCode * 59 + SwRev.GetHashCode();
         }
         if (SerNum != null)
         {
             hashCode = hashCode * 59 + SerNum.GetHashCode();
         }
         if (Model != null)
         {
             hashCode = hashCode * 59 + Model.GetHashCode();
         }
         if (Owner != null)
         {
             hashCode = hashCode * 59 + Owner.GetHashCode();
         }
         if (PrimeOps != null)
         {
             hashCode = hashCode * 59 + PrimeOps.GetHashCode();
         }
         if (SecondOps != null)
         {
             hashCode = hashCode * 59 + SecondOps.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#31
0
        public override int GetHashCode()
        {
            var hash = 1;

            if (Types != null)
            {
                foreach (var type in Types)
                {
                    hash += type.GetHashCode();
                }
            }
            if (XAdresses != null)
            {
                foreach (var address in XAdresses)
                {
                    hash += address.GetHashCode();
                }
            }
            hash += (Model?.GetHashCode() + Name?.GetHashCode() + Address?.GetHashCode()) ?? 0;
            return(hash);
        }
        public void GetHashCodeForValidObjectReturnsObjectHashCode()
        {
            var sut = new GenericEqualityComparer<Model>();
            var model = new Model();

            Assert.Equal(model.GetHashCode(), sut.GetHashCode(model));
        }