Funktionierend
This commit is contained in:
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Selenium.UndetectedChromeDriver" Version="1.1.2-alpha" />
|
<PackageReference Include="Selenium.WebDriver" Version="4.22.0" />
|
||||||
<PackageReference Include="Selenium.WebDriver" Version="4.16.2" />
|
<PackageReference Include="Selenium.WebDriver.GeckoDriver" Version="0.35.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// See https://aka.ms/new-console-template for more information
|
// See https://aka.ms/new-console-template for more information
|
||||||
|
|
||||||
using OpenQA.Selenium.Chrome;
|
using OpenQA.Selenium.Chrome;
|
||||||
using SeleniumUndetectedChromeDriver;
|
//using SeleniumUndetectedChromeDriver;
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -38,8 +38,9 @@ namespace CardmarketBot
|
|||||||
ChromeOptions options = new ChromeOptions();
|
ChromeOptions options = new ChromeOptions();
|
||||||
options.AddArgument("start-maximized");
|
options.AddArgument("start-maximized");
|
||||||
//options.AddArgument("incognito");
|
//options.AddArgument("incognito");
|
||||||
//options.AddArgument("disable-popup-blocking");
|
options.AddArgument("disable-popup-blocking");
|
||||||
options.AddArgument("force-device-scale-factor=0.8");
|
options.AddArgument("force-device-scale-factor=0.8");
|
||||||
|
//options.AddArgument("lang=en");
|
||||||
IWebDriver cd = new ChromeDriver(options);
|
IWebDriver cd = new ChromeDriver(options);
|
||||||
|
|
||||||
//driver.GoToUrl("https://www.cardmarket.com/de/OnePiece");
|
//driver.GoToUrl("https://www.cardmarket.com/de/OnePiece");
|
||||||
@@ -189,7 +190,11 @@ namespace CardmarketBot
|
|||||||
|
|
||||||
|
|
||||||
// Artikeln
|
// Artikeln
|
||||||
element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[5]/table/tbody"));
|
var k = cd.FindElements(By.XPath("/html/body/main/section/div/div[1]/div/*/table"));
|
||||||
|
//Debugger.Break();
|
||||||
|
element = k[0];
|
||||||
|
//element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[6]/table/tbody"));
|
||||||
|
//element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[5]/table/tbody"));
|
||||||
string artikeln = element.Text;
|
string artikeln = element.Text;
|
||||||
kunde.Artikels = Helper.ParseArtikeln(element.Text);
|
kunde.Artikels = Helper.ParseArtikeln(element.Text);
|
||||||
|
|
||||||
|
|||||||
38
CardMarketBot/CheckSevDeskInternalList.cs
Normal file
38
CardMarketBot/CheckSevDeskInternalList.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using ConsoleApp3.Contracts;
|
||||||
|
|
||||||
|
namespace CardmarketBot
|
||||||
|
{
|
||||||
|
internal class CheckSevDeskInternalList : ICheckSevDesk
|
||||||
|
{
|
||||||
|
private const string FILENAME = "usedList.csv";
|
||||||
|
|
||||||
|
private List<string> Query => (from l in File.ReadAllLines("usedList.csv")
|
||||||
|
select l.Split(',') into p
|
||||||
|
select new string(p[0])).ToList();
|
||||||
|
|
||||||
|
public CheckSevDeskInternalList()
|
||||||
|
{
|
||||||
|
if (!File.Exists("usedList.csv"))
|
||||||
|
{
|
||||||
|
File.Create("usedList.csv");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AlreadyKnown(string verkaufsnummer)
|
||||||
|
{
|
||||||
|
if (Query.Find((string x) => x.Equals(verkaufsnummer)) != null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Write(string verkaufsnummer)
|
||||||
|
{
|
||||||
|
verkaufsnummer += Environment.NewLine;
|
||||||
|
File.AppendAllText("usedList.csv", verkaufsnummer);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,16 +2,49 @@
|
|||||||
using ConsoleApp3.Contracts;
|
using ConsoleApp3.Contracts;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using CardMarketBot;
|
using CardMarketBot;
|
||||||
using OpenQA.Selenium.DevTools.V119.Network;
|
|
||||||
using System.Reflection.Metadata.Ecma335;
|
using System.Reflection.Metadata.Ecma335;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
namespace CardmarketBot
|
namespace CardmarketBot
|
||||||
{
|
{
|
||||||
internal class Programm
|
internal class Programm
|
||||||
{
|
{
|
||||||
|
private static bool CheckServerAvaible()
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
IPAddress[] hostAddresses = Dns.GetHostAddresses("huskyteufel.ddnss.de");
|
||||||
|
if (hostAddresses.Length == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
IPEndPoint iPEndPoint = new IPEndPoint(hostAddresses[0], 4000);
|
||||||
|
Socket socket = new Socket(iPEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
socket.Connect(iPEndPoint);
|
||||||
|
if (socket.Connected)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
ICheckSevDesk checkSevDesk = new CheckSevDeskPublicList();
|
Console.WriteLine("Hendrik prüft ob Server erreichbar ist");
|
||||||
|
bool flag = CheckServerAvaible();
|
||||||
|
Console.WriteLine("Das ergebnis von Hendrik seine erkundung lautet: " + flag);
|
||||||
|
|
||||||
|
ICheckSevDesk checkSevDesk = ((!flag) ? ((ICheckSevDesk)new CheckSevDeskInternalList()) : ((ICheckSevDesk)new CheckSevDeskPublicList()));
|
||||||
|
|
||||||
|
|
||||||
Console.WriteLine("Hallo Herzlich willkommen Augustin Karneval e.V.");
|
Console.WriteLine("Hallo Herzlich willkommen Augustin Karneval e.V.");
|
||||||
Console.WriteLine("Was kann ich für dich tun?");
|
Console.WriteLine("Was kann ich für dich tun?");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user