public static void Init() { Items = new List <ItemAsset>(); ItemsMap = new Dictionary <string, ItemAsset>(); Asset[] assets = Assets.find(EAssetType.ITEM); foreach (Asset asset in assets) { Items.Add((ItemAsset)asset); string namelow = asset.name.ToLower(); if (ItemsMap.ContainsKey(namelow)) { SysConsole.Output(OutputType.INIT, "MINOR: multiple item assets named " + namelow); continue; } ItemsMap.Add(namelow, (ItemAsset)asset); EntityType.ITEMS.Add(namelow, new EntityType(asset.name, EntityAssetType.ITEM)); } SysConsole.Output(OutputType.INIT, "Loaded " + Items.Count + " base items!"); }
public override bool ParseBytesAndExecute(byte[] data) { if (data.Length < 16) { SysConsole.Output(OutputType.WARNING, "Got chunk info packet of size: " + data.Length); return(false); } DataStream ds = new DataStream(data); DataReader dr = new DataReader(ds); int x = dr.ReadInt(); int y = dr.ReadInt(); int z = dr.ReadInt(); int posMult = dr.ReadInt(); double prio = (new Location(x, y, z) * Chunk.CHUNK_SIZE).DistanceSquared(TheClient.Player.GetPosition()); lock (TheClient.TheRegion.PreppingNow) { TheClient.TheRegion.PrepChunks.Enqueue(() => { lock (TheClient.TheRegion.PreppingNow) { TheClient.TheRegion.PreppingNow.Add(new Vector3i(x, y, z)); } TheClient.Schedule.StartASyncTask(() => { try { ParseData(data, dr, x, y, z, posMult); } catch (Exception ex) { Utilities.CheckException(ex); SysConsole.Output(ex); lock (TheClient.TheRegion.PreppingNow) { TheClient.TheRegion.PreppingNow.Remove(new Vector3i(x, y, z)); } } }); }, prio); } return(true); }
/// <summary> /// Send a packet along the primary socket. /// </summary> /// <param name="packet">The packet to send</param> public void Send(AbstractPacketOut packet) { try { byte[] data = new byte[packet.Data.Length + 5]; BitConverter.GetBytes(packet.Data.Length).CopyTo(data, 0); data[4] = packet.ID; packet.Data.CopyTo(data, 5); Network.InternalSocket.Send(data); } catch (Exception ex) { if (!tdisco) { SysConsole.Output(OutputType.ERROR, "Error sending packet to player: " + ex.ToString()); Kick("Error sending packet"); } } }
/// <summary> /// Fired when the entity is spawned. /// </summary> public override void OnSpawn() { if (Entity.Engine is GameEngine2D eng) { ActualLight = new PointLight2D(LightPosition, LightStrength, LightSDScale, eng) { Color = LightColor, ShouldShadow = CastShadow, ExtraLightDist = LightExtraDist, IsSkyLight = IsSkyLight }; eng.Lights.Add(ActualLight); Entity.OnPositionChanged += FixPosition; } else { SysConsole.Output(OutputType.WARNING, "2D light spawned into a non-2D-engine-based game!"); } }
public BlockGroupEntity(Region tregion, BGETraceMode mode, BlockInternal[] blocks, int xwidth, int ywidth, int zwidth, Location sOffs) : base(tregion, true, true) { SetMass(blocks.Length); XWidth = xwidth; YWidth = ywidth; ZWidth = zwidth; Blocks = blocks; TraceMode = mode; if (TraceMode == BGETraceMode.PERFECT) { Shape = new MobileChunkShape(new Vector3i(xwidth, ywidth, zwidth), blocks, out Vector3 shoffs); } else { Shape = CalculateHullShape(out shapeOffs); } SysConsole.Output(OutputType.INFO, "Shape offs : " + shapeOffs + " vs " + sOffs); shapeOffs = sOffs; }
public override bool ParseBytesAndExecute(byte[] data) { if (data.Length < 16) { SysConsole.Output(OutputType.WARNING, "Got chunk info packet of size: " + data.Length); return(false); } DataStream ds = new DataStream(data); DataReader dr = new DataReader(ds); int x = dr.ReadInt(); int y = dr.ReadInt(); int z = dr.ReadInt(); int posMult = dr.ReadInt(); lock (TheClient.TheRegion.PreppingNow) { Action act = () => { lock (TheClient.TheRegion.PreppingNow) { TheClient.TheRegion.PreppingNow.Add(new Vector3i(x, y, z)); } TheClient.Schedule.StartAsyncTask(() => { try { ParseData(data, dr, x, y, z, posMult); } catch (Exception ex) { Utilities.CheckException(ex); SysConsole.Output(ex); lock (TheClient.TheRegion.PreppingNow) { TheClient.TheRegion.PreppingNow.Remove(new Vector3i(x, y, z)); } } }); }; TheClient.TheRegion.PrepChunks.Add(new KeyValuePair <Vector3i, Action>(new Vector3i(x, y, z), act)); } return(true); }
/// <summary> /// Loads the chunk from save data. /// </summary> /// <param name="det">The block data.</param> /// <param name="ents">The entity data.</param> public void LoadFromSaveData(ChunkDetails det, ChunkDetails ents) { if (det.Version != 2 || ents.Version != 2) { throw new Exception("invalid save data VERSION: " + det.Version + " and " + ents.Version + "!"); } Flags = det.Flags & ~(ChunkFlags.POPULATING); for (int i = 0; i < BlocksInternal.Length; i++) { BlocksInternal[i]._BlockMaterialInternal = Utilities.BytesToUshort(Utilities.BytesPartial(det.Blocks, i * 2, 2)); BlocksInternal[i].BlockData = det.Blocks[BlocksInternal.Length * 2 + i]; BlocksInternal[i].BlockLocalData = det.Blocks[BlocksInternal.Length * 3 + i]; BlocksInternal[i]._BlockPaintInternal = det.Blocks[BlocksInternal.Length * 4 + i]; } for (int i = 0; i < Reachability.Length; i++) { Reachability[i] = det.Reachables[i] == 1; } if (ents.Blocks != null && ents.Blocks.Length > 0 && entsToSpawn.Count == 0) { BsonDocument bsd = BsonSerializer.Deserialize(ents.Blocks); if (bsd.ContainsKey("list")) { List <BsonValue> docs = bsd["list"]; for (int i = 0; i < docs.Count; i++) { BsonDocument ent = (BsonDocument)docs[i]; EntityType etype = (EntityType)Enum.Parse(typeof(EntityType), ent["ENTITY_TYPE"].AsString); try { Entity e = OwningRegion.ConstructorFor(etype).Create(OwningRegion, ent); e.EID = ent["ENTITY_ID"].AsInt64; entsToSpawn.Add(e); } catch (Exception ex) { Utilities.CheckException(ex); SysConsole.Output("Spawning an entity of type " + etype, ex); } } } } }
public static void Init() { WorldObjects = new List <ObjectAsset>(); WorldObjectsMap = new Dictionary <string, ObjectAsset>(); Asset[] assets = Assets.find(EAssetType.OBJECT); foreach (Asset asset in assets) { WorldObjects.Add((ObjectAsset)asset); string namelow = asset.name.ToLower(); if (WorldObjectsMap.ContainsKey(namelow)) { SysConsole.Output(OutputType.INIT, "MINOR: multiple world object assets named " + namelow); continue; } WorldObjectsMap.Add(namelow, (ObjectAsset)asset); EntityType.WORLD_OBJECTS.Add(namelow, new EntityType(asset.name, EntityAssetType.WORLD_OBJECT)); } SysConsole.Output(OutputType.INIT, "Loaded " + WorldObjects.Count + " base world objects!"); }
void ListenLoop() { while (true) { try { Socket socket = ListenSocket.Accept(); lock (networkLock) { Connections.Add(new Connection(TheServer, socket)); } } catch (Exception ex) { Utilities.CheckException(ex); SysConsole.Output(OutputType.ERROR, "Network listen: " + ex.ToString()); } } }
/// <summary> /// Renders a line box. /// </summary> public void RenderLineBox(Location min, Location max, Matrix4d?rot = null) { if (min.IsNaN() || min.IsInfinite() || max.IsNaN() || max.IsInfinite()) { SysConsole.Output(OutputType.WARNING, "Invalid line box from " + min + " to " + max); return; } GL.ActiveTexture(TextureUnit.Texture0); Engine.White.Bind(); View3D.CheckError("RenderLineBox: BindTexture"); Location halfsize = (max - min) / 2; if ((min + halfsize) == Location.Zero) { return; // ??? } if (Math.Abs(min.X + halfsize.X) < 1 || Math.Abs(min.Y + halfsize.Y) < 1 || Math.Abs(min.Z + halfsize.Z) < 1) { return; // ??? } if (Math.Abs(min.X) < 1 || Math.Abs(min.Y) < 1 || Math.Abs(min.Z) < 1) { return; // ??? } if (bbreak) { return; // TODO: Fix! } Matrix4d mat = Matrix4d.Scale(ClientUtilities.ConvertD(halfsize)) * (rot != null && rot.HasValue ? rot.Value : Matrix4d.Identity) * Matrix4d.CreateTranslation(ClientUtilities.ConvertD(min + halfsize)); Client.Central.MainWorldView.SetMatrix(2, mat); // TODO: Client reference! View3D.CheckError("RenderLineBox: SetMatrix"); GL.BindVertexArray(Box._VAO); View3D.CheckError("RenderLineBox: Bind VAO"); GL.DrawElements(PrimitiveType.Lines, 24, DrawElementsType.UnsignedInt, IntPtr.Zero); if (View3D.CheckError("RenderLineBox: Pass")) { SysConsole.Output(OutputType.DEBUG, "Caught: " + Box._VAO + ", " + min + ", " + max + ", " + halfsize); } }
public void CheckWebSession(string username, string key) { if (username == null || key == null) { throw new ArgumentNullException(); } string rip = PrimarySocket.RemoteEndPoint.ToString(); if (!TheServer.CVars.n_online.ValueB) { if (!IsLocalIP(rip)) { throw new Exception("Connection from '" + rip + "' rejected because its IP is not localhost!"); } SysConsole.Output(OutputType.INFO, "Connection from '" + rip + "' accepted **WITHOUT AUTHENTICATION** with username: "******"formtype", "confirm" }, { "username", username }, { "session", key } }; byte[] response = wb.UploadValues(VoxProgram.GlobalServerAddress + "account/microconfirm", "POST", data); string resp = FileHandler.encoding.GetString(response).Trim(' ', '\n', '\r', '\t'); if (resp.StartsWith("ACCEPT=") && resp.EndsWith(";")) { string ip = resp.Substring("ACCEPT=".Length, resp.Length - 1 - "ACCEPT=".Length); if (!TheServer.CVars.n_verifyip.ValueB || IsLocalIP(rip) || rip.Contains(ip)) { SysConsole.Output(OutputType.INFO, "Connection from '" + rip + "' accepted with username: "******"Connection from '" + rip + "' rejected because its IP is not " + ip + " or localhost!"); } throw new Exception("Connection from '" + rip + "' rejected because: Failed to verify session!"); } }
/// <summary> /// Central program entry point. /// Decides whether to lauch the server or the client. /// </summary> /// <param name="args">The command line arguments.</param> static void Main(string[] args) { ConsoleHandle = Process.GetCurrentProcess().MainWindowHandle; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture; SysConsole.Init(); StringBuilder arger = new StringBuilder(); for (int i = 0; i < args.Length; i++) { arger.Append(args[i]).Append(' '); } try { Program.Init(); if (args.Length > 0 && args[0] == "server") { string[] targs = new string[args.Length - 1]; Array.Copy(args, 1, targs, 0, targs.Length); Server.Init(targs); } else { Client.Init(arger.ToString()); } } catch (Exception ex) { if (ex is ThreadAbortException) { Console.WriteLine("Forced shutdown - terminating process."); Environment.Exit(0); return; } SysConsole.Output(ex); File.WriteAllText("GLOBALERR_" + DateTime.Now.ToFileTimeUtc().ToString() + ".txt", ex.ToString() + "\n\n" + Environment.StackTrace); } SysConsole.ShutDown(); Console.WriteLine("Final shutdown - terminating process."); Environment.Exit(0); }
/// <summary> /// Internally saves chunk blocks to file. /// </summary> /// <param name="blks">The block data.</param> void SaveToFileI(byte[] blks) { try { ChunkDetails det = new ChunkDetails() { Version = 2, X = WorldPosition.X, Y = WorldPosition.Y, Z = WorldPosition.Z, Flags = Flags, Blocks = blks, Reachables = new byte[(int)ChunkReachability.COUNT] }; for (int i = 0; i < det.Reachables.Length; i++) { det.Reachables[i] = (byte)(Reachability[i] ? 1 : 0); } byte[] lod = LODBytes(5, false, true); byte[] lodsix = LODBytes(6, false, true); byte[] slod = lod.Length == 0 ? lod : SLODBytes(lod, true); lock (GetLocker()) { OwningRegion.PushHeightCorrection(WorldPosition, slod); } if (blks.Length == 0 && !FromFile) { return; } lock (GetLocker()) { OwningRegion.ChunkManager.WriteChunkDetails(det); //OwningRegion.ChunkManager.WriteLODChunkDetails(det.X, det.Y, det.Z, lod); OwningRegion.ChunkManager.WriteSuperLODChunkDetails(det.X, det.Y, det.Z, slod); OwningRegion.ChunkManager.WriteLODSixChunkDetails(det.X, det.Y, det.Z, lodsix); } } catch (Exception ex) { SysConsole.Output(OutputType.ERROR, "Saving chunk " + WorldPosition.ToString() + " to file: " + ex.ToString()); } }
public void Disconnect(Thread ConnectionThread, CancellationTokenSource cancelMe, Socket ConnectionSocket, Socket ChunkSocket) { if (norep) { return; } norep = true; if (ConnectionThread != null && ConnectionThread.IsAlive && cancelMe != null) { cancelMe.Cancel(); } if (ConnectionSocket != null) { if (IsAlive) { try { SendPacket(new DisconnectPacketOut()); } catch (Exception ex) { if (ex is ThreadAbortException) { throw ex; } SysConsole.Output(OutputType.WARNING, "Disconnecting: " + ex.ToString()); } } Socket csock = ConnectionSocket; TheClient.Schedule.ScheduleSyncTask(() => csock.Close(2), 2); ConnectionSocket = null; } if (ChunkSocket != null) { Socket csock = ChunkSocket; TheClient.Schedule.ScheduleSyncTask(() => csock.Close(2), 2); ChunkSocket = null; } TheClient.ShowMainMenu(); IsAlive = false; norep = false; }
/// <inheritdoc/> public override void Execute(UserSettings settings) { switch (settings.AppSide) { case AppSide.Client: IContract client = CreateClient <IContract>(settings); int threads = 5; SysConsole.WriteQuestionLine("Single client instance created!"); SysConsole.WriteQuestionLine($"{threads} thread gonna calling this client."); SysConsole.WriteQuestionLine($"Expected {threads} concurrent executions.", 1); for (int i = 0; i < threads; i++) { var localId = i; new Thread( () => { SysConsole.WriteInfoLine("[ON] Client Request-Reply method caller"); while (true) { client.Method($"User{localId + 1}"); } }).Start(); } Console.ReadKey(); break; case AppSide.Server: var host = CreateServiceHost <IContract, ConcurrencyMultiple>(settings); host.Open(); SysConsole.WriteInfoLine($"Each one contract method process time at least {ThreadSleepTimeSeconds} SECONDS"); QuestionManager.AwaitingClientConnections(); break; default: throw new ArgumentOutOfRangeException(); } }
public void LoadDir(string dir) { dir = dir.Replace('\\', '/'); dir = dir.Replace("..", "__error__"); string fdir = Environment.CurrentDirectory.Replace('\\', '/') + "/" + dir.ToLowerFast() + "/"; if (SubDirectories.Contains(fdir)) { SysConsole.Output(OutputType.WARNING, "Ignoring attempt to add same directory twice."); return; } SubDirectories.Add(fdir); foreach (PakFile pf in Paks) { pf.Storer.Dispose(); } Paks.Clear(); Files.Clear(); Init(); }
void SaveToFileE(BsonDocument ents) { try { ChunkDetails det = new ChunkDetails(); det.Version = 2; det.X = (int)WorldPosition.X; det.Y = (int)WorldPosition.Y; det.Z = (int)WorldPosition.Z; det.Blocks = BsonSerializer.Serialize(ents); lock (GetLocker()) { OwningRegion.ChunkManager.WriteChunkEntities(det); } } catch (Exception ex) { SysConsole.Output(OutputType.ERROR, "Saving entities for chunk " + WorldPosition.ToString() + " to file: " + ex.ToString()); } }
/// <summary> /// The primary tick entry point from the OpenGL window. /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The frame event details, including delta timing</param> static void Window_UpdateFrame(object sender, FrameEventArgs e) { Delta = ((double)Ticker.ElapsedTicks) / ((double)Stopwatch.Frequency); Ticker.Reset(); Ticker.Start(); try { GlobalTickTime += Delta; MouseHandler.Tick(); KeyHandler.Tick(); UIConsole.Tick(); ClientCommands.Tick(); ClientNetworkBase.Tick(); TickWorld(); } catch (Exception ex) { SysConsole.Output(OutputType.ERROR, "Error / updateframe: " + ex.ToString()); } }
public void SendChunkPacket(AbstractPacketOut packet) { if (!IsAlive) { return; } try { ChunkSocket.Send(GetBytesFor(packet)); } catch (Exception ex) { if (ex is ThreadAbortException) { throw ex; } SysConsole.Output(OutputType.WARNING, "Forcibly disconnected from server: " + ex.GetType().Name + ": " + ex.Message); Disconnect(); } }
public override bool ParseBytesAndExecute(byte[] data) { if (data.Length != 8 + 4 + 1) { SysConsole.Output(OutputType.WARNING, "Invalid animation packet length"); return(false); } long EID = Utilities.BytesToLong(Utilities.BytesPartial(data, 0, 8)); string anim = TheClient.Network.Strings.StringForIndex(Utilities.BytesToInt(Utilities.BytesPartial(data, 8, 4))); byte mode = data[8 + 4]; Entity e = TheClient.TheRegion.GetEntity(EID); if (e != null && e is EntityAnimated) { ((EntityAnimated)e).SetAnimation(anim, mode); return(true); } SysConsole.Output(OutputType.WARNING, "Not an animated entity: " + EID + " -> " + e); return(false); }
/// <summary> /// Tries to initialize VR - returns the VR support object, or null if loading failed. /// </summary> /// <param name="tclient">The game client.</param> /// <returns>VR, if any.</returns> public static VRSupport TryInit(GameClientWindow tclient) { if (!Available()) { return(null); } EVRInitError err = EVRInitError.None; VRSupport vrs = new VRSupport() { TheClient = tclient, VR = OpenVR.Init(ref err) }; if (err != EVRInitError.None) { SysConsole.Output(OutputType.INFO, "VR error: " + err + ": " + OpenVR.GetStringForHmdError(err)); return(null); } vrs.Start(); return(vrs); }
private void InitClient(object clientObj) { // Each one client processing service messages on call GetMessages() var client = clientObj as IMyService; // 1. Login method call. var clientId = client.Login(Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); try { do { // 2. Infinity GetMessage requests var callbackMessages = client.GetMessages(clientId, TimeSpan.FromSeconds(10)); // 3. Processing messages foreach (var callbackMessage in callbackMessages) { var broadcast = callbackMessage as BroadcastMessage; if (broadcast != null) { ProcessBroadcast(clientId, broadcast); continue; } var personal = callbackMessage as PersonalMessage; if (personal != null) { ProcessPersonal(clientId, personal); continue; } SysConsole.WriteQuestionLine($"Unknown message {callbackMessage.GetType()}"); } } while (true); } catch (ClientNotFoundedException ex) { SysConsole.WriteErrorLine($"Client disconnected {ex.ClientId}. Re-login required..."); } }
public override void Execute(UserSettings settings) { if (!(settings.Binding is BasicHttpBinding)) { SysConsole.WriteErrorLine($"Supports {nameof(BasicHttpBinding)} only."); return; } switch (settings.AppSide) { case AppSide.Client: var clients = QuestionManager.Choose( new[] { 1, 2, 3 }, (o) => o.ToString(), "Choose clients count"); // Creates callback processors for (int i = 0; i < clients; i++) { // proxy client var client = CreateClient <IMyService>(settings); // client thread Task.Factory.StartNew(InitClient, client); } SysConsole.PressAnyKey(); SysConsole.WriteLine(null, 2); break; case AppSide.Server: CreateServiceHost <IMyService, MyService>(settings).Open(); QuestionManager.AwaitingClientConnections(); break; } }
/// <summary> /// Start the network engine. /// </summary> public override void Start() { if (Socket.OSSupportsIPv6) { try { Listening = new TcpListener(IPAddress.IPv6Any, Port); Listening.Server.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, false); } catch (Exception ex) { SysConsole.Output("Opening IPv6/IPv4 combo-socket", ex); Listening = new TcpListener(IPAddress.Any, Port); } } else { Listening = new TcpListener(IPAddress.Any, Port); } Listening.Start(100); }
/// <summary> /// Sends a packet from the client to the server down the secondary packet channel. /// </summary> /// <param name="packet">The packet to send</param> public static void SendPacketToSecondary(AbstractPacketOut packet) { if (!Connected) { throw new Exception("Tried to send packet while not ready to send packets!"); } try { byte[] data = packet.Data; byte[] full = new byte[data.Length + 5]; BitConverter.GetBytes(data.Length).CopyTo(full, 0); full[4] = (byte)packet.ID; data.CopyTo(full, 5); ChunkConnection.Send(full); } catch (Exception ex) { SysConsole.Output(OutputType.ERROR, "Networking / send packet [secondary] (" + packet.ID + "): " + ex.ToString()); Disconnect(); } }
public void DestroyJoint(InternalBaseJoint joint) { if (!Joints.Remove(joint)) { SysConsole.Output(OutputType.WARNING, "Destroyed non-existent joint?!"); } joint.One.Joints.Remove(joint); joint.Two.Joints.Remove(joint); if (joint.Enabled) { joint.Disable(); } if (joint is BaseJoint pjoint) { if (pjoint.CurrentJoint != null) { PhysicsWorld.Remove(pjoint.CurrentJoint); pjoint.CurrentJoint = null; } } }
protected override void OnUnload(EventArgs e) { m_UseTime.Add("OnUnload_Start"); base.OnUnload(e); m_UseTime.Add("OnUnload"); string szSessionID = ""; try { if (Session["SessionID"] != null) { szSessionID = ((uint)Session["SessionID"]).ToString(); } } catch (Exception ee) { } //Logger.Trace(m_szCurrentExecutionFilePath + ":" + m_UseTime.GetAllUseTime()); SysConsole.LogPageStat(szSessionID, m_szCurrentExecutionFilePath, m_UseTime); }
public Model LoadModel(string filename) { try { filename = FileHandler.CleanFileName(filename); if (!TheClient.Files.Exists("models/" + filename + ".vmd")) { SysConsole.Output(OutputType.WARNING, "Cannot load model, file '" + TextStyle.Color_Standout + "models/" + filename + ".vmd" + TextStyle.Color_Warning + "' does not exist."); return(null); } return(FromBytes(filename, TheClient.Files.ReadBytes("models/" + filename + ".vmd"))); } catch (Exception ex) { SysConsole.Output(OutputType.ERROR, "Failed to load model from filename '" + TextStyle.Color_Standout + "models/" + filename + ".vmd" + TextStyle.Color_Error + "': " + ex.ToString()); return(null); } }
/// <summary> /// Loads the engine. /// </summary> public void Load() { try { StackNoteHelper.Push("GameEngineBase - Loading", this); SysConsole.Output(OutputType.INIT, "GameEngine starting load sequence, start with basic..."); LoadBasic(); SysConsole.Output(OutputType.INIT, "GameEngine loading shaders..."); GetShaders(); SysConsole.Output(OutputType.INIT, "GameEngine core load complete, calling additional load..."); PostLoad(); SysConsole.Output(OutputType.INIT, "GameEngine prepping audio systems..."); Sounds = new SoundEngine(); Sounds.Init(this); SysConsole.Output(OutputType.INIT, "GameEngine load sequence complete."); } finally { StackNoteHelper.Pop(); } }
public void LaunchTicker() { TheClient.Schedule.StartASyncTask(() => { while (true) { try { if (!Tick()) { return; } Thread.Sleep(16); } catch (Exception ex) { SysConsole.Output(OutputType.ERROR, "Connection: " + ex.ToString()); } } }); }