2024年5月27日发(作者:)
daos_
package daosconfig
import (
"bufio"
"io"
"os"
"strings"
)
type Config struct {
Mymap map[string]string
strcet string
}
func (c *Config) InitConfig(path string) {
= make(map[string]string)
f, err := (path)
if err != nil {
panic(err)
}
defer ()
r := der(f)
for {
b, _, err := ne()
if err != nil {
if err == {
break
}
panic(err)
}
s := ace(string(b))
if (s, "#") == 0 {
continue
}
n1 := (s, "[")
n2 := dex(s, "]")
if n1 > -1 && n2 > -1 && n2 > n1+1 {
= ace(s[n1+1 : n2])
continue
}
if len() == 0 {
continue
}
index := (s, "=")
if index < 0 {
continue
}
frist := ace(s[:index])
if len(frist) == 0 {
continue
}
second := ace(s[index+1:])
pos := (second, "t#")
if pos > -1 {
second = second[0:pos]
}
pos = (second, " #")
if pos > -1 {
second = second[0:pos]
}
pos = (second, "t//")
if pos > -1 {
second = second[0:pos]
}
pos = (second, " //")
if pos > -1 {
second = second[0:pos]
}
if len(second) == 0 {
continue
}
key := + "=" + frist
[key] = ace(second)
}
}
func (c Config) Read(node, key string) string {
key = node + "=" + key


发布评论