private void LoadImageToEncryptButtonOnClick(object sender, EventArgs e) { _loadImage = BitConverter.ToString(HelperLibrary.ConvertImageToByte(pictureBox1.Image)); MessageBox.Show("Image Load Successfully"); groupBox4.Enabled = true; Selector_saveImage.Enabled = true; Button_encryptImage.Enabled = true; }
private void SendKeyButtonOnClick(object sender, EventArgs e) { var ip = GetIpAddress(); Selector_decrypt.Enabled = true; if (Button_sendPublicKey.Text == "Send Public Key") { if (prime1TextBox.Text == "" || prime2TextBox.Text == "" || ETextBox.Text == "") { MessageBox.Show("Enter Valid Details For RSA", "ERROR"); } else { if (HelperLibrary.IsPrime(Convert.ToInt16(prime1TextBox.Text))) { _rsaP = Convert.ToInt16(prime1TextBox.Text); } else { prime1TextBox.Text = ""; MessageBox.Show("Enter Prime Number"); return; } if (HelperLibrary.IsPrime(Convert.ToInt16(prime2TextBox.Text))) { _rsaQ = Convert.ToInt16(prime2TextBox.Text); } else { prime2TextBox.Text = ""; MessageBox.Show("Enter Prime Number"); return; } _rsaE = Convert.ToInt16(ETextBox.Text); // Help taken from SO // Calculating Private Key _n = RSAalgorithm.n_value(_rsaP, _rsaQ); var phi = RSAalgorithm.cal_phi(_rsaP, _rsaQ); _d = RSAalgorithm.cal_privateKey(phi, _rsaE, _n); MessageBox.Show( "Please Connect to the server IP : " + ip + "\nPublic Key = (" + _rsaE + " ," + _n + ")\nPrivate Key = (" + _d + "," + _n + ")", "Alert"); Button_sendPublicKey.Text = "Receive"; // Sending Public key Console.WriteLine("Sending public key"); File.WriteAllText("Key.txt", _rsaE + "+" + _n); MessageBox.Show("Sending Public key"); } } else { MessageBox.Show("Public Key integrity check passed."); } }
/// <summary> /// Function to Export LP record to excel /// </summary> /// <param name="fileName">File Name</param> /// <returns>Complete File Path</returns> public string ExportToExcel(string fileName) { ExcelReportButton.DoClick(); HelperLibrary.wait.UntilDocumentReady(); System.Threading.Thread.Sleep(5000); string filePath = HelperLibrary.SaveDownloadedFile(fileName); return(filePath); }
static void Main(string[] args) { var restaurantRepo = new RestaurantRepo(); var restaurants = restaurantRepo.GetRestaurants(); var input = ""; while (input.ToLower() != "end") { Console.WriteLine("What would you like to do?"); Console.WriteLine("Enter 'restaurants' to see Restaurants"); Console.WriteLine("Enter 'highest rated' to see the highest rated restaurant"); Console.WriteLine("Enter 'sorted' to see the sorted restaurants by name"); Console.WriteLine("Enter 'end' to end program"); input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { input = ""; } if (input.ToLower() == "restaurants") { foreach (var r in restaurants) { Console.WriteLine(r); } } if (input.ToLower() == "highest rated") { Console.WriteLine(restaurantRepo.GetTopRatedRestaurant()); } if (input.ToLower() == "sorted") { foreach (var r in HelperLibrary.SortRestaurantsByName(restaurants)) { Console.WriteLine(r); } } } }
private void DecryptButtonOnClick(object sender, EventArgs e) { Disable_all(); try { var de = DecryptImage(_loadcipher); pictureBox1.Image = HelperLibrary.ConvertByteToImage(HelperLibrary.DecodeHex(de)); var fi = new FileInfo(txt_strDec.Text); label9.Text = "File Name: " + fi.Name; label10.Text = "Image Resolution: " + pictureBox1.Image.PhysicalDimension.Height + " X " + pictureBox1.Image.PhysicalDimension.Width; pictureBox1.Image.Save(txt_strDec.Text, ImageFormat.Jpeg); double imageMb = fi.Length / 1024f / 1024f; label11.Text = "Image Size: " + imageMb.ToString(".##") + "MB"; MessageBox.Show("Image decrypted and Saved"); } catch (Exception ex) { MessageBox.Show(ex.Message); Console.WriteLine(ex.Message); } }
/// <summary> /// Author : Kavita Nunse /// Desc : Sets different status on search lodgement page /// </summary> /// <param name="statusList"></param> /// <returns></returns> public bool SelectDifferentLodgeStatus(params string[] statusList) { try { bool flag = true; for (int i = 0; i < statusList.Length; i++) { // Click on Search Magnifying Icon present on My Lodgement tab if (SearchMagnifyingIcon.FindElement(By.XPath("..")).GetAttribute("class").Contains("collapsed")) { Retry.Do(SearchMagnifyingIcon.Click); } HelperLibrary.SelectItem(LodgementPortalApp.SearchLodgementPage.status, statusList[i]); // Click on search button SearchButton.Click(); // Get Column data int columnIndex = WebTableHelper.GetColumnIndex(searchGrid, LodgementPortalConstants.STATUS); string columnValue = WebTableHelper.GetCellFromTable(searchGrid, 0, columnIndex); if (columnValue.Contains(statusList[i])) { HelperLibrary.log.LogInfo(true, string.Format("Successfully Searched Record Status with value {0} in My Lodgement tab", statusList[i])); } else if (NoRecordFound.Displayed) { HelperLibrary.log.LogInfo(false, string.Format("Failed to Search Record Status with value {0} in My Lodgement tab", statusList[i])); flag = false; } } return(flag); } catch (Exception ex) { HelperLibrary.log.LogException(ex, ex.StackTrace); return(false); } }
public void SortRestaurantsByNameReturnsCorrectlyOrderedRestaurants4() { var list = HelperLibrary.SortRestaurantsByName(_restaurants); Assert.AreEqual(list[4].Id, _restaurantsSorted[4].Id); }
public void SearchRestaurantsByNameDoesNotReturnUnCorrectRestaurants1() { var list = HelperLibrary.SearchRestaurantsByName(_restaurants, "Restaurant"); Assert.AreNotEqual(list.Count, 4); }
public void SearchRestaurantsByNameDoesNotReturnUnCorrectRestaurants0() { var list = HelperLibrary.SearchRestaurantsByName(_restaurants, "3"); Assert.AreNotEqual(list[0].Id, 2); }
public void SearchRestaurantsByNameReturnsCorrectRestaurants1() { var list = HelperLibrary.SearchRestaurantsByName(_restaurants, "Restaurant"); Assert.AreEqual(list.Count, 5); }
public void SearchRestaurantsByNameReturnsCorrectRestaurants0() { var list = HelperLibrary.SearchRestaurantsByName(_restaurants, "3"); Assert.AreEqual(list[0].Id, 3); }
public void SortRestaurantsByNameDoesNotReturnUnCorrectlyOrderedRestaurants1() { var list = HelperLibrary.SortRestaurantsByName(_restaurants); Assert.AreNotEqual(list[4].Id, _restaurantsSorted[2].Id); }
public void SetUpHelpers() { var helperLibrary = new HelperLibrary <AppSettings>(this.Context.GetWebDriver(), this.Context.GetSettingsLibrary <AppSettings>()); this.Context.SetHelperLibrary(helperLibrary); }
/// <summary> /// Kavita Nunse <3-Aug-2017> /// Desc: Search Single values /// </summary> /// <param name="searchFields"></param> /// <returns></returns> public bool searchLodgements(Dictionary <IWebElement, string> searchFields, Dictionary <IWebElement, string> searchColumn) { bool flag = true; bool findSubmissionDate = false; int columnIndex = 0; int submissionDateColumnIndex = 0; string columnValue = null; string submissionDateColumnValue = null; var searchCriteria = searchFields.ToList(); var column = searchColumn.ToList(); try { for (int i = 0, j = 0; i < searchCriteria.Count && j < column.Count; i++, j++) //Iterate 2 dictionaries together { // Click on Search Magnifying Icon present on My Lodgement tab LodgementPortalApp.log.LogInfo("Click on Search Magnifying Icon"); if (SearchMagnifyingIcon.FindElement(By.XPath("..")).GetAttribute("class").Contains("collapsed")) { SearchMagnifyingIcon.Click(); } LodgementPortalApp.log.LogInfo("Search Criteria is : " + column[j].Value + " AND value :" + searchCriteria[i].Value); // Select Status from dropdown if (searchCriteria[i].Key.GetAttribute("name").Equals("StatusId")) { HelperLibrary.SelectItem(searchCriteria[i].Key, searchCriteria[i].Value); findSubmissionDate = true; } // Click on show deleted checkbox else if (searchCriteria[i].Key.GetAttribute("type").Equals("checkbox")) { searchCriteria[i].Key.Click(); } else { // Enter Value to be searched searchCriteria[i].Key.Clear(); searchCriteria[i].Key.SendKeys(searchCriteria[i].Value); //MayurP added following line for period end date searchCriteria[i].Key.SendKeys(Keys.Tab); } // Click on search button SearchButton.Click(); // Get Column data if (!findSubmissionDate) { columnIndex = WebTableHelper.GetColumnIndex(searchGrid, column[j].Value); columnValue = WebTableHelper.GetCellFromTable(searchGrid, 0, columnIndex); } else // code to search and save submission date, required for searching submission date { columnIndex = WebTableHelper.GetColumnIndex(searchGrid, column[j].Value); columnValue = WebTableHelper.GetCellFromTable(searchGrid, 0, columnIndex); submissionDateColumnIndex = WebTableHelper.GetColumnIndex(searchGrid, LodgementPortalConstants.SUBMISSION_DATE); submissionDateColumnValue = WebTableHelper.GetCellFromTable(searchGrid, 0, submissionDateColumnIndex); if (submissionDateColumnValue != null) { string[] split = submissionDateColumnValue.Split(' '); HelperLibrary.RunTimeXMl.WriteNode("submissionDate", split[0]); } } if (columnValue.Contains(searchCriteria[i].Value)) { HelperLibrary.log.LogInfo(true, string.Format("Successfully Searched Record {0} with value {1} in My Lodgement tab", column[j].Value, searchCriteria[i].Value)); } else if (NoRecordFound.Displayed) { HelperLibrary.log.LogInfo(false, string.Format("Failed to Search Record {0} with value {1} in My Lodgement tab", column[j].Value, searchCriteria[i].Value)); flag = false; } // Click on Search Magnifying Icon present on My Lodgement tab SeleniumDriver.driver.FindElement(By.CssSelector(".glyphicon.glyphicon-search")); LodgementPortalApp.log.LogInfo("Click on Search Magnifying Icon"); Retry.Do(SearchMagnifyingIcon.Click); if (!searchCriteria[i].Key.GetAttribute("name").Equals("StatusId")) { searchCriteria[i].Key.Clear(); //As we do not have clear button, so we will clear field as soon as verification is done } } return(flag); } catch (Exception ex) { HelperLibrary.log.LogException(ex, ex.StackTrace); HelperLibrary.log.LogInfo("Failed to search record"); return(false); } }