public bool WrieFile(FileContentWrite fileContentWrite) { var fileName = fileContentWrite.FileName; string path = Path.Combine(Constraint.AppDataDir, fileName); if (!Directory.Exists(Constraint.AppDataDir)) { Directory.CreateDirectory(Constraint.AppDataDir); } if (!File.Exists(path)) { File.Create(path).Dispose(); } using (StreamWriter streamWriter = new StreamWriter(path, false)) { streamWriter.Write(fileContentWrite.ContentFile); } return(true); }
public bool WriteDbInfo(DatabaseInfo dbInfo) { if (dbInfo == null) { return(false); } string info = ConvertDbInfoToJson(dbInfo); string directory = Constraint.AppDirectoryFolder; string path = Constraint.fileConnection; string fileName = System.IO.Path.Combine(directory, path); IFile ifile = new FileHandler(); FileContentWrite fileContentWrite = new FileContentWrite { ContentFile = info, FileName = fileName }; ifile.WrieFile(fileContentWrite); return(true); }