/// <summary> /// Allows to initialize the object from the gived path /// </summary> /// <param name="path">The file's path</param> /// <author>Quijada Romero Luis Gonzalo</author> /// public DataFileManager(String path, String password = null) { this.fileSource = path; this.password = password; try { String encrypted = System.IO.File.ReadAllText(path); if (password == null) { this.dataString = encrypted; } else { this.dataString = BiEncrypt.Decrypt(encrypted, password); } } catch (Exception e) { this.dataString = null; } try { this.dataObject = new DataJson(dataString); } catch (Exception e) { this.dataObject = null; } }
/// <summary> /// Allows to set the data for saving a new string into a file /// </summary> /// <param name="JsonData"></param> /// <author>Quijada Romero Luis Gonzalo</author> public void SetData(String JsonData) { try { dataString = JsonData; dataObject = new DataJson(JsonData); } catch (Exception e) { dataString = null; dataObject = null; } }