private void CheckWinOrLoseCondition() { if (enemyController.Count <= 0) { LogHandler.AddLog("WINNER!!!!"); } }
public void ButtPress() { Vector3 input = Input.mousePosition; LogHandler.AddLog("ButtonPress " + Camera.main.ScreenToWorldPoint(input).ToString()); if (Input.touchCount > 0) { for (int i = 0; i < Input.touchCount; i++) { if (Input.touchCount < i) { return; } Input.GetTouch(i); Vector3 pos = new Vector3(Input.GetTouch(i).position.x, Input.GetTouch(i).position.y, 0); LogHandler.AddLog("Button Touch " + Camera.main.ScreenToWorldPoint(pos).ToString()); } } if (GameManager.Instance != null) { GameManager.Instance.MainPlayerAttack(); GameManager.Instance.PlayerAttack(); } }
//public async Task<bool> Sendemail(long UserId, string Email) public async Task <bool> Sendemail(long UserId, string Email) { try { if (UserId < 1) { return(false); } //CLayer.OfflineBooking data = BLayer.OfflineBooking.GetOfflineBookingCustomerDetailsByID(UserId); try { string message = ""; Common.Mailer ml = new Common.Mailer(); //if (data.CustomerEmail != "") //{ LogHandler.AddLog("Mail process starts:-" + DateTime.Now.ToString()); message = await Common.Mailer.MessageFromHtml(System.Configuration.ConfigurationManager.AppSettings.Get("PaymentRequest") + (Guid)Session["PaymentGuid"]); System.Net.Mail.MailMessage PaymentMsg = new System.Net.Mail.MailMessage(); //PaymentMsg.To.Add(Session["CustomerEmail"].ToString()); PaymentMsg.To.Add(Email); PaymentMsg.Subject = "Request for Payment"; PaymentMsg.Body = message; PaymentMsg.IsBodyHtml = true; try { LogHandler.AddLog("Mail Sending to reservation starts:-" + DateTime.Now.ToString()); await ml.SendMailAsync(PaymentMsg, Common.Mailer.MailType.Reservation); LogHandler.AddLog("Mail Sending to reservation Ends:-" + DateTime.Now.ToString()); } catch (Exception ex) { LogHandler.AddLog("Mail Sending Exception Eror(244):-" + DateTime.Now.ToString()); Common.LogHandler.HandleError(ex); } //} } catch (Exception ex) { LogHandler.AddLog("Mail Sending Exception Eror(252):-" + DateTime.Now.ToString()); Common.LogHandler.HandleError(ex); } } catch (Exception ex) { LogHandler.AddLog("Mail Sending Exception Eror(258):-" + DateTime.Now.ToString()); Common.LogHandler.HandleError(ex); } return(true); }
public ActionResult CustomerBookingList(long id) { LogHandler.AddLog("CustomerBookingList:-" + id.ToString()); Session["CustomerId"] = id; string Cus_Email = ""; Models.CustomerDetailModel details = null; //CLayer.User data = BLayer.User.Get(id); CLayer.OfflineBooking data = BLayer.OfflineBooking.GetOfflineBookingCustomerDetailsByID(id); LogHandler.AddLog("CustomerBookingList data read successfull:-" + DateTime.Now.ToString()); if (data != null) { LogHandler.AddLog("If CustomerBookingList data is not null:-" + DateTime.Now.ToString()); List <CLayer.OfflineBooking> users = BLayer.OfflineBooking.GetAllForPaymentList_Details(data.CustomerName); LogHandler.AddLog("users count:-" + DateTime.Now.ToString()); //List<CLayer.OfflineBooking> users = BLayer.OfflineBooking.GetAllForPaymentList_Details(id); // Cus_Email = users.First().CustomerEmail; foreach (var item in users) { if (Cus_Email == "") { if (item.PaymentLinkStatus == "checked" && item.CustomerEmail != "" && Cus_Email == "") { LogHandler.AddLog("PaymentLinkStatus is checked:-" + DateTime.Now.ToString()); Cus_Email = users.First().CustomerEmail; } } else { break; } } if (Cus_Email == "" && users.Count > 0) { Cus_Email = users.First().CustomerEmail; //Advance = users.First().AdvanceReceived; } Session["CustomerEmail"] = Cus_Email; details = new Models.CustomerDetailModel() { UserId = id, FirstName = data.FirstName, LastName = data.LastName, Name = data.CustomerName, Email = Cus_Email, AdvanceReceived = 0, OfflineBookingList = users, }; } LogHandler.AddLog("CustomerBookingList returns successfull:-" + DateTime.Now.ToString()); return(View(details)); }
private void btnExit_Click(object sender, EventArgs e) { if (!completed) { canceled = true; LogHandler.AddLog("TCP scan canceled."); tokenSource.Cancel(); } else { LogHandler.AddLog($"TCP scan completed. Open TCP ports : {portsClosed}, Closed/Unreached TCP ports : {portsOpened}"); } Close(); }
private void btnRemoveAll_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show($"Are you sure you want to remove ALL ({lbTargets.Items.Count}) targets?", "Remove ALL Targets", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { foreach (var tar in lbTargets.Items) { FormSession.TARGETS.Remove(IPAddress.Parse(tar.ToString())); } LogHandler.AddLog("Removed ALL targets"); RefreshList(); CHANGES_HAPPENED = true; } }
private void btnExit_Click(object sender, EventArgs e) { if (!completed) { canceled = true; LogHandler.AddLog("Ping scan canceled."); tokenSource.Cancel(); } else { LogHandler.AddLog($"Ping test completed. Successful pings : {pingGood}, Unsuccessful pings : {pingBad}"); } Close(); }
public bool AddLog([FromBody] Logs log) { return(LogHandler.AddLog(log)); }
private void btnAdd_Click(object sender, EventArgs e) { if (rbSingle.Checked) { if (tbSingleIP.Text.TryParseIPv4(out IPAddress _address)) { if (!FormSession.TARGETS.Contains(_address)) { IP_ADDRESS = _address; FormSession.TARGETS.Add(IP_ADDRESS); IP_RANGE = null; LogHandler.AddLog($"Added address to targets : {IP_ADDRESS.ToString()}"); CHANGES_HAPPENED = true; Close(); } else { MessageBox.Show("This IP is already on the target list!"); } } else { IP_ADDRESS = null; MessageBox.Show("This is not a valid IP address!"); } } else { if (tbRangeIP.Text[tbRangeIP.Text.Length - 1] == '.') //Remove '.' at the end if necessary { tbRangeIP.Text = tbRangeIP.Text.Substring(0, tbRangeIP.Text.Length - 1); } if ($"{tbRangeIP.Text}.{numFrom.Value}".TryParseIPv4(out IPAddress _address)) //Custom TryParse to check IPv4 { for (int i = (int)numFrom.Value; i <= numTo.Value; i++) { IPAddress ip = IPAddress.Parse($"{tbRangeIP.Text}.{i}"); if (!FormSession.TARGETS.Contains(ip)) { IP_RANGE.Add(ip); continue; } //What if range contains one of the already added targets DialogResult result = MessageBox.Show($"IP address {ip.ToString()} is already on the list.", "Warning", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning); if (result == DialogResult.Retry) { i--; } else if (result == DialogResult.Ignore) { continue; } else { return; } } FormSession.TARGETS.AddRange(IP_RANGE); LogHandler.AddLog($"Added range of addresses to targets : {IP_RANGE[0].ToString()} to {IP_RANGE[IP_RANGE.Count - 1].ToString()}"); CHANGES_HAPPENED = true; IP_ADDRESS = null; Close(); } else { IP_RANGE.Clear(); MessageBox.Show("This is not a valid IP range! (Use in form of XYZ.XYZ.XYZ)"); } } }
private void ExecutePing() { lProgress.Invoke((MethodInvoker) delegate { lProgress.Text = "Initializing ping scan..."; }); pBar.Invoke((MethodInvoker) delegate { pBar.Maximum = 0; if ((PingType.Loopback & currentType) == PingType.Loopback) { pBar.Maximum += LOOPBACK_PING_AMOUNT; } if ((PingType.Localhost & currentType) == PingType.Localhost) { pBar.Maximum += LOCALHOST_PING_AMOUNT; } if ((PingType.Dns & currentType) == PingType.Dns) { pBar.Maximum += byte.Parse(Settings.GetSetting("DNS_COUNT")) * DNS_PING_AMOUNT; } if ((PingType.Targets & currentType) == PingType.Targets) { pBar.Maximum += FormSession.TARGETS.Count * TARGET_PING_AMOUNT; } }); token.ThrowIfCancellationRequested(); if (!tokenSource.IsCancellationRequested) { lProgress.Invoke((MethodInvoker) delegate { lProgress.Text = $"Pinging {currentIretation}/{pBar.Maximum}..."; }); } if ((PingType.Loopback & currentType) == PingType.Loopback) { uint currentGood = 0, currentBad = 0; for (int i = 1; i <= LOOPBACK_PING_AMOUNT; i++) { PingReply reply = GetPingReply(IPAddress.Loopback); if (reply.Status == IPStatus.Success) { pingGood++; currentGood++; } else { pingBad++; currentBad++; } if (!tokenSource.IsCancellationRequested) { lbInfo.Invoke((MethodInvoker) delegate { lbInfo.Items.Add($"Loopback ping {i}/{LOOPBACK_PING_AMOUNT} : {reply.Status.ToString()} \t| Round Trip Time : {reply.RoundtripTime}ms"); }); } if (i != LOOPBACK_PING_AMOUNT) { NextAction(); } } if (!tokenSource.IsCancellationRequested) { LogHandler.AddLog($"Loopback Address ping(s) completed. Successful pings : {currentGood}, Unsuccessful pings : {currentBad}"); } } if ((PingType.Localhost & currentType) == PingType.Localhost) { uint currentGood = 0, currentBad = 0; for (int i = 1; i <= LOCALHOST_PING_AMOUNT; i++) { PingReply reply = GetPingReply(StaticUtilities.GetLocalIPv4Address()); if (reply.Status == IPStatus.Success) { pingGood++; currentGood++; } else { pingBad++; currentBad++; } if (!tokenSource.IsCancellationRequested) { lbInfo.Invoke((MethodInvoker) delegate { lbInfo.Items.Add($"Localhost ping {i}/{LOCALHOST_PING_AMOUNT} : {reply.Status.ToString()} \t| Round Trip Time : {reply.RoundtripTime}ms"); }); } if (i != LOCALHOST_PING_AMOUNT) { NextAction(); } } if (!tokenSource.IsCancellationRequested) { LogHandler.AddLog($"Localhost Address ping(s) completed. Successful pings : {currentGood}, Unsuccessful pings : {currentBad}"); } } if ((PingType.Dns & currentType) == PingType.Dns) { uint currentGood = 0, currentBad = 0; foreach (var dns in Settings.GetSettingsDnsAddresses()) { int i = 1; for (; i <= DNS_PING_AMOUNT; i++) { PingReply reply = GetPingReply(dns); if (reply.Status == IPStatus.Success) { pingGood++; currentGood++; } else { pingBad++; currentBad++; } if (!tokenSource.IsCancellationRequested) { lbInfo.Invoke((MethodInvoker) delegate { lbInfo.Items.Add($"DNS ping ({dns}) {i}/{DNS_PING_AMOUNT} : {reply.Status.ToString()} \t| Round Trip Time : {reply.RoundtripTime}ms"); }); } if (i != DNS_PING_AMOUNT) { NextAction(); } } if (i != DNS_PING_AMOUNT) { NextAction(); } } if (!tokenSource.IsCancellationRequested) { LogHandler.AddLog($"DNS Addresses ping(s) completed. Successful pings : {currentGood}, Unsuccessful pings : {currentBad}"); } } if ((PingType.Targets & currentType) == PingType.Targets) { uint currentGood = 0, currentBad = 0; foreach (var target in FormSession.TARGETS) { if (tokenSource.IsCancellationRequested) { break; } int i = 1; for (; i <= TARGET_PING_AMOUNT; i++) { if (tokenSource.IsCancellationRequested) { break; } PingReply reply = GetPingReply(target); if (reply.Status == IPStatus.Success) { pingGood++; currentGood++; } else { pingBad++; currentBad++; } if (!tokenSource.IsCancellationRequested) { lbInfo.Invoke((MethodInvoker) delegate { lbInfo.Items.Add($"Target ping ({target})\t{i}/{TARGET_PING_AMOUNT} : {reply.Status.ToString()} \t| Round Trip Time : {reply.RoundtripTime}ms"); }); } if (i != TARGET_PING_AMOUNT) { NextAction(); } } if (i != TARGET_PING_AMOUNT) { NextAction(); } } if (!tokenSource.IsCancellationRequested) { LogHandler.AddLog($"Target Addresses ping(s) completed. Successful pings : {currentGood}, Unsuccessful pings : {currentBad}"); } } if (!tokenSource.IsCancellationRequested) { lbInfo.Invoke((MethodInvoker) delegate { lProgress.Text = "Pings completed"; btnStart.Enabled = false; btnExit.Text = "Exit Test"; }); completed = true; FormSession.TEST_DATA = GenerateData(); } }