示例#1
0
 LdtpdService()
 {
     if (!String.IsNullOrEmpty(ldtpDebugEnv))
         debug = true;
     if (String.IsNullOrEmpty(ldtpPort))
         ldtpPort = "4118";
     common = new Common(debug);
     windowList = new WindowList(common);
     listener = new HttpListener();
     listener.Prefixes.Add("http://localhost:" + ldtpPort + "/");
     listener.Prefixes.Add("http://+:" + ldtpPort + "/");
     // Listen on all possible IP address
     if (listenAllInterface != null && listenAllInterface.Length > 0)
     {
         if (debug)
             Console.WriteLine("Listening on all interface");
         listener.Prefixes.Add("http://*:" + ldtpPort + "/");
     }
     else
     {
         // For Windows 8, still you need to add firewall rules
         // Refer: README.txt
         if (debug)
             Console.WriteLine("Listening only on local interface");
     }
     listener.Start();
     svc = new Core(windowList, common, debug);
 }
示例#2
0
        public MainForm() : base()
        {
            InitializeComponent();
            this.Icon = Properties.Resources.asset_icon;
            ShowAll();
            liveBox      = new LiveBox(this);
            munisToolBar = new CustomControls.MunisToolBar(this);
            windowList   = new CustomControls.WindowList(this);

            DateTimeLabel.Text   = DateTime.Now.ToString();
            ToolStrip1.BackColor = Colors.AssetToolBarColor;
            ResultGrid.DoubleBuffered(true);
            CheckForAdmin();
            GetGridStyles();

            WatchdogInstance.Watchdog.StatusChanged += WatchdogStatusChanged;
            WatchdogInstance.Watchdog.RebuildCache  += WatchdogRebuildCache;
            WatchdogInstance.Watchdog.WatcherTick   += WatchdogTick;
            WatchdogInstance.Watchdog.StartWatcher(GlobalSwitches.CachedMode);

            munisToolBar.InsertMunisDropDown(ToolStrip1, 2);
            windowList.InsertWindowList(ToolStrip1);
            InitLiveBox();

            InitDBControls();
            Clear_All();
            ShowTestDBWarning();
            InitDBCombo();
        }
示例#3
0
        /// <summary>
        /// 创建便签
        /// </summary>
        /// <param name="path">缓存路径</param>
        /// <param name="imdex"></param>
        /// <param name="oldNotepad"></param>
        public static void CreateNotepad(string path, int imdex, WindowNotepad oldNotepad)
        {
            if (WindowList.Count >= 15)
            {
                MessageBox.Show("便签数据日经达到最大值15个!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            if (WindowList.Exists(t => t.CacheFileName == path))
            {
                return;
            }

            WindowNotepad      window            = null;
            WindowSettingsAllM windowSettingsAll = ReadSetings();
            string             id       = Path.GetFileNameWithoutExtension(path);
            WindowSettingsM    settings = windowSettingsAll?.WindowSettingses.Find(t => t.ID == id);

            if (settings == null)
            {
                settings = GetDefaultWindowSettingsM(id);
            }

            window = new WindowNotepad(settings);
            SetTop(window, oldNotepad);
            window.Show();
            WindowList.Add(window);
            ShowWindowListCount++;
            WindowListCount++;
        }
示例#4
0
        private void buttonFindMsgTarget_Click(object sender, EventArgs e)
        {
            if (radioButtonApplication.Checked)
            {
                OpenFileDialog find = new OpenFileDialog();
                find.Filter      = "All files|*.*";
                find.Multiselect = false;
                find.Title       = "Application to send message to";

                if (find.ShowDialog(this) == DialogResult.OK)
                {
                    textBoxMsgTarget.Text = find.FileName;
                }
            }
            else if (radioButtonClass.Checked)
            {
                WindowList windowList = new WindowList(true);
                if (windowList.ShowDialog(this) == DialogResult.OK)
                {
                    textBoxMsgTarget.Text = windowList.SelectedItem;
                }
            }
            else if (radioButtonWindowTitle.Checked)
            {
                WindowList windowList = new WindowList(false);
                if (windowList.ShowDialog(this) == DialogResult.OK)
                {
                    textBoxMsgTarget.Text = windowList.SelectedItem;
                }
            }
        }
示例#5
0
        public MainForm()
        {
            InitializeComponent();

            InitNetworking();
            InitMessaging();
            InitApplication();
            InitUI();

            //  Flag indicating whether any modal dialog is open.
            bModalOpen = false;

            //  Create a list for holding all the opened and closed tab pages.
            tabList = new TabPageList();

            //  Create a list for holding all opened and closed chat windows.
            windowList = new WindowList();

            //  Create a list for holding all the user groups.
            groupList = new List <string>();

            //  A dictionary that acts as lookup for a user's group.
            userGroupLookup = new Dictionary <string, string>();

            //  Initialize this to current time.
            userRefreshTime = DateTime.UtcNow;

            //  Initialize idle time (millisecs) to 0.
            idleTime    = 0;
            bSystemIdle = false;
        }
示例#6
0
        public static void OpenImputFIle()
        {
            //检测缓存文件数量是否有变化
            if (Directory.GetFiles(RichTextBoxTool.PathCache, SystemCommon.SearchExtensionName).Length > NotepadManage.WindowListCount)
            {
                //查找新导入文件并打开
                //DirectoryInfo info = new DirectoryInfo(RichTextBoxTool.PathCache);
                foreach (string s in Directory.GetFiles(RichTextBoxTool.PathCache, SystemCommon.SearchExtensionName))
                {
                    var v = WindowList.Find(m => m.CacheFileName == s);

                    if (v == null)
                    {
                        if (App.Current.Dispatcher.Thread != Thread.CurrentThread)
                        {
                            App.Current.Dispatcher.Invoke((Action)(() =>
                            {
                                CreateNotepad(Path.GetFileNameWithoutExtension(s), GetNewIndex());
                            }));
                        }
                        else
                        {
                            CreateNotepad(Path.GetFileNameWithoutExtension(s), GetNewIndex());
                        }
                    }
                }
            }
        }
示例#7
0
 /// <summary>
 /// 移除便签
 /// </summary>
 /// <param name="window"></param>
 public static void RemoveNotepad(WindowNotepad window)
 {
     if (WindowList.Contains(window))
     {
         WindowList.Remove(window);
     }
 }
示例#8
0
        public override void Add(Segment segment)
        {
            segment.SequenceNumber = _currentSeqNumber;
            _currentSeqNumber     += (byte)segment.Data.Length;

            WindowList.Add(segment);
        }
示例#9
0
        private static Form SetConnectionForm(Form ConForm, string connectionPanel)
        {
            Form connectionForm = default(Form);

            if (ConForm == null)
            {
                connectionForm = WindowList.FromString(connectionPanel);
            }
            else
            {
                connectionForm = ConForm;
            }

            if (connectionForm == null)
            {
                connectionForm = AddPanel(connectionPanel);
            }
            else
            {
                ((ConnectionWindow)connectionForm).Show(frmMain.Default.pnlDock);
            }

            connectionForm.Focus();
            return(connectionForm);
        }
示例#10
0
            public bool Equals(WindowList other)
            {
                if (other == null)
                {
                    return(false);
                }

                //Здесь сравнение по ссылкам необязательно.
                //Если вы уверены, что многие проверки на идентичность будут отсекаться на проверке по ссылке - //можно имплементировать.
                if (object.ReferenceEquals(this, other))
                {
                    return(true);
                }

                //Если по логике проверки, экземпляры родительского класса и класса потомка могут считаться равными,
                //то проверять на идентичность необязательно и можно переходить сразу к сравниванию полей.
                if (this.GetType() != other.GetType())
                {
                    return(false);
                }

                if (this.ID == other.ID &&
                    this.Heigt == other.Heigt &&
                    this.Left == other.Left &&
                    this.Title == other.Title &&
                    this.Top == other.Top &&
                    this.Width == other.Width)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
示例#11
0
        public FormAdvancedSearch(FormStaff formStaff,
                                  CtrlAddAppt addAppt,
                                  MySqlConnection conn,
                                  int search,
                                  string userID)
        {
            InitializeComponent();

            this.formStaff = formStaff;
            this.windows   = WindowList.Staff;
            this.addAppt   = addAppt;
            this.controls  = ControlsList.Add_Appt;
            this.search    = search;


            if (search == 1)
            {
                this.pnlSearchPat.Visible = true;
                this.pnlSearchDoc.Visible = false;
            }
            else
            {
                this.pnlSearchPat.Visible = false;
                this.pnlSearchDoc.Visible = true;
            }

            this.pnlPatDoc.Visible = false;

            this.conn   = conn;
            this.userID = userID;

            this.UpdateHeader();
        }
示例#12
0
        public override void Shift()
        {
            var segments = WindowList.TakeWhile(s => s.StateInWindow == State.Confirmed);

            OutputList.AddRange(segments);

            WindowList.RemoveRange(0, segments.Count());
        }
示例#13
0
        public MenuManager()
        {
            _applicationMenusMap = new Hashtable();

#if !PocketPC
            WindowList = new WindowList();
#endif
        }
示例#14
0
文件: Utils.cs 项目: sganesh/cobra
 public Utils(WindowList windowList, Common common, bool debug)
 {
     this.debug = debug;
     this.windowList = windowList;
     this.common = common;
     backgroundThread = new Thread(new ThreadStart(BackgroundThread));
     // Clean up window handles in different thread
     backgroundThread.Start();
 }
示例#15
0
        public void CreateMainWindow()
        {
            var win = new MainV();

            win.Show();
            win.UpdateLayout();
            MainWindow = win;
            WindowList.Add(win.Title, win);
        }
示例#16
0
 private static void PrepareTabControllerSupport(bool noTabber, ConnectionWindow connectionForm)
 {
     if (noTabber)
     {
         connectionForm.TabController.Dispose();
     }
     else
     {
         WindowList.Add(connectionForm);
     }
 }
示例#17
0
        public int UnconfirmedSegments()
        {
            if (WindowList.Any() && (WindowList.First().StateInWindow == State.Confirmed))
            {
                return(0);
            }

            var unconfirmedSegs = WindowList.TakeWhile(s => s.StateInWindow == State.Unconfirmed);

            return(unconfirmedSegs.Count());
        }
    protected override void SetupUI()
    {
        base.SetupUI();

        Dropdown dropdown = GameObject.Find("Dropdown").GetComponent <Dropdown>();

        if (dropdown != null)
        {
#if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
            WindowList list = AgoraNativeBridge.GetMacWindowList();
            if (list != null)
            {
                dropdown.options = list.windows.Select(w =>
                                                       new Dropdown.OptionData(w.kCGWindowOwnerName + "|" + w.kCGWindowNumber)).ToList();
            }
            GameObject.Find("InputField").SetActive(false);
            GameObject.Find("WinHelpButton").SetActive(false);
#else
            dropdown.gameObject.SetActive(false);
            inputField = GameObject.Find("InputField").GetComponent <InputField>();
#endif
            WindowOptionDropdown = dropdown;
        }

        Button button = GameObject.Find("ShareWindowButton").GetComponent <Button>();
        if (button != null)
        {
            button.onClick.AddListener(OnShareWindowClick);
        }

        button = GameObject.Find("ShareDisplayButton").GetComponent <Button>();
        if (button != null)
        {
            button.onClick.AddListener(ShareDisplayScreen);
        }

        button = GameObject.Find("StopShareButton").GetComponent <Button>();
        if (button != null)
        {
            button.onClick.AddListener(() => { mRtcEngine.StopScreenCapture(); });
        }

        GameObject quad = GameObject.Find("DisplayPlane");
        if (ReferenceEquals(quad, null))
        {
            Debug.Log("Error: failed to find DisplayPlane");
            return;
        }
        else
        {
            quad.AddComponent <VideoSurface>();
        }
    }
        /// <summary>
        /// 更新某个窗口的配置
        /// </summary>
        /// <param name="obj"></param>
        public void Update(PictureInPuctureObject obj)
        {
            var item = WindowList.FirstOrDefault(x => x.VideoNo == obj.VideoNo);

            if (item != null)
            {
                item.Left   = obj.Left;
                item.Top    = obj.Top;
                item.Width  = obj.Width;
                item.Height = obj.Height;
            }
        }
示例#20
0
 /// <summary>
 /// Window constructor
 /// </summary>
 /// <param name="xpos">x position to build window at</param>
 /// <param name="ypos">y position to build window at</param>
 /// <param name="visible">start off as visible or invisible</param>
 /// <param name="texture">texture of the window</param>
 public Window(int xpos, int ypos, bool visible, Texture2D texture)
     : base(texture)
 {
     Position.X = xpos;
     Position.Y = ypos;
     Visible    = visible;
     ButtonList = new List <Button>();
     m_Texture  = texture;
     TowerDefenseManager.TDLayers[3].AddEntity(this);
     WindowList.Add(this);
     Xoffset = 10 + (int)Position.X;
     Yoffset = 10 + (int)Position.Y;
 }
示例#21
0
 /// <summary>
 /// 激活所有的便签
 /// </summary>
 public static void ActivatedNotepad()
 {
     _isActivatedNotepad = true;
     //升序
     foreach (WindowNotepad window in WindowList.OrderBy(s => s.WindowSettings.Index))
     {
         //window.Topmost = true;
         window.Activate();
         //window.Topmost = false;
         //Debug.WriteLine(window.Caption);
         //window.WindowsTool.ShowWindow(window);
     }
     _isActivatedNotepad = false;
 }
示例#22
0
        private void buttonArrangeWindows_Click(object sender, EventArgs e)
        {
            // Using a lambda expression
            // WindowInformation wi = windowListExtended.Find(
            // w => w.Caption.StartsWith("c# - How")
            // );
            var windowsToBeArranged  = new List <IntPtr>();
            var windowsListSecondSet = new List <IntPtr>();

            this.windowListBasic.ForEach(x => Logger.Info($" {x.Class} - {x.Caption} "));
            foreach (var windowInformation in this.windowListBasic)
            {
                if (windowInformation.Class.Contains("SunAwtFrame") && windowInformation.Caption.Contains("5 min bars") && windowInformation.Caption.Contains("@"))
                {
                    windowsToBeArranged.Add(windowInformation.Handle);
                }

                // if (windowInformation.Class.Contains("Chrome_WidgetWin_1") && !string.IsNullOrEmpty(windowInformation.Caption))
                // {
                // windowsToBeArranged.Add(windowInformation.Handle);
                // }
            }

            WindowList.TileWindows(windowsToBeArranged, WindowList.WindowTile.Horizontally, 6, 4);

            foreach (var windowInformation in this.windowListBasic)
            {
                if (windowInformation.Class.Contains("SunAwtFrame") && windowInformation.Caption.Contains("5 min bars"))
                {
                    windowsListSecondSet.Add(windowInformation.Handle);
                }

                // if (windowInformation.Class.Contains("Chrome_WidgetWin_1") && !string.IsNullOrEmpty(windowInformation.Caption))
                // {
                // windowsToBeArranged.Add(windowInformation.Handle);
                // }
            }

            windowsListSecondSet = windowsListSecondSet.Except(windowsToBeArranged).ToList();

            WindowList.TileWindows(windowsListSecondSet, WindowList.WindowTile.Vertically, 8, 3, 2);
            // WindowInformation w2 = windowListBasic.Find(
            // w => w.Class.Contains("SunAwtFrame") && !w.Caption.Contains("5 min bars")
            // );

            // Using a query expression
            // WindowInformation wi1 = (from w in windowListExtended.AsEnumerable()
            // where w.Caption.StartsWith("c# - How")
            // select w).First();
        }
示例#23
0
        public virtual void TransitionTo(ViewModelBase newWindow)
        {
            PreviousWindow = CurrentWindow;
            CurrentWindow  = newWindow;

            CurrentWindowListIndex++;

            for (int i = CurrentWindowListIndex; i < WindowList.Count; i++)
            {
                WindowList.RemoveRange(i, WindowList.Count - i);
            }

            WindowList.Add(CurrentWindow);
        }
示例#24
0
        public ViewDeviceForm(ExtendedForm parentForm, MappedObject device, bool startHidden = false) : base(parentForm, device, startHidden)
        {
            currentViewDevice = (Device)device;

            InitializeComponent();
            InitDBControls();

            controlParser = new DBControlParser(this);
            controlParser.EnableFieldValidation();

            defaultFormTitle = this.Text;

            liveBox = new LiveBox(this);
            liveBox.AttachToControl(CurrentUserTextBox, DevicesCols.CurrentUser, LiveBoxSelectAction.UserSelect, DevicesCols.MunisEmpNum);
            liveBox.AttachToControl(DescriptionTextBox, DevicesCols.Description, LiveBoxSelectAction.SelectValue);

            munisToolBar = new MunisToolBar(this);
            munisToolBar.InsertMunisDropDown(ToolStrip1, 6);

            windowList = new WindowList(this);
            windowList.InsertWindowList(ToolStrip1);

            statusSlider = new SliderLabel();
            statusSlider.FlashStripOnNewMessage = true;
            StatusStrip.Items.Add(statusSlider.ToToolStripControl(StatusStrip));

            RefreshCombos();

            DataGridHistory.DoubleBuffered(true);
            TrackingGrid.DoubleBuffered(true);

            SetEditMode(false);

            LoadCurrentDevice();

            WatchdogInstance.Watchdog.StatusChanged += Watchdog_StatusChanged;

            if (!startHidden)
            {
                this.Show();
            }
            else
            {
                // Let the base class know that the hidden form is ready.
                // Since no load event occurs, we need someway to notify
                // when all the components are instantiated and populated.
                base.HiddenFormReady();
            }
        }
示例#25
0
        public void LoadPreviewWindowImages()
        {
            if (isLoadPreviewWindow)
            {
                return;
            }

            isLoadPreviewWindow = true;
            WindowList          = _enumerationWindowService.GetWindowList();
            if (WindowList != null)
            {
                SelectedWindow = WindowList.FirstOrDefault();
            }
            isLoadPreviewWindow = false;
        }
        private void OnActivated(object sender, EventArgs e)
        {
            var windows = SystemWindow.FilterToplevelWindows(new Predicate <SystemWindow>(IsAppWindow));

            Array.Sort(windows, (wnd1, wnd2) => wnd1.Title.CompareTo(wnd2.Title));

            //
            // If an item was already selected in the list, try to find it in the new list and
            // select it.
            //

            var selectedWindow = WindowList.SelectedItem as SystemWindow;

            m_Windows.Clear();
            m_Windows.AddRange(windows);

            WindowList.Items.Refresh();
            CollectionViewSource.GetDefaultView(WindowList.ItemsSource).Refresh();

            //
            // If the previously selected window is not found in the new list, simply select
            // the first element.
            //

            int selectIndex = 0;

            if (selectedWindow != null)
            {
                for (int i = 0; i < WindowList.Items.Count; ++i)
                {
                    SystemWindow wnd = WindowList.Items[i] as SystemWindow;
                    if (wnd.HWnd == selectedWindow.HWnd)
                    {
                        selectIndex = i;
                        break;
                    }
                }
            }

            if (!WindowList.Items.IsEmpty)
            {
                WindowList.SelectedIndex = selectIndex;
                WindowList.UpdateLayout();
                (WindowList.ItemContainerGenerator.ContainerFromIndex(selectIndex) as ListViewItem).Focus();
            }

            FuzzySearchTitle.Focus();
        }
示例#27
0
        public override void Shift()
        {
            WindowList.Sort();

            int i;

            for (i = 0; (i < WindowList.Count) && (WindowList[i].SequenceNumber == _windowBegin); i++)
            {
                _windowBegin = WindowList[i].RequiredAck;
                OutputList.Add(WindowList[i]);
            }

            for (int k = 0; k < i; k++)
            {
                WindowList.RemoveAt(0);
            }
        }
示例#28
0
        LdtpdService()
        {
            if (!String.IsNullOrEmpty(ldtpDebugEnv))
            {
                debug = true;
            }
            if (String.IsNullOrEmpty(ldtpPort))
            {
                ldtpPort = "4118";
            }
            common     = new Common(debug);
            windowList = new WindowList(common);

            try
            {
                listener = new HttpListener();
                listener.Prefixes.Add("http://localhost:" + ldtpPort + "/");
                listener.Prefixes.Add("http://+:" + ldtpPort + "/");
                // Listen on all possible IP address
                if (listenAllInterface != null && listenAllInterface.Length > 0)
                {
                    if (debug)
                    {
                        Console.WriteLine("Listening on all interface");
                    }
                    listener.Prefixes.Add("http://*:" + ldtpPort + "/");
                }
                else
                {
                    // For Windows 8, still you need to add firewall rules
                    // Refer: README.txt
                    if (debug)
                    {
                        Console.WriteLine("Listening only on local interface");
                    }
                }
                listener.Start();
            }
            catch (HttpListenerException ex)
            {
                common.LogMessage(ex);
                System.Environment.Exit(1);
            }
            svc = new Core(windowList, common, debug);
        }
示例#29
0
        /// <summary>
        /// 保存所有便签设置
        /// </summary>
        public static void SaveSetings(WindowNotepad windowNotepad = null)
        {
            WindowSettingsAllM windowSettingsAll = ReadSetings();

            if (windowSettingsAll == null)
            {
                windowSettingsAll = new WindowSettingsAllM();
            }
            if (windowSettingsAll.WindowSettingses == null)
            {
                windowSettingsAll.WindowSettingses = new List <WindowSettingsM>();
            }

            windowSettingsAll.SystemSetting = SystemSetting;

            List <WindowNotepad> list;

            if (windowNotepad != null)
            {
                list = WindowList.FindAll(m => m.WindowSettings.ID == windowNotepad.WindowSettings.ID);
            }
            else
            {
                list = WindowList;
            }
            foreach (WindowNotepad notepad in list)
            {
                notepad.WindowSettings.Top           = notepad.Top;
                notepad.WindowSettings.Left          = notepad.Left;
                notepad.WindowSettings.BackColorName = notepad.SkinM.Name;
                notepad.WindowSettings.Width         = notepad.Width;
                notepad.WindowSettings.Height        = notepad.Height;

                //替换为新设置
                int index = windowSettingsAll.WindowSettingses.FindIndex(t => t.ID == notepad.WindowSettings.ID);
                if (index > 0)
                {
                    windowSettingsAll.WindowSettingses.RemoveAt(index);
                }

                windowSettingsAll.WindowSettingses.Add(notepad.WindowSettings);
            }

            XMLSerializer.Serializer(windowSettingsAll);
        }
示例#30
0
 private void PaneUpdated(OutputWindowPane pane)
 {
     if (!WindowList.Contains(pane.Name))
     {
         WindowList.Add(pane.Name);
         if (string.IsNullOrEmpty(CurrentWindow))
         {
             CurrentWindow = pane.Name;
         }
     }
     if (!_windowNames.ContainsKey(pane.Name))
     {
         _windowNames.Add(pane.Name, pane.Guid);
     }
     // See [IDE GUID](https://docs.microsoft.com/en-us/visualstudio/extensibility/ide-guids?view=vs-2017 )
     PorcessNewInput(pane);
     UpdateOutput();
 }
示例#31
0
    public static WindowList GetMacWindowList()
    {
        StringBuilder sb = new StringBuilder(CharBufferSize);

        GetWindows(sb, sb.Capacity);

        WindowList macWindows = WindowList.ParseJson(sb.ToString());

        if (macWindows != null)
        {
            Debug.LogWarning("JSON list count = " + macWindows.windows.Count);
            foreach (MacWindowModel win in macWindows.windows)
            {
//                Debug.LogWarning(win.kCGWindowOwnerName + " => " + win.kCGWindowNumber);
            }
        }
        return(macWindows);
    }
示例#32
0
            public override bool Equals(object other)
            {
                if (other == null)
                {
                    return(false);
                }
                if (object.ReferenceEquals(this, other))
                {
                    return(true);
                }
                if (this.GetType() != other.GetType())
                {
                    return(false);
                }
                WindowList wl = (WindowList)other;

                return(this.Equals(wl));
            }
示例#33
0
 public Core(WindowList windowList, Common common, bool debug = false)
     : base(windowList, common, debug)
 {
     ps = new ProcessStats(common);
 }
示例#34
0
        static void SingleThreadExec()
        {
            bool debug = false;
            string ldtpDebugEnv = Environment.GetEnvironmentVariable("LDTP_DEBUG");
            string ldtpPort = Environment.GetEnvironmentVariable("LDTP_SERVER_PORT");
            string listenAllInterface = Environment.GetEnvironmentVariable(
                "LDTP_LISTEN_ALL_INTERFACE");
            if (!String.IsNullOrEmpty(ldtpDebugEnv))
                debug = true;
            if (String.IsNullOrEmpty(ldtpPort))
                ldtpPort = "4118";
            Common common = new Common(debug);
            /*
            // If planning to use Remoting instead of HTTP
            // use this commented portion of code
            // NOTE: To have this at work, you need to add your
            // app under Firewall
            IDictionary props = new Hashtable();
            props["name"] = "LdtpdService";
            props["port"] = 4118;
            HttpChannel channel = new HttpChannel(
               props,
               null,
               new XmlRpcServerFormatterSinkProvider()
            );
            ChannelServices.RegisterChannel(channel, false);

            RemotingConfiguration.RegisterWellKnownServiceType(
              typeof(LdtpdMain),
              "service.rem",
              WellKnownObjectMode.Singleton);
            Console.WriteLine("Press <ENTER> to shutdown");
            Console.ReadLine();
            /**/
            WindowList windowList = new WindowList(common);
            HttpListener listener = new HttpListener();
            listener.Prefixes.Add("http://localhost:" + ldtpPort + "/");
            listener.Prefixes.Add("http://+:" + ldtpPort + "/");
            // Listen on all possible IP address
            if (String.IsNullOrEmpty(listenAllInterface))
            {
                if (debug)
                    Console.WriteLine("Listening on all interface");
                listener.Prefixes.Add("http://*:" + ldtpPort + "/");
            }
            else
            {
                // For Windows 8, still you need to add firewall rules
                // Refer: README.txt
                if (debug)
                    Console.WriteLine("Listening only on local interface");
            }
            listener.Start();
            XmlRpcListenerService svc = new Core(windowList, common, debug);
            try
            {
                while (true)
                {
                    GC.Collect();
                    try
                    {
                        if (debug)
                            Console.WriteLine("Waiting for clients");
                        HttpListenerContext context = listener.GetContext();
                        // Don't create LDTP instance here, this creates
                        // new object for every request !
                        // Moved before creating HttpListenerContext
                        //XmlRpcListenerService svc = new LdtpdMain();
                        if (debug)
                            Console.WriteLine("Processing request");
                        svc.ProcessRequest(context);
                        /*
                        // FIXME: If trying to do parallel process
                        // memory usage goes high and never comes back
                        // This is required for startprocessmonitor API
                        Thread parallelProcess = new Thread(delegate()
                        {
                            try
                            {
                                svc.ProcessRequest(context);
                            }
                            finally
                            {
                                context.Response.Close();
                                context = null;
                                GC.Collect();
                            }
                        });
                        parallelProcess.Start();
                        /* */
                        context.Response.Close();
                        context = null;
                    }
                    catch (InvalidOperationException ex)
                    {
                        common.LogMessage(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                common.LogMessage(ex);
            }
            finally
            {
                svc = null;
                windowList = null;
                listener.Stop();
            }
        }