示例#1
0
 public static void Initialize(Config config)
 {
     conn = new MySqlConnection(
         String.Format("Server={0};Port={1};Database={2};Uid={3};Pwd={4};",
         config.DatabaseHost,
         config.DatabasePort,
         config.DatabaseName,
         config.DatabaseUser,
         config.DatabasePassword));
 }
示例#2
0
文件: Config.cs 项目: oxykidz/RiceEmu
        public static Config Load(string path = "config.json")
        {
            Config config;

            if (File.Exists(configPath))
            {
                Log.WriteLine("Config file exists, loading.");

                string json = File.ReadAllText(configPath);
                config = JsonConvert.DeserializeObject<Config>(json);
            }
            else
            {
                Log.WriteLine("Config file could not be found, creating.");

                config = new Config();
                config.Save();
            }

            return config;
        }