Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open "Example" for text as #1
- filedialog "Open manifest file", "manifest.json", fileName$
- if fileName$ <> "" then
- open fileName$ for input as #g
- txt$ = input$(#g, lof(#g))
- close #g
- print #1, txt$
- print #1, "Images/theme_frame : " + getPath$(fileName$) + replacePathSeperator$(getString$("theme_frame","images",txt$))
- print #1, "Name : " + getString$("name","",txt$)
- print #1, "Colors/frame : " + getArray$("frame","colors",txt$)
- input "Press 'Return'"; r$
- end if
- close #1
- end
- function getString$(value$,section$,string$)
- getString$=""
- start=0
- stringend=LEN(string$)
- if section$<>"" then
- start = INSTR(string$,chr$(34)+section$+chr$(34),0)+LEN(section$)+2
- if start>0 then stringend = INSTR(string$,"},",start)
- end if
- start=INSTR(string$,chr$(34)+value$+chr$(34),start)+LEN(value$)+2
- if (start>0) AND (start<stringend) then
- start=INSTR(string$,chr$(34),start)+1
- stringend=INSTR(string$,chr$(34),start)
- getString$=MID$(string$, start, stringend-start)
- end if
- end function
- function getArray$(value$,section$,string$)
- getString$=""
- start=0
- stringend=LEN(string$)
- if section$<>"" then
- start = INSTR(string$,chr$(34)+section$+chr$(34),0)+LEN(section$)+2
- if start>0 then stringend = INSTR(string$,"},",start)
- end if
- start=INSTR(string$,chr$(34)+value$+chr$(34),start)+LEN(value$)+2
- if (start>0) AND (start<stringend) then
- start=INSTR(string$,"[",start)+1
- stringend=INSTR(string$,"]",start)
- getArray$=TRIM$(MID$(string$, start, stringend-start))
- end if
- end function
- function getPath$(fullpath$)
- pathEnd=0
- location=1
- while location<>0
- location=INSTR(fullpath$,"\",location+1)
- if location<>0 then pathEnd=location
- wend
- getPath$=MID$(fullpath$, 1, pathEnd)
- end function
- function replacePathSeperator$(fullpath$)
- pathEnd=0
- location=1
- finalstring$=""
- while location<>0
- location=INSTR(fullpath$,"/",location+1)
- if location<>0 then finalstring$=finalstring$+MID$(fullpath$, lastpos+1, location-1)+"\"
- if location<>0 then lastpos=location
- wend
- replacePathSeperator$ = finalstring$ + MID$(fullpath$, lastpos+1)
- end function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement