public override bool Validate() { Refresh(); if (int.TryParse(Day.text, out day)) { if (int.TryParse(Month.text, out month)) { if (int.TryParse(Year.text, out year)) { if (year > 0) { if (TimeConversions.IntInRange(month, 1, 12)) { if (TimeConversions.IntInRange(day, 1, DateTime.DaysInMonth(year, month))) { if (DateTime.Compare(new DateTime(year, month, day), DateTime.Now) >= 0) { return(true); } } } } } } } ShowError(); return(false); }
IEnumerator RequestTodaysView() { // today's view yield return(0); DateTime currentDate = DateTime.Now; if (currentDate.DayOfWeek == System.DayOfWeek.Monday) { RequestView(State.WEEKLY, currentDate); } else { RequestView(State.MONTHLY, currentDate); } // get upcoming alarms yield return(0); List <Alarm> eventsThisWeek = new List <Alarm>(); DateTime temp; for (int i = 0; i < 6; i++) { temp = currentDate.AddDays(i); SearchResult search = data.TryGetEntries(temp.Day.ToString() + "." + temp.Month.ToString() + "." + temp.Year.ToString()); if (search.value) { if (search.info.Alarms.Count > 0) { eventsThisWeek.AddRange(search.info.Alarms); } } } eventsThisWeek.RemoveAll(x => x.report); yield return(0); // check for semester report if (currentDate.Month % 3 == 0 && TimeConversions.IntInRange(currentDate.Day, 20, 31)) { Alarm reportAlarm = new Alarm(); reportAlarm.attributes[0] = gManager.language.ReportAlarmNotes; reportAlarm.report = true; eventsThisWeek.Insert(0, reportAlarm); } // display events if (eventsThisWeek.Count > 0) { ExtrasViewController extras = FindObjectOfType <ExtrasViewController>(); if (extras) { extras.RequestAlarmPreview(eventsThisWeek); } } }
public override void BtnConvert_Click(object sender, EventArgs e) { var fromUnit = (TimeUnits)base.FromUnitType; var toUnit = (TimeUnits)base.ToUnitType; var conv = new TimeConversions(fromUnit, toUnit); EditText etFrom = SV.FindViewById <EditText>(Resource.Id.et_from_prompt); if (etFrom.Text != null) { double from = Convert.ToDouble(etFrom.Text); double toValue = conv.GetConversionResult(from); EditText etTo = SV.FindViewById <EditText>(Resource.Id.et_to_prompt); etTo.SetText(toValue.ToString(), TextView.BufferType.Normal); } }
public override bool Validate() { Refresh(); if (int.TryParse(SH.text, out sH)) { if (int.TryParse(SM.text, out sM)) { if (int.TryParse(EH.text, out eH)) { if (int.TryParse(EM.text, out eM)) { if (TimeConversions.IntInRange(sH, 0, 24)) { if (TimeConversions.IntInRange(eH, 0, 24)) { if (TimeConversions.IntInRange(sM, 0, 59)) { if (TimeConversions.IntInRange(eM, 0, 59)) { if (sH < eH) { return(true); } else { if (sH == eH) { if (sM < eM) { return(true); } } } } } } } } } } } ShowError(); return(false); }
protected override void RequestData() { SearchResult res = dataManager.TryGetEntries(_tag); if (res.value) { info = res.info; } if (assignedDate.Month >= gManager.currentDate.Month && assignedDate.Month % 3 == 0 && TimeConversions.IntInRange(assignedDate.Day, 20, 31)) { Alarm reportAlarm = new Alarm(); reportAlarm.XMLToObject(gManager.language.ReportAlarmNotes); reportAlarm.report = true; info.AddAlarm(reportAlarm); } }
public static void DisableChecks(bool CompletedEvent) { cheats_detected = Get_Cheat_Status(); if (cheats_detected != 0) { if (cheats_detected == 64 && !CompletedEvent) { /* You Know the Rules and So Do I */ } else { if (ServerProxy.Running()) { foreach (string report_url in URLs.AntiCheatFD) { if (Completed == 0) { Completed++; FunctionStatus.ExternalToolsWasUsed = true; } if (report_url.EndsWith("?")) { try { Uri sendReport = new Uri(report_url + "serverip=" + serverip + "&user_id=" + user_id + "&persona_name=" + persona_name + "&event_session=" + event_id + "&cheat_type=" + cheats_detected + "&hwid=" + HardwareID.FingerPrint.Value() + "&persona_id=" + persona_id + "&launcher_hash=" + WebHelpers.Value() + "&launcher_certificate=" + CertificateStore.LauncherSerial + "&hwid_fallback=" + HardwareID.FingerPrint.ValueAlt() + "&car_used=" + DiscordGamePresence.PersonaCarName + "&os_platform=" + InformationCache.OSName + "&event_status=" + CompletedEvent); ServicePointManager.FindServicePoint(sendReport).ConnectionLeaseTimeout = (int)TimeSpan.FromSeconds(30).TotalMilliseconds; var Client = new WebClient { Encoding = Encoding.UTF8 }; if (!WebCalls.Alternative()) { Client = new WebClientWithTimeout { Encoding = Encoding.UTF8 }; } else { Client.Headers.Add("user-agent", "SBRW Launcher " + Application.ProductVersion + " - (" + InsiderInfo.BuildNumberOnly() + ")"); } Client.DownloadStringCompleted += (Nice, Brock) => { Client.Dispose(); }; try { string NTVersion = WindowsProductVersion.GetWindowsBuildNumber() != 0 ? WindowsProductVersion.GetWindowsBuildNumber().ToString() : "Wine"; Client.Headers.Add("os-version", NTVersion); Client.DownloadStringAsync(sendReport); } catch { } } catch { } } else { try { Uri sendReport = new Uri(report_url); ServicePointManager.FindServicePoint(sendReport).ConnectionLeaseTimeout = (int)TimeSpan.FromSeconds(30).TotalMilliseconds; var request = (HttpWebRequest)WebRequest.Create(sendReport); var postData = "serverip=" + serverip + "&user_id=" + user_id + "&persona_name=" + persona_name + "&event_session=" + event_id + "&cheat_type=" + cheats_detected + "&hwid=" + HardwareID.FingerPrint.Value() + "&persona_id=" + persona_id + "&launcher_hash=" + WebHelpers.Value() + "&launcher_certificate=" + CertificateStore.LauncherSerial + "&hwid_fallback=" + HardwareID.FingerPrint.ValueAlt() + "&car_used=" + DiscordGamePresence.PersonaCarName + "&os_platform=" + InformationCache.OSName + "&event_status=" + CompletedEvent; var data = Encoding.ASCII.GetBytes(postData); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; request.Timeout = (int)TimeSpan.FromSeconds(30).TotalMilliseconds; using (var stream = request.GetRequestStream()) { stream.Write(data, 0, data.Length); } var response = (HttpWebResponse)request.GetResponse(); String responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); } catch { } } } } else { if (Completed != URLs.AntiCheatSD.Length) { foreach (string report_url in URLs.AntiCheatSD) { Completed++; if (report_url.EndsWith("?")) { try { Uri sendReport = new Uri(report_url + "serverip=" + serverip + "&user_id=" + user_id + "&cheat_type=" + cheats_detected + "&hwid=" + HardwareID.FingerPrint.Value() + "&launcher_hash=" + WebHelpers.Value() + "&launcher_certificate=" + CertificateStore.LauncherSerial + "&hwid_fallback=" + HardwareID.FingerPrint.ValueAlt() + "&os_platform=" + InformationCache.OSName); ServicePointManager.FindServicePoint(sendReport).ConnectionLeaseTimeout = (int)TimeSpan.FromSeconds(30).TotalMilliseconds; var Client = new WebClient { Encoding = Encoding.UTF8 }; if (!WebCalls.Alternative()) { Client = new WebClientWithTimeout { Encoding = Encoding.UTF8 }; } else { Client.Headers.Add("user-agent", "SBRW Launcher " + Application.ProductVersion + " - (" + InsiderInfo.BuildNumberOnly() + ")"); } Client.DownloadStringCompleted += (Nice, Brock) => { Client.Dispose(); }; try { string NTVersion = WindowsProductVersion.GetWindowsBuildNumber() != 0 ? WindowsProductVersion.GetWindowsBuildNumber().ToString() : "Wine"; Client.Headers.Add("os-version", NTVersion); Client.DownloadStringAsync(sendReport); } catch { } } catch { } } } } } TimeConversions.MUFRTime(); } } detect_MULTIHACK = detect_FAST_POWERUPS = detect_SPEEDHACK = detect_SMOOTH_WALLS = detect_TANK_MODE = detect_WALLHACK = detect_DRIFTMOD = detect_PURSUITBOT = false; cheats_detected = 0; Secret.Abort(); }
public static void Main() { TimeConversions tc = new TimeConversions(); Console.WriteLine(tc.ReturnTimeOnServer("9/1/2007 5:32:07 -05:00")); }
public int GetEndTime() { return(TimeConversions.StringTimeToInt(endTime, 60)); }
public int GetStartTime() { return(TimeConversions.StringTimeToInt(startTime, 60)); }
protected override void SetTag() { _tag = TimeConversions.DateTimeToString(assignedDate); }
protected void FillEmptySlots() { int threshold = (int)SettingsManager.ReadFloat("MinimumTourTime"); int minTime = 100000, maxTime = 0; Event n1; if (info.Events.TryGet(0, out n1)) { if (n1.GetStartTime() < minTime) { minTime = n1.GetStartTime(); } if (n1.GetEndTime() > maxTime) { maxTime = n1.GetEndTime(); } for (int i = 1; i < info.Events.Count(); i++) { if (info.Events.TryGet(i, out n1)) { if (n1.GetStartTime() - maxTime >= threshold) { AddFiller(TimeConversions.IntTimeToString(maxTime, 60), n1.startTime); } if (n1.GetStartTime() < minTime) { minTime = n1.GetStartTime(); } if (n1.GetEndTime() > maxTime) { maxTime = n1.GetEndTime(); } } } int k = 0; for (k = 1; k < setTime.Length - 1; k++) { if (TimeConversions.StringTimeToInt(setTime[k], 60) <= minTime) { AddFiller(setTime[k - 1], setTime[k]); } else { break; } } if (k == 1) { k--; if (minTime - TimeConversions.StringTimeToInt(setTime[k], 60) >= threshold) { AddFiller(setTime[k], TimeConversions.IntTimeToString(minTime, 60)); } } for (k = setTime.Length - 2; k > 0; k--) { if (TimeConversions.StringTimeToInt(setTime[k], 60) >= maxTime) { AddFiller(setTime[k], setTime[k + 1]); } else { break; } } if (k == setTime.Length - 2) { k++; if (TimeConversions.StringTimeToInt(setTime[k], 60) - maxTime >= threshold) { AddFiller(TimeConversions.IntTimeToString(maxTime, 60), setTime[k]); } } } }
public static string ErrorTranslation(int Exit_Code) { switch (Exit_Code) { case -1073741819: return("Game Crash: Access Violation (0x" + Exit_Code.ToString("X") + ")"); case -1073740940: return("Game Crash: Heap Corruption (0x" + Exit_Code.ToString("X") + ")"); case -1073740791: return("Game Crash: Stack buffer overflow (0x" + Exit_Code.ToString("X") + ")"); case -805306369: return("Game Crash: Application Hang (0x" + Exit_Code.ToString("X") + ")"); case -1073741515: return("Game Crash: Missing dependency files (0x" + Exit_Code.ToString("X") + ")"); case -1073740972: return("Game Crash: Debugger crash (0x" + Exit_Code.ToString("X") + ")"); case -1073741676: return("Game Crash: Division by Zero (0x" + Exit_Code.ToString("X") + ")"); case 1: return("The process nfsw.exe was killed via Task Manager"); case 69: return("AllocationAssistant encountered an 'Out of Memory' condition"); case 2137: return("Launcher Forced Closed your Game. \nYou are Required to Restart the Game After " + TimeConversions.RelativeTime((InformationCache.SelectedServerJSON.secondsToShutDown != 0) ? InformationCache.SelectedServerJSON.secondsToShutDown : 7200)); case 2017: return("Server replied with Code: " + Tokens.UserId + " (0x" + Exit_Code.ToString("X") + ")"); case -1: return("No DirectX resources. Please check if GPU has enough VRAM before playing"); case -3: return("The Server was unable to resolve the request"); case -4: return("Another instance is already executed"); case -5: return("DirectX Device was not found. Please install GPU Drivers before playing"); case -6: return("Server was unable to resolve your request"); case -7: /* Known Affected Programs: MSI Dragon Center, Windows 10 1909 (Fix: Update to Latest)*/ return("Corrupted Memory. Please check for interrupting Programs or System Updates."); /* ModLoader */ case 1450: return("ModNet: Unable to load ModLoader. Please Exclude Game Files with your Antivirus Software"); case 193: return("ModNet: Unable to load ModLoader. Please Install Microsoft Visual C++ Runtimes 2015-2019"); case 2: return("ModNet: Game was launched with invalid command line parameters."); case 3: return("ModNet: .links file should not exist upon startup!"); case 4: return("ModNet: An Unhandled Error Appeared"); /* Generic Error */ default: return("Game Crash with exitcode: " + Exit_Code.ToString() + " (0x" + Exit_Code.ToString("X") + ")"); } }
private void CorruptedFilesFound() { DiscordLauncherPresence.Status("Verify Bad", null); /* START Show Redownloader Progress*/ StartScanner.SafeInvokeAction(() => StartScanner.Visible = false); StopScanner.SafeInvokeAction(() => StopScanner.Visible = true); VerifyHashText.SafeInvokeAction(() => VerifyHashText.Text = "Currently (re)downloading files\nThis part may take awhile\ndepending on your connection."); if (File.Exists("invalidfiles.dat") && File.ReadAllLines("invalidfiles.dat") != null) { DownloadProgressText.SafeInvokeAction(() => DownloadProgressText.Text = "\nPreparing to Download Files"); string[] files = File.ReadAllLines("invalidfiles.dat"); foreach (string text in files) { if (!ForceStopScan) { try { while (StillDownloading) { } if (!ForceStopScan) { currentCount = files.Count(); string text2 = FileSettingsSave.GameInstallation + text; string address = FinalCDNURL + "/unpacked" + text.Replace("\\", "/"); if (File.Exists(text2)) { try { LogVerify.Deleted("File: " + text2); File.Delete(text2); } catch (Exception Error) { LogVerify.Error("File: " + text2 + " Error: " + Error.Message); LogVerify.ErrorIC("File: " + text2 + " Error: " + Error.HResult); LogVerify.ErrorFR("File: " + text2 + " Error: " + Error.ToString()); } } try { if (!new FileInfo(text2).Directory.Exists) { new FileInfo(text2).Directory.Create(); } } catch (Exception Error) { LogToFileAddons.OpenLog("VERIFY HASH File Info", null, Error, null, true); } Uri URLCall = new Uri(address); int Timeout = (int)TimeSpan.FromMinutes(5).TotalMilliseconds; if (address.Contains("copspeechdat")) { Timeout = (int)TimeSpan.FromMinutes(30).TotalMilliseconds; } else if (address.Contains("nfs09mx.mus")) { Timeout = (int)TimeSpan.FromMinutes(15).TotalMilliseconds; } ServicePointManager.FindServicePoint(URLCall).ConnectionLeaseTimeout = Timeout; var Client = new WebClient(); if (!WebCalls.Alternative()) { Client = new WebClientWithTimeout(); } else { Client.Headers.Add("user-agent", "SBRW Launcher " + Application.ProductVersion + " (+https://github.com/SoapBoxRaceWorld/GameLauncher_NFSW)"); } Client.DownloadProgressChanged += (Systems, RecevingData) => { if (RecevingData.TotalBytesToReceive >= 1 && !ForceStopScan) { DownloadProgressText.SafeInvokeAction(() => DownloadProgressText.Text = "Downloading File [ " + redownloadedCount + " / " + currentCount + " ]:\n" + CurrentDownloadingFile + "\n" + TimeConversions.FormatFileSize(RecevingData.BytesReceived) + " of " + TimeConversions.FormatFileSize(RecevingData.TotalBytesToReceive)); } else if (ForceStopScan) { Client.CancelAsync(); } }; Client.DownloadFileCompleted += new AsyncCompletedEventHandler(Client_DownloadFileCompleted); try { Client.DownloadFileAsync(URLCall, text2); CurrentDownloadingFile = text; StillDownloading = true; } catch (Exception Error) { if (!ForceStopScan) { redownloadErrorCount++; } LogToFileAddons.OpenLog("VERIFY HASH", null, Error, null, true); } finally { if (Client != null) { Client.Dispose(); } } } else { break; } } catch (Exception Error) { if (!ForceStopScan) { redownloadErrorCount++; } LogToFileAddons.OpenLog("VERIFY HASH", null, Error, null, true); } finally { if (IsVerifyHashOpen) { Application.DoEvents(); GC.Collect(); } } } else { break; } } } }