private void OnTimerTick() { foreach (var d in chobbyla.downloader.Downloads.Where(x => x.IsComplete == null)) { SendCommand(new DownloadFileProgress() { Name = d.Name, FileType = d.DownloadType.ToString(), Progress = d.TotalProgress.ToString("F2", CultureInfo.InvariantCulture), SecondsRemaining = d.SecondsRemaining, TotalLength = d.TotalLength, CurrentSpeed = d.CurrentSpeed }); } discordController.Update(); }
protected void UpdateThread() { while (true) { if (!firstFrameRendered) { continue; } if (Time.currentTime * 1000 - lastUpdate < 1) { continue; } HandleInput(); DiscordController.Update(); Update(1000 / (Time.GetMilliseconds() - lastUpdate)); lastUpdate = Time.GetMilliseconds(); Thread.Sleep(1000 / 60); } }