Exemplo n.º 1
0
        public static Settings Load()
        {
            try
            {
                return((Settings)DataContractHelper.LoadFromXml(typeof(Settings), StandardPaths.SettingsFile));
            }
            catch (System.Exception e)
            {
                string message = string.Format("Failed to load settings.\n{0}", e.Message);
                Log.Error(message);

                return(new Settings());
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// NOTE: filePath is relative to the base puzzle directory.
        /// </summary>
        public static PuzzleConfig Load(string filePath)
        {
            try
            {
                string fullPath = Path.GetFullPath(Path.Combine(StandardPaths.ConfigDir, filePath));
                return((PuzzleConfig)DataContractHelper.LoadFromXml(typeof(PuzzleConfig), fullPath));
            }
            catch (System.Exception e)
            {
                string message = string.Format("Failed to load puzzle config.\n{0}", e.Message);
                Log.Error(message);

                return(new PuzzleConfig());
            }
        }