示例#1
0
        public void SaveData()
        {
            string json         = Serialaizer.GetInstance().Serialize(instance);
            var    streamWriter = new StreamWriter(matchDataPath);

            streamWriter.Write(json);
            streamWriter.Close();
        }
示例#2
0
 public static Serialaizer GetInstance()
 {
     if (instance == null)
     {
         instance = new Serialaizer();
     }
     return(instance);
 }
示例#3
0
        public Match GetMatch()
        {
            string json;
            var    streamReader = new StreamReader(matchDataPath);

            json = streamReader.ReadToEnd();
            var match = Serialaizer.GetInstance().Deserialize(json);

            streamReader.Close();

            return(match);
        }
示例#4
0
        public void LoadData()
        {
            var    streamReader = new StreamReader(matchDataPath);
            string json         = streamReader.ReadToEnd();
            var    data         = Serialaizer.GetInstance().DeserializeData(json);

            streamReader.Close();
            if (data != null)
            {
                instance = data;
            }
        }