from retail

This commit is contained in:
Bunny67
2020-07-14 00:44:45 +03:00
parent b8259819df
commit 85345af8a2
6 changed files with 1277 additions and 21 deletions
+5
View File
@@ -112,7 +112,12 @@ local prototype = {
end, end,
Close = function(self, store) Close = function(self, store)
return store return store
end,
Delete = function(self, image)
for id in pairs(image.stores) do
Archivist:Delete("ReadOnly", id)
end end
end,
} }
Archivist:RegisterStoreType(prototype) Archivist:RegisterStoreType(prototype)
File diff suppressed because it is too large Load Diff
+4
View File
@@ -0,0 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="LibSerialize.lua" />
</Ui>
+31 -14
View File
@@ -571,9 +571,13 @@ end)
local Compresser = LibStub:GetLibrary("LibCompress") local Compresser = LibStub:GetLibrary("LibCompress")
local LibDeflate = LibStub:GetLibrary("LibDeflate") local LibDeflate = LibStub:GetLibrary("LibDeflate")
local Serializer = LibStub:GetLibrary("AceSerializer-3.0")
local LibSerialize = LibStub("LibSerialize")
local Comm = LibStub:GetLibrary("AceComm-3.0")
local configForDeflate = {level = 9} -- the biggest bottleneck by far is in transmission and printing; so use maximal compression local configForDeflate = {level = 9} -- the biggest bottleneck by far is in transmission and printing; so use maximal compression
local Serializer = LibStub:GetLibrary("AceSerializer-3.0"); local configForLS = {
local Comm = LibStub:GetLibrary("AceComm-3.0"); errorOnUnserializableType = false
}
local tooltipLoading; local tooltipLoading;
local receivedData; local receivedData;
@@ -630,7 +634,7 @@ end
local compressedTablesCache = {} local compressedTablesCache = {}
function TableToString(inTable, forChat) function TableToString(inTable, forChat)
local serialized = Serializer:Serialize(inTable) local serialized = LibSerialize:SerializeEx(configForLS, inTable)
local compressed local compressed
-- get from / add to cache -- get from / add to cache
if compressedTablesCache[serialized] then if compressedTablesCache[serialized] then
@@ -649,9 +653,7 @@ function TableToString(inTable, forChat)
compressedTablesCache[k] = nil compressedTablesCache[k] = nil
end end
end end
-- prepend with "!" so that we know that it is not a legacy compression local encoded = "!WA:2!"
-- also this way, old versions of weakauras will error out due to the "bad" encoding
local encoded = "!"
if(forChat) then if(forChat) then
encoded = encoded .. LibDeflate:EncodeForPrint(compressed) encoded = encoded .. LibDeflate:EncodeForPrint(compressed)
else else
@@ -661,11 +663,21 @@ function TableToString(inTable, forChat)
end end
function StringToTable(inString, fromChat) function StringToTable(inString, fromChat)
-- if gsub strips off a ! at the beginning then we know that this is not a legacy encoding -- encoding format:
local encoded, usesDeflate = inString:gsub("^%!", "") -- version 0: simple b64 string, compressed with LC and serialized with AS
-- version 1: b64 string prepended with "!", compressed with LD and serialized with AS
-- version 2+: b64 string prepended with !WA:N! (where N is encode version)
-- compressed with LD and serialized with LS
local _, _, encodeVersion, encoded = inString:find("^(!WA:%d+!)(.+)$")
if encodeVersion then
encodeVersion = tonumber(encodeVersion:match("%d+"))
else
encoded, encodeVersion = inString:gsub("^%!", "")
end
local decoded local decoded
if(fromChat) then if(fromChat) then
if usesDeflate == 1 then if encodeVersion > 0 then
decoded = LibDeflate:DecodeForPrint(encoded) decoded = LibDeflate:DecodeForPrint(encoded)
else else
decoded = decodeB64(encoded) decoded = decodeB64(encoded)
@@ -679,7 +691,7 @@ function StringToTable(inString, fromChat)
end end
local decompressed, errorMsg = nil, "unknown compression method" local decompressed, errorMsg = nil, "unknown compression method"
if usesDeflate == 1 then if encodeVersion > 0 then
decompressed = LibDeflate:DecompressDeflate(decoded) decompressed = LibDeflate:DecompressDeflate(decoded)
else else
decompressed, errorMsg = Compresser:Decompress(decoded) decompressed, errorMsg = Compresser:Decompress(decoded)
@@ -688,11 +700,16 @@ function StringToTable(inString, fromChat)
return "Error decompressing: " .. errorMsg return "Error decompressing: " .. errorMsg
end end
local success, deserialized = Serializer:Deserialize(decompressed); local success, deserialized
if not(success) then if encodeVersion < 2 then
return "Error deserializing "..deserialized; success, deserialized = Serializer:Deserialize(decompressed)
else
success, deserialized = LibSerialize:Deserialize(decompressed)
end end
return deserialized; if not(success) then
return "Error deserializing "..deserialized
end
return deserialized
end end
function WeakAuras.DisplayToString(id, forChat) function WeakAuras.DisplayToString(id, forChat)
+1 -5
View File
@@ -18,11 +18,7 @@
<Script file="Libs\LibDeflate\LibDeflate.lua"/> <Script file="Libs\LibDeflate\LibDeflate.lua"/>
<Include file="Libs\LibCustomGlow-1.0\LibCustomGlow-1.0.xml"/> <Include file="Libs\LibCustomGlow-1.0\LibCustomGlow-1.0.xml"/>
<Script file="Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua"/> <Script file="Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua"/>
<!--@non-retail@
<Include file="Libs\LibClassicDurations\LibClassicDurations.xml"/>
<Script file="Libs\LibClassicCasterino\LibClassicCasterino.lua"/>
<Script file="Libs\LibClassicSpellActionCount-1.0\LibClassicSpellActionCount-1.0.lua"/>
@end-non-retail@-->
<Script file="Libs\LibGetFrame-1.0\LibGetFrame-1.0.lua"/> <Script file="Libs\LibGetFrame-1.0\LibGetFrame-1.0.lua"/>
<Include file="Libs\Archivist\Archivist.xml"/> <Include file="Libs\Archivist\Archivist.xml"/>
<Include file="Libs\LibSerialize\lib.xml"/>
</Ui> </Ui>
@@ -53,7 +53,6 @@ local function ConstructImportExport(frame)
elseif(mode == "table") then elseif(mode == "table") then
displayStr = WeakAuras.DataToString(id); displayStr = WeakAuras.DataToString(id);
end end
input.editBox:SetMaxBytes(nil);
input.editBox:SetScript("OnEscapePressed", function() group:Close(); end); input.editBox:SetScript("OnEscapePressed", function() group:Close(); end);
input.editBox:SetScript("OnChar", function() input:SetText(displayStr); input.editBox:HighlightText(); end); input.editBox:SetScript("OnChar", function() input:SetText(displayStr); input.editBox:HighlightText(); end);
input.editBox:SetScript("OnMouseUp", function() input.editBox:HighlightText(); end); input.editBox:SetScript("OnMouseUp", function() input.editBox:HighlightText(); end);
@@ -71,12 +70,14 @@ local function ConstructImportExport(frame)
input.editBox:SetScript("OnMouseUp", nil) input.editBox:SetScript("OnMouseUp", nil)
input.editBox:SetScript("OnTextChanged", function() input.editBox:SetScript("OnTextChanged", function()
local str = input:GetText() local str = input:GetText()
str = str:match("^%s*(.-)%s*$")
input:SetLabel(""..#str) input:SetLabel(""..#str)
if #str > 20 then if #str > 20 then
WeakAuras.Import(str) WeakAuras.Import(str)
end end
end) end)
input:SetText("") input:SetText("")
input:SetLabel("0");
input:SetFocus(); input:SetFocus();
end end
end end