Post Reply 
Social Buttons
Load & Save Config for editor
12-26-2019, 07:37 AM
Post: #1
Load & Save Config for editor
just two functions:

Code:
SUB SaveConfig

string sConfig , dest
char   cdBuff[256]
GetCurrentDir 256, strptr cdBuff
'print cdBuff   'show current folder
sConfig = "~theme" + "[" + str(theme) + "]"   ' res ->  ~theme[1]

   dest = cdBuff + "\AurelEditConf.cfg"
   putfile dest, sConfig

END SUB

'/////////////////////////////////////////////////////////////////////

SUB LoadConfig

string sConfig , dest
char   cdBuff[256]
GetCurrentDir 256, strptr cdBuff
'print cdBuff   'show current folder
'sConfig = "~theme" + "[" + str(theme) + "]"   ' res ->  ~theme[1]

   dest = cdBuff + "\AurelEditConf.cfg"
's_cfg = getfile configdir & "\O2HEdit.cfg"
   'if s_cfg then
    ' o2dir=extractData s_cfg, "$o2dir "
    ' compiler=extractData s_cfg, "$compiler "
sConfig = getfile dest
IF sConfig = ""
   MsgBox "Configuration file is EMPTY" + crlf +
          "create new file by opening Option Window!" , "AurelEdit::INFO"
   Return
ELSE
   MsgBox "Configuration file Exists" + crlf + sConfig + crlf +
          "OK!" , "AurelEdit::INFO"
END IF


END SUB

'////////////////////////////////////////////////////////////////////
Function ExtractData(string s,k) as string
  'format: $keyword [data]
  sys a = instr(s,k)
  if a=0 then exit function
  a = instr a,s,"["
  b = instr a,s,"]"
  IF a THEN
    a++
    return mid s,a,b-a
  END IF
End Function
[/i]
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: