Beispiel #1
0
        /// <summary>
        ///     Saves the Network Config to the specififed path
        /// </summary>
        /// <param name="path"></param>
        /// <param name="conf"></param>
        public static void Save(string path, NetworkServerConfig conf)
        {
            if (File.Exists(path))
            {
                File.Delete(path);
            }
            var cs = new XmlSerializer(typeof(NetworkServerConfig));
            var fs = new FileStream(path, FileMode.Create);

            cs.Serialize(fs, conf);
        }
Beispiel #2
0
        /// <summary>
        ///     Loads the Network Config from the specified path.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static NetworkServerConfig Load(string path = "")
        {
            var ret = new NetworkServerConfig();

            if (!File.Exists(path))
            {
                return(ret);
            }
            var cs = new XmlSerializer(typeof(NetworkServerConfig));
            var fs = new FileStream(path, FileMode.Open);

            ret = (NetworkServerConfig)cs.Deserialize(fs);

            return(ret);
        }