예제 #1
0
        static Config()
        {
            try
            {
                if (!File.Exists("config.txt"))
                {
                    using (var sw = new StreamWriter("config.txt"))
                    {
                        sw.Write(Properties.Resources.DefaultConfig);
                    }
                }
                Default = new Config("config.txt");
            }
            catch
            {
                Default = new Config("", "config.txt");
            }

            try
            {
                if (!File.Exists("net-conf.txt"))
                {
                    using (var sw = new StreamWriter("net-conf.txt"))
                    {
                        sw.Write(Properties.Resources.DefaultNetConfig);
                    }
                }
                NetConf = new Config("net-conf.txt");
            }
            catch
            {
                NetConf = new Config("", "net-conf.txt");
            }

            try
            {
                if (!File.Exists("user-cache.txt"))
                    using (var sw = new StreamWriter("user-cache.txt"))
                    {
                        sw.Write("");
                    }
                UserCache = new Config("user-cache.txt");
            }
            catch
            {
                UserCache = new Config("", "user-cache.txt");
            }

        }
예제 #2
0
        /// <summary>
        /// Reloads the config data from the file it was originally loaded from
        /// </summary>
        public void Reload()
        {
            var newdat = new Config(_path)._data;

            foreach (var kvp in newdat)
            {
                _data[kvp.Key] = kvp.Value;
            }
        }