StrokePlus 백업
function BackupConfig(source, destination)
local BUFSIZE = 2^14;
local fInHandle = io.open(source, "rb");
local fOutHandle = io.open(destination, "wb");
local current = fInHandle:seek() -- get current position
local size = fInHandle:seek("end") -- get file size
fInHandle:seek("set", current) -- restore position
local blocks = math.floor(size / BUFSIZE);
local remainder = size - (blocks * BUFSIZE);
for i = 1, blocks do
data = fInHandle:read(BUFSIZE);
fOutHandle:write(data);
pos = 1000 * i * BUFSIZE / size;
end
if (remainder > 0) then
data = fInHandle:read(remainder);
fOutHandle:write(data);
end
fInHandle:close();
fOutHandle:close();
end
local sBackupFolder = os.getenv('USERPROFILE').."\\OneDrive\\#Utils\\Backups\\StorkePlus\\"
BackupConfig(os.getenv('USERPROFILE').."\\AppData\\Roaming\\StrokesPlus\\StrokesPlus.xml", sBackupFolder.."StrokesPlus.xml_"..os.date("%Y-%m-%d"))