|
||
|
|
#1 (permalink) |
|
Forum Newbie
Join Date: Apr 2003
Posts: 22
|
Hi all.
I was wondering if it is possible for the next release of RunUO, to have the console timestamp each line, and for this to be of a customisable format? also it would be very useful to be able to force the client to save, restart and shutdown from the console, instead of logging in via a client. Perhaps this could be done with a taskbar icon. I have seen a similar request back from 22/4/2003, but nothing much came of it, so I thought I might post my own request. thanks all. |
|
|
|
|
|
#2 (permalink) | |
|
Account Terminated
|
Quote:
![]() |
|
|
|
|
|
|
#3 (permalink) |
|
Forum Newbie
Join Date: Apr 2003
Posts: 22
|
Immensely helpful phantom...
I wouldn't know where to start with coding this. Since it is in the console, I would assume that it's written into the RunUO.exe file... Meh i'll have a look, if I create something, i'll post it |
|
|
|
|
|
#4 (permalink) |
|
Forum Expert
Join Date: Dec 2002
Posts: 730
|
This is not my code, and I really don't remeber who made it but here it is. It stamps the time on each line of the console.
Code:
using System;
using System.IO;
using System.Text;
namespace System
{
public class ConsoleHook : TextWriter
{
public override Encoding Encoding
{
get { return Encoding.ASCII; }
}
private string Timestamp
{
get { return String.Format( "{0:D2}/{1:D2}-{2:D2}:{3:D2} ",DateTime.Now.Day,DateTime.Now.Month,DateTime.Now.Hour,DateTime.Now.Minute ); }
}
private static Stream m_OldOutput;
private static bool m_Newline;
public static void Initialize()
{
m_OldOutput = Console.OpenStandardOutput();
Console.SetOut( new ConsoleHook() );
m_Newline = true;
}
public override void WriteLine( string value )
{
if ( m_Newline )
{
value = Timestamp + value;
}
byte[] data = Encoding.GetBytes( value );
m_OldOutput.Write( data,0,data.Length );
m_OldOutput.WriteByte( 10 );
m_Newline = true;
}
public override void Write( string value )
{
if ( m_Newline )
{
value = Timestamp + value;
}
byte[] data = Encoding.GetBytes( value );
m_OldOutput.Write( data,0,data.Length );
m_Newline = false;
}
}
}
|
|
|
|
|
|
#6 (permalink) | |
|
Account Terminated
|
Quote:
But my statment still is valid, |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|