public void BuildPath() { saveLoader.Write((string)Json.Serialize(new Dictionary <string, System.Object> ())); string toLoadJson = saveLoader.Read(); saveContents = ((Dictionary <string, System.Object>)Json.Deserialize(toLoadJson)); string toLoadDef = defaultLoader.ReadDefault(); defaultContent = ((Dictionary <string, System.Object>)Json.Deserialize(toLoadDef)); }
public Dictionary <string, System.Object> LoadOne() { string toLoadJson = saves.Read(); Dictionary <string, System.Object> savedDictionary = (Dictionary <string, System.Object>)Json.Deserialize(toLoadJson); string toCompareJson = defaults.ReadDefault(); Dictionary <string, System.Object> toCompare = (Dictionary <string, System.Object>)Json.Deserialize(toCompareJson); return(savedDictionary); }
/* * Simple constructor. */ public MarineDAO(iFileLoader saveLoader, iFileLoader defaultLoader) { this.saveLoader = saveLoader; this.defaultLoader = defaultLoader; string toLoadJson = saveLoader.Read(); //.Read() will return ERROR if the file does not exist. If this is the case //then we will wait for saveContents to get set in the BuildFilePath() function which //is predictably called before any DAO's are used. In the other case we are using the //save files which DO exist and so saveContents will get set here. if (!toLoadJson.Equals("ERROR")) { saveContents = ((Dictionary <string, System.Object>)Json.Deserialize(toLoadJson)); } string toLoadDef = defaultLoader.ReadDefault(); if (!toLoadDef.Equals("ERROR")) { defaultContent = ((Dictionary <string, System.Object>)Json.Deserialize(toLoadDef)); } }