示例#1
0
        public Gift()
        {
            Candy  candy  = new Candy();
            Fruit  fruit  = new Fruit();
            Waffle waffle = new Waffle();
            string Path   = @"C:\!C#\At\Input.txt";

            using (StreamReader stream = new StreamReader(Path, System.Text.Encoding.Default))
            {
                while (!stream.EndOfStream)
                {
                    string   Buffer = stream.ReadLine();
                    string[] SweetnessInformation = Buffer.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    if (SweetnessInformation[0] == "C")
                    {
                        InitializationCandy(SweetnessInformation, candy); candy = new Candy();
                    }
                    if (SweetnessInformation[0] == "W")
                    {
                        InitializationWaffle(SweetnessInformation, waffle); waffle = new Waffle();
                    }
                    if (SweetnessInformation[0] == "F")
                    {
                        InitializationFruit(SweetnessInformation, fruit); fruit = new Fruit();
                    }
                    waffle = new Waffle();
                }
            };
            IsFruit();
        }
示例#2
0
 private void InitializationWaffle(string[] WaffleInformation, Waffle waffle)
 {
     InitializationSweetness(WaffleInformation, waffle);
     waffle.Taste = WaffleInformation[5];
     waffle.Glaze = Convert.ToBoolean(WaffleInformation[6]);
     //Waffles.Add(waffle);
     Sweetnesses.Add(waffle);
     waffle = new Waffle();
 }