1 Star 0 Fork 0

简约/govcl

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
config.go 836 Bytes
Copy Edit Raw Blame History
不在乎y authored 2020-04-18 13:24 . 1. Add a TRichEdit component.
//----------------------------------------
//
// Copyright © ying32. All Rights Reserved.
//
// Licensed under Apache License 2.0
//
//----------------------------------------
package main
import (
"encoding/json"
"io/ioutil"
"os"
"github.com/ying32/govcl/vcl/rtl"
)
type TConnConfig struct {
Name string
Host string
Port int
Password string
}
// 全局配置
var (
appConfFileName = rtl.ExtractFilePath(os.Args[0]) + "app.conf"
config = make(map[string]TConnConfig, 0)
)
func saveConfig() {
bs, err := json.Marshal(config)
if err == nil {
ioutil.WriteFile(appConfFileName, bs, 0664)
}
}
func loadConfig() {
config = make(map[string]TConnConfig, 0)
if rtl.FileExists(appConfFileName) {
bs, err := ioutil.ReadFile(appConfFileName)
if err == nil {
json.Unmarshal(bs, &config)
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/jianyue/govcl.git
git@gitee.com:jianyue/govcl.git
jianyue
govcl
govcl
v2.2.3

Search