static void Main(string[] args) { Pizza.Pizza[] pizzas = new Pizza.Pizza[2]; //Создания итальянской и французкой пиццы pizzas[0] = new ItalianPizza(); pizzas[1] = new FrancePizza(); foreach(var pz in pizzas) PrintPizza(pz); // Добавление сыра и мяса в итальянскую пиццу pizzas[0] = new Cheese(pizzas[0]); pizzas[0] = new Meat(pizzas[0]); // Добавление ананаса и соуса во французкую пиццу pizzas[1] = new Pine(pizzas[1]); pizzas[1] = new Sauce(pizzas[1]); foreach (var pz in pizzas) PrintPizza(pz); }
public Pizza CreatePizza(string type) { Pizza pizza = null; switch (type) { case "Cheese": pizza = new Cheese(); break; case "Pepperoni": pizza = new Pepperoni(); break; case "Supreme": pizza = new Supreme(); break; default: break; } return(pizza); }
public async Task <bool> UpdateCheese(Cheese cheese) { try { var cheeseToUpdate = await _context.Cheese.SingleOrDefaultAsync(c => c.Id == cheese.Id); if (cheeseToUpdate != null) { if (cheese.Picture.Image != null) { cheeseToUpdate.Picture.Picture = ConvertImageToByteArray(cheese.Picture.Image); } var result = _context.Cheese.Update(cheeseToUpdate); await _context.SaveChangesAsync(); return(true); } return(false); } catch (Exception e) { return(false); } }
public static Pizza CreatePizza(string type) { Pizza pizza = null; switch (type) { case "Over The Moon Pizza": pizza = new Cheese(); break; case "Galactic Pepperoni": pizza = new Pepperoni(); break; case "Zorg": pizza = new Supreme(); break; default: break; } return(pizza); }
partial void DeleteCheese(Cheese instance);
partial void InsertCheese(Cheese instance);
public void SetChesse(Cheese cheese) { Burger.burgerCheese = cheese; }
protected abstract void VisitInternal(Cheese cheese);
public Cheese Update(Cheese cheese) { return(cheese); }
/// <summary>Кладет сыр в указанную клетку лабиринта.</summary> /// <param name="cheese">Сыр.</param> /// <param name="row">Номер строки клетки (начиная с 1).</param> /// <param name="col">Номер столбца клетки (начиная с 1).</param> public void PutCheese(Cheese cheese, int row, int col) { CheckLabyrinth(); Labyrinth.PutCheese(cheese, row, col); }
private void attach_Cheeses(Cheese entity) { this.SendPropertyChanging(); entity.Milk = this; }
private void detach_Cheeses(Cheese entity) { this.SendPropertyChanging(); entity.Consistency = null; }
partial void UpdateCheese(Cheese instance);
public void AddCheese(Cheese cheese) { Cheese = cheese; }
private void detach_Cheeses(Cheese entity) { this.SendPropertyChanging(); entity.Milk = null; }
public static void Add(Cheese cheese) { Cheeses.Add(cheese); }
private static void UpdateCheat() { _saidWait = false; try { Console.WriteLine("Initializing mumble"); init_mumble(); Console.WriteLine("finished initializing mumble"); int dir = 0; ShipStatus status = Cheese.GetShipStatus(); if (status.OwnerId == 0 && !_saidWait) { foreach (var player in _playerDataList) { player.StopObserveState(); } Console.WriteLine("Not in game, waiting...."); _x = 0; _y = 0; _z = 0; _localPlayer = null; _saidWait = true; } else { _playerDataList = Cheese.GetAllPlayers(); foreach (var player in _playerDataList) { if (player.IsLocalPlayer) { player.StartObserveState(); } } } while (true) { update_mumble(_x, _y, _z, _direction, _name, _context); Thread.Sleep(UpdateTime); //Console.WriteLine("hey"); _localPlayer = _playerDataList.Find(s => s.IsLocalPlayer); if (_localPlayer == null) { _x = 0; _y = 0; _z = 0; Console.WriteLine("Not in game, waiting...."); _localPlayer = null; _saidWait = true; continue; } if (!_localPlayer.PlayerInfo.HasValue) { _x = 0; _y = 0; _z = 0; _localPlayer = null; Console.WriteLine("Not in game, waiting...."); _x = 0; _y = 0; _z = 0; _localPlayer = null; _saidWait = true; continue; } _name = Utils.ReadString(_localPlayer.PlayerInfo.Value.PlayerName); if (_lastX > _localPlayer.Position.x) { dir = 0; } else if (_lastX < _localPlayer.Position.x) { dir = 1; } _x = _localPlayer.Position.x; _y = 0; _z = _localPlayer.Position.y; _direction = dir; _context = "main"; _lastX = _localPlayer.Position.x; Console.WriteLine( $"Name : {_name}, x : {_localPlayer.Position.x} , y: {_localPlayer.Position.y}, direction: " + (dir == 0 ? "left" : "right") + $" , context: {_context}"); } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
public override string ToString() { return($"Dough: {Dough.GetType().Name}\n" + $"Sauce: {Sauce.GetType().Name}\n" + $"Cheese: {Cheese.GetType().Name}\n"); }
private void BtnAdd_Click(object sender, EventArgs e) { if (menuGridView.CurrentRow == null) { return; } IMenuItem item = new Coffee(); if (menuGridView.CurrentRow.Index == 1) { item = new CoffeeDarkRoast(); } else if (menuGridView.CurrentRow.Index == 2) { item = new Tea(); } else if (menuGridView.CurrentRow.Index == 3) { item = new SandwichWithBacon(); } else if (menuGridView.CurrentRow.Index == 4) { item = new SandwichWithEggSalad(); } else if (menuGridView.CurrentRow.Index == 5) { item = new SandwichWithRoastedBeef(); } for (int i = 0; i < NUD_Cheese.Value; i++) { item = new Cheese(item); } for (int i = 0; i < NUD_Lettuce.Value; i++) { item = new Lettuce(item); } for (int i = 0; i < NUD_Mayo.Value; i++) { item = new Mayo(item); } for (int i = 0; i < NUD_Milk.Value; i++) { item = new Milk(item); } for (int i = 0; i < NUD_Sugar.Value; i++) { item = new Suggar(item); } for (int i = 0; i < NUD_Sweetener.Value; i++) { item = new Sweetener(item); } for (int i = 0; i < NUD_Tomato.Value; i++) { item = new Tomato(item); } orderListGridView.Rows.Add(); orderListGridView.Rows[numberOfRows].Cells[0].Value = item.Description; orderListGridView.Rows[numberOfRows++].Cells[1].Value = item.Cost; items.Add(item); }
private static void Main() { try { AutoUpdater.HttpUserAgent = "AutoUpdater"; AutoUpdater.ParseUpdateInfoEvent += OnParseUpdateInfo; AutoUpdater.Start("https://api.github.com/repos/LelouBil/AmongUsMumbleLink/releases/latest"); Console.WriteLine("Starting"); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; // Cheat Init Console.WriteLine("try init cheese"); if (Cheese.Init()) { Console.WriteLine("Initialized cheese"); // Update Player Data When Every Game Cheese.ObserveShipStatus((shipStat) => { try { ShipStatus status = Cheese.GetShipStatus(); if (status.OwnerId == 0 && !_saidWait) { foreach (var player in _playerDataList) { player.StopObserveState(); } Console.WriteLine("Not in game, waiting...."); _x = 0; _y = 0; _z = 0; _localPlayer = null; _playerDataList = new List <PlayerData>(); _saidWait = true; return; } if (status.OwnerId != 0 && _saidWait) { _saidWait = false; } _playerDataList = Cheese.GetAllPlayers(); foreach (var player in _playerDataList) { if (player.IsLocalPlayer) { player.StartObserveState(); } } } catch (Exception e) { if (!_saidWait) { foreach (var player in _playerDataList) { player.StopObserveState(); } Console.WriteLine("Not in game, waiting...."); _localPlayer = null; _saidWait = true; _x = 0; _y = 0; _z = 0; } return; } }); Console.WriteLine("Starting Thread"); CancellationTokenSource cts = new CancellationTokenSource(); Task.Factory.StartNew( UpdateCheat, cts.Token).Wait(cts.Token); } else { Console.WriteLine("Failed init cheese, game is not running or app is not running as admin"); } } catch (Exception e) { Console.WriteLine(e.ToString()); } Console.WriteLine("Press any key to stop..."); Console.ReadKey(); }
public Bundle(Cheese cheese, Screwdriver screwdriver, PercentageDiscount percentageDiscount) { _cheese = cheese; _screwdriver = screwdriver; _percentageDiscount = percentageDiscount; }
public AddMenuItemViewModel(Cheese selectedCheese, Models.Menu menu, IEnumerable <Cheese> cheeses) : this(menu, cheeses) { SelectedCheeseID = selectedCheese.ID; }
public override void prepare() { cheese = new Cheese(); }
protected override void VisitInternal(Cheese cheese) => cheese.AmountOfPepperUsed *= 1.25;
public Cheese Update(Cheese cheese) { cheese.Price *= 0.90; return(PriceHelper.LimitPrice(cheese)); }
public override void Prepare() { Console.WriteLine("Preparing {0}", Name); Dough = pizzaIngredientFactory.CreateDough(); Sauce = pizzaIngredientFactory.CreateSauce(); Cheese = pizzaIngredientFactory.CreateCheese(); Veggies = pizzaIngredientFactory.CreateVeggies(); Clam = pizzaIngredientFactory.CreateClam(); Console.WriteLine("Ingredients: Dough: {0} - Sauce: {1} - Cheese: {2} - Clam: {3}", Dough.ToString(), Sauce.ToString(), Cheese.ToString(), Clam.ToString()); }
public void Visit(Cheese item) { VisitInternal(item); }
public override void Prepare() { Console.WriteLine("Preparing {0}", Name); Dough = pizzaIngredientFactory.CreateDough(); Sauce = pizzaIngredientFactory.CreateSauce(); Cheese = pizzaIngredientFactory.CreateCheese(); Pepperoni = pizzaIngredientFactory.CreatePepperoni(); Console.WriteLine("Ingredients: Dough: {0} - Sauce: {1} - Cheese: {2} - Pepperoni: {3}", Dough.ToString(), Sauce.ToString(), Cheese.ToString(), Pepperoni.ToString()); }
static void Main(string[] args) { #region Singleton Console.WriteLine("Singleton"); Console.WriteLine(""); DBConnectClassic serviceInstance1 = DBConnectClassic.GetInstance(); Console.WriteLine(serviceInstance1.GetCreationCount()); DBConnectClassic serviceInstance2 = DBConnectClassic.GetInstance(); Console.WriteLine(serviceInstance2.GetCreationCount()); DBConnectClassic1 serviceInstance3 = DBConnectClassic1.Instance; Console.WriteLine(serviceInstance3.GetCreationCount()); DBConnectClassic1 serviceInstance4 = DBConnectClassic1.Instance; Console.WriteLine(serviceInstance4.GetCreationCount()); DBConnectClassic2 serviceInstance5 = DBConnectClassic2.Instance2; Console.WriteLine(serviceInstance5.GetCreationCount()); DBConnectClassic2 serviceInstance6 = DBConnectClassic2.Instance2; Console.WriteLine(serviceInstance6.GetCreationCount()); Console.WriteLine(serviceInstance1 == serviceInstance2); Console.WriteLine(serviceInstance3 == serviceInstance4); Console.WriteLine(serviceInstance5 == serviceInstance6); Console.WriteLine(""); #endregion #region Factory Console.WriteLine("Factory"); Console.WriteLine(""); var a = AnimalFactory.Create(Animal.Dog); Console.WriteLine("Classe:" + a.GetType().Name); Console.WriteLine(""); #endregion #region AbstractFactory Console.WriteLine("DesignPatterns"); Console.WriteLine(""); Console.WriteLine("AbstractFactory"); ContinentFactory africa = new AfricaFactory(); AnimalWorld world = new AnimalWorld(africa); world.Animais(); Console.WriteLine(""); ContinentFactory america = new AmericaFactory(); //BRAZIL world = new AnimalWorld(america); world.Animais(); Console.WriteLine(""); #endregion #region Builder Console.WriteLine("Builder"); Console.WriteLine(""); BuildingsBuilder builders; Build builder = new Build(); builders = new ComercialBuilder(); builder.Construct(builders); builders.Building.Show(); Console.WriteLine(""); builders = new SchoolBuilder(); builder.Construct(builders); builders.Building.Show(); Console.WriteLine(""); #endregion #region Prototype Console.WriteLine("Prototype"); Console.WriteLine(""); Document d1 = new Document("test.doc"); Document c1 = (Document)d1.Clone(); Console.WriteLine($"d1 - original { d1.ShowName()}"); Console.WriteLine($"c1 - clone { c1.ShowName()}"); Console.WriteLine(""); #endregion #region Adapter Console.WriteLine("Adapter"); Console.WriteLine(""); Sockets s1pin = new Sockets("1Pin"); s1pin.Display(); Console.WriteLine(""); SocketType s2pin = new SocketType("2Pin"); s2pin.Display(); Console.WriteLine(""); SocketType s3pin = new SocketType("3Pin"); s3pin.Display(); Console.WriteLine(""); SocketType s3pinY = new SocketType("3PinY"); s3pinY.Display(); Console.WriteLine(""); #endregion #region Bridge Console.WriteLine("Bridge"); Console.WriteLine(""); string url = "www.facebook.com"; Sites site = new Sites("Firefox", url); site.Navegate(); Console.WriteLine(""); site = new Sites("Edge", url); site.Navegate(); Console.WriteLine(""); site = new Sites("Chrome", url); site.Navegate(); Console.WriteLine(""); #endregion #region Composite Console.WriteLine("Composite"); Console.WriteLine(""); Woman mother = new Woman(); var father = new Man(); var kid1 = new Man(); var kid2 = new Woman(); mother.AddFiliation(kid1); mother.AddFiliation(kid2); mother.Display(); Console.WriteLine(""); father.Display(); Console.WriteLine(""); #endregion #region Decorator Console.WriteLine("Decorator"); Console.WriteLine(""); Burguer burger = new Burguer("BBQ simples"); Bread bread = new Bread("Frances", 1, 1); Cheese cheese = new Cheese("Prato", 0.400, 2); Salada salada = new Salada("Alface", 1, 2); Steak hamburguer = new Steak("160g", 1, 2); Sauce sauce = new Sauce("BBQ", 1, 2); burger.SetIngredients(bread); burger.SetIngredients(cheese); burger.SetIngredients(salada); burger.SetIngredients(hamburguer); burger.SetIngredients(sauce); burger.MakeFood(); Console.WriteLine(""); Pizza pizza = new Pizza("Calabreza"); Batter batter = new Batter("Media", 1, 2); cheese = new Cheese("Mussarela", 0.500, 2); sauce = new Sauce("Tomatoe", 0.500, 2); Specialities specialities = new Specialities("Calabreza", 1, 3); pizza.SetIngredients(batter); pizza.SetIngredients(cheese); pizza.SetIngredients(sauce); pizza.SetIngredients(specialities); pizza.MakeFood(); Console.WriteLine(""); Massa massa = new Massa("Bolonhesa"); Pasta pasta = new Pasta("Spaguetti", 1, 3); cheese = new Cheese("Parmesão", 0.500, 2); sauce = new Sauce("Tomatoe", 0.500, 2); specialities = new Specialities("Carne Moida", 1, 3); massa.SetIngredients(pasta); massa.SetIngredients(cheese); massa.SetIngredients(sauce); massa.SetIngredients(specialities); massa.MakeFood(); Console.WriteLine(""); #endregion #region Facade Console.WriteLine("Facade"); Console.WriteLine(""); Facade facade = new Facade(); facade.Buy(); Console.WriteLine(""); #endregion #region FlyWeight Console.WriteLine("FlyWeight"); Console.WriteLine(""); Mover move = new Mover(); move.MoveTo("A.pdf", @"\\Vp1\c\Docs\"); Console.WriteLine(""); #endregion #region Proxy Console.WriteLine("Proxy"); Console.WriteLine(""); FinancialRFBR financialRFBR = new FinancialRFBR(); financialRFBR.PayLegal(19333.88, 15, "10000-1101010-1010201010"); Console.WriteLine(""); financialRFBR.PayPhysical(150.55, 10, "10000-1101010"); Console.WriteLine(""); #endregion #region ChainResponsability Console.WriteLine("ChainResponsability"); Console.WriteLine(""); GameTable gt = new GameTable(); Players p1 = new Players("Andre"); Players p2 = new Players("Bruna"); Players p3 = new Players("Cesar"); Players p4 = new Players("Danilo"); Players p5 = new Players("Ester"); Players p6 = new Players("Fabiana"); gt.AddPlayer(p1); gt.AddPlayer(p5); gt.AddPlayer(p3); gt.AddPlayer(p6); gt.AddPlayer(p4); gt.AddPlayer(p2); int NumberOfPlays = 5; gt.PlayGame(NumberOfPlays); Console.WriteLine(""); #endregion #region Strategy Console.WriteLine("Strategy"); Console.WriteLine(""); OrdenedArray vector = new OrdenedArray(); vector.Add("1"); vector.Add("3"); vector.Add("4"); vector.Add("7"); vector.Add("9"); vector.SetOrderStrategy(new NormalOrder()); vector.Order(); Console.WriteLine(""); vector.SetOrderStrategy(new ReverseOrder()); vector.Order(); Console.WriteLine(""); #endregion Console.WriteLine("Oh Glória!!"); Console.ReadLine(); }
public void CleanUpTest() { _cheese = null; }
public void InitializeTest() { _cheese = new Cheese(); }
static void UpdateCheat() { while (true) { int meeting_status = Cheese.GetMeetingStatus(); uint game_state = client.GameState; //on start game if ((old_game_state == 0 || old_game_state == 1) && game_state == 2) { Thread.Sleep(5000); //waiting for imposters to be set and all that jazz. inGame = true; initialize(); StringBuilder players = new StringBuilder("" + (PlayMap)client.TutorialMapId); StringBuilder imposters = new StringBuilder("imposters"); foreach (var data in playerDatas) { var name = Utils.ReadString(data.PlayerInfo.Value.PlayerName); players.Append("," + name); if (data.PlayerInfo.Value.IsImpostor == 1) { imposters.Append("," + name); } } Write(players.ToString()); Write(imposters.ToString()); } if (inGame) { //check for dead players foreach (var player in playerDatas) { //on player killed if (!old_player_info[player.PlayerInfo.Value.ColorId].isDead && player.PlayerInfo.Value.IsDead == 1) { old_player_info[player.PlayerInfo.Value.ColorId].isDead = true; var victimName = Utils.ReadString(player.PlayerInfo.Value.PlayerName); var killerName = getKiller(player.Position); Write("kill," + killerName + "," + victimName); } } //on discussion start if (old_meeting_status == 0 && meeting_status == 4) { inDiscussion = true; string name = getPlayerWhoCalledMeeting(); if (!name.Equals("")) { sb.Append("button," + name); } else //body reported { sb.Append("report"); } } //on meeting end if (old_meeting_status == 4 && meeting_status == 0) { Thread.Sleep(5000); foreach (var player in playerDatas) { //on player exiled if (!old_player_info[player.PlayerInfo.Value.ColorId].isDead && player.PlayerInfo.Value.IsDead == 1) { old_player_info[player.PlayerInfo.Value.ColorId].isDead = true; sb.Append("," + Utils.ReadString(player.PlayerInfo.Value.PlayerName)); Write(sb.ToString()); sb = new StringBuilder(); } } } //on game end if (old_game_state == 2 && (game_state == 3 || game_state == 1)) { var imposterCount = 0; var crewmateCount = 0; foreach (var data in playerDatas) { if (data.PlayerInfo.Value.IsImpostor == 1) { imposterCount++; } else { crewmateCount++; } } if (imposterCount == crewmateCount) { Write("winner,imposters"); } else if (imposterCount == 0) { Write("winner,crewmates"); } inGame = false; } } old_game_state = game_state; old_meeting_status = meeting_status; Thread.Sleep(1000); } }
//Helper method to add cheese into database to make unit tests more readable. public void AddEntry(Cheese data) { DBContext.Cheeses.Add(data); DBContext.SaveChanges(); }