webstatus&how to lıst names ın an order
well ı thınk tıtle explaıns all thıs ıs my webstatus.cs and what ı wanna ask ıs ıf there ıs a way to lıst names ın an order lıke fırst staffs than players or ın an alphabetıc order and so ıf there ıs how??
well ı thınk tıtle explaıns all thıs ıs my webstatus.cs and what ı wanna ask ıs ıf there ıs a way to lıst names ın an order lıke fırst staffs than players or ın an alphabetıc order and so ıf there ıs how??
Code:
using System;
using System.IO;
using System.Text;
using System.Net;
using System.Collections;
using System.Diagnostics;
using Server;
using Server.Network;
using Server.Guilds;
using Server.Items;
using Server.Accounting;
namespace Server.Misc
{
public class StatusPage : Timer
{
public string FormatTimeSpan(TimeSpan ts)
{
return String.Format("{0:D2}:{1:D2}:{2:D2}:{3:D2}", ts.Days, ts.Hours % 24, ts.Minutes % 60, ts.Seconds % 60);
}
public static string FormatByteAmount(long totalBytes)
{
if (totalBytes > 1000000000)
return String.Format("{0:F1} GB", (double)totalBytes / 1073741824);
if (totalBytes > 1000000)
return String.Format("{0:F1} MB", (double)totalBytes / 1048576);
if (totalBytes > 1000)
return String.Format("{0:F1} KB", (double)totalBytes / 1024);
return String.Format("{0} Bytes", totalBytes);
}
public static void Initialize()
{
new StatusPage().Start();
}
public StatusPage()
: base(TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(10.0))
{
Priority = TimerPriority.FiveSeconds;
}
private static string Encode(string input)
{
StringBuilder sb = new StringBuilder(input);
sb.Replace("&", "&");
sb.Replace("<", "<");
sb.Replace(">", ">");
sb.Replace("\"", """);
sb.Replace("'", "'");
return sb.ToString();
}
protected override void OnTick()
{
DateTime now = DateTime.Now;
if (!Directory.Exists("web"))
Directory.CreateDirectory("web");
using (StreamWriter op = new StreamWriter("c:/Inetpub/vhosts/realmofdestiny.net/httpdocs/status.html"))
{
op.WriteLine("<html>");
op.WriteLine(" <head>");
op.WriteLine(" <br><p align=\"center\"><img align=\"center\" border=\"2\" border-color=\"FFFFFF\" src=\"http://img18.imageshack.us/img18/3092/logoa3xs.gif\" </p>");
op.WriteLine(" <title>Renovatio Server Status</title>");
op.WriteLine(" </head>");
op.WriteLine(" <body bgcolor=\"black\">");
op.WriteLine(" <h1><font color=\"steelblue\">Renovatio UO Server Status</h1>");
op.WriteLine(" <table>");
op.WriteLine(" <tr><td nowrap width=\"5%\"><font face=\"Verdana\" size=\"2\" color=\"maroon\"><b>Date & Time:</b> </font></td><td width=\"95%\"><font face=\"Verdana,Arial,Helvetica,sans-serif\" color=\"silver\" size=\"2\"><b>{0}</b></font></td></tr>", DateTime.Now.ToString());
op.WriteLine(" <tr><td nowrap width=\"5%\"><font face=\"Verdana\" size=\"2\" color=\"maroon\"><b>Uptime:</b> </font></td><td width=\"95%\"><font face=\"Verdana,Arial,Helvetica,sans-serif\" color=\"silver\" size=\"2\"><b>{0}</b></font></td></tr>", FormatTimeSpan(DateTime.Now - Clock.ServerStart));
op.WriteLine(" <tr><td nowrap width=\"5%\"><font face=\"Verdana\" size=\"2\" color=\"maroon\"><b>Memory:</b> </font></td><td width=\"95%\"><font face=\"Verdana,Arial,Helvetica,sans-serif\" color=\"silver\" size=\"2\"><b>{0}</b></font></td></tr>", FormatByteAmount(GC.GetTotalMemory(false)));
op.WriteLine(" <tr><td width=\"5%\" height=\"15\"></td><td width=\"95%\" height=\"15\"></td></tr>");
op.WriteLine(" <tr><td nowrap width=\"5%\"><font face=\"Verdana\" size=\"2\" color=\"maroon\"><b>Mobiles:</b> </font></td><td width=\"95%\"><font face=\"Verdana,Arial,Helvetica,sans-serif\" color=\"silver\" size=\"2\"><b>{0}</b></font></td></tr>", World.Mobiles.Count.ToString());
op.WriteLine(" <tr><td nowrap width=\"5%\"><font face=\"Verdana\" size=\"2\" color=\"maroon\"><b>Items:</b> </font></td><td width=\"95%\"><font face=\"Verdana,Arial,Helvetica,sans-serif\" color=\"silver\" size=\"2\"><b>{0}</b></font></td></tr>", World.Items.Count.ToString());
//op.WriteLine(" <tr><td nowrap width=\"5%\"><font face=\"Verdana\" size=\"2\" color=\"maroon\"><b>Moon Phase:</b> </font></td><td width=\"95%\"><font face=\"Verdana,Arial,Helvetica,sans-serif\" color=\"silver\" size=\"2\"><b>{0}</b></font></td></tr>", now.Hour.ToString());
op.WriteLine(" </table>");
op.WriteLine(" <table>");
op.WriteLine(" <tr><td width=\"5%\" height=\"15\"></td><td width=\"95%\" height=\"15\"></td></tr>");
op.WriteLine(" <tr><td nowrap width=\"5%\"><font face=\"Verdana\" size=\"2\" color=\"steelblue\"><b>Online clients:</b> </font></td><td width=\"95%\"><font face=\"Verdana,Arial,Helvetica,sans-serif\" color=\"goldenrod\" size=\"2\"><b>{0}</b></font></td></tr>", NetState.Instances.Count.ToString());
op.WriteLine(" <table>");
op.WriteLine(" <table width=\"100%\">");
op.WriteLine(" <tr>");
op.WriteLine(" <td bgcolor=\"maroon\"><font color=\"silver\"><b>Name</b></font></td><td bgcolor=\"maroon\"><font color=\"silver\"><b>Location</b></font></td><td bgcolor=\"maroon\"><font color=\"silver\"><b>Kills</b></font></td><td bgcolor=\"maroon\"><font color=\"silver\"><b>Karma / Fame</b></font></td>");
op.WriteLine(" </tr>");
op.WriteLine(" <font color=\"white\">");
foreach (NetState state in NetState.Instances)
{
Mobile m = state.Mobile;
if (m != null)
{
Guild g = m.Guild as Guild;
op.Write(" <tr><td><b><font color=\"white\">");
if (g != null)
{
op.Write("<font color=\"white\">" + Encode(m.Name));
op.Write(" [");
string title = m.GuildTitle;
if (title != null)
title = title.Trim();
else
title = "";
if (title.Length > 0)
{
op.Write(Encode(title));
op.Write(", ");
}
op.Write(Encode(g.Abbreviation));
op.Write(']');
}
else
{
op.Write( Encode( m.Name ) );
}
op.Write("</b></td><td><font color=\"white\">");
op.Write("<b>");
if ( m.Region != null )
{
op.Write(m.Region.ToString());
}
else
{
op.Write("in Britannia");
}
op.Write("</b></td><td><b><font color=\"white\">");
op.Write(m.Kills);
op.Write("</b></td><td><b><font color=\"white\">" );
op.Write(m.Karma);
op.Write(" / ");
op.Write(m.Fame);
op.WriteLine("<b></td></tr><font color=\"white\">" );
}
}
op.WriteLine(" <tr>");
op.WriteLine(" </table>");
op.WriteLine(" </body>");
op.WriteLine("</html>");
}
}
}
}