public MTJSONObject SerializeToJson(bool justSyncData) { MTJSONObject res = MTJSONObject.CreateDict(); res.Set("id", _id); res.Set("name", _name); res.Set("maxLevel", _maxLevel); // levels var levelsEnum = _levels.GetEnumerator(); MTJSONObject levelsJson = MTJSONObject.CreateDict(); while (levelsEnum.MoveNext()) { var current = levelsEnum.Current; levelsJson.Set(current.Key.ToString(), current.Value); } res.Set("levels", levelsJson); return(res); }
public void SaveToFile() { MTJSONObject setJs = MTJSONObject.CreateDict(); setJs.Set(SettingEnum.totalCoin.ToString(), totalCoin); setJs.Set(SettingEnum.recordCoin.ToString(), recordCoin); setJs.Set(SettingEnum.recordScore.ToString(), recordScore); setJs.Set(SettingEnum.recordBomb.ToString(), recordBomb); setJs.Set(SettingEnum.recordRound.ToString(), recordRound); setJs.Set(SettingEnum.recordMatch.ToString(), recordMatch); var bt = MTXXTea.Encrypt(setJs.ToString(), SKEY); File.WriteAllBytes(GetPath(), bt); }