public static bool Write(string logContent, string classUrl, string funcName) { StringBuilder stringBuilder = new StringBuilder(); if (!string.IsNullOrEmpty(classUrl)) { stringBuilder.Append(classUrl); } if (!string.IsNullOrEmpty(funcName)) { stringBuilder.Append("/"); stringBuilder.Append(funcName); } if (!string.IsNullOrEmpty(logContent)) { if (TextLogger.WRITE_APP_LOG) { stringBuilder.Append("<br />"); } else { stringBuilder.Append("\r\n\t"); } stringBuilder.Append(logContent); } return(TextLogger.Write(stringBuilder.ToString(), "AppDebug")); }
public static List <TextLoggerEntity> GetTextLogger() { string filePath = ""; if (TextLogger.GetFileList().Count > 0) { filePath = Path.Combine(TextLogger.APP_LOG_DIRECTORY, TextLogger.GetFileList().Values[0]); } return(TextLogger.GetTextLogger(filePath)); }
public static bool DeleteFile(string path) { bool result = false; try { new FileInfo(path).Delete(); result = true; } catch (Exception ex) { TextLogger.Write(ex.ToString()); } return(result); }
public static List <TextLoggerEntity> GetTextLogger(string filePath) { List <TextLoggerEntity> list = new List <TextLoggerEntity>(); string[] array = TextLogger.LoadFile(filePath).Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[] { '|' }); list.Add(new TextLoggerEntity(DateTime.Parse(array2[0].Trim()), array2[1], array2[2], array2[3])); } return(list); }
public bool Send() { MailMessage message = new MailMessage(); Encoding displayNameEncoding = Encoding.GetEncoding("utf-8"); message.From = new MailAddress(this.From, this.Subject, displayNameEncoding); message.To.Add(this.m_recipient); message.Subject = this.Subject; message.IsBodyHtml = true; message.Body = this.Body; message.Priority = MailPriority.Normal; message.BodyEncoding = Encoding.GetEncoding("utf-8"); SmtpClient client = new SmtpClient { Host = this.MailDomain, Port = this.MailDomainPort, Credentials = new NetworkCredential(this.MailServerUserName, this.MailServerPassWord) }; if (this.MailDomainPort != 0x19) { client.EnableSsl = true; } try { if (this.IsAsync) { string userToken = "userToken"; client.SendAsync(message, userToken); } else { client.Send(message); message.Dispose(); } } catch (SmtpException exception) { string str2 = exception.Message; TextLogger.Write(exception.ToString()); return(false); } return(true); }
public static bool Write(Type cType, string funcName, string text) { return(TextLogger.Write(cType.Namespace + cType.Name, funcName, text)); }
public static bool Write(string logContent) { return(TextLogger.Write(logContent, "AppError")); }