This commit is contained in:
+23
@@ -13,6 +13,8 @@ class Program
|
|||||||
|
|
||||||
private static readonly string FolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Simpsons_generator");
|
private static readonly string FolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Simpsons_generator");
|
||||||
private static readonly string OverrideBrowser = Path.Combine(FolderPath, "overrideBrowser.xml");
|
private static readonly string OverrideBrowser = Path.Combine(FolderPath, "overrideBrowser.xml");
|
||||||
|
public static readonly string filePath = Path.Combine(FolderPath, "episodes-watched.csv");
|
||||||
|
|
||||||
|
|
||||||
static SQLiteConnection CreateConnection()
|
static SQLiteConnection CreateConnection()
|
||||||
{
|
{
|
||||||
@@ -137,6 +139,27 @@ class Program
|
|||||||
|
|
||||||
SQLiteConnection sqliteconn;
|
SQLiteConnection sqliteconn;
|
||||||
sqliteconn = CreateConnection();
|
sqliteconn = CreateConnection();
|
||||||
|
|
||||||
|
//check if the old excel exist and convert it to SQLLITE
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
Console.WriteLine("Excel file present");
|
||||||
|
var linesRead = File.ReadLines(filePath);
|
||||||
|
|
||||||
|
foreach (var lineRead in linesRead)
|
||||||
|
{
|
||||||
|
Console.WriteLine(lineRead);
|
||||||
|
string[] words = lineRead.Split('-');
|
||||||
|
int season = Convert.ToInt16(words[3]);
|
||||||
|
int episode = Convert.ToInt16(words[5]);
|
||||||
|
SaveIntoDatabase(sqliteconn,season,episode);
|
||||||
|
Console.WriteLine(season);
|
||||||
|
Console.WriteLine(episode);
|
||||||
|
|
||||||
|
}
|
||||||
|
System.IO.File.Move(filePath,filePath+"_converted.csv");
|
||||||
|
}
|
||||||
|
|
||||||
bool restart = false;
|
bool restart = false;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user