Guidance
指路人
g.yi.org
software / rapidq / Examples / Date & Time / Carnet v2 / demo.bas

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
'-------DEMO module create demo data files

     $IFDEF FRANCAIS
      CONST demofile="data\demoFR.txt"
      CONST s_firstuse="Apparemment, tu exécutes ce programme pour la première fois. Je vais préparer des données de démonstration."
     $ELSE
      CONST demofile="data\demoEN.txt"
      CONST s_firstuse="It seems you're using this program for the first time. Let me build demo data for you."
     $ENDIF

     SUB createdemo(filename AS STRING)
'parse demo.txt file to build file filename.txt
      DIM demolist AS QSTRINGLIST
      DIM s AS STRING
      CHDIR appdir
      demolist.clear
      demolist.loadfromfile(demofile)
      FOR i=0 TO demolist.itemcount-1
       s=demolist.item(i)
       IF s<>"" THEN
        IF LEFT$(s,1)<>"'" THEN
         IF s="# "+filename THEN GOTO foundstart
        END IF
       END IF
      NEXT
'keyword '# Filename' not found -> exit
      EXIT SUB
foundstart:
      DIM demosavelist AS QSTRINGLIST
      demosavelist.clear
      DO
       i++
       s=demolist.item(i)
       IF LEFT$(s,6)="<date>" THEN s=lundi+s-"<date>"
       demosavelist.additems(s)
      LOOP UNTIL (LEFT$(s,1)="#")OR(i=demolist.itemcount-1)
      IF i<>demolist.itemcount-1 THEN demosavelist.delitems(demosavelist.itemcount-1)
      CHDIR appdir
      demosavelist.savetofile("data\"+filename+".txt")
     END SUB '-(createdemo)

     SUB demo 'create demo files if needed
      CHDIR appdir
      IF FILEEXISTS(demofile)=false THEN EXIT SUB 'if no demo file, do nothing !!
      IF FILEEXISTS(wkfile) THEN EXIT SUB
      IF FILEEXISTS(adfile) THEN EXIT SUB
      IF FILEEXISTS(trfile) THEN EXIT SUB
      IF FILEEXISTS(lkfile) THEN EXIT SUB
      IF FILEEXISTS(prfile) THEN EXIT SUB
'if no data files are found, build them :
      SHOWMESSAGE(s_firstuse)
      createdemo(wkfile-"data\"-".txt")
      createdemo(adfile-"data\"-".txt")
      createdemo(addeffile-"data\"-".txt")
      createdemo(trfile-"data\"-".txt")
'createdemo(trStrFile-"data\"-".txt")
'createdemo(trAppFile-"data\"-".txt")
      createdemo(lkfile-"data\"-".txt")
      createdemo(prfile-"data\"-".txt")
      createdemo(opfile-"data\"-".txt")
     END SUB
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Wed 2021-4-14  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:44:06