コード例 #1
0
        static void SetUrl()
        {
            Console.Write("Present url: " + Json_Data.WriteData("url"));
            Console.SetCursorPosition(0, 2);
            Console.Write("Write new url: ");
            string newUrl = Console.ReadLine();

            if (!string.IsNullOrEmpty(newUrl))
            {
                Json_Data.ModifyData("url", newUrl);
            }
            Console.Write("Saved!");
            Console.ReadKey();
        }
コード例 #2
0
        public void LoginToOwnAccount()
        {
            MainPage home = new MainPage(driver);

            home.goToPage();
            Task.Delay(2000).Wait();
            home.RodoPopUpClose();
            Task.Delay(2000).Wait();
            home.LoginOnPage(Json_Data.WriteData("login"), Json_Data.WriteData("password"));
            Task.Delay(2000).Wait();
            home.EnterUserPassword(Json_Data.WriteData("userPassword"));
            Task.Delay(2000).Wait();
            home.BookList();
            driver.Quit();
            PushToExcel.ListToExcel(home.bookList, home.bookLinkList);
        }
コード例 #3
0
 static void ShowMenu()
 {
     Console.BackgroundColor = ConsoleColor.Black;
     Console.Clear();
     Console.ForegroundColor = ConsoleColor.Green;
     Console.WriteLine("Obecny url: " + Json_Data.WriteData("url"));
     Console.WriteLine();
     for (int i = 0; i < menuItem.Length; i++)
     {
         if (i == selectedMenuItem)
         {
             Console.BackgroundColor = ConsoleColor.Green;
             Console.ForegroundColor = ConsoleColor.Black;
             Console.WriteLine("{0, -20}", menuItem[i]);
             Console.BackgroundColor = ConsoleColor.Black;
             Console.ForegroundColor = ConsoleColor.Green;
         }
         else
         {
             Console.WriteLine(menuItem[i]);
         }
     }
 }
コード例 #4
0
        public static void ListToExcel(List <string> List1, List <string> linkList)
        {
            Microsoft.Office.Interop.Excel.Application Excel;
            Microsoft.Office.Interop.Excel._Workbook   Excel_Workbook;
            Microsoft.Office.Interop.Excel._Worksheet  Excel_Sheet;
            Microsoft.Office.Interop.Excel.Range       oRng;
            object misvalue = System.Reflection.Missing.Value;

            //Start Excel and get Application object.
            Excel = new Microsoft.Office.Interop.Excel.Application
            {
                Visible = CommonHelpers.ExcelVisible
            };

            //Get an active workbook.
            Excel_Workbook = (Microsoft.Office.Interop.Excel._Workbook)(Excel.Workbooks.Open(Json_Data.WriteData("filePath")));
            Excel_Sheet    = (Microsoft.Office.Interop.Excel._Worksheet)Excel_Workbook.ActiveSheet;

            //Show all rows when Autofilter is enabled
            if ((Excel_Sheet.AutoFilterMode && Excel_Sheet.FilterMode) || Excel_Sheet.FilterMode)
            {
                Excel_Sheet.AutoFilter.ShowAllData();
            }

            oRng = Excel_Sheet.UsedRange;
            int rowNo = oRng.Rows.Count + 1;

            for (int row = 0; row < List1.Count; ++row)
            {
                string[] TitleAndAuthor = PushToExcel.RemoveExtension(List1[row]);
                Excel_Sheet.Cells[row + rowNo, "A"] = TitleAndAuthor[1];
                Excel_Sheet.Cells[row + rowNo, "B"] = TitleAndAuthor[0];
                Excel_Sheet.Cells[row + rowNo, "C"] = CommonHelpers.Folder;
            }

            for (int row = 0; row < linkList.Count; ++row)
            {
                Excel_Sheet.Hyperlinks.Add(Excel_Sheet.get_Range($"B{row + rowNo}"), linkList[row], "", $"Pobierz plik {List1[row]}");
            }

            Excel.Visible     = false;
            Excel.UserControl = false;
            Excel_Workbook.Save();
            Excel_Workbook.Close();
            Excel.Quit();
        }
コード例 #5
0
 public void goToPage()
 {
     driver.Navigate().GoToUrl(Json_Data.WriteData("url"));
     Console.WriteLine($@"Open {Json_Data.WriteData("url")} website.");
 }