コード例 #1
0
 /// <summary><para>Performs a rebalance of the <see cref="RBTree{T}"/> starting with the current node.</para></summary>
 private void InsertRebalanceCondition2()
 {
     Parent.Color      = Colors.Black;
     Uncle.Color       = Colors.Black;
     GrandParent.Color = Colors.Red;
     GrandParent.InsertRebalanceCondition1();
 }
コード例 #2
0
 public static bool Create(GrandParent entity)
 {
     using (var session = NHibernateHelper.OpenSession())
     {
         using (var transaction = session.BeginTransaction())
         {
             try
             {
                 var result = (int)session.Save(entity);
                 // session.Update(entity);
                 //session.Get<T>(id);
                 // session.Delete(entity);
                 transaction.Commit();
                 if (result > 0)
                 {
                     return(true);
                 }
             }
             catch
             {
                 transaction.Rollback();
                 throw;
             }
         }
     }
     return(false);
 }
コード例 #3
0
        public void ShouldApplyMapperConfigurationsInOrderAutomatically()
        {
            var values = new List <int> {
                1, 2, 3
            };
            var provider = new StubServiceProvider(values);

            var grandParent = new GrandParent
            {
                DatChild = new Parent {
                    MyChild = new Child()
                }
            };

            using (var mapper = Mapper.CreateNew())
            {
                mapper.WhenMapping
                .UseServiceProvider(provider)
                .UseConfigurations
                .From <GrandParentMapperConfiguration>();

                var result = mapper.Map(grandParent).ToANew <GrandParentDto>();

                result.MyChild.ShouldNotBeNull();
                result.MyChild.MyChild.ShouldNotBeNull();
                result.MyChild.MyChild.IsMyCountGtrZero.ShouldBeTrue();
            }
        }
コード例 #4
0
 protected override bool CheckRuntimeType(GrandParent item)
 {
     if (item == null)
     {
         return(false);
     }
     return(item.GetType() == typeof(Parent));
 }
コード例 #5
0
        public void SetUp()
        {
            this._grandParent = new GrandParent();
            this._parent      = new Parent();
            this._child       = new Child();

            this._grandParent.Child      = this._parent;
            this._grandParent.GrandChild = this._child;

            this._parent.Child        = this._child;
            this._parent.DirectParent = this._grandParent;

            this._child.Parent      = this._parent;
            this._child.GrandParent = this._grandParent;
        }
        public void SetUp()
        {
            this._grandParent = new GrandParent();
            this._parent = new Parent();
            this._child = new Child();

            this._grandParent.Child = this._parent;
            this._grandParent.GrandChild = this._child;

            this._parent.Child = this._child;
            this._parent.DirectParent = this._grandParent;

            this._child.Parent = this._parent;
            this._child.GrandParent = this._grandParent;
        }
コード例 #7
0
    public static void Main()
    {
        Child       c1 = new Child("ABC"), c2 = new Child("123"), c3 = new Child("tmp");
        Parent      p1 = new Parent("p1"), p2 = new Parent("p2"), p3 = new Parent("p3");
        GrandParent g1 = new GrandParent("g1"), g2 = new GrandParent("g2"), g3 = new GrandParent("g3");

        p1.childList.Add(c1); p1.childList.Add(c2);
        p2.childList.Add(c2);
        p3.childList.Add(c3);

        g1.parentList.Add(p1); g1.parentList.Add(p2); g1.parentList.Add(p3);
        g2.parentList.Add(p2);
        g3.parentList.Add(p3);

        List <GrandParent> repo = new List <GrandParent> {
            g1, g2, g3
        };

        var filteredParents = from g in repo
                              from p in g.parentList
                              where p.childList.Any(c => c.city == "tmp")
                              select new Parent(p.name)
        {
            childList = p.childList.Where(c => c.city == "tmp").ToList()
        };

        var filteredGrandParents = from g in repo
                                   from p in g.parentList
                                   where filteredParents.Any(fp => fp.name == p.name)
                                   select new GrandParent(g.name)
        {
            parentList = g.parentList.Where(pp => filteredParents.Any(fp => fp.name == pp.name)).ToList()
        };

        foreach (var g in filteredGrandParents)
        {
            Console.WriteLine(g.name);
            foreach (var p in g.parentList)
            {
                Console.WriteLine("\t" + p.name);
                foreach (var c in p.childList)
                {
                    Console.WriteLine("\t\t" + c.city);
                }
            }
            Console.WriteLine();
        }
    }
コード例 #8
0
ファイル: Program.cs プロジェクト: aasopun/Swan-geese-4.0
        static void Main(string[] args)
        {
            Parent      man         = new Parent("Мужик", "Мужской", 52);
            Parent      woman       = new Parent("Баба", "Женский", 44);
            Child       daughter    = new Child("Доченька", "Женский", 12);
            Child       son         = new Child("Сынок", "Мужской", 8);
            Goose       goose       = new Goose("Гуси-лебеди", "Птица", "Коричневые", 1, 1, 2);
            Oven        oven        = new Oven("Печка", "Еда");
            AppleTree   apple_tree  = new AppleTree("Яблоня", "Фрукты", 21);
            MilkRiver   milk_river  = new MilkRiver("Молочная река", 100, 21);
            GrandParent granny_yaga = new GrandParent("Баба-Яга", "Женский", 119);
            Mouse       mouse       = new Mouse("Мышка", "Грызун", "Серый", 1, 1, 4);

            Swan_geese_story(man, woman, daughter, son, goose, oven, apple_tree, milk_river, granny_yaga, mouse);
            //правильная концвока при 2, 2, 2, 2, 1, 1, 1, 1 включая рандомы

            Console.ReadKey();
        }
コード例 #9
0
        private void AssertEntities(GrandParent grandParent, Parent parent, Child child)
        {
            Assert.IsNotNull(grandParent);
            Assert.IsNotNull(parent);
            Assert.IsNotNull(child);

            Assert.AreNotSame(this._grandParent, grandParent);
            Assert.AreNotSame(this._parent, parent);
            Assert.AreNotSame(this._child, child);

            Assert.AreSame(grandParent.Child, parent);
            Assert.AreSame(grandParent.GrandChild, child);

            Assert.AreSame(parent.DirectParent, grandParent);
            Assert.AreSame(parent.Child, child);

            Assert.AreSame(child.Parent, parent);
            Assert.AreSame(child.GrandParent, grandParent);
        }
コード例 #10
0
        public void SetUp()
        {
            this._context = new InMemoryDataContext();

            this._grandParent = new GrandParent();
            this._parent      = new Parent();
            this._child       = new Child();

            this._grandParent.Child      = this._parent;
            this._grandParent.GrandChild = this._child;

            this._parent.Child        = this._child;
            this._parent.DirectParent = this._grandParent;

            this._child.Parent      = this._parent;
            this._child.GrandParent = this._grandParent;

            this._context.Add(_parent);
            this._context.Commit();
        }
コード例 #11
0
        public void SetUp()
        {
            this._context = new InMemoryDataContext();

            this._grandParent = new GrandParent();
            this._parent = new Parent();
            this._child = new Child();
            
            this._grandParent.Child = this._parent;
            this._grandParent.GrandChild = this._child;

            this._parent.Child = this._child;
            this._parent.DirectParent = this._grandParent;

            this._child.Parent = this._parent;
            this._child.GrandParent = this._grandParent;

            this._context.Add(_parent);
            this._context.Commit();
        }
コード例 #12
0
        public static void Do()
        {
            GrandParent rpt = new GrandParent {
                Name = "report1", Description = "This is simply a report"
            };

            ParentOne stcln1 = new ParentOne {
                Columns = "asdf", Alias = "just a column"
            };
            ParentOne stcln2 = new ParentOne {
                Columns = "asdf", Alias = "just a column"
            };

            rpt.ParentList = new List <ParentOne>();
            rpt.AddSelectedColumns(stcln1);
            rpt.AddSelectedColumns(stcln2);

            ChildOne c1 = new ChildOne();

            c1.Name = "Ram";

            stcln1.AddSelectedColumns(c1);
            Helper.Create(rpt);

            Helper.Select();

            //f.Create<Report>(rpt);


            ///Delete many elements in one-to-may relationship

            //var obj1 = f.GetSelectedColumnsById(1);
            //Collection<SelectedColumn> selectedcolumns = new Collection<SelectedColumn>();

            //foreach(object[] item in obj1)
            //{
            //    selectedcolumns.Add(new SelectedColumn {ParentId=(int) item[0],Columns = (string) item[1], Alias = (string) item[2], SortType = (string) item[3], SortOrder = (string) item[4], GrandParentId = (int) item[5]   });
            //}

            //f.Delete<SelectedColumn>(selectedcolumns);
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: brettveenstra/ExampleCode
        static void Main()
        {
            try
            {
                var connection = new SqlConnection(@"Server=localhost\sqlexpress;Database=ExperimentalStuff;Trusted_Connection=true;");

                var id = new Guid("DB44BD6A-532C-4F9A-A9A0-CE32C193F467");
                var grandParent = new GrandParent
                {
                    Id = id,
                    Name = "grandparent",
                };

                Builder<Parent>.CreateListOfSize(3).Build()
                    .ToList().ForEach(grandParent.AddParent);

                connection.Open();
                using (var transaction = connection.BeginTransaction())
                {
                    connection.Delete<GrandParent>(new { grandParent.Id }, transaction);
                    var insert = connection.Insert(grandParent, transaction);
                    Console.WriteLine(insert);
                    transaction.Commit();
                }
                connection.Close();

                Print(connection, grandParent.Id);
                //connection.Delete<GrandParent>(new { grandParent.Id });

                connection.Dispose();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
            finally
            {
                Console.WriteLine("Press any key to exit.");
                Console.ReadKey();
            }
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: aasopun/Swan_Geese_5.0
        static void Main(string[] args)
        {
            Parent              man         = new Parent("Мужик", "Мужской", 52);
            Parent              woman       = new Parent("Баба", "Женский", 44);
            Child               daughter    = new Child("Доченька", "Женский", 12, 4);
            Child               son         = new Child("Сынок", "Мужской", 8, 1);
            Goose               goose       = new Goose("Гуси-лебеди", "Птица", "Коричневые", 1, 1, 2);
            Oven                oven        = new Oven("Печка", "Еда");
            AppleTree           apple_tree  = new AppleTree("Яблоня", "Фрукты", 21);
            MilkRiver           milk_river  = new MilkRiver("Молочная река", 100, 21);
            GrandParent <Human> granny_yaga = new GrandParent <Human>("Баба-Яга", "Женский", 119);
            Mouse               mouse       = new Mouse("Мышка", "Грызун", "Серый", 1, 1, 4);

            //правильная концвока при 2, 2, 2, 2, 1, 1, 1, 1 включая рандомы
            //Класс Zmey(в нем находится так же dictionary) и GrandParent обобщенные

            StoryTeller storyTeller = new StoryTeller();

            storyTeller.TellStrory(man, woman, daughter, son, goose, oven, apple_tree, milk_river, granny_yaga, mouse);

            Console.ReadKey();
        }
コード例 #15
0
        public void ChildChangesPropagateToGrandParent()
        {
            TestClasses.Child  c = new TestClasses.Child();
            TestClasses.Parent p = new TestClasses.Parent();
            GrandParent        g = new GrandParent();

            g.Parents.Add(p);
            p.Children.Add(c);

            c.ResetDirtyFlag();
            p.ResetDirtyFlag();
            g.ResetDirtyFlag();

            Assert.IsFalse(c.IsDirty);
            Assert.IsFalse(p.IsDirty);
            Assert.IsFalse(g.IsDirty);

            c.Name = "Pietje";

            Assert.IsTrue(c.IsDirty);
            Assert.IsTrue(p.IsDirty);
            Assert.IsTrue(g.IsDirty);
        }
コード例 #16
0
 public Parent(Child child, Sibling sibling, GrandParent grandParent)
 {
 }
コード例 #17
0
 protected abstract bool CheckRuntimeType(GrandParent item);
コード例 #18
0
 private void AssertEntities(GrandParent grandParent, Parent parent, Child child)
 {
     Assert.AreEqual(this._grandParent, grandParent);
     Assert.AreEqual(this._parent, parent);
     Assert.AreEqual(this._child, child);
 }
コード例 #19
0
        public void Build(SerializableCutscene cutscene)
        {
            Clear();

            #region Name
            {
                var item = new NativeMenuItem("Name");
                item.SetRightLabel(cutscene.Name);
                AddItem(item);
                item.Activated += (sender, selectedItem) =>
                {
                    GameFiber.StartNew(delegate
                    {
                        ResetKey(Common.MenuControls.Back);
                        Editor.Editor.DisableControlEnabling = true;

                        string title = Util.GetUserInput();
                        if (string.IsNullOrEmpty(title))
                        {
                            item.SetRightBadge(NativeMenuItem.BadgeStyle.Alert);
                            item.SetRightLabel("");
                            SetKey(Common.MenuControls.Back, GameControl.CellphoneCancel, 0);
                            Editor.Editor.DisableControlEnabling = false;
                            cutscene.Name        = null;
                            MenuItems[3].Enabled = false;
                            return;
                        }
                        Editor.Editor.DisableControlEnabling = false;
                        item.SetRightBadge(NativeMenuItem.BadgeStyle.None);
                        cutscene.Name = title;
                        selectedItem.SetRightLabel(title.Length > 20 ? title.Substring(0, 20) + "..." : title);
                        SetKey(Common.MenuControls.Back, GameControl.CellphoneCancel, 0);

                        if (cutscene.Length > 0 && !string.IsNullOrEmpty(cutscene.Name))
                        {
                            MenuItems[3].Enabled = true;
                        }
                    });
                };
            }
            #endregion

            #region Play at Objective

            {
                var item = new MenuListItem("Play at Objective", StaticData.StaticLists.ObjectiveIndexList, cutscene.PlayAt);
                AddItem(item);
                item.OnListChanged += (sender, index) =>
                {
                    cutscene.PlayAt = index;
                };
            }
            #endregion

            #region Duration
            {
                var item = new NativeMenuItem("Duration in Seconds");
                item.SetRightLabel(((int)(cutscene.Length / 1000f)).ToString());
                AddItem(item);
                item.Activated += (sender, selectedItem) =>
                {
                    GameFiber.StartNew(delegate
                    {
                        ResetKey(Common.MenuControls.Back);
                        Editor.Editor.DisableControlEnabling = true;

                        string title = Util.GetUserInput();
                        if (string.IsNullOrEmpty(title))
                        {
                            item.SetRightBadge(NativeMenuItem.BadgeStyle.Alert);
                            item.SetRightLabel("");
                            SetKey(Common.MenuControls.Back, GameControl.CellphoneCancel, 0);
                            cutscene.Length = 0;
                            Editor.Editor.DisableControlEnabling = false;
                            MenuItems[3].Enabled = false;
                            return;
                        }
                        int len;
                        if (!int.TryParse(title, NumberStyles.Integer, CultureInfo.InvariantCulture, out len))
                        {
                            item.SetRightBadge(NativeMenuItem.BadgeStyle.Alert);
                            item.SetRightLabel("");
                            SetKey(Common.MenuControls.Back, GameControl.CellphoneCancel, 0);
                            cutscene.Length = 0;
                            Editor.Editor.DisableControlEnabling = false;
                            MenuItems[3].Enabled = false;
                            Game.DisplayNotification("Integer not in correct format.");
                            return;
                        }

                        if (len <= 0)
                        {
                            item.SetRightBadge(NativeMenuItem.BadgeStyle.Alert);
                            item.SetRightLabel("");
                            SetKey(Common.MenuControls.Back, GameControl.CellphoneCancel, 0);
                            cutscene.Length = 0;
                            Editor.Editor.DisableControlEnabling = false;
                            Game.DisplayNotification("Duration must be more than 0");
                            MenuItems[3].Enabled = false;
                            return;
                        }

                        Editor.Editor.DisableControlEnabling = false;
                        item.SetRightBadge(NativeMenuItem.BadgeStyle.None);
                        cutscene.Length = len * 1000;
                        selectedItem.SetRightLabel(title.Length > 20 ? title.Substring(0, 20) + "..." : title);
                        SetKey(Common.MenuControls.Back, GameControl.CellphoneCancel, 0);
                        if (cutscene.Length > 0 && !string.IsNullOrEmpty(cutscene.Name))
                        {
                            MenuItems[3].Enabled = true;
                        }
                    });
                };
            }
            #endregion

            #region Edit

            {
                var item = new NativeMenuItem("Continue");
                AddItem(item);
                if (cutscene.Length == 0 || string.IsNullOrEmpty(cutscene.Name))
                {
                    MenuItems[3].Enabled = false;
                }

                item.Activated += (sender, selectedItem) =>
                {
                    GrandParent.EnterCutsceneEditor(cutscene);
                    Visible = false;
                };
            }
            #endregion

            RefreshIndex();
        }
コード例 #20
0
        private void AssertEntities(GrandParent grandParent, Parent parent, Child child)
        {
            Assert.IsNotNull(grandParent);
            Assert.IsNotNull(parent);
            Assert.IsNotNull(child);

            Assert.AreNotSame(this._grandParent, grandParent);
            Assert.AreNotSame(this._parent, parent);
            Assert.AreNotSame(this._child, child);

            Assert.AreSame(grandParent.Child, parent);
            Assert.AreSame(grandParent.GrandChild, child);

            Assert.AreSame(parent.DirectParent, grandParent);
            Assert.AreSame(parent.Child, child);

            Assert.AreSame(child.Parent, parent);
            Assert.AreSame(child.GrandParent, grandParent);
        }
コード例 #21
0
 private void AssertEntities(GrandParent grandParent, Parent parent, Child child)
 {
     Assert.AreEqual(this._grandParent, grandParent);
     Assert.AreEqual(this._parent, parent);
     Assert.AreEqual(this._child, child);
 }
コード例 #22
0
ファイル: StoryTeller.cs プロジェクト: aasopun/Swan_Geese_5.0
        public void TellStrory(Parent parent1, Parent parent2, Child child1, Child brother, Goose goose, Oven oven,
                               AppleTree appleTree, MilkRiver milkRiver, GrandParent <Human> grandParent, Mouse mouse)
        {
            Order order = Answers;

            order.Invoke();


            Random rnd = new Random();
            Zmey <Goose, Human> zmey_gorinich = new Zmey <Goose, Human>(3, 213321);

            parent1.Keep_live();
            parent2.Ask(child1);
            parent1.Go_out_from_home();

            Console.WriteLine("  Остаться и поиграть с братиком/Пойти гулять? Введите 1 или 2...");

            string number1 = Console.ReadLine();

            if (number1 == "1")
            {
                Order order1 = child1.Stay_at_home;
                order1();
            }
            else
            {
                Order order2 = child1.Forget;
                order2 += child1.Go_out_from_home;
                order2 += goose.Steal_child;
                order2 += child1.Cry;
                order2 += child1.Search;
                order2 += child1.Run;
                order2 += oven.Keep_staying;
                order2 += child1.Where_brother;
                order2 += oven.Eat_my_cake;
                order2();

                Console.WriteLine("  Скушать пирожок/Пойти дальше? Введите 1 или 2...");

                string number2 = Console.ReadLine();
                if (number2 == "1")
                {
                    try
                    {
                        oven.Drop_cake(5, 20);
                        Display_delegate("Печь дала 5 пирожков.");
                        order2 -= child1.Forget;
                        order2 -= child1.Go_out_from_home;
                        order2 -= goose.Steal_child;
                        order2 -= child1.Cry;
                        order2 -= child1.Search;
                        order2 -= child1.Run;
                        order2 -= oven.Keep_staying;
                        order2 -= child1.Where_brother;
                        order2 -= oven.Eat_my_cake;
                        order2 += child1.Eat_cake;
                        order2();
                    }
                    catch (NullReferenceException ex)
                    {
                        Console.WriteLine(ex.Message + "Девочка заблудилась в лесу...");
                    }
                    finally
                    {
                        child1.Come_to_hut();
                    }

                    Order orderfact = delegate
                    {
                        Console.WriteLine("Interested fact: granny Yaga is not just granny =)");
                    };
                    orderfact();    // анонимный метод


                    child1.Do("-Девочка зашла в дом, говорит");
                    child1.Say("-Здравствуй бабушка!");
                    grandParent.Say("-Здравствуй, девица! Зачем на глаза явилась?");
                    child1.Say("-Я по мхам, по болотам ходила, платье измочила, пришла погреться.");
                    grandParent.Say("Садись покуда кудель прясть.");
                    grandParent.Give_spin(grandParent);
                    child1.Spin();
                    mouse.Run();
                    mouse.Ask_to_eat();
                    child1.Give_to_eat();
                    mouse.Ask_to_run();

                    //лямбда
                    Order order3 = () => Console.WriteLine("  Забрать братика и сбежать/Не поверить мышке и ждать бабулю? Введите 1 или 2...");
                    order3();

                    int c = rnd.Next(1, 2);
                    if (c == 1)
                    {
                        child1.Say("-Спасибо тебе большое, мышка!");
                        child1.Go_out_from_hut();
                        grandParent.Ask_girl(grandParent);
                        mouse.Lie();
                        grandParent.Come_to_hut(grandParent);
                        child1.Ask_oven(oven);
                        oven.Save_children();
                        goose.Not_see();
                        child1.Come_to_home();
                        parent1.Come_to_home();
                    }
                    else
                    {
                        child1.Stay_at_hut();
                    }
                }
                else
                {
                    child1.Not_eat_cake();
                    oven.Go_out_child();
                    appleTree.Keep_staying();
                    child1.Where_brother();
                    appleTree.Eat_my_apple();

                    Console.WriteLine("  Не хочу/С радостью! Введите 1 или 2...");

                    int h = rnd.Next(1, 2);
                    if (h == 2)
                    {
                        child1.Eat_apple();
                        child1.Come_to_hut();
                        child1.Do("-Девочка зашла в дом, говорит");
                        child1.Say("-Здравствуй бабушка!");
                        grandParent.Say("-Здравствуй, девица! Зачем на глаза явилась?");
                        child1.Say("-Я по мхам, по болотам ходила, платье измочила, пришла погреться.");
                        grandParent.Say("Садись покуда кудель прясть.");
                        grandParent.Give_spin(grandParent);
                        child1.Spin();
                        mouse.Run();
                        mouse.Ask_to_eat();
                        child1.Give_to_eat();
                        mouse.Ask_to_run();
                        Console.WriteLine("  Забрать братика и сбежать/Не поверить мышке и ждать бабулю? Введите 1 или 2...");
                        string c = Console.ReadLine();
                        if (c == "1")
                        {
                            child1.Say("-Спасибо тебе большое, мышка!");
                            child1.Go_out_from_hut();
                            grandParent.Ask_girl(grandParent);
                            mouse.Lie();
                            grandParent.Come_to_hut(grandParent);
                            child1.Ask_apple_tree(appleTree);
                            appleTree.Save_children();
                            goose.Not_see();
                            goose.Fly();
                            oven.Keep_staying();
                            child1.Ask_oven(oven);
                            oven.Eat_my_cake();

                            Console.WriteLine("  Скушать пирожок/Пойти дальше? Введите 1 или 2...");

                            string number3 = Console.ReadLine();
                            if (number3 == "1")
                            {
                                child1.Eat_cake();
                                oven.Save_children();
                                goose.Not_see();
                                appleTree.Keep_staying();
                                child1.Ask_apple_tree(appleTree);
                                appleTree.Save_children();
                                goose.Not_see();
                                child1.Come_to_home();
                                parent1.Come_to_home();
                            }
                            else
                            {
                                child1.Not_eat();
                            }
                        }
                        else
                        {
                            child1.Stay_at_hut();
                        }
                    }
                    else
                    {
                        child1.Not_eat_apple();
                        appleTree.Go_out_child();
                        milkRiver.Keep_staying();
                        child1.Where_brother();
                        milkRiver.Drink_my_kissel();

                        Console.WriteLine("  Попить киселя/Пойти дальше? Введите 1 или 2...");
                        string number4 = Console.ReadLine();
                        if (number4 == "1")
                        {
                            child1.Drink_kissel();
                            child1.Come_to_hut();
                            child1.Do("-Девочка зашла в дом, говорит");
                            child1.Say("-Здравствуй бабушка!");
                            grandParent.Say("-Здравствуй, девица! Зачем на глаза явилась?");
                            child1.Say("-Я по мхам, по болотам ходила, платье измочила, пришла погреться.");
                            grandParent.Say("Садись покуда кудель прясть.");
                            grandParent.Give_spin(grandParent);
                            child1.Spin();
                            mouse.Run();
                            mouse.Ask_to_eat();
                            child1.Give_to_eat();
                            mouse.Ask_to_run();

                            Console.WriteLine("  Забрать братика и сбежать/Не поверить мышке и ждать бабулю? Введите 1 или 2...");

                            int c = rnd.Next(1, 2);
                            if (c == 1)
                            {
                                child1.Say("-Спасибо тебе большое, мышка!");
                                child1.Go_out_from_hut();
                                grandParent.Ask_girl(grandParent);
                                mouse.Lie();
                                grandParent.Come_to_hut(grandParent);
                                child1.Ask_oven(oven);
                                oven.Eat_my_cake();

                                Console.WriteLine("  Скушать пирожок/Пойти дальше? Введите 1 или 2...");

                                string number5 = Console.ReadLine();
                                if (number5 == "1")
                                {
                                    try
                                    {
                                        child1.Eat_cake();;
                                    }
                                    catch (NullReferenceException ex)
                                    {
                                        Console.WriteLine(ex.Message + "Налетели гуси-лебеди...");
                                        child1.Not_eat();
                                    }
                                    finally
                                    {
                                        oven.Save_children();
                                    }
                                    goose.Not_see();
                                    appleTree.Keep_staying();
                                    child1.Ask_apple_tree(appleTree);
                                    appleTree.Eat_my_apple();

                                    Console.WriteLine("  Скушать яблочко/Пойти дальше? Введите 1 или 2...");

                                    string number6 = Console.ReadLine();
                                    if (number6 == "1")
                                    {
                                        appleTree.Drop_apple(3, 32);
                                        child1.Eat_apple();
                                        appleTree.Save_children();
                                        goose.Not_see();
                                        milkRiver.Keep_staying();
                                        child1.Ask_river(milkRiver);
                                        milkRiver.Save_children();
                                        goose.Not_see();
                                        child1.Come_to_home();
                                        parent1.Come_to_home();
                                    }
                                    else
                                    {
                                        zmey_gorinich.Fire(goose);
                                        zmey_gorinich.Description("Была умной", "Была глупой", "Самой младшей");
                                        zmey_gorinich.Speak_to_human(child1);
                                        child1.Come_to_home();
                                        parent1.Come_to_home();
                                    }
                                }
                                else
                                {
                                    zmey_gorinich.Fire(goose);
                                    zmey_gorinich.Description("Была умной", "Была глупой", "Самой младшей");
                                    zmey_gorinich.Speak_to_human(child1);
                                    child1.Come_to_home();
                                    parent1.Come_to_home();
                                }
                            }
                            else
                            {
                                child1.Stay_at_hut();
                            }
                        }
                        else
                        {
                            child1.Not_drink_kissel();
                            milkRiver.Go_out_child();
                            child1.Search_in_fields();
                            child1.Come_to_hut();
                            child1.Do("-Девочка зашла в дом, говорит");
                            child1.Say("-Здравствуй бабушка!");
                            grandParent.Say("-Здравствуй, девица! Зачем на глаза явилась?");
                            child1.Say("-Я по мхам, по болотам ходила, платье измочила, пришла погреться.");
                            grandParent.Say("Садись покуда кудель прясть.");
                            grandParent.Give_spin(grandParent);
                            child1.Spin();
                            mouse.Run();
                            mouse.Ask_to_eat();
                            child1.Give_to_eat();
                            mouse.Ask_to_run();

                            Console.WriteLine("  Забрать братика и сбежать/Не поверить мышке и ждать бабулю? Введите 1 или 2...");

                            string c = Console.ReadLine();
                            if (c == "1")
                            {
                                try
                                {
                                    child1.Say("-Спасибо тебе большое, мышка!");
                                }
                                catch when(c == "2")
                                {
                                    child1.Stay_at_hut();
                                }
                                finally
                                {
                                    child1.Go_out_from_hut();
                                }
                                grandParent.Ask_girl(grandParent);
                                mouse.Lie();
                                grandParent.Come_to_hut(grandParent);
                                oven.Keep_staying();
                                child1.Ask_oven(oven);
                                oven.Eat_my_cake();

                                Console.WriteLine("  Скушать пирожок/Пойти дальше?? Введите 1 или 2...");

                                int number5 = rnd.Next(1, 2);
                                if (number5 == 1)
                                {
                                    child1.Eat_cake();
                                    oven.Save_children();
                                    goose.Not_see();
                                    appleTree.Keep_staying();
                                    child1.Ask_apple_tree(appleTree);
                                    appleTree.Eat_my_apple();

                                    Console.WriteLine("  Скушать яблочко/Пойти дальше? Введите 1 или 2...");

                                    string number6 = Console.ReadLine();
                                    if (number6 == "1")
                                    {
                                        try
                                        {
                                            child1.Eat_apple();
                                        }
                                        catch when(number6 == "2")
                                        {
                                            child1.Not_eat();
                                        }
                                        finally
                                        {
                                            appleTree.Save_children();
                                        }
                                        goose.Not_see();
                                        milkRiver.Keep_staying();
                                        child1.Ask_river(milkRiver);
                                        milkRiver.Flowing("речечка");
                                        milkRiver.Drink_my_kissel();

                                        Console.WriteLine("  Попить киселю/Пойти дальше? Введите 1 или 2...");

                                        string number7 = Console.ReadLine();
                                        if (number7 == "1")
                                        {
                                            child1.Drink_kissel();
                                            milkRiver.Save_children();
                                            goose.Not_see();
                                            child1.Come_to_home();
                                            parent1.Come_to_home();
                                        }
                                        else
                                        {
                                            child1.Not_eat();
                                        }
                                    }
                                }
                                else
                                {
                                    child1.Not_eat();
                                }
                            }
                            else
                            {
                                child1.Stay_at_hut();
                            }
                        }
                    }
                }
            }
        }