public HotfixStructureAttribute(DB2Hash hash, ClientVersionBuild addedInVersion, ClientVersionBuild removedInVersion)
 {
     if (ClientVersion.InVersion(addedInVersion, removedInVersion))
     {
         Hash = hash;
     }
 }
 public HotfixStructureAttribute(DB2Hash hash, ClientVersionBuild addedInVersio)
 {
     if (ClientVersion.AddedInVersion(addedInVersio))
     {
         Hash = hash;
     }
 }
Esempio n. 3
0
 public static void AddHotfixData(int entry, DB2Hash type, bool deleted, uint timeStamp)
 {
     HotfixDatas.Add(new HotfixData
     {
         RecordID  = entry,
         TableHash = type,
         Deleted   = deleted,
         Timestamp = timeStamp
     });
 }
Esempio n. 4
0
 public bool ShouldLog(DB2Hash fileHash)
 {
     for (var i = 0; i < Hashes.Count; ++i)
     {
         var currentElement = Hashes[i];
         if (currentElement.FileHash == fileHash.ToString())
         {
             return(currentElement.Enabled);
         }
     }
     return(false);
 }
        private static void HandleHotfixOptionalData(Packet packet, DB2Hash type, int entry, Packet db2File)
        {
            var leftSize       = db2File.Length - db2File.Position;
            var backupPosition = db2File.Position;

            // 28 bytes = size of TactKey optional data
            if (leftSize % 28 == 0)
            {
                var tactKeyCount = leftSize / 28;

                for (int i = 0; i < tactKeyCount; ++i)
                {
                    // get hash, we need to verify
                    var hash = db2File.ReadUInt32E <DB2Hash>();

                    // check if hash is valid hash, we only support TactKey optional data yet
                    if (hash == DB2Hash.TactKey)
                    {
                        // read optional data
                        var optionalData = db2File.ReadBytes(24);

                        packet.AddValue($"(OptionalData) [{i}] Key:", hash);
                        packet.AddValue($"(OptionalData) [{i}] OptionalData:", Utilities.ByteArrayToHexString(optionalData));

                        HotfixOptionalData hotfixOptionalData = new HotfixOptionalData
                        {
                            // data to link the optional data to correct hotfix
                            TableHash = type,
                            RecordID  = entry,
                            Key       = hash,

                            Data = new Blob(optionalData)
                        };

                        Storage.HotfixOptionalDatas.Add(hotfixOptionalData);
                    }
                    else
                    {
                        db2File.SetPosition(backupPosition);
                        db2File.WriteLine($"(Entry: {entry} TableHash: {type}) has incorrect structure OR optional data. PacketLength: {db2File.Length} CurrentPosition: {db2File.Position} ");
                        db2File.AsHex();
                    }
                }
            }
            else
            {
                db2File.WriteLine($"(Entry: {entry} TableHash: {type}) has incorrect structure OR optional data. PacketLength: {db2File.Length} CurrentPosition: {db2File.Position} ");
                db2File.AsHex();
            }
        }
        public bool ShouldLog(DB2Hash fileHash)
        {
            for (var i = 0; i < Hashes.Count; ++i)
            {
                if (Settings.ParseAllHotfixes == true)
                {
                    return(true);
                }

                var currentElement = Hashes[i];
                if (currentElement.FileHash == fileHash.ToString())
                {
                    return(currentElement.Enabled);
                }
            }
            return(false);
        }
Esempio n. 7
0
 public static void AddHotfixData(int entry, DB2Hash type, bool deleted, uint timeStamp)
 {
     HotfixDatas.Add(new HotfixData
     {
         Deleted = deleted,
         RecordID = entry,
         Timestamp = timeStamp
     });
 }
Esempio n. 8
0
 public static HotfixStore <T> GetStore <T>(DB2Hash hash) where T : class, new() => (HotfixStore <T>)GetStore(hash);
Esempio n. 9
0
 public static void RemoveRecord(DB2Hash fileHash, int recordKey)
 {
     GetStore(fileHash)?.RemoveRecord(recordKey);
     OnRecordReceived?.Invoke(fileHash, recordKey, false);
 }
Esempio n. 10
0
 public static void AddRecord(DB2Hash fileHash, int recordKey, Packet db2File)
 {
     GetStore(fileHash)?.AddRecord(recordKey, db2File);
     OnRecordReceived?.Invoke(fileHash, recordKey, true);
 }
Esempio n. 11
0
 public static IHotfixStore GetStore(DB2Hash hash)
 {
     return(_stores.ContainsKey(hash) ? _stores[hash] : null);
 }
Esempio n. 12
0
 public HotfixStructureAttribute(DB2Hash hash)
 {
     Hash = hash;
 }