示例#1
0
            public string getMenuDetail(string factoryType, string restaurantType, string relativePath, string fileExtension)
            {
                if (factoryType == "British")
                {
                    IRestaurantFactory factory = new BritishRestaurant();
                    var readMenu      = factory.Reader(InputReader);
                    var menugen       = factory.MenuGenerator();
                    var menuFormatter = factory.MenuOutputFormatter(OutputFormat);

                    var inputFile     = File.ReadAllText(relativePath);
                    var data          = readMenu.readFile2(inputFile, factoryType);
                    var genData       = menugen.generateMenu(data, restaurantType);
                    var formattedData = menuFormatter.formatText(genData);

                    return(formattedData.ToString());
                }
                else if (factoryType == "American")
                {
                    IRestaurantFactory factory = new AmericanRestaurant();
                    var readMenu      = factory.Reader(InputReader);
                    var menugen       = factory.MenuGenerator();
                    var menuFormatter = factory.MenuOutputFormatter(OutputFormat);

                    var inputFile     = File.ReadAllText(relativePath);
                    var data          = readMenu.readFile2(inputFile, factoryType);
                    var genData       = menugen.generateMenu(data, restaurantType);
                    var formattedData = menuFormatter.formatText(genData);

                    return(formattedData.ToString());
                }
                else
                {
                    return(string.Empty);
                }
            }
示例#2
0
            public string getMenuDetail(string factoryType, string restaurantType, string relativePath, string fileExtension)
            {
                if (factoryType == "British")
                {
                    IRestaurantFactory factory = new BritishRestaurant();
                    var readMenu = factory.Reader(InputReader);
                    var menugen = factory.MenuGenerator();
                    var menuFormatter = factory.MenuOutputFormatter(OutputFormat);

                    var inputFile = File.ReadAllText(relativePath);
                    var data = readMenu.readFile2(inputFile, factoryType);
                    var genData = menugen.generateMenu(data, restaurantType);
                    var formattedData = menuFormatter.formatText(genData);

                    return formattedData.ToString();

                }
                else if (factoryType == "American")
                {
                    IRestaurantFactory factory = new AmericanRestaurant();
                    var readMenu = factory.Reader(InputReader);
                    var menugen = factory.MenuGenerator();
                    var menuFormatter = factory.MenuOutputFormatter(OutputFormat);

                    var inputFile = File.ReadAllText(relativePath);
                    var data = readMenu.readFile2(inputFile, factoryType);
                    var genData = menugen.generateMenu(data, restaurantType);
                    var formattedData = menuFormatter.formatText(genData);

                    return formattedData.ToString();
                }
                else
                {
                    return string.Empty;
                }
            }