public void AddCurrentAgentInfo(AgentInfo ag, string key)
        {
            string k = AgentInfoKey + key;

            if (LoginProvider == "Cookie")
            {
                WebHelper.WriteCookie(k, ag.ToJson(), 60);
            }
            else
            {
                WebHelper.WriteSession(k, ag.ToJson());
            }
        }
Beispiel #2
0
        public AgentInfo Info(AgentInfo info)
        {
            XTrace.WriteLine(info.ToJson());

            var set = Setting;

            // 使用对方送过来的星尘服务端地址
            if (set.Server.IsNullOrEmpty() && !info.Server.IsNullOrEmpty())
            {
                set.Server = info.Server;
                set.Save();

                XTrace.WriteLine("StarAgent使用应用[{0}]送过来的星尘服务端地址:{1}", info.ProcessName, info.Server);

                if (Service is MyService svc)
                {
                    ThreadPoolX.QueueUserWorkItem(() =>
                    {
                        svc.StartFactory();
                        svc.StartClient();
                    });
                }
            }

            var ai = AgentInfo.GetLocal();

            ai.Server   = set.Server;
            ai.Services = Manager?.Services.Select(e => e.Name).ToArray();

            return(ai);
        }