public SaveResult Save(AConnection oDB, int nBrowserVersionID, string sRemoteIP, string sSessionCookie) { var oResult = new SaveResult(id); if (data != null) { foreach (UiActionEventModel oEvt in data) { oResult.Add(oEvt.eventID, oEvt.Save(oDB, nBrowserVersionID, sRemoteIP, sSessionCookie)); } } return(oResult); } // Save
public static SaveResult Save(string fullPath, string filename, object objectToSave, bool scramble = false, bool encode = false, string extension = "") { SaveResult result = 0; //Check input if (objectToSave == null) { Debug.LogWarningFormat("{0}Object you are trying to save is NULL! Aborting... (\"{1}\")", TAG, fullPath); result = result.Add(SaveResult.NullObject); return(result); } //Check Path if (string.IsNullOrEmpty(fullPath)) { Debug.LogWarningFormat("{0}Invalid path! Aborting...", TAG); result = result.Add(SaveResult.NullPath); return(result); } if (!Directory.Exists(fullPath)) { Directory.CreateDirectory(fullPath); result = result.Add(SaveResult.DirectoryCreated); } var json = JsonUtility.ToJson(objectToSave); json = (encode) ? DataUtility.EncodeTo64(json) : json; json = (scramble) ? DataUtility.Scramble(json) : json; File.WriteAllText(fullPath + "/" + filename + "." + extension, json); result = result.Add(SaveResult.Done); Debug.LogFormat("{0}File \"{1}\" saved successfully!", TAG, fullPath + "/" + filename + "." + extension); return(result); }