MTMCL.Customize.TileColor.Load C# (CSharp) Method

Load() public static method

public static Load ( string file ) : TileColor
file string
return TileColor
        public static TileColor Load(string file)
        {
            if (!File.Exists(file))
                return new TileColor();
            try
            {
                //var fs = new FileStream(file, FileMode.Open);
                var ser = new DataContractSerializer(typeof(TileColor));
                ///for json
                var cfg = JsonConvert.DeserializeObject<TileColor>(File.ReadAllText(file));
                ///for xml
                //var cfg = (Config)ser.ReadObject(fs);
                //fs.Close();
                return cfg;
            }
            catch (UnauthorizedAccessException e)
            {
                Logger.log(e);
                return new TileColor();
            }
            catch (Exception e)
            {
                Logger.log(e);
                //MessageBox.Show("errer occurred when loading the config file, try to use default config.");
                return new TileColor();
            }
        }