// ================================================================================= /// Writes using JSON pretty print the given object into the file at the given path. /// /// @param filePath The file path in which to write. /// @param fileData An object to be encoded in JSON format. /// @return _true_ if the file was written. _false_ otherwise. /// public static bool PrettyWrite(string filePath, System.Object fileData) { var jsonRoot = JObject.Build(fileData); var jsonData = JSONPrettyPrint.Print(jsonRoot.Encode(), 80); return(TextFileUtils.WriteFile(filePath, jsonData)); }
// ================================================================================= /// Writes the given object into the file at the given path. /// /// @param filePath The file path in which to write. /// @param fileData An object to be encoded in JSON format. /// @return _true_ if the file was written. _false_ otherwise. /// public static bool Write(string filePath, System.Object fileData) { var jsonRoot = JObject.Build(fileData); var jsonData = jsonRoot.Encode(); return(TextFileUtils.WriteFile(filePath, jsonData)); }
// ---------------------------------------------------------------------- /// Writes or overwrites the CSharp code file. /// /// @param folderPath The absolute path of the code generation folder. /// @param className The name of the type/file. /// @param code The code to be put into the file. /// public static void WriteCSharpFile(string folderPath, string className, string code) { var filePath = folderPath + "/" + className + kFileExtension; TextFileUtils.WriteFile(filePath, code); }