home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / jpi / libedito.bas < prev    next >
Encoding:
BASIC Source File  |  1998-01-01  |  1.5 KB  |  55 lines

  1. Attribute VB_Name = "Module1"
  2. Global Const CURRVERSION$ = "ION FORMAT VERSION: 1.0"
  3. Global Const LFile$ = "GraphicLibs.Dat"
  4. Global Const SFile$ = "GraphicLibs.Dat"
  5. Type GFXLIB
  6.   LibName As String
  7.   GraphicsFile As String
  8. End Type
  9. Global GraphixLibs(100) As GFXLIB
  10. Global MaxLibs As Integer
  11. Sub LoadFile()
  12. Open LFile$ For Input As #1
  13. LNum = 0
  14. Do
  15.   Line Input #1, a$
  16.   If a$ = "[ENDOFFILE]" Then Exit Do
  17.   If a$ = "[GRAPHICSLIBRARYDEF]" Then
  18.     LNum = LNum + 1
  19.     Line Input #1, a$
  20.     GraphixLibs(LNum).LibName = Right$(a$, Len(a$) - 13)
  21.     Line Input #1, a$
  22.     GraphixLibs(LNum).GraphicsFile = Right$(a$, Len(a$) - 6)
  23.     Line Input #1, a$
  24.     fval$ = Right$(a$, Len(a$) - 8)
  25.   End If
  26. Loop
  27. Close #1
  28. MaxLibs = LNum
  29. End Sub
  30. Sub SaveFile()
  31. Open SFile$ For Output As #1
  32. Print #1, CURRVERSION$
  33. For i = 1 To MaxLibs
  34.   Print #1, "[GRAPHICSLIBRARYDEF]"
  35.   Print #1, "LibraryName: " & GraphixLibs(i).LibName
  36.   Print #1, "File: " & GraphixLibs(i).GraphicsFile
  37.   Print #1, "[ENDGRAPHICSLIBRARYDEF]"
  38. Next i
  39. Print #1, "[ENDOFFILE]"
  40. Close #1
  41. End Sub
  42. Sub UpdateView()
  43. currselect = Form1.List1.ListIndex
  44. Form1.List1.Clear
  45. Form1.List1.AddItem "[NewLib]"
  46. For i = 1 To MaxLibs
  47.   Form1.List1.AddItem GraphixLibs(i).LibName
  48. Next i
  49. Form1.List1.ListIndex = currselect
  50. If Form1.List1.ListIndex <> 0 Then
  51.   Form1.Text1.Text = GraphixLibs(Form1.List1.ListIndex).LibName
  52.   Form1.Text2.Text = GraphixLibs(Form1.List1.ListIndex).GraphicsFile
  53. End If
  54. End Sub
  55.