Updated program
Some minor fixes, will be getting rid of this in favor of UI setup.
This commit is contained in:
parent
7128bfad65
commit
d4a9b88cc0
1 changed files with 8 additions and 3 deletions
|
|
@ -61,12 +61,14 @@ class Program
|
||||||
settingsSyncer
|
settingsSyncer
|
||||||
};
|
};
|
||||||
var lastTime = DateTime.Now;
|
var lastTime = DateTime.Now;
|
||||||
|
var checkInterval = TimeSpan.FromSeconds(30);
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (syncers.Any(x => x != null && x.IsDirty() ))
|
if (syncers.Any(x => x != null && x.IsDirty() ))
|
||||||
{
|
{
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
if (lastTime - DateTime.Now > TimeSpan.FromSeconds(30))
|
var lastCheck = DateTime.Now - lastTime;
|
||||||
|
if (lastCheck > checkInterval)
|
||||||
{
|
{
|
||||||
var start = DateTime.Now;
|
var start = DateTime.Now;
|
||||||
Console.WriteLine("Checking for updates...");
|
Console.WriteLine("Checking for updates...");
|
||||||
|
|
@ -76,7 +78,9 @@ class Program
|
||||||
var end = DateTime.Now - start;
|
var end = DateTime.Now - start;
|
||||||
Console.WriteLine($"Check completed. Total Time: {end}");
|
Console.WriteLine($"Check completed. Total Time: {end}");
|
||||||
}
|
}
|
||||||
if (Process.GetProcessesByName("FreeTube").Length > 0) continue;
|
|
||||||
|
var procs = Process.GetProcessesByName("FreeTube");
|
||||||
|
if (procs.Length > 0) continue;
|
||||||
Console.WriteLine("FreeTube has closed and we have updates, we're going to try and update.");
|
Console.WriteLine("FreeTube has closed and we have updates, we're going to try and update.");
|
||||||
Thread.Sleep(1500);
|
Thread.Sleep(1500);
|
||||||
|
|
||||||
|
|
@ -94,7 +98,8 @@ class Program
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
if (lastTime - DateTime.Now <= TimeSpan.FromSeconds(30)) continue;
|
var lastCheck = DateTime.Now - lastTime;
|
||||||
|
if (lastCheck < checkInterval) continue;
|
||||||
var start = DateTime.Now;
|
var start = DateTime.Now;
|
||||||
Console.WriteLine("Checking for updates...");
|
Console.WriteLine("Checking for updates...");
|
||||||
foreach (var syncer in syncers)
|
foreach (var syncer in syncers)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue