public void SaveVictimsFile() { using (var writer = new StreamWriter(_file.ToString(), false)) { // TODO: Change this ugly workaround if (_victims != null && _victims.Count > 0) { var victims = new Victims { Array = (from victim in _victims let bans = Titan.Instance.BanManager.GetBanInfoFor(SteamUtil.FromSteamID64(victim.SteamID)) where !(bans.GameBanCount > 0 || bans.VacBanned) select victim).ToArray() }; writer.Write(JsonConvert.SerializeObject(victims, Formatting.Indented)); } else { writer.Write("{\"victims\":[]}"); } } _log.Debug("Successfully wrote Victim file."); }
public void SaveVictimsFile() { using (var writer = new StreamWriter(_file.ToString(), false)) { if (_victims != null && _victims.Count > 0) { var victimList = new List <Victims.Victim>(); foreach (var victim in _victims) { if (Titan.Instance.WebHandle.RequestBanInfo(SteamUtil.FromSteamID64(victim.SteamID), out var banInfo)) { if (!(banInfo.GameBanCount > 0 || banInfo.VacBanned)) { victimList.Add(victim); } } } var victims = new Victims { Array = victimList.ToArray() }; writer.Write(JsonConvert.SerializeObject(victims, Formatting.Indented)); } else { writer.Write("{\"victims\":[]}"); } } _log.Debug("Successfully wrote Victim file."); }
// Quartz.NET Job Executor public void Execute(IJobExecutionContext context) { _log.Debug("Checking all victims if they have bans on record."); _log.Information("Victims: {a}", _victims); foreach (var victim in _victims.ToArray()) { var target = SteamUtil.FromSteamID64(victim.SteamID); var bans = Titan.Instance.BanManager.GetBanInfoFor(target); var time = DateTime.Now.Subtract(new DateTime(victim.Ticks)); if (bans.GameBanCount > 0 || bans.VacBanned) { var count = bans.GameBanCount == 0 ? bans.VacBanCount : bans.GameBanCount; var id64 = target.ConvertToUInt64(); if (_victims.Remove(victim)) { _log.Information("Your recently botted target {Target} received " + "{Count} ban(s) after {Delay}. Thank you for using Titan.", id64, count, time.Hours == 0 ? time.Minutes + " minute(s)" : time.Hours + " hour(s)"); Titan.Instance.UIManager.SendNotification( "Titan - " + id64 + " banned", "Your recently botted target " + id64 + " " + "has been banned and has now " + count + " Ban(s) on record." ); } } } }
public void TestSteamID64Parser() { if (SteamUtil.FromSteamID64(76561198224231904).ConvertToUInt64() == 76561198224231904) { Assert.True(true, "Steam ID parsing successfull"); } else { Assert.True(false); } }
// Quartz.NET Job Executor public Task Execute(IJobExecutionContext context) { return(Task.Run(() => { _log.Debug("Checking all victims if they have bans on record."); _log.Information("Victims: {a}", _victims); foreach (var victim in _victims.ToArray()) { var target = SteamUtil.FromSteamID64(victim.SteamID); var time = DateTime.Now.Subtract(victim.Timestamp.ToDateTime()); if (Titan.Instance.WebHandle.RequestBanInfo(target, out var banInfo)) { if (banInfo.GameBanCount > 0 || banInfo.VacBanned) { var count = banInfo.GameBanCount == 0 ? banInfo.VacBanCount : banInfo.GameBanCount; var id64 = target.ConvertToUInt64(); if (_victims.Remove(victim)) { if (!Titan.Instance.Options.Secure) { _log.Information("Your recently botted target {Target} received " + "{Count} ban(s) after {Delay}. Thank you for using Titan.", id64, count, time.Hours == 0 ? time.Minutes + " minute(s)" : time.Hours + " hour(s)"); Titan.Instance.UIManager.SendNotification( "Titan - " + id64 + " banned", "Your recently botted target " + id64 + " " + "has been banned and has now " + count + " Ban(s) on record.", () => Process.Start("http://steamcommunity.com/profiles/" + id64) ); } } } } } })); }
// Quartz.NET Job Executor public void Execute(IJobExecutionContext context) { _log.Debug("Checking all victims if they have bans on record."); _log.Information("Victims: {a}", _victims); foreach (var victim in _victims.ToArray()) { var target = SteamUtil.FromSteamID64(victim.SteamID); var bans = Titan.Instance.BanManager.GetBanInfoFor(target); var time = DateTime.Now.Subtract(new DateTime(victim.Ticks)); if (bans.GameBanCount > 0 || bans.VacBanned) { var count = bans.GameBanCount == 0 ? bans.VacBanCount : bans.GameBanCount; var id64 = target.ConvertToUInt64(); if (_victims.Remove(victim)) { _log.Information("Your recently botted target {Target} received " + "{Count} ban(s) after {Delay}. Thank you for using Titan.", id64, count, time.Hours == 0 ? time.Minutes + " minute(s)" : time.Hours + " hour(s)"); var notification = new Notification { Title = "Titan - " + id64 + " banned", Message = "Your recently botted target " + id64 + " " + "has been banned and has now " + count + " Ban(s) on record.", Icon = Titan.Instance.UIManager.SharedResources.TITAN_ICON }; notification.Activated += delegate { Process.Start("https://steamcommunity.com/profiles/" + id64 + "/"); }; Application.Instance.Invoke(() => notification.Show()); } } } }
// Quartz.NET Job Executor public Task Execute(IJobExecutionContext context) { return(Task.Run(() => { _log.Information("Checking all victims if they have bans on record."); _log.Debug("Victims: {a}", _victims); foreach (var victim in _victims.ToArray()) { var target = SteamUtil.FromSteamID64(victim.SteamID); var time = DateTime.Now.Subtract(victim.Timestamp.ToDateTime()); if (Titan.Instance.WebHandle.RequestBanInfo(target, out var banInfo)) { if (banInfo.GameBanCount > 0 || banInfo.VacBanned) { var count = banInfo.GameBanCount == 0 ? banInfo.VacBanCount : banInfo.GameBanCount; var id64 = target.ConvertToUInt64(); if (_victims.Remove(victim)) { if (!Titan.Instance.Options.Secure) { _log.Information("Your recently botted target {Target} received " + "{Count} ban(s) after {Delay}. Thank you for using Titan.", id64, count, time.Hours == 0 ? time.Minutes + " minute(s)" : time.Hours + " hour(s)"); if (Titan.Instance.EnableUI) { Titan.Instance.UIManager.SendNotification( "Titan - " + id64 + " banned", "Your recently botted target " + id64 + " " + "has been banned and has now " + count + " Ban(s) on record.", () => Process.Start("http://steamcommunity.com/profiles/" + id64) ); Task.Run(() => Titan.Instance.ProfileSaver.SaveSteamProfile(target)); Application.Instance.Invoke(() => { Titan.Instance.UIManager.ShowForm(UIType.Victim, new Form { Title = "Banned Victim - " + id64 + " - Titan", Icon = Titan.Instance.UIManager.SharedResources.TITAN_ICON, Resizable = false, Visible = true, ClientSize = new Size(1280, 720), Topmost = true, Content = new TableLayout { Spacing = new Size(5, 5), Padding = new Padding(10, 10, 10, 10), Rows = { new TableRow( new Label { Text = "Success! Your recently botted target has " + "been banned after " + time.Hours + " hours. " + "The profile has been saved to \"Titan/" + "victimprofiles/" + id64 + ".html\".", TextAlignment = TextAlignment.Center } ), new WebView { Url = new Uri("http://steamcommunity.com/profiles/" + id64) } } } }); }); } } } } } } })); }