Go Back   RunUO - Ultima Online Emulation > RunUO > New Join Forum

New Join Forum So your new to RunUO and looking to work with people that are new, this is the place.

Reply
 
Thread Tools Display Modes
Old 03-31-2004, 05:35 PM   #1 (permalink)
Supremeone
Guest
 
Posts: n/a
Default WebStatus.cs Help

any one know how to make this html file save in a diffrent folder?
  Reply With Quote
Old 03-31-2004, 07:53 PM   #2 (permalink)
Hmmmmm...
 
Join Date: Feb 2004
Age: 37
Posts: 8
Send a message via ICQ to purplebear
Default

It looks like you would just need to change three lines(39, 40 and 42) from this:

Code:
		protected override void OnTick()
		{
			if ( !Directory.Exists( "web" ) )
				Directory.CreateDirectory( "web" );

			using ( StreamWriter op = new StreamWriter( "web/status.html" ) )
To something like:

Code:
		protected override void OnTick()
		{
			if ( !Directory.Exists( "C:/Inetpub/wwwroot" ) )
				Directory.CreateDirectory( "C:/Inetpub/wwwroot" );

			using ( StreamWriter op = new StreamWriter( "C:/Inetpub/wwwroot/status.html" ) )
purplebear is offline   Reply With Quote
Old 03-31-2004, 11:38 PM   #3 (permalink)
Supremeone
Guest
 
Posts: n/a
Default

i tryed something very simular to this and it didnt work... ill try this when no on isonline on my shard


This does not work... (i know how to ge this working but i dont want the runuo program avalable to the web if they get ahold of info.
  Reply With Quote
Old 04-01-2004, 09:53 PM   #4 (permalink)
Hmmmmm...
 
Join Date: Feb 2004
Age: 37
Posts: 8
Send a message via ICQ to purplebear
Default

Here is the exact script I am running on my test server now. I modified it to have two strings that can be set near the top of the file for the path and filename.


Code:
using System;
using System.IO;
using System.Text;
using System.Collections;

using Server;
using Server.Network;
using Server.Guilds;

namespace Server.Misc
{
	public class StatusPage : Timer
	{
		public const string BaseDir = "C:/InetPub/wwwroot"; // Must use slash (/) not backslash (\) in path

		public const string FileName = "status.html";

		public static void Initialize()
		{
			new StatusPage().Start();
		}

		public StatusPage() : base( TimeSpan.FromSeconds( 5.0 ), TimeSpan.FromSeconds( 60.0 ) )
		{
			Priority = TimerPriority.FiveSeconds;
		}

		private static string Encode( string input )
		{
			StringBuilder sb = new StringBuilder( input );

			sb.Replace( "&", "&" );
			sb.Replace( "<", "&lt;" );
			sb.Replace( ">", "&gt;" );
			sb.Replace( "\"", "&quot;" );
			sb.Replace( "'", "&apos;" );

			return sb.ToString();
		}

		protected override void OnTick()
		{
			if ( !Directory.Exists( BaseDir ) )
				Directory.CreateDirectory( BaseDir );

			using ( StreamWriter op = new StreamWriter( BaseDir + "/" + FileName ) )
			{
				op.WriteLine( "<html>" );
				op.WriteLine( "   <head>" );
				op.WriteLine( "      <title>RunUO Server Status</title>");
				op.WriteLine( "   </head>" );
				op.WriteLine( "   <body bgcolor=\"white\">" );
				op.WriteLine( "      <h1>RunUO Server Status</h1>" );
				op.WriteLine( "      Online clients:<br>" );
				op.WriteLine( "      <table width=\"100%\">" );
				op.WriteLine( "         <tr>" );
				op.WriteLine( "            <td bgcolor=\"black\"><font color=\"white\">Name</font></td><td bgcolor=\"black\"><font color=\"white\">Location</font></td><td bgcolor=\"black\"><font color=\"white\">Kills</font></td><td bgcolor=\"black\"><font color=\"white\">Karma / Fame</font></td>" );
				op.WriteLine( "         </tr>" );

				foreach ( NetState state in NetState.Instances )
				{
					Mobile m = state.Mobile;

					if ( m != null )
					{
						Guild g = m.Guild;

						op.Write( "         <tr><td>" );

						if ( g != null )
						{
							op.Write( 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( "</td><td>" );
						op.Write( m.X );
						op.Write( ", " );
						op.Write( m.Y );
						op.Write( ", " );
						op.Write( m.Z );
						op.Write( " (" );
						op.Write( m.Map );
						op.Write( ")</td><td>" );
						op.Write( m.Kills );
						op.Write( "</td><td>" );
						op.Write( m.Karma );
						op.Write( " / " );
						op.Write( m.Fame );
						op.WriteLine( "</td></tr>" );
					}
				}

				op.WriteLine( "         <tr>" );
				op.WriteLine( "      </table>" );
				op.WriteLine( "   </body>" );
				op.WriteLine( "</html>" );
			}
		}
	}
}
purplebear is offline   Reply With Quote
Old 06-06-2004, 11:18 PM   #5 (permalink)
Forum Expert
 
cfaust's Avatar
 
Join Date: Jul 2003
Location: Shreveport, LA
Age: 39
Posts: 426
Send a message via ICQ to cfaust Send a message via AIM to cfaust Send a message via MSN to cfaust
Default

Supremeone, that script change posted by purplebear does work, I'm using it myself.
__________________
USAF [July 17, 1989 - Current]
cfaust is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5