You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SAE-2.01/MCTG/ConsoleApp/Program.cs

36 lines
1.1 KiB

// See https://aka.ms/new-console-template for more information
using ConsoleApp;
using ConsoleApp.Menu;
using DataPersistence;
using Model;
using System.Linq;
using System.Text;
Console.WriteLine("Hello, World!\n\n");
// TESTS:
DataManager dataMgr = new DataManager(new Stubs());
//DataManager dataMgr = new DataManager(new DataContractXML(xmlFolderPath: "../../../../DataPersistence/data"));
//DataManager dataMgr = new DataManager(new DataContractJSON());
//dataMgr.Serializer = new DataContractXML(xmlFolderPath: "../../../../DataPersistence/data");
dataMgr.Serializer = new DataContractJSON();
// /!\ here is an absolute path I put for testing purpose. It will only work on my computer so don't forget to change it whene you test.
//dataMgr.Export(rc[2], "C:\\Users\\alex6\\Downloads\\recipe2.json");
//dataMgr.Import<Recipe>("C:\\Users\\alex6\\Downloads\\recipe2.json");
RecipeCollection rc = new RecipeCollection("All recipes", dataMgr.Data[nameof(Recipe)].Cast<Recipe>().ToArray());
dataMgr.Save();
MenuManager menuMgr = new MenuManager(dataMgr);
menuMgr.Loop();
// press any key to quit
//Console.ReadKey();