コード例 #1
0
        void HandleHotfixRequest(HotfixRequest hotfixQuery)
        {
            Dictionary <ulong, int> hotfixes = Global.DB2Mgr.GetHotfixData();

            HotfixResponse hotfixQueryResponse = new HotfixResponse();

            foreach (ulong hotfixId in hotfixQuery.Hotfixes)
            {
                int hotfix = hotfixes.LookupByKey(hotfixId);
                if (hotfix != 0)
                {
                    var storage = Global.DB2Mgr.GetStorage(MathFunctions.Pair64_HiPart(hotfixId));

                    HotfixResponse.HotfixData hotfixData = new HotfixResponse.HotfixData();
                    hotfixData.ID       = hotfixId;
                    hotfixData.RecordID = hotfix;
                    if (storage.HasRecord((uint)hotfixData.RecordID))
                    {
                        hotfixData.Data.HasValue = true;
                        storage.WriteRecord((uint)hotfixData.RecordID, GetSessionDbcLocale(), hotfixData.Data.Value);
                    }

                    hotfixQueryResponse.Hotfixes.Add(hotfixData);
                }
            }

            SendPacket(hotfixQueryResponse);
        }
コード例 #2
0
        void HandleHotfixRequest(HotfixRequest hotfixQuery)
        {
            var hotfixes = Global.DB2Mgr.GetHotfixData();

            HotfixResponse hotfixQueryResponse = new HotfixResponse();

            foreach (HotfixRecord hotfixRecord in hotfixQuery.Hotfixes)
            {
                var hotfixedRecords = hotfixes.LookupByKey(hotfixRecord.HotfixID);
                if (!hotfixedRecords.Empty())
                {
                    foreach (var tableRecord in hotfixedRecords)
                    {
                        var storage = Global.DB2Mgr.GetStorage(hotfixRecord.TableHash);

                        HotfixResponse.HotfixData hotfixData = new HotfixResponse.HotfixData();
                        hotfixData.Record = hotfixRecord;
                        if (storage != null && storage.HasRecord((uint)hotfixData.Record.RecordID))
                        {
                            uint pos = hotfixQueryResponse.HotfixContent.GetSize();
                            storage.WriteRecord((uint)hotfixData.Record.RecordID, GetSessionDbcLocale(), hotfixQueryResponse.HotfixContent);
                            hotfixData.Size.Set(hotfixQueryResponse.HotfixContent.GetSize() - pos);
                        }
                        else
                        {
                            byte[] blobData = Global.DB2Mgr.GetHotfixBlobData(hotfixData.Record.TableHash, hotfixData.Record.RecordID);
                            if (blobData != null)
                            {
                                hotfixData.Size.Set((uint)blobData.Length);
                                hotfixQueryResponse.HotfixContent.WriteBytes(blobData);
                            }
                        }

                        hotfixQueryResponse.Hotfixes.Add(hotfixData);
                    }
                }
            }

            SendPacket(hotfixQueryResponse);
        }