Esempio n. 1
0
        public ActionResult Ping(int id, string clientId, bool active)
        {
            if (active)
            {
                SystemUpdaterCollection.Active(id, clientId);
            }
            else
            {
                var config = SysUpdateHelper.GetSystemConfig(id);

                SystemUpdaterCollection.Inactive(id, clientId, config.PingInterval);
            }

            var file = SysUpdateHelper.GetClientCommandFile(id, clientId);

            if (!System.IO.File.Exists(file))
            {
                return(Content(string.Empty));
            }
            else
            {
                var cmd = System.IO.File.ReadAllText(file);

                IOHelper.DeleteFile(file);

                return(Content(cmd, "application/octet-stream"));
            }
        }
Esempio n. 2
0
        public ActionResult PingList(int id, string clientName, int p = 1, DateTime?date = null)
        {
            var system = SysUpdateHelper.GetSystem(id);

            if (system == null)
            {
                return(NotFound());
            }

            var now = DateTime.Now;

            var config     = SysUpdateHelper.GetSystemConfig(id);
            var clientApps = SystemUpdaterCollection.GetClientApps(id)
                             .Where(c => string.IsNullOrEmpty(clientName) || c.ClientId.Contains(clientName));

            var model = new SystemPingListViewModel
            {
                ClientApps = clientApps,
                Config     = config,
                System     = system,
                ClientName = clientName
            };

            return(View(model));
        }
Esempio n. 3
0
        public ActionResult Config(int id)
        {
            var system = SysUpdateHelper.GetSystem(id);

            if (system == null)
            {
                return(NotFound());
            }

            var config = SysUpdateHelper.GetSystemConfig(id);

            ViewBag.Title    = $"系统更新设置-{system.Name}";
            ViewBag.SystemId = id;

            return(View(config));
        }
Esempio n. 4
0
        public ActionResult GetSystemConfig(int id)
        {
            var config = SysUpdateHelper.GetSystemConfig(id);

            return(Json(config, JsonRequestBehavior.AllowGet));
        }