代码
Fn GetMaxFileVersion theMaxFile =
(
local versionFloat,theBinStream,keyWord,notFind,textFromBin,binEnd
versionFloat = 0
if isMaxFile theMaxFile do
(
theBinStream = fopen theMaxFile "r"
keyWord = "Version:"
notFind = true
textFromBin = ""
fseek theBinStream 0 #seek_end
binEnd = ftell theBinStream
fseek theBinStream 0 #seek_set
while (ftell theBinStream < binEnd ) and notFind do
(
textFromBin = ReadString theBinStream
if textFromBin == "V" do
(
for i = 1 to keyWord.Count - 1 do textFromBin += ReadString theBinStream as string
)
if keyWord == textFromBin do
(
versionString = ""
for i = 1 to 5 do versionString += ReadString theBinStream as string
versionFloat = versionString as float
notFind = false
)
)
FClose theBinStream
)
versionFloat
)
GetMaxFileVersion(getOpenFileName())