private static void PickVideoAndSrt() { Console.ResetColor(); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.White; bool confirmedVideo = false; while (!confirmedVideo) { Console.Write("Enter path of video file: "); videoPath = Console.ReadLine(); if (System.IO.File.Exists(videoPath)) { confirmedVideo = true; } else { Console.WriteLine("File doesn't exist."); } } bool confirmedSRT = false; while (!confirmedSRT) { Console.Write("Enter path of subtitle file: "); srtPath = Console.ReadLine(); if (System.IO.File.Exists(srtPath)) { confirmedSRT = true; } else { Console.WriteLine("File doesn't exist."); } } Console.ForegroundColor = ConsoleColor.White; Console.WriteLine($"Chosen Video path {videoPath}, and corresponding SRT: {srtPath}"); Console.WriteLine($"Wanna continue with these settings?"); bool confirmedEnter = false; while (!confirmedEnter) { Console.WriteLine("Please enter y/n :"); string input = Console.ReadLine(); if (input.ToLower() == "y") { confirmedEnter = true; } else if (input.ToLower() == "n") { PickVideoAndSrt(); confirmedEnter = true; } } Console.ResetColor(); ArtItem newItem = new ArtItem(videoPath, srtPath); string json = JsonConvert.SerializeObject(newItem); System.IO.File.WriteAllText(Path.Combine(AnkiMovieData, "1.json"), json); }
private static void LoadVideoAndSrt() { string path = Path.Combine(AnkiMovieData, "1.json"); ArtItem ObjectResult = null; using (var reader = new StreamReader(path)) ObjectResult = JsonConvert.DeserializeObject <ArtItem>(reader.ReadToEnd()); videoPath = ObjectResult.MoviePath; srtPath = ObjectResult.SrtPath; }