Skip to content

Commit 7395717

Browse files
author
Sébastien Geiser
committed
Add Update Check in progress
1 parent 89f8cdf commit 7395717

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

RegexDialog/RegExToolDialog.xaml.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Diagnostics;
1111
using System.IO;
1212
using System.Linq;
13+
using System.Net.Http;
1314
using System.Reflection;
1415
using System.Text;
1516
using System.Text.RegularExpressions;
@@ -307,6 +308,29 @@ private void Init()
307308

308309
// Set Treeview Matches Result base contextMenu
309310
MatchResultsTreeView.ContextMenu = MatchResultsTreeView.Resources["cmMatchResultsMenu"] as ContextMenu;
311+
312+
CheckUpdates();
313+
}
314+
315+
private async void CheckUpdates()
316+
{
317+
double hoursFromLastCheck = Math.Abs((DateTime.Now - Config.Instance.LastUpdateCheck).TotalHours);
318+
319+
//if (hoursFromLastCheck > 8)
320+
if (true)
321+
{
322+
try
323+
{
324+
HttpClient client = new HttpClient();
325+
326+
var response = await client.GetAsync("https://github.com/codingseb/CSharpRegexTools4Npp/releases");
327+
328+
string responseText = await response.Content.ReadAsStringAsync();
329+
330+
331+
}
332+
catch { }
333+
}
310334
}
311335

312336
private void BuildRegexOptionsCheckBoxs()

RegexDialog/Utils/Config.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,7 @@ private void Init()
130130
public bool ShowEndOfLinesCSharpTextSourceEditorOption { get; set; }
131131

132132
public bool ShowCSharpTextSourceTestInANewTab { get; set; } = true;
133+
134+
public DateTime LastUpdateCheck { get; set; } = DateTime.Now.AddHours(-8);
133135
}
134136
}

0 commit comments

Comments
 (0)