private static void ParseRecipes(IIngredientClassifier classifier, IIngredientTypes types) { List <ClassifiedRecipe> result = new List <ClassifiedRecipe>(); IngregientClassifierSetup.ParseRecipesImpl("ingredients.xls", "./", classifier, types, result); string tempFile = System.IO.Path.GetTempFileName(); File.Copy("ingredients.xls", tempFile, true); System.Diagnostics.Process.Start("excel.exe", tempFile); }
static void Main(string[] args) { // load the ingredient settings string[] webServerPrefixes = ConfigurationManager.AppSettings["WebServerPrefixes"].Split(',', ' ', ';', '\t'); string spiderPath = ConfigurationManager.AppSettings["SpiderPath"]; string classificationFile = ConfigurationManager.AppSettings["ClassificationFile"]; string ingredientTypesFile = ConfigurationManager.AppSettings["TypesFile"]; IIngredientClassifier classifier = new RegexIngredientClassifier(classificationFile); IIngredientTypes ingredientTypes = new TypesBySensitivity(ingredientTypesFile); { StringBuilder notFound = new StringBuilder(); foreach (string ingredientClass in classifier.KnownClassNames) { if (!ingredientTypes.ClassToType.ContainsKey(ingredientClass)) { notFound.Append(ingredientClass).Append(", "); } } string notFoundStr = notFound.ToString(); if (0 < notFoundStr.Length) { throw new Exception("Can't find an ingredient type for class(es) '" + notFoundStr + "' in types from '" + ingredientTypesFile); } } // load the recipe spider data foreach (var i in ingredientTypes.ClassToType) { SortedSet <string> types; if (!ingredientTypes_.TryGetValue(i.Value.Group, out types)) { ingredientTypes_[i.Value.Group] = (types = new SortedSet <string>()); } types.Add(i.Value.Type); } IngregientClassifierSetup.ParseRecipesImpl( "ingregients.parse.log.xls", spiderPath, classifier, ingredientTypes, recipes_); ingredientsAsColumns_ = PreferenceColumnLayout(5); // load the preferences and users preferences_ = new PreferenceRepo(new DirectoryInfo("./Preferences")); users_ = new UserRepo(new DirectoryInfo("./Users")); users_["gene"] = new UserInfo { Username = "******", Password = "******" }; users_["anna"] = new UserInfo { Username = "******", Password = "******" }; // run the web server WebServer s = new WebServer(DispatchWebPage, webServerPrefixes); s.Run(); // and don't exit while (true) { Thread.Sleep(1); } }