bool ConnectToServer(BuildContext ctx) { try { if (ctx.Connect()) { ctx.Connected = true; return(true); } else { if (ctx.FirstNotAuthorised) { LogService.WriteLine("ERROR: Connection to server not authorized."); LogService.WriteLine("To enable connections from this service, go to the administration page"); LogService.WriteLine("in the server and click on the Change Service option."); ctx.FirstNotAuthorised = false; } else { LogService.WriteLine("Connection not authorized. Trying again."); } } } catch (Exception ex) { LogService.WriteLine("Connection failed: " + ex.Message); } ctx.Connected = false; return(false); }
bool ConnectToServer(BuildContext ctx) { try { if (ctx.Connect ()) { ctx.Connected = true; return true; } else { if (ctx.FirstNotAuthorised) { Console.WriteLine ("ERROR: Connection to server not authorized."); Console.WriteLine ("To enable connections from this service, go to the administration page"); Console.WriteLine ("in the server and click on the Change Service option."); ctx.FirstNotAuthorised = false; } else Console.WriteLine ("Connection not authorized. Trying again."); } } catch (Exception ex) { Console.WriteLine ("Connection failed: " + ex.Message); } ctx.Connected = false; return false; }