public void LoadAdsData() { adsSettings = new AdsSetting[1] { new AdsSetting() }; //We should load ads setting from a json file adsFullCondition = new AdsFullCondition(); //We should load ads setting from a json file if (File.Exists(dataPath)) { BinaryFormatter binaryFormatter = new BinaryFormatter(); string data; using (FileStream fileStream = File.Open(dataPath, FileMode.Open)) { try { data = (string)binaryFormatter.Deserialize(fileStream); adsDataCollection = JsonUtility.FromJson <AdsDataCollection>(data); } catch (System.Exception e) { Debug.LogError(e.Message); ResetData(); } } } else { ResetData(); } adsDataCollection.UpdateAdsCollection(adsSettings); }
private void ResetData() { adsDataCollection = new AdsDataCollection(adsSettings); SaveAdsData(); }