muddesigner/MudEngine/GameManagement/Log.cs
Scionwest_cp a52ccf8da9 MudEngine:
- Converted all Types from C# types to .NET Types (such as bool changed to Boolean, and int changed to Int32).
 - Zone no longer gets saved from within GameWorld.Save, but rather in Realm.Save()
 - Room no longer gets saved from within GameWorld.Save(), but rather in Zone.Save();
 - Added new SaveWorld command that admins only can execute to force save the world. It's not fully implemented at this time.

MudGame:
 - began work on command execution from within the server while it's running.
2010-08-14 00:20:43 -07:00

53 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using MudEngine.FileSystem;
namespace MudEngine.GameManagement
{
public static class Log
{
static List<String> cachedMessages = new List<String>();
public static Boolean IsVerbose;
public static void Write(String message)
{
String filename = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Root), "Log.txt");
StreamWriter sw;
if (File.Exists(filename))
sw = File.AppendText(filename);
else
sw = File.CreateText(filename);
sw.WriteLine(message);
sw.Close();
//Add to the cache so consoles can get these messages if they want to.
cachedMessages.Add(message);
}
public static String GetMessages()
{
StringBuilder sb = new StringBuilder();
foreach (String message in cachedMessages)
{
sb.AppendLine(message);
}
if ((sb.ToString() == "") || (IsVerbose))
return "";
else
return sb.ToString();
}
public static void FlushMessages()
{
cachedMessages = new List<String>();
}
}
}