Beispiel #1
0
 /// <summary>
 /// Write message to a file
 /// </summary>
 /// <param name="text"></param>
 /// <param name="InputStyle"></param>
 /// <param name="owner"></param>
 /// <param name="directory"></param>
 /// <param name="time"></param>
 public static void Log(string text, Client.ContentLine.MessageStyle InputStyle, Graphics.Window owner, string directory, DateTime time)
 {
     try
     {
         if (!Directory.Exists(Configuration.Logs.logs_dir))
         {
             Directory.CreateDirectory(Configuration.Logs.logs_dir);
         }
         if (!Directory.Exists(Configuration.Logs.logs_dir + Path.DirectorySeparatorChar + owner._Network.ServerName))
         {
             System.IO.Directory.CreateDirectory(Configuration.Logs.logs_dir + Path.DirectorySeparatorChar + owner._Network.ServerName);
         }
         if (!Directory.Exists(Configuration.Logs.logs_dir + Path.DirectorySeparatorChar + owner._Network.ServerName + Path.DirectorySeparatorChar + validpath(owner, directory)))
         {
             Directory.CreateDirectory(Configuration.Logs.logs_dir + Path.DirectorySeparatorChar + owner._Network.ServerName + Path.DirectorySeparatorChar + validpath(owner, directory));
         }
         if (Configuration.Logs.logs_txt)
         {
             string stamp = "";
             if (Configuration.Scrollback.chat_timestamp)
             {
                 stamp = Configuration.Scrollback.format_date.Replace("$1", time.ToString(Configuration.Scrollback.timestamp_mask));
             }
             Core.IO.InsertText(stamp + Protocol.DecodeText(Core.RemoveSpecial(text)) + "\n", _getFileName(owner, directory, time) + ".txt");
         }
         if (Configuration.Logs.logs_html)
         {
             string stamp = "";
             if (Configuration.Scrollback.chat_timestamp)
             {
                 stamp = Configuration.Scrollback.format_date.Replace("$1", time.ToString(Configuration.Scrollback.timestamp_mask));
             }
             Core.IO.InsertText("<font size=\"" + Configuration.CurrentSkin.FontSize.ToString() + "px\" face=" + Configuration.CurrentSkin.LocalFont + ">" + System.Web.HttpUtility.HtmlEncode(stamp + Protocol.DecodeText(Core.RemoveSpecial(text))) + "</font><br>\n", _getFileName(owner, directory, time) + ".html");
         }
         if (Configuration.Logs.logs_xml)
         {
             Core.IO.InsertText("<line time=\"" + time.ToBinary().ToString() + "\" style=\"" + InputStyle.ToString() + "\">" + System.Web.HttpUtility.HtmlEncode(Protocol.DecodeText(Core.RemoveSpecial(text))) + "</line>\n", _getFileName(owner, directory, time) + ".xml");
         }
     }
     catch (Exception fail)
     {
         Core.handleException(fail);
     }
 }