Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }