示例#1
0
        private async void btnStop_Click(object sender, EventArgs e)
        {
            if (m_ServerNode != null && m_ServerNode.IsWorking())
            {
                await m_ServerNode.Stop();

                await Task.Delay(500);

                if (!m_ServerNode.IsWorking())
                {
                    CommonLog.Info("Server Stopped");
                }
            }
        }
示例#2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            CommonLog.SetGuiControl(this, mmLog);

            RemoteCaller.HttpConnectionLimit = 1000;

            var appSettings = ConfigurationManager.AppSettings;

            var allKeys = appSettings.AllKeys;

            foreach (var key in allKeys)
            {
                if (key == "InternalServer")
                {
                    m_InternalSetting = JsonConvert.DeserializeObject <ServerSetting>(appSettings[key]);
                }
                if (key == "PublicServer")
                {
                    m_PublicSetting = JsonConvert.DeserializeObject <ServerSetting>(appSettings[key]);
                }

                if (key == "NodeName")
                {
                    m_NodeName = appSettings[key];
                }
                if (key == "GroupName")
                {
                    m_GroupName = appSettings[key];
                }
                if (key == "ServerInfoStorageName")
                {
                    m_StorageName = appSettings[key];
                }

                if (key == "Services")
                {
                    var fileNames = appSettings[key].Split(',');
                    m_ServiceFileNames.Clear();
                    m_ServiceFileNames.AddRange(fileNames);
                }
            }

            if (m_ServerNode == null)
            {
                m_ServerNode = new ServerNode(m_NodeName, m_GroupName, CommonLog.GetLogger());
                m_ServerNode.SetServerInfoStorage(m_StorageName);
                m_ServerNode.ResetLocalServiceFiles(m_ServiceFileNames);
            }
        }
示例#3
0
        private async void btnStart_Click(object sender, EventArgs e)
        {
            if (m_ServerNode != null && !m_ServerNode.IsWorking())
            {
                await m_ServerNode.Start(m_InternalSetting, m_PublicSetting);

                await Task.Delay(500);

                if (m_ServerNode.IsWorking())
                {
                    CommonLog.Info("Server Started");
                    CommonLog.Info("Internal URL: " + m_ServerNode.GetInternalAccessUrl());
                    CommonLog.Info("Public URL: " + m_ServerNode.GetPublicAccessUrl());
                }
            }
        }