public static void WriteLog(string text, LogType logType) { DateTime now = DateTime.Now; string strDate = now.ToLongDateString(); string strTime = now.ToLongTimeString(); string strLogType = Enum.GetName(typeof(LogType), logType).PadRight(6, ' '); string total = strDate + " " + strTime + "\t" + strLogType + "\t" + text + "\r\n"; TextStreamClass.Append("./" + logFile, total); }
public Property GetProperties() { if (!CheckFileExist()) { CreateEmptyFile(); } string json = TextStreamClass.Read("./" + propertyJSON); JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings() { Formatting = Formatting.Indented, StringEscapeHandling = StringEscapeHandling.EscapeNonAscii }; Property p = JsonConvert.DeserializeObject <Property>(json, jsonSerializerSettings); return(p); }
private void CreateEmptyFile() { Property p = new Property() { ExcelPath = "", OracleDb = "", OraclePassword = "", OracleUsername = "", TableRelations = new TableRelation[1] { new TableRelation() { ExcelTablename = "", OracleTablename = "", FieldRelations = new FieldRelation[1] { new FieldRelation() { ExcelField = "", OracleField = "" } } } } }; string json = JsonConvert.SerializeObject(p, new JsonSerializerSettings() { Formatting = Formatting.Indented, StringEscapeHandling = StringEscapeHandling.EscapeNonAscii }); TextStreamClass.Write("./" + propertyJSON, json); }