This a just a *.zip file that contains an *.mqo file and a thumbnail.jpg file and maybe an *.mqx file.
Below are examples in Delphi 10.2 and Python 2.7 that show how to read the *.mqo inside the *.zip.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Delphi 10.2 | |
uses System.Zip; | |
procedure TForm1.FormCreate(Sender: TObject); | |
var | |
zipfile :TZipFile; | |
i : integer; | |
s : string; | |
found : Boolean; | |
m : TStream; | |
hdr:TZipHeader; | |
begin | |
Memo1.Clear; | |
found:=False; | |
if TZipFile.IsValid('C:/Users/Username/Desktop/test.mqoz') then | |
begin | |
try | |
zipfile:=TZipFile.Create; | |
zipfile.Open('C:/Users/Username/Desktop/test.mqoz',zmRead); | |
for i:= Low(zipfile.FileNames) to High(zipfile.FileNames) do | |
begin | |
s:= zipfile.FileNames[i]; | |
if LowerCase(ExtractFileExt(s))='.mqo' then | |
begin | |
found:=True; | |
break; | |
end; | |
end; | |
if found then | |
begin | |
m:=TStream.Create; | |
try | |
zipfile.Read(i,m,hdr); | |
memo1.Lines.LoadFromStream(m); | |
finally | |
m.Free; | |
end; | |
end; | |
finally | |
zipfile.Close; | |
zipfile.Free; | |
end; | |
end; | |
end; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Python 2.7 | |
import zipfile | |
import os | |
def read_zip_file(filepath): | |
zfile = zipfile.ZipFile(filepath) | |
for finfo in zfile.infolist(): | |
print finfo.filename | |
f,ext = os.path.splitext(finfo.filename) | |
if ext.lower()== ".mqo": | |
ifile = zfile.open(finfo) | |
line_list = ifile.readlines() | |
print line_list | |
if __name__=="__main__": | |
read_zip_file("test.mqoz") |
No comments:
Post a Comment