' Gambas module file

'{
Public $aNames As String[] = [
  ("Amber"),
  ("Amethyst"),
  ("Blues"),
  ("Emerald"),
  ("Gambas"),
  ("Obsidian"),
  ("Pastel"),
  ("Quest"),
  ("Quick"),
  ("Ruby"),
  ("Sapphire"),
  ("Tango"),
  ("Visual"),
  ("Zen")
]
'}

Public Sub Main()

  Dim aTheme As New String[]
  Dim sTheme As String
  Dim sData As String
  Dim iPos As Integer
  Dim iPos2 As Integer
  Dim sPath As String

  For Each sTheme In Dir("themes").Sort()
    If aTheme.Count Then aTheme.Last &= ","
    aTheme.Add("  (" & Quote(String.UCaseFirst(sTheme)) & ")")
  Next

  aTheme.Add("Public $aNames As String[] = [", 0)
  aTheme.Add("]")

  sPath = Application.Path &/ ".src/MThemeName.module"
  sData = File.Load(sPath)
  iPos = InStr(sData, "\n'{\n")
  iPos2 = InStr(sData, "\n'}\n", iPos + 1)
  sData = Left(sData, iPos + 3) & aTheme.Join("\n") & Mid(sData, iPos2)
  File.Save(sPath, sData)

End
