protected override void StartRun()
{
_listener = new HttpListener();
#if !UNSAFE
try
{
#endif
_listener.Prefixes.Add("http://*:" + (Settings.Instance.WebServerPort) + "/");
try
{
_listener.Start();
}
catch (HttpListenerException ex)
{
#if WINDOWS
if (ex.NativeErrorCode == 5)
{
Log.Fatal(@"TO GET XG UP AND RUNNING YOU MUST RUN 'netsh http add urlacl url=http://*:5556/ user=%USERDOMAIN%\%USERNAME%' AS ADMINISTRATOR");
}
#endif
throw;
}
var fileLoader = new FileLoader {Salt = Salt};
while (_allowRunning)
{
#if !UNSAFE
try
{
#endif
var connection = new BrowserConnection
{
Context = _listener.GetContext(),
Servers = Servers,
Files = Files,
Searches = Searches,
Snapshots = Snapshots,
FileLoader = fileLoader,
Password = Password,
Salt = Salt
};
connection.Start();
#if !UNSAFE
}
catch (HttpListenerException)
{
// this is ok
}
#endif
}
#if !UNSAFE
}
catch (HttpListenerException)
{
// this is ok
}
#endif
}