48 lines
No EOL
781 B
Go
48 lines
No EOL
781 B
Go
package Tools
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
type RegistryEntries struct{
|
|
entries map[string]string
|
|
}
|
|
|
|
var(
|
|
Registry RegistryEntries
|
|
)
|
|
|
|
func CheckIfRegistryFileExists() bool{
|
|
_, dirErr := os.Stat("data")
|
|
_, fileErr := os.Stat("data/registry.list")
|
|
if dirErr != nil || fileErr != nil {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func parseRegistryList() map[string]string{
|
|
file, err := os.Open("data/registry.list")
|
|
if err != nil {
|
|
ErrorLogger.Fatal(err)
|
|
}
|
|
|
|
lines := make(map[string]string)
|
|
scanner := bufio.NewScanner(file)
|
|
|
|
for scanner.Scan() {
|
|
if scanner.Text()[0] != '#'{
|
|
//TODO - Implement splitter
|
|
}
|
|
}
|
|
return lines
|
|
}
|
|
|
|
func LoadRegistryList() {
|
|
if CheckIfRegistryFileExists() {
|
|
Registry.entries = parseRegistryList()
|
|
fmt.Printf(Registry.entries["0"])
|
|
}
|
|
} |