Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -5,68 +5,69 @@ using Server.Network;
|
|||
|
||||
namespace Server.Engines.MyRunUO
|
||||
{
|
||||
public class MyRunUOStatus
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
if ( Config.Enabled )
|
||||
{
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 20.0 ), Config.StatusUpdateInterval, Begin );
|
||||
public class MyRunUOStatus
|
||||
{
|
||||
private static DatabaseCommandQueue m_Command;
|
||||
|
||||
CommandSystem.Register( "UpdateWebStatus", AccessLevel.Administrator, UpdateWebStatus_OnCommand );
|
||||
}
|
||||
}
|
||||
public static void Initialize()
|
||||
{
|
||||
if (Config.Enabled)
|
||||
{
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(20.0), Config.StatusUpdateInterval, Begin);
|
||||
|
||||
[Usage( "UpdateWebStatus" )]
|
||||
[Description( "Starts the process of updating the MyRunUO online status database." )]
|
||||
public static void UpdateWebStatus_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
if ( m_Command == null || m_Command.HasCompleted )
|
||||
{
|
||||
Begin();
|
||||
e.Mobile.SendMessage( "Web status update process has been started." );
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Mobile.SendMessage( "Web status database is already being updated." );
|
||||
}
|
||||
}
|
||||
CommandSystem.Register("UpdateWebStatus", AccessLevel.Administrator, UpdateWebStatus_OnCommand);
|
||||
}
|
||||
}
|
||||
|
||||
private static DatabaseCommandQueue m_Command;
|
||||
[Usage("UpdateWebStatus")]
|
||||
[Description("Starts the process of updating the MyRunUO online status database.")]
|
||||
public static void UpdateWebStatus_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
if (m_Command == null || m_Command.HasCompleted)
|
||||
{
|
||||
Begin();
|
||||
e.Mobile.SendMessage("Web status update process has been started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Mobile.SendMessage("Web status database is already being updated.");
|
||||
}
|
||||
}
|
||||
|
||||
public static void Begin()
|
||||
{
|
||||
if ( m_Command != null && !m_Command.HasCompleted )
|
||||
return;
|
||||
public static void Begin()
|
||||
{
|
||||
if (m_Command != null && !m_Command.HasCompleted)
|
||||
return;
|
||||
|
||||
DateTime start = DateTime.UtcNow;
|
||||
Console.WriteLine( "MyRunUO: Updating status database" );
|
||||
DateTime start = DateTime.UtcNow;
|
||||
Console.WriteLine("MyRunUO: Updating status database");
|
||||
|
||||
try
|
||||
{
|
||||
m_Command = new DatabaseCommandQueue( "MyRunUO: Status database updated in {0:F1} seconds", "MyRunUO Status Database Thread" );
|
||||
try
|
||||
{
|
||||
m_Command = new DatabaseCommandQueue("MyRunUO: Status database updated in {0:F1} seconds",
|
||||
"MyRunUO Status Database Thread");
|
||||
|
||||
m_Command.Enqueue( "DELETE FROM myrunuo_status" );
|
||||
m_Command.Enqueue("DELETE FROM myrunuo_status");
|
||||
|
||||
List<NetState> online = NetState.Instances;
|
||||
List<NetState> online = NetState.Instances;
|
||||
|
||||
for ( int i = 0; i < online.Count; ++i )
|
||||
{
|
||||
NetState ns = online[i];
|
||||
Mobile mob = ns.Mobile;
|
||||
for (int i = 0; i < online.Count; ++i)
|
||||
{
|
||||
NetState ns = online[i];
|
||||
Mobile mob = ns.Mobile;
|
||||
|
||||
if ( mob != null )
|
||||
m_Command.Enqueue(
|
||||
$"INSERT INTO myrunuo_status (char_id) VALUES ({mob.Serial.Value.ToString()})");
|
||||
}
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
Console.WriteLine( "MyRunUO: Error updating status database" );
|
||||
Console.WriteLine( e );
|
||||
}
|
||||
if (mob != null)
|
||||
m_Command.Enqueue(
|
||||
$"INSERT INTO myrunuo_status (char_id) VALUES ({mob.Serial.Value.ToString()})");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("MyRunUO: Error updating status database");
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
|
||||
m_Command?.Enqueue( null );
|
||||
}
|
||||
}
|
||||
m_Command?.Enqueue(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue