Funktionierend
This commit is contained in:
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user