46 lines
No EOL
697 B
Go
46 lines
No EOL
697 B
Go
package Tools
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
type RegistryList struct {
|
|
Registries []string
|
|
}
|
|
|
|
func CheckIfRegistryFileExists() bool{
|
|
_, dirErr := os.Stat("data")
|
|
_, fileErr := os.Stat("data/registry.list")
|
|
if dirErr != nil || fileErr != nil {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func parseRegistryList() []string{
|
|
file, err := os.Open("data/registry.list")
|
|
if err != nil {
|
|
ErrorLogger.Fatal(err)
|
|
}
|
|
|
|
lines := make([]string, 512)
|
|
scanner := bufio.NewScanner(file)
|
|
|
|
i := 0
|
|
for scanner.Scan() {
|
|
if scanner.Text()[0] != '#'{
|
|
lines[i] = scanner.Text()
|
|
i++
|
|
}
|
|
}
|
|
return lines
|
|
}
|
|
|
|
func LoadRegistryList(){
|
|
if CheckIfRegistryFileExists(){
|
|
|
|
registries := parseRegistryList()
|
|
}
|
|
} |