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,
Close = function(self, store)
return store
end,
Delete = function(self, image)
for id in pairs(image.stores) do
Archivist:Delete("ReadOnly", id)
end
end,
}
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 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 Serializer = LibStub:GetLibrary("AceSerializer-3.0");
local Comm = LibStub:GetLibrary("AceComm-3.0");
local configForLS = {
errorOnUnserializableType = false
}
local tooltipLoading;
local receivedData;
@@ -630,7 +634,7 @@ end
local compressedTablesCache = {}
function TableToString(inTable, forChat)
local serialized = Serializer:Serialize(inTable)
local serialized = LibSerialize:SerializeEx(configForLS, inTable)
local compressed
-- get from / add to cache
if compressedTablesCache[serialized] then
@@ -649,9 +653,7 @@ function TableToString(inTable, forChat)
compressedTablesCache[k] = nil
end
end
-- prepend with "!" so that we know that it is not a legacy compression
-- also this way, old versions of weakauras will error out due to the "bad" encoding
local encoded = "!"
local encoded = "!WA:2!"
if(forChat) then
encoded = encoded .. LibDeflate:EncodeForPrint(compressed)
else
@@ -661,11 +663,21 @@ function TableToString(inTable, forChat)
end
function StringToTable(inString, fromChat)
-- if gsub strips off a ! at the beginning then we know that this is not a legacy encoding
local encoded, usesDeflate = inString:gsub("^%!", "")
-- encoding format:
-- 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
if(fromChat) then
if usesDeflate == 1 then
if encodeVersion > 0 then
decoded = LibDeflate:DecodeForPrint(encoded)
else
decoded = decodeB64(encoded)
@@ -679,7 +691,7 @@ function StringToTable(inString, fromChat)
end
local decompressed, errorMsg = nil, "unknown compression method"
if usesDeflate == 1 then
if encodeVersion > 0 then
decompressed = LibDeflate:DecompressDeflate(decoded)
else
decompressed, errorMsg = Compresser:Decompress(decoded)
@@ -688,11 +700,16 @@ function StringToTable(inString, fromChat)
return "Error decompressing: " .. errorMsg
end
local success, deserialized = Serializer:Deserialize(decompressed);
if not(success) then
return "Error deserializing "..deserialized;
local success, deserialized
if encodeVersion < 2 then
success, deserialized = Serializer:Deserialize(decompressed)
else
success, deserialized = LibSerialize:Deserialize(decompressed)
end
return deserialized;
if not(success) then
return "Error deserializing "..deserialized
end
return deserialized
end
function WeakAuras.DisplayToString(id, forChat)
+1 -5
View File
@@ -18,11 +18,7 @@
<Script file="Libs\LibDeflate\LibDeflate.lua"/>
<Include file="Libs\LibCustomGlow-1.0\LibCustomGlow-1.0.xml"/>
<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"/>
<Include file="Libs\Archivist\Archivist.xml"/>
<Include file="Libs\LibSerialize\lib.xml"/>
</Ui>
@@ -53,7 +53,6 @@ local function ConstructImportExport(frame)
elseif(mode == "table") then
displayStr = WeakAuras.DataToString(id);
end
input.editBox:SetMaxBytes(nil);
input.editBox:SetScript("OnEscapePressed", function() group:Close(); end);
input.editBox:SetScript("OnChar", function() input:SetText(displayStr); 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("OnTextChanged", function()
local str = input:GetText()
str = str:match("^%s*(.-)%s*$")
input:SetLabel(""..#str)
if #str > 20 then
WeakAuras.Import(str)
end
end)
input:SetText("")
input:SetLabel("0");
input:SetFocus();
end
end