예제 #1
0
파일: Program.cs 프로젝트: Duke-Jones/NVNC
        private static void Main(string[] args)
        {
            var s = new VncServer("", "a", 5901, 5900, "Ulterius VNC");

            try
            {
                s.Start();
                Console.Read();
                s.Stop();
            }
            catch (ArgumentNullException ex)
            {
                s.Stop();
                return;
            }
        }
예제 #2
0
        private static void Main(string[] args)
        {
            var    s   = new VncServer("", "password", 5901, 5900, "VNC Client");
            Thread thr = new Thread(new ThreadStart(startTunnel));

            try
            {
                thr.Start();
                s.Start();
                Console.Read();
                s.Stop();
            }
            catch (ArgumentNullException ex)
            {
                s.Stop();
                return;
            }
        }
예제 #3
0
파일: Program.cs 프로젝트: mlof/ED-IBE
        public static void Cleanup()
        {
            try
            {
                if (EDDNComm != null)
                {
                    EDDNComm.Dispose();
                    EDDNComm = null;
                }

                if (JournalScanner != null)
                {
                    JournalScanner.Dispose();
                    JournalScanner = null;
                }

                if (DBCon != null)
                {
                    DBCon.Dispose();
                    DBCon = null;
                }

                // if EliteDBProcess is not null the process is created
                // by this program, so we also have to do the cleanup
                if ((EliteDBProcess != null) && (!EliteDBProcess.WasRunning))
                {
                    String user = IniFile.GetValue("DB_Connection", "User", "RN_User");
                    String pass = IniFile.GetValue("DB_Connection", "Pass", "Elite");

                    EliteDBProcess.StopServer(user, pass);
                    EliteDBProcess.Dispose();
                    EliteDBProcess = null;
                }

                Data.Dispose();


#if useVNC
                if (VNCAppServer != null)
                {
                    VNCAppServer.Stop();
                }
#endif

                //VNCServerThread = new System.Threading.Thread(new System.Threading.ThreadStart(s.Start));
            }
            catch (Exception ex)
            {
                throw new Exception("Error while cleaning up", ex);
            }
        }
예제 #4
0
        public void StopVncServer()
        {
            if (vncThread != null)
            {
                vncServer.Stop();
                vncWindow.Close();

                // It's important to null these things so the garbage collector
                //  will free the dangling resources (sockets, threads, etc).
                // The nulls also trigger Start() to recreate the now-defunct objects
                vncWindow = null;
                vncThread = null;
                vncServer = null;
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
        }
예제 #5
0
 public void StartVncServer()
 {
     try
     {
         var settings     = new Settings();
         var vncProxyPort = settings.Read("Vnc", "VncProxyPort", 5901);
         var vncPort      = settings.Read("Vnc", "VncPort", 5900);
         var vncPass      = settings.Read("Vnc", "VncPass", "");
         vncServer = new VncServer(vncPass, vncProxyPort, vncPort, "Ulterius VNC");
         Task.Run(() => { vncServer.Start(); });
         var endData = new
         {
             vncStarted = true,
             proxyPort  = vncProxyPort,
             port       = vncPort,
             message    = "VNC Server Started"
         };
         serializator.Serialize(_client, packet.endpoint, packet.syncKey, endData);
     }
     catch (ArgumentNullException)
     {
         vncServer?.Stop();
     }
 }