static void Main(string[] args)
        {
            //if (args.Length < 1)
              //{
              //  Console.WriteLine("No argument passed!");
              //  Debug.Print("Cosmetic Simulator: No argument passed!");
              //}
              //else
              //{
              //  foreach (string ar in args)
              //  {
              //    Console.WriteLine("Argument:{0}", ar);
              //    Debug.Print("Cosmetic Simulator:Argument Content {0}", ar);
              //  }
              //}
              Debug.Print("2D Simulator: Start!");
              int port = 10000;
              string sRet = "";
              //simulator si = new simulator(port, "2DViewer");
              simulator si = new simulator(port);

              ////Minimize or Restore
              //si.StartSimulater("min");
              //sRet = si.StopSimulator(120000);
              //Console.WriteLine("Get from thread:{0}", sRet);

              ////Get Configuration
              //si.StartSimulater("CgkJPHRyb3BoeSAgdHlwZT0icGFzX3NldF9jb25maWciPgoJCQkgIDxjb25maWc+CgkJCQkgICA8IS0tYXBwX2ljb24gb3B0aW9uYWwsIHZhbHVlIGlzIGxvY2FsIHBhdGgtLT4KCQkJICAJICA8cGFyYW1ldGVyIGtleT0iYXBwX2ljb24iIHZhbHVlPSJEOlx0ZXN0XGljb24uanBnIi8+CgkJCQkgIDwhLS1tb2RlIG9wdGlvbmFsICB2YWx1ZSByYW5nZVtsaWdodCxwYXRpZW50XS0tPgoJCQkJICA8cGFyYW1ldGVyIGtleT0ibW9kZSIgdmFsdWU9InBhdGllbnQiLz4KCgkJCSAgPC9jb25maWc+CgkJPC90cm9waHk+CgkJCgk=");
              //sRet = si.StopSimulator(30000);
              //Console.WriteLine("Get from thread:{0}", sRet);

              ////Close or Set Configuration
              //si.StartSimulater("close");
              //sRet = si.StopSimulator(30000);
              //Console.WriteLine("Get from thread:{0}", sRet);

              while (true)
              {
              //Start 2DView
            //si.StartSimulater("0,Logicon");
            si.StartSimulater("0,2DViewer");
              //...
              sRet = si.StopSimulator(120000);
              Console.WriteLine("Get from thread:{0}", sRet);

              Console.WriteLine("==================");
              }
              si.StartSimulater("0,2DViewer");
              sRet = si.StopSimulator(300000);
              Console.WriteLine("Get from thread:{0}", sRet);
              Console.WriteLine("==================");

              si.StartSimulater("0,2DViewer");
              sRet = si.StopSimulator(300000);
              Console.WriteLine("Get from thread:{0}", sRet);
              Console.WriteLine("==================");

              si.StartSimulater("0,2DViewer");
              sRet = si.StopSimulator(300000);
              Console.WriteLine("Get from thread:{0}", sRet);
              Console.WriteLine("==================");

              si.StartSimulater("0,2DViewer");
              sRet = si.StopSimulator(300000);
              Console.WriteLine("Get from thread:{0}", sRet);
              Console.WriteLine("==================");

              //si = new simulator("test");
              //si.StartSimulater();

              //sRet = si.getSimBack(120000);
              //Console.WriteLine("Get from thread:{0}", sRet);

              //Get Configuration
              //si.StartSimulater("CgkJPHRyb3BoeSAgdHlwZT0icGFzX3NldF9jb25maWciPgoJCSAgPGNvbmZpZz4KCQkJICAgPCEtLXRpdGxlIG9wdGlvbmFsLS0+CgkJCSAgIDxwYXJhbWV0ZXIga2V5PSJ0aXRsZSIgdmFsdWU9InRlc3QiLz4KCQkJICAgPCEtLWFwcF9pY29uIG9wdGlvbmFsLS0+CgkJCSAgIDxwYXJhbWV0ZXIga2V5PSJhcHBfaWNvbiIgdmFsdWU9IkQ6XHRlc3RcaWNvbi5qcGciLz4KCQkJICAgPCEtLWFwcF9uYW1lIG9wdGlvbmFsLS0+CgkJCSAgIDxwYXJhbWV0ZXIga2V5PSJhcHBfbmFtZSIgdmFsdWU9ImRwbXMiLz4KCQkJICAgPCEtLW1vZGUgb3B0aW9uYWwgIHZhbHVlIHJhbmdlW2xpZ2h0LHBhdGllbnRdLS0+CgkJCSAgIDxwYXJhbWV0ZXIga2V5PSJtb2RlIiB2YWx1ZT0icGF0aWVudCIvPgoJCQkgICA8IS0tc3RhdGUgb3B0aW9uYWwgIHZhbHVlIHJhbmdlW3Jlc3RvcmUsbWluaW1pemVdLS0+CgkJCSAgIDxwYXJhbWV0ZXIga2V5PSJzdGF0ZSIgdmFsdWU9Im1pbmltaXplZCIvPgoJCQkgICA8IS0tdG9vdGhfbm90YXRpb24gb3B0aW9uYWwgIHZhbHVlIHJhbmdlW2V1cm9wZWFuLGFtZXJpY2FuLHVua25vd25dLS0+CgkJCSAgIDxwYXJhbWV0ZXIga2V5PSJ0b290aF9ub3RhdGlvbiIgdmFsdWU9ImV1cm9wZWFuIi8+CgkJICA8L2NvbmZpZz4KCQk8L3Ryb3BoeT4KCQkKCQ==");
              //sRet = si.StopSimulator(30000);
              //Console.WriteLine("Get from thread:{0}", sRet);

              Console.Read();
        }
        static void Main(string[] args)
        {
            //if (args.Length < 1)
            //{
            //  Console.WriteLine("No argument passed!");
            //  Debug.Print("Cosmetic Simulator: No argument passed!");
            //}
            //else
            //{
            //  foreach (string ar in args)
            //  {
            //    Console.WriteLine("Argument:{0}", ar);
            //    Debug.Print("Cosmetic Simulator:Argument Content {0}", ar);
            //  }
            //}
            Debug.Print("2D Simulator: Start!");
            int    port = 10000;
            string sRet = "";
            //simulator si = new simulator(port, "2DViewer");
            simulator si = new simulator(port);

            ////Minimize or Restore
            //si.StartSimulater("min");
            //sRet = si.StopSimulator(120000);
            //Console.WriteLine("Get from thread:{0}", sRet);

            ////Get Configuration
            //si.StartSimulater("CgkJPHRyb3BoeSAgdHlwZT0icGFzX3NldF9jb25maWciPgoJCQkgIDxjb25maWc+CgkJCQkgICA8IS0tYXBwX2ljb24gb3B0aW9uYWwsIHZhbHVlIGlzIGxvY2FsIHBhdGgtLT4KCQkJICAJICA8cGFyYW1ldGVyIGtleT0iYXBwX2ljb24iIHZhbHVlPSJEOlx0ZXN0XGljb24uanBnIi8+CgkJCQkgIDwhLS1tb2RlIG9wdGlvbmFsICB2YWx1ZSByYW5nZVtsaWdodCxwYXRpZW50XS0tPgoJCQkJICA8cGFyYW1ldGVyIGtleT0ibW9kZSIgdmFsdWU9InBhdGllbnQiLz4KCgkJCSAgPC9jb25maWc+CgkJPC90cm9waHk+CgkJCgk=");
            //sRet = si.StopSimulator(30000);
            //Console.WriteLine("Get from thread:{0}", sRet);

            ////Close or Set Configuration
            //si.StartSimulater("close");
            //sRet = si.StopSimulator(30000);
            //Console.WriteLine("Get from thread:{0}", sRet);

            while (true)
            {
                //Start 2DView
                //si.StartSimulater("0,Logicon");
                si.StartSimulater("0,2DViewer");
                //...
                sRet = si.StopSimulator(120000);
                Console.WriteLine("Get from thread:{0}", sRet);

                Console.WriteLine("==================");
            }
            si.StartSimulater("0,2DViewer");
            sRet = si.StopSimulator(300000);
            Console.WriteLine("Get from thread:{0}", sRet);
            Console.WriteLine("==================");

            si.StartSimulater("0,2DViewer");
            sRet = si.StopSimulator(300000);
            Console.WriteLine("Get from thread:{0}", sRet);
            Console.WriteLine("==================");

            si.StartSimulater("0,2DViewer");
            sRet = si.StopSimulator(300000);
            Console.WriteLine("Get from thread:{0}", sRet);
            Console.WriteLine("==================");

            si.StartSimulater("0,2DViewer");
            sRet = si.StopSimulator(300000);
            Console.WriteLine("Get from thread:{0}", sRet);
            Console.WriteLine("==================");

            //si = new simulator("test");
            //si.StartSimulater();

            //sRet = si.getSimBack(120000);
            //Console.WriteLine("Get from thread:{0}", sRet);



            //Get Configuration
            //si.StartSimulater("CgkJPHRyb3BoeSAgdHlwZT0icGFzX3NldF9jb25maWciPgoJCSAgPGNvbmZpZz4KCQkJICAgPCEtLXRpdGxlIG9wdGlvbmFsLS0+CgkJCSAgIDxwYXJhbWV0ZXIga2V5PSJ0aXRsZSIgdmFsdWU9InRlc3QiLz4KCQkJICAgPCEtLWFwcF9pY29uIG9wdGlvbmFsLS0+CgkJCSAgIDxwYXJhbWV0ZXIga2V5PSJhcHBfaWNvbiIgdmFsdWU9IkQ6XHRlc3RcaWNvbi5qcGciLz4KCQkJICAgPCEtLWFwcF9uYW1lIG9wdGlvbmFsLS0+CgkJCSAgIDxwYXJhbWV0ZXIga2V5PSJhcHBfbmFtZSIgdmFsdWU9ImRwbXMiLz4KCQkJICAgPCEtLW1vZGUgb3B0aW9uYWwgIHZhbHVlIHJhbmdlW2xpZ2h0LHBhdGllbnRdLS0+CgkJCSAgIDxwYXJhbWV0ZXIga2V5PSJtb2RlIiB2YWx1ZT0icGF0aWVudCIvPgoJCQkgICA8IS0tc3RhdGUgb3B0aW9uYWwgIHZhbHVlIHJhbmdlW3Jlc3RvcmUsbWluaW1pemVdLS0+CgkJCSAgIDxwYXJhbWV0ZXIga2V5PSJzdGF0ZSIgdmFsdWU9Im1pbmltaXplZCIvPgoJCQkgICA8IS0tdG9vdGhfbm90YXRpb24gb3B0aW9uYWwgIHZhbHVlIHJhbmdlW2V1cm9wZWFuLGFtZXJpY2FuLHVua25vd25dLS0+CgkJCSAgIDxwYXJhbWV0ZXIga2V5PSJ0b290aF9ub3RhdGlvbiIgdmFsdWU9ImV1cm9wZWFuIi8+CgkJICA8L2NvbmZpZz4KCQk8L3Ryb3BoeT4KCQkKCQ==");
            //sRet = si.StopSimulator(30000);
            //Console.WriteLine("Get from thread:{0}", sRet);

            Console.Read();
        }