コード例 #1
0
        static void Main(string[] args)
        {
            Sapper sp1 = new Sapper(true, false, "arcada", "9.0", 235, 500, 211);
            Sapper sp2 = new Sapper(true, false, "arcada", "9.0", 235, 500, 211);


            CConficer tr = new CConficer(235, 500, 211);
            Word      wd = new Word(900, 235, 500, 211);

            Game          gm1    = new Game(true, false, "strategy", "5.0", 235, 500, 211, "Command&Conguer");
            TextProcessor wordPd = new TextProcessor(235, 500, 211, "WordPad");

            Computer <Soft> pc = new Computer <Soft>();

            pc.Add(sp1);
            pc.Add(sp2);
            pc.Add(tr);
            pc.Add(wd);
            pc.Add(gm1);
            pc.Add(wordPd);



            ComputerManager.AbcOut(pc);
            ComputerManager.SearchGame(pc, "strategy");
            ComputerManager.SearchTextProcessor(pc);
            Console.Read();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("///////// Partial Class in Different files test");
            Virus virus2 = new Virus("Chameleon", "Yura", "Data Base");

            virus2.Info();
            Console.WriteLine();
            Virus virus1 = new Virus("qwe", "Yura", "OS");

            virus1.Info();
            Console.Write("Are objects equal?  ");
            if (virus1.Equals(virus2))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No!");
            }

            Console.WriteLine();
            Console.WriteLine("///////// Enum test");
            Game Dota2 = new Game("Dota 2", "Valve", "MMORPG");

            Dota2.Info();
            Dota2.GetState();
            Console.WriteLine("Включаем программу...");
            Dota2.State = Program.ProgramState.Loading;
            Dota2.GetState();
            Dota2.State = Program.ProgramState.Ready;
            Dota2.GetState();


            Console.WriteLine();
            Console.WriteLine("///////// Struct test");

            Virus structVirus = new Virus();

            Virus.Properties props = new Virus.Properties
            {
                version        = "1.0.2",
                lastModifiedBy = "Kubarko"
            };
            props.Log();


            Console.WriteLine();
            Console.WriteLine("///////// Class-Container test");

            Word   wordProgram   = new Word();
            Sapper sapperProgram = new Sapper();
            Game   gameProgram   = new Game("Dota 2", "Valve", "MMORPG");

            Computer.Add(wordProgram);
            Computer.Add(sapperProgram);
            Computer.Add(gameProgram);
            Computer.Add(new Game("Crusader Kings 3", "Paradox", "Strategy"));
            Console.WriteLine("\n*** Printing all objects before deleting ***");
            Computer.Print();
            Computer.Delete(gameProgram);
            Console.WriteLine("\n*** Printing all objects after deleting ***");
            Computer.Print();



            Console.WriteLine("///////// Class-Controller test");
            Console.WriteLine();
            Game gameController1 = new Game("Dota 2", "Valve", "MMORPG");
            Game gameController2 = new Game("Dota 3", "Ubisoft", "MMORPG");
            Game gameController3 = new Game("Dota 15", "Paradox", "MMORPG");
            Game gameController4 = new Game("Counter-Strike", "Valve", "Shooter");

            Computer.Add(gameController1);
            Computer.Add(gameController2);
            Computer.Add(gameController3);
            Computer.Add(gameController4);


            List <Program> GamesSortedByGenre = Controller.FindGamesByType();

            foreach (Game p in GamesSortedByGenre)
            {
                p.Info();
                Console.WriteLine();
            }

            Console.WriteLine("///////// Class-Controller test 2");
            Console.WriteLine();
            TextProcessor tController1 = new TextProcessor("Texter", "Ivan", "1.0.0");
            TextProcessor tController2 = new TextProcessor("Edit Me", "Helen Frolova", "1.2.0");
            TextProcessor tController3 = new TextProcessor();
            Word          tController4 = new Word("John Worder", "1.0.1");
            Word          tController5 = new Word();

            Computer.Add(tController1);
            Computer.Add(tController2);
            Computer.Add(tController3);
            Computer.Add(tController4);
            Computer.Add(tController5);

            List <Program> TextProcessorsFilteredByVersion = Controller.TextProcessorVersion();

            foreach (TextProcessor t in TextProcessorsFilteredByVersion)
            {
                t.Info();
                Console.WriteLine();
            }
            Console.ReadKey();
            Console.WriteLine("//////////// Sorting Test");
            Console.WriteLine("Before Sorting: ");
            foreach (Program p in Computer.Programs)
            {
                p.Info();
                Console.WriteLine();
            }
            Console.WriteLine();
            Console.WriteLine("After Sorting: ");
            List <Program> SortedPrograms = Controller.SortByName();

            foreach (Program p in SortedPrograms)
            {
                p.Info();
                Console.WriteLine();
            }
        }