Esempio n. 1
0
        public async Task StartSessionUpdateLoop(string userName, string password)
        {
            Credentials = new RestServerCredentials
            {
                Username   = userName,
                Password   = password,
                ApiBaseURL = Repo1Client.API_URL,
            };

            if (_isTracking)
            {
                return;
            }
            _isTracking = true;

            Status = "FindSavedSessions ...";
            var recs = await FindSavedSessions();

            if (recs == null)
            {
                return;
            }
            if (recs.Count > 1)
            {
                return;
            }

            var savd = recs.SingleOrDefault();

            if (savd == null)
            {
                savd = await PostNewSession();
            }

            if (!Repo1Cfg.Found(ConfigKey))
            {
                Repo1Cfg.WriteBlank(ConfigKey);
            }

            while (true)
            {
                await Task.Delay(1000 * 60 *SendIntervalMins);

                var sess = await GatherSessionInfo(savd);

                var newCfg = await SendAndGetNewCfg(sess);

                if (newCfg != sess.Repo1CfgJson)
                {
                    Repo1Cfg.Rewrite(newCfg, ConfigKey);
                }
            }
        }
Esempio n. 2
0
        private void UpdateLocalCfgAsNeeded(Dictionary <string, object> dict)
        {
            var expctd = dict.FieldValue("field_expectedcfg");

            if (expctd.IsBlank())
            {
                return;
            }

            var actual = Repo1Cfg.Read(_cfgKey);

            if (actual != expctd)
            {
                Repo1Cfg.Rewrite(expctd, _cfgKey);
            }
        }
Esempio n. 3
0
        private async Task <bool> RunOfflineJobs(R1MachineSpecsBase obj)
        {
            obj.ExePath          = SafeGet(() => GetExePath());
            obj.MacAndPrivateIPs = SafeGet(() => GetMacAndPrivateIPs());
            obj.ExeVersion       = SafeGet(() => GetExeVersion());
            obj.WindowsAccount   = SafeGet(() => Environment.UserName);
            obj.ComputerName     = SafeGet(() => Environment.MachineName);
            obj.Workgroup        = SafeGet(() => GetWorkgroup());
            obj.LegacyCfgJson    = SafeGet(() => ReadLegacyCfg?.Invoke());
            obj.Repo1CfgJson     = SafeGet(() => Repo1Cfg.Read(_cfgKey));
            obj.IsAdminUser      = CurrentWindowsUser.IsAdmin();

            await Task.Delay(1);

            return(true);
        }
Esempio n. 4
0
        private string GetFutureLicenseKey()
        {
            var rCfg = Repo1Cfg.Parse(ConfigKey);

            if (rCfg == null)
            {
                return(null);
            }
            var list = MacAddresses.List();

            for (int i = 0; i < list.Count; i++)
            {
                list[i] = rCfg.GetLicenseKey(list[i]);
            }

            return(string.Join(L.f, list));
        }
Esempio n. 5
0
 protected override DownloaderCfg ParseDownloaderCfg(string configKey)
 => Repo1Cfg.Parse(configKey);
Esempio n. 6
0
 public ClientValidator1(string configKey) : base(configKey, Repo1Cfg.Parse(configKey))
 {
 }