diff --git a/Program.cs b/Program.cs index 47e8a56..d0d65af 100644 --- a/Program.cs +++ b/Program.cs @@ -13,6 +13,8 @@ class Program private static readonly string FolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Simpsons_generator"); private static readonly string OverrideBrowser = Path.Combine(FolderPath, "overrideBrowser.xml"); + public static readonly string filePath = Path.Combine(FolderPath, "episodes-watched.csv"); + static SQLiteConnection CreateConnection() { @@ -137,6 +139,27 @@ class Program SQLiteConnection sqliteconn; 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; do {