Example #1
0
        public void HandleConnect()
        {
            if (NetworkManager.Instance.IsConnected())
            {
                if (Settings.Default.DumpConnectData)
                {
                    this.DumpLogFile();
                }

                NetworkManager.Instance.Disconnect();

                Plugin.EditMode = EditModes.Design;
            }
            else
            {
                using (ConnectDialog cd = new ConnectDialog(NetworkManager.ServerPort))
                {
                    if (cd.ShowDialog(this) == DialogResult.OK)
                    {
                        NetworkManager.ServerIP = cd.GetServer();
                        NetworkManager.ServerPort = cd.GetPort();

                        //it is too early now to send Settings.Default.BreakAPP to app as
                        //it will cause inconsistence in breakpoints checking
                        //BreakAPP can only be sent to cpp after all the breakpoints info have been sent
                        if (NetworkManager.Instance.Connect(cd.GetServer(), cd.GetPort()))
                            Plugin.EditMode = EditModes.Connect;
                    }
                }
            }
        }
Example #2
0
        public void HandleConnect()
        {
            try
            {
                Plugin.WrongWorksapceReported = false;

                if (Plugin.EditMode == EditModes.Connect || NetworkManager.Instance.IsConnected())
                {
                    if (Settings.Default.DumpConnectData)
                    {
                        this.DumpLogFile();
                    }

                    NetworkManager.Instance.Disconnect();
                    Plugin.DebugAgentInstance = string.Empty;

                    Plugin.EditMode = EditModes.Design;
                }
                else
                {
                    FileManagers.SaveResult saveResult = MainWindow.Instance.CheckSavingBehaviors();
                    if (saveResult != FileManagers.SaveResult.Cancelled)
                    {
                        using (ConnectDialog cd = new ConnectDialog(NetworkManager.UseLocalIP, NetworkManager.ServerIP, NetworkManager.ServerPort))
                        {
                            if (cd.ShowDialog(this) == DialogResult.OK)
                            {
                                NetworkManager.UseLocalIP = cd.UseLocalIP();
                                NetworkManager.ServerIP = cd.GetServer();
                                NetworkManager.ServerPort = cd.GetPort();

                                if (NetworkManager.Instance.Connect(cd.GetServer(), cd.GetPort()))
                                {
                                    Plugin.EditMode = EditModes.Connect;

                                    Utilities.ReportConnectGame();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Check(false, ex.Message);
            }
        }