Exemple #1
0
 /// <summary>
 /// Constructor taking a Mod index and ID as separate parameters
 /// </summary>
 /// <param name="modID">Mod index to use</param>
 /// <param name="id">Record ID to use.  Must be less than 0x00FFFFFF.</param>
 /// <exception cref="ArgumentException">ID needs to contain no data in upper two bytes, or it will throw.</exception>
 public FormID(ModIndex modID, uint id)
 {
     if ((id & 0xFF000000) != 0)
     {
         throw new ArgumentException("Data present in Mod index bytes of id");
     }
     this.Raw  = (uint)(modID.ID << 24);
     this.Raw += this.Raw + id & 0x00FFFFFF;
 }
Exemple #2
0
        /// <summary>
        /// Default equality operator
        /// </summary>
        /// <param name="obj">object to compare to</param>
        /// <returns>True if ModIndex with equal index</returns>
        public override bool Equals(object obj)
        {
            if (!(obj is ModIndex))
            {
                return(false);
            }
            ModIndex rhs = (ModIndex)obj;

            return(this.ID == rhs.ID);
        }
Exemple #3
0
        /// <summary>
        /// Constructs a FormKey from a list of masters and the raw uint
        /// </summary>
        /// <param name="masterReferences">Master reference list to refer to</param>
        /// <param name="idWithModID">Mod index and Record ID to use</param>
        /// <returns>Converted FormID</returns>
        public static FormKey Factory(MasterReferenceReader masterReferences, uint idWithModID)
        {
            var modID = ModIndex.GetModIndexByteFromUInt(idWithModID);

            if (modID >= masterReferences.Masters.Count)
            {
                return(new FormKey(
                           masterReferences.CurrentMod,
                           idWithModID));
            }

            var master = masterReferences.Masters[modID];

            return(new FormKey(
                       master.Master,
                       idWithModID));
        }