Skip to content

Commit b2fdf59

Browse files
Date/Time not synced error
1 parent 2b9e4ce commit b2fdf59

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

Form/KeyAuth.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using System.Threading.Tasks;
1919
using System.Net.Http;
2020
using System.Linq;
21+
using System.Windows;
2122

2223
namespace KeyAuth
2324
{
@@ -1128,15 +1129,9 @@ public static void error(string message)
11281129
}
11291130

11301131
File.AppendAllText(file, DateTime.Now + $" > {message}" + Environment.NewLine);
1131-
1132-
Process.Start(new ProcessStartInfo("cmd.exe", $"/c start cmd /C \"color b && title Error && echo {message} && timeout /t 5\"")
1133-
{
1134-
CreateNoWindow = true,
1135-
RedirectStandardOutput = true,
1136-
RedirectStandardError = true,
1137-
UseShellExecute = false
1138-
});
1139-
TerminateProcess(GetCurrentProcess(), 1);
1132+
1133+
System.Windows.MessageBox.Show(message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
1134+
Environment.Exit(1);
11401135
}
11411136

11421137
private static async Task<string> req(NameValueCollection post_data)
@@ -1278,6 +1273,7 @@ private static void sigCheck(string resp, WebHeaderCollection headers, string ty
12781273
// Try to parse the input string to a long Unix timestamp
12791274
if (!long.TryParse(timestamp, out long unixTimestamp))
12801275
{
1276+
error("Failed to parse the timestamp from the server. Please ensure your device's date and time settings are correct.");
12811277
TerminateProcess(GetCurrentProcess(), 1);
12821278
}
12831279

@@ -1293,6 +1289,7 @@ private static void sigCheck(string resp, WebHeaderCollection headers, string ty
12931289
// Check if the timestamp is within 20 seconds of the current time
12941290
if (timeDifference.TotalSeconds > 20)
12951291
{
1292+
error("Date/Time settings aren't synced on your device, please sync them to use the program");
12961293
TerminateProcess(GetCurrentProcess(), 1);
12971294
}
12981295

0 commit comments

Comments
 (0)