コード例 #1
0
        public void Add(Mobile listener, Mobile from, string speech)
        {
            SpeechLogEntry e = new SpeechLogEntry(from, DateTime.Now.ToString() + "\n" + speech);

            SpeechlogLogging.WriteLine(listener, e);
            Add(e);
        }
コード例 #2
0
ファイル: Logging.cs プロジェクト: jicomub/Temrael
        public static void WriteLine(Mobile from, SpeechLogEntry e)
        {
            try
            {
                string path = Directories.AppendPath(Directories.logs, "Speechlogs");

                Account acct = from.Account as Account;

                string name = (acct == null ? from.Name : acct.Username);

                path = Directories.AppendPath(path, from.AccessLevel.ToString());
                path = Directories.AppendPath(path, name);
                string today = Directories.FormatDay(e.Created);
                path = Path.Combine(path, String.Format("{0} {1}.log", from.Name, today));

                using (StreamWriter sw = new StreamWriter(path, true))
                    sw.WriteLine("[{0}] {1}: {2}", e.Created, SpeechlogLogging.Format(e.From), e.Speech);
            }
            catch
            {
            }
        }