37 lines
1.4 KiB
C#
37 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Pluto.Registration;
|
|
using Pluto.MSL.Api;
|
|
|
|
namespace AutoUpdater
|
|
{
|
|
class Program
|
|
{
|
|
const int SLEEP_INTERVAL_AFTER_EACH_UPDATE_CALL_TO_NOT_OVERLOAD_SERVER_IN_MS = 2000;
|
|
const int NUMBER_OF_TIMES_TO_RUN_THRU_UPDATE_LOOP_TO_MAKE_SURE_WE_UPDATED_ALL = 3;
|
|
|
|
static void Main(string[] args)
|
|
{
|
|
Client[] clients = RegistrationWrapper.GetClients();
|
|
if (clients != null)
|
|
{
|
|
for (int i = 0; i < NUMBER_OF_TIMES_TO_RUN_THRU_UPDATE_LOOP_TO_MAKE_SURE_WE_UPDATED_ALL; ++i)
|
|
{
|
|
foreach (Client client in clients)
|
|
{
|
|
bool bCanConnect = Yaulw.Net.IPHostHelper.HasConnectivity(client.host.host, (uint)client.host.port, 0);
|
|
if (bCanConnect)
|
|
{
|
|
API.SetNetworkSettings(client.host.host, (uint)client.host.port);
|
|
API.UpdateServiceIfNeeded();
|
|
System.Threading.Thread.Sleep(SLEEP_INTERVAL_AFTER_EACH_UPDATE_CALL_TO_NOT_OVERLOAD_SERVER_IN_MS);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|