Пример #1
0
 public SoftwareData(ProjectInfo projectInfo)
 {
     start   = SoftwareCoUtil.getNowInSeconds();
     project = projectInfo;
     version = SoftwareCoPackage.GetVersion();
     os      = SoftwareCoPackage.GetOs();
 }
        public static async void SendHeartbeat(string reason)
        {
            string jwt    = GetJwt();
            bool   online = await IsOnlineAsync();

            if (online && jwt != null)
            {
                string version = Constants.EditorVersion;

                JsonObject jsonObj = new JsonObject();
                jsonObj.Add("version", SoftwareCoPackage.GetVersion());
                jsonObj.Add("os", SoftwareCoPackage.GetOs());
                jsonObj.Add("pluginId", Constants.PluginId);
                jsonObj.Add("start", SoftwareCoUtil.getNowInSeconds());
                jsonObj.Add("trigger_annotation", reason);
                jsonObj.Add("hostname", SoftwareCoUtil.getHostname());

                string api      = "/data/heartbeat";
                string jsonData = jsonObj.ToString();
                HttpResponseMessage response = await SoftwareHttpManager.SendRequestAsync(HttpMethod.Post, api, jsonData, jwt);

                if (!SoftwareHttpManager.IsOk(response))
                {
                    Logger.Warning("Code Time: Unable to send heartbeat");
                }
            }
        }
Пример #3
0
        public PluginData(string projectName, string projectDirectory)
        {
            this.type     = "Events";
            this.pluginId = Constants.PluginId;
            NowTime nowTime = SoftwareCoUtil.GetNowTime();

            start       = nowTime.now;
            local_start = nowTime.local_now;
            offset      = nowTime.offset_minutes;
            version     = SoftwareCoPackage.GetVersion();
            os          = SoftwareCoPackage.GetOs();
            source      = new List <PluginDataFileInfo>();
            project     = GetPluginProjectUsingDir(projectDirectory);
            cumulative_editor_seconds  = 0;
            elapsed_seconds            = 0;
            cumulative_session_seconds = 0;
            project_null_error         = "";
            workspace_name             = "";
            hostname = "";
        }
Пример #4
0
        private void InitializeData()
        {
            NowTime nowTime = SoftwareCoUtil.GetNowTime();

            this.timestamp       = nowTime.now;
            this.timestamp_local = nowTime.local_now;
            this.pluginId        = Constants.PluginId;
            this.os       = SoftwareCoPackage.GetOs();
            this.hostname = SoftwareCoUtil.getHostname();
            this.version  = SoftwareCoPackage.GetVersion();
            if (TimeZone.CurrentTimeZone.DaylightName != null &&
                TimeZone.CurrentTimeZone.DaylightName != TimeZone.CurrentTimeZone.StandardName)
            {
                this.timezone = TimeZone.CurrentTimeZone.DaylightName;
            }
            else
            {
                this.timezone = TimeZone.CurrentTimeZone.StandardName;
            }
        }