/* PUBLIC VARS */ /* CONSTRUCTOR */ public ClientComm(Socket sock) { _Sock = sock; _Tp = new TextParser(); //has no constructor try { _Stream = new NetworkStream(_Sock); // precaches Plugins in constructor, if no plugin could be loaded -> Exception _Pm = new PluginManager(); _Pm.LoadPlugins(); } // PluginIns could not be loaded - quit! catch (FileNotFoundException e) { Console.WriteLine(e.Message); if (_Stream != null) { _Stream.Close(); } Console.WriteLine("Will quit now..."); Console.WriteLine("---------------------"); Console.ReadLine(); Environment.Exit(1); } catch (Exception) { throw; } // if server quits, destroy objects System.AppDomain.CurrentDomain.ProcessExit += new EventHandler(ServerQuittingHandler); Console.CancelKeyPress += new ConsoleCancelEventHandler(ServerQuittingHandler); }
public void SetUp() { this._Tp = new TextParser(); this._Pm = new PluginManager(); // set PluginPath differently (for Directory is not the same!) this._Pm.PlugPath = "C:\\Users\\broadcastzero\\0 FH\\3. Semester\\SWE\\bz_hal\\Server\\bin\\Debug\\Plugins"; this._Pm.LoadPlugins(); }
private void ServerQuittingHandler(object sender, ConsoleCancelEventArgs args) { if (ClientComm.cleaned == false) { ClientComm.cleaned = true; this._Pm = null; this._Tp = null; Console.WriteLine("---------------------"); Console.WriteLine("Garbage Collector"); Console.WriteLine("---------------------"); GC.Collect(); //force GarbageCollector to do his work Console.WriteLine("finished!"); Console.WriteLine("---------------------"); } Console.ReadLine(); }
public void SetUp() { _Tp = new TextParser(); }