Exemple #1
0
    private void SaveMatchesData()
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/MatchesData.md");

        MatchesData data = new MatchesData();

        data.allMatches = allMatches;

        bf.Serialize(file, data);
        file.Close();
    }
Exemple #2
0
    private void LoadMatchesData()
    {
        if (File.Exists(Application.persistentDataPath + "/MatchesData.md"))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + "/MatchesData.md", FileMode.Open);
            MatchesData     data = (MatchesData)bf.Deserialize(file);
            file.Close();

            allMatches = data.allMatches;
        }
        else
        {
            allMatches = new List <DataMatch>();
            SaveMatchesData();
        }
    }