/** * Saves the object specified by the Dictionary parameter. * This function will always * check if an object with the name exists before it adds it. If it does * it just won't add the object. Also will check to make sure there is * still room (could become outdated functionality). */ public void SaveAll() { string toWriteToFile = (string)Json.Serialize(saveContents); saveLoader.Write(toWriteToFile); saveContents = ((Dictionary <string, System.Object>)Json.Deserialize(saveLoader.Read())); }
public void SaveOne(string name, Dictionary <string, System.Object> toSave) { string toLoadJson = saves.Read(); if (toLoadJson.Equals("")) { Dictionary <string, System.Object> toAddAdditionalTo = new Dictionary <string, object>(); toAddAdditionalTo.Add(name, toSave); saves.Write((string)Json.Serialize(toAddAdditionalTo)); } else { Dictionary <string, System.Object> toAddAdditionalTo = ((Dictionary <string, System.Object>)Json.Deserialize(toLoadJson)); toAddAdditionalTo.Add(name, toSave); string toWriteToFile = (string)Json.Serialize(toAddAdditionalTo); saves.Write(toWriteToFile); } }
public void SaveOne(Dictionary <string, System.Object> toSave) { string toWriteToFile = (string)Json.Serialize(toSave); saves.Write(toWriteToFile); }
/** * Save string to file. Will be appended. */ public void Save(string line) { directory.Write(line); }