static void Main(string[] args)
        {
            List <string> data  = Console.ReadLine().Split(", ").ToList();
            int           value = int.Parse(Console.ReadLine());

            Article article = new Article(data[0], data[1], data[2]);

            for (int i = 0; i < value; i++)
            {
                string[] commandData = Console.ReadLine().Split(": ");
                if (commandData[0] == "Edit")
                {
                    article.Edit(commandData[1]);
                }
                else if (commandData[0] == "ChangeAuthor")
                {
                    article.ChangeAuthor(commandData[1]);
                }
                else if (commandData[0] == "Rename")
                {
                    article.Rename(commandData[1]);
                }
            }

            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 2
0
        private static void Main(string[] args)
        {
            string[] input   = Console.ReadLine().Split(", ");
            string   title   = input[0];
            string   content = input[1];
            string   author  = input[2];

            Article article = new Article(title, content, author);

            int numberOfCommands = int.Parse(Console.ReadLine());

            for (int i = 0; i < numberOfCommands; i++)
            {
                string[] commands = Console.ReadLine().Split(": ");

                if (commands[0] == "Edit")
                {
                    article.EditContent(commands[1]);
                }
                else if (commands[0] == "ChangeAuthor")
                {
                    article.ChangeAuthor(commands[1]);
                }
                else if (commands[0] == "Rename")
                {
                    article.Rename(commands[1]);
                }
            }
            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            string[] line    = Console.ReadLine().Split(", ");
            Article  article = new Article(line[0], line[1], line[2]);

            int numberOfCommands = int.Parse(Console.ReadLine());

            for (int i = 0; i < numberOfCommands; i++)
            {
                string[] command = Console.ReadLine().Split(": ");
                switch (command[0])
                {
                case "Edit":
                    article.Edit(command[1]);
                    break;

                case "ChangeAuthor":
                    article.ChangeAuthor(command[1]);
                    break;

                case "Rename":
                    article.Rename(command[1]);
                    break;

                default:
                    Console.WriteLine("Wrong command!!!");
                    break;
                }
            }

            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 4
0
        static void Main()
        {
            string[] baseArticle    = Console.ReadLine().Split(", ");
            Article  article        = new Article(baseArticle[0], baseArticle[1], baseArticle[2]);
            int      commandCounter = int.Parse(Console.ReadLine());

            for (int i = 1; i <= commandCounter; i++)
            {
                string[] commandInput = Console.ReadLine().Split(": ");
                switch (commandInput[0])
                {
                case "Edit":
                    article.Edit(commandInput[1]);
                    break;

                case "ChangeAuthor":
                    article.ChangeAuthor(commandInput[1]);
                    break;

                case "Rename":
                    article.Rename(commandInput[1]);
                    break;
                }
            }
            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            List <string> input          = Console.ReadLine().Split(", ").ToList();
            int           numberCommands = int.Parse(Console.ReadLine());

            Article publication = new Article(input[0], input[1], input[2]);

            for (int i = 0; i < numberCommands; i++)
            {
                string[] commandArr = Console.ReadLine().Split(": ").ToArray();

                if (commandArr.Contains("Edit"))
                {
                    publication.Edit(commandArr[1]);
                }
                else if (commandArr.Contains("ChangeAuthor"))
                {
                    publication.ChangeAuthor(commandArr[1]);
                }
                else if (commandArr.Contains("Rename"))
                {
                    publication.Rename(commandArr[1]);
                }
            }

            Console.WriteLine(publication.ToString());
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            string[] input   = Console.ReadLine().Split(", ");
            Article  article = new Article(input[0], input[1], input[2]);

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                string[] cmdArg   = Console.ReadLine().Split(": ");
                string   comand   = cmdArg[0];
                string   argument = cmdArg[1];

                switch (comand)
                {
                case "Edit":
                    article.Edit(argument);
                    break;

                case "ChangeAuthor":
                    article.ChangeAuthor(argument);
                    break;

                case "Rename":
                    article.Rename(argument);
                    break;
                }
            }
            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            string input = Console.ReadLine();

            string[] elements = input.Split(", ", StringSplitOptions.RemoveEmptyEntries).ToArray();

            Article article = new Article(elements[0], elements[1], elements[2]);

            int n = int.Parse(Console.ReadLine());

            for (int i = 1; i <= n; i++)
            {
                string   command  = Console.ReadLine();
                string[] commands = command.Split(": ", StringSplitOptions.RemoveEmptyEntries).ToArray();

                if (commands[0] == "Edit")
                {
                    article.Edit(commands[1]);
                }
                else if (commands[0] == "ChangeAuthor")
                {
                    article.ChangeAuthor(commands[1]);
                }
                else if (commands[0] == "Rename")
                {
                    article.Rename(commands[1]);
                }
            }

            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            string[] bookInfo = Console.ReadLine().Split(", ").ToArray();
            int      n        = int.Parse(Console.ReadLine());

            Article newArticle = new Article(bookInfo[0], bookInfo[1], bookInfo[2]);

            for (int i = 0; i < n; i++)
            {
                string[] tokens = Console.ReadLine().Split(": ", StringSplitOptions.RemoveEmptyEntries).ToArray();

                if (tokens[0] == "Edit")
                {
                    newArticle.Edit(tokens[1]);
                }
                else if (tokens[0] == "ChangeAuthor")
                {
                    newArticle.ChangeAuthor(tokens[1]);
                }
                else if (tokens[0] == "Rename")
                {
                    newArticle.Rename(tokens[1]);
                }
            }

            Console.WriteLine(newArticle.ToString());
        }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            List <string> article         = Console.ReadLine().Split(", ", StringSplitOptions.RemoveEmptyEntries).ToList();
            int           numberOfChanges = int.Parse(Console.ReadLine());
            Article       newArticle      = new Article(article[0], article[1], article[2]);

            for (int i = 1; i <= numberOfChanges; i++)
            {
                var command        = Console.ReadLine();
                var splitedCommand = command.Split(": ", StringSplitOptions.RemoveEmptyEntries).ToList();

                if (splitedCommand[0] == "Edit")
                {
                    newArticle.Edit(splitedCommand[1]);
                }
                else if (splitedCommand[0] == "ChangeAuthor")
                {
                    newArticle.ChangeAuthor(splitedCommand[1]);
                }
                else
                {
                    newArticle.Rename(splitedCommand[1]);
                }
            }

            Console.WriteLine(newArticle.ToString());
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            var data = Console.ReadLine().
                       Split(", ", StringSplitOptions.RemoveEmptyEntries).  // прочитане не първоначалните стойности;
                       ToArray();

            string title   = data[0];
            string content = data[1];
            string author  = data[2];

            Article article = new Article(title, content, author); // създавам обект от клас Article с първоначaлните стойности;

            int commandsCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < commandsCount; i++)
            {
                var command = Console.ReadLine().Split(": ", StringSplitOptions.RemoveEmptyEntries).ToArray();

                switch (command[0])
                {
                case "Edit": article.Edit(command[1]); break;

                case "ChangeAuthor": article.ChangeAuthor(command[1]); break;

                case "Rename": article.Rename(command[1]); break;
                }
            }
            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine()
                             .Split(", ", StringSplitOptions.RemoveEmptyEntries)
                             .ToArray();

            Article article = new Article(input[0], input[1], input[2]);

            int numberCommands = int.Parse(Console.ReadLine());

            for (int i = 0; i < numberCommands; i++)
            {
                string[] command = Console.ReadLine()
                                   .Split(": ", StringSplitOptions.RemoveEmptyEntries)
                                   .ToArray();



                if (command[0] == "Edit")
                {
                    article.Edit(command[1]);
                }
                else if (command[0] == "ChangeAuthor")
                {
                    article.ChangeAuthor(command[1]);
                }
                else if (command[0] == "Rename")
                {
                    article.Rename(command[1]);
                }
            }

            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            string[] token = Console.ReadLine().Split(", ", StringSplitOptions.RemoveEmptyEntries);
            int      n     = int.Parse(Console.ReadLine());

            Article article = new Article(token[0], token[1], token[2]);

            for (int i = 0; i < n; i++)
            {
                string[] input    = Console.ReadLine().Split(": ", StringSplitOptions.RemoveEmptyEntries);
                string   comand   = input[0];
                string   argument = input[1];

                switch (comand)
                {
                case "Edit":
                    article.Edit(argument);
                    break;

                case "ChangeAuthor":
                    article.ChangeAuthor(argument);
                    break;

                case "Rename":
                    article.Rename(argument);
                    break;

                default:
                    break;
                }
            }

            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 13
0
        static void Main(string[] args)
        {
            string[] articleTokens = Console.ReadLine().Split(", ");
            Article  myArticle     = new Article(articleTokens[0], articleTokens[1], articleTokens[2]);

            int count = int.Parse(Console.ReadLine());

            for (int i = 0; i < count; i++)
            {
                string[] comand = Console.ReadLine().Split(": ");
                string   cmd    = comand[0];

                if (cmd == "Edit")
                {
                    myArticle.Edit(comand[1]);
                }
                else if (cmd == "ChangeAuthor")
                {
                    myArticle.ChangeAuthor(comand[1]);
                }
                else if (cmd == "Rename")
                {
                    myArticle.Rename(comand[1]);
                }
            }
            Console.WriteLine(myArticle.ToString());
        }
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(", ", StringSplitOptions.RemoveEmptyEntries)
                        .ToArray();
            Article article = new Article(input[0], input[1], input[2]);

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                var command = Console.ReadLine().Split(": ", StringSplitOptions.RemoveEmptyEntries).ToArray();

                switch (command[0])
                {
                case "Edit":
                    article.Edit(command[1]);
                    break;

                case "ChangeAuthor":
                    article.ChangeAuthor(command[1]);
                    break;

                case "Rename":
                    article.Rename(command[1]);
                    break;
                }
            }


            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(", ");

            int n = int.Parse(Console.ReadLine());

            Article article = new Article();

            article.Title   = input[0];
            article.Content = input[1];
            article.Autor   = input[2];

            for (int i = 0; i < n; i++)
            {
                string[] command = Console.ReadLine().Split(": ");

                if (command[0] == "Edit")
                {
                    article.Edit(command[1]);
                }
                else if (command[0] == "ChangeAuthor")
                {
                    article.ChangeAutor(command[1]);
                }
                else if (command[0] == "Rename")
                {
                    article.Rename(command[1]);
                }
            }
            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 16
0
        static void Main(string[] args)
        {
            string[] readArticle   = Console.ReadLine().Split(", ", StringSplitOptions.RemoveEmptyEntries).ToArray();
            int      countCommands = int.Parse(Console.ReadLine());
            Article  article       = new Article(readArticle[0], readArticle[1], readArticle[2]);

            for (int i = 0; i < countCommands; i++)
            {
                string[] commands = Console.ReadLine().Split(": ", StringSplitOptions.RemoveEmptyEntries).ToArray();
                switch (commands[0])
                {
                case "Edit":
                    article.Edit(commands[1]);
                    break;

                case "ChangeAuthor":
                    article.ChangeAutho(commands[1]);
                    break;

                case "Rename":
                    article.Rename(commands[1]);
                    break;
                }
            }
            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 17
0
        static void Main(string[] args)
        {
            // GOTTA SAVE THAT MEMORY
            string[] parameters = Console.ReadLine().Split(", ");

            Article article = new Article(parameters);

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; n++)
            {
                string command = Console.ReadLine();

                switch (command.Split(":")[0])
                {
                case "Edit":
                    article.Edit(command.Split()[1].TrimStart());
                    break;

                case "ChangeAuthor":
                    article.ChangeAuthor(command.Split()[1].TrimStart());
                    break;

                case "Rename":
                    article.Rename(command.Split()[1].TrimStart());
                    break;
                }
            }

            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 18
0
        private static void Main(string[] args)
        {
            string[] articleData = Console.ReadLine().Split(", ");
            Article  article     = new Article(articleData[0], articleData[1], articleData[2]);

            int operationsNumber = int.Parse(Console.ReadLine());

            for (int i = 0; i < operationsNumber; i++)
            {
                string[] operation = Console.ReadLine().Split(":", StringSplitOptions.RemoveEmptyEntries);
                string   command   = operation[0];
                string   value     = operation[1].Trim();
                switch (command)
                {
                case "Edit":
                    article.Content = value;
                    break;

                case "ChangeAuthor":
                    article.Author = value;
                    break;

                case "Rename":
                    article.Title = value;
                    break;

                default:
                    break;
                }
            }

            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 19
0
        static void Main()
        {
            string[] articleInfo = Console.ReadLine()
                                   .Split(", ", StringSplitOptions.RemoveEmptyEntries);

            string title    = articleInfo[0];
            string constent = articleInfo[1];
            string author   = articleInfo[2];

            Article article = new Article(title, constent, author);

            int changesCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < changesCount; i++)
            {
                string[] commands = Console.ReadLine().Split(": ", StringSplitOptions.RemoveEmptyEntries);

                string command = commands[0];

                switch (command)
                {
                case "Edit":
                    string newContent = commands[1];
                    article.Edit(newContent);
                    break;

                case "ChangeAuthor":
                    string newAuthor = commands[1];
                    article.ChangeAuthor(newAuthor);
                    break;

                case "Rename":
                    string newTitle = commands[1];
                    article.Rename(newTitle);
                    break;

                default:
                    Console.WriteLine("Invalid command!");
                    break;
                }
            }

            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 20
0
        static void Main(string[] args)
        {
            var articleData = Console.ReadLine()?.Split(",");

            if (articleData != null && articleData.Length == 3)
            {
                var article = new Article(articleData[0].Trim(), articleData[1].Trim(), articleData[2].Trim());

                int commandCount = int.Parse(Console.ReadLine() ?? throw new InvalidOperationException());
                for (int commandIndex = 0; commandIndex < commandCount; commandIndex++)
                {
                    string[] command = Console.ReadLine()?.Split(":");
                    if (command == null || command.Length != 2)
                    {
                        throw new InvalidProgramException(nameof(command));
                    }

                    var methodName     = command[0].Trim();
                    var methodArgument = command[1].Trim();

                    switch (methodName.ToLower())
                    {
                    case "edit":
                        article.Edit(methodArgument);
                        break;

                    case "changeauthor":
                        article.ChangeAuthor(methodArgument);
                        break;

                    case "rename":
                        article.Rename(methodArgument);
                        break;

                    default:
                        break;
                    }
                }

                Console.WriteLine(article.ToString());
            }
        }
Ejemplo n.º 21
0
        static void Main(string[] args)
        {
            List <Article> articles = new List <Article>();

            int numberOfArticles = int.Parse(Console.ReadLine());

            for (int i = 0; i < numberOfArticles; i++)
            {
                string[] articleArgs = Console.ReadLine().Split(", ");

                string title   = articleArgs[0];
                string content = articleArgs[1];
                string author  = articleArgs[2];

                Article article = new Article(title, content, author);

                articles.Add(article);
            }

            string filter = Console.ReadLine();

            List <Article> sortedArticles = new List <Article>();

            if (filter == "content")
            {
                sortedArticles = articles.OrderBy(x => x.Content).ToList();
            }
            else if (filter == "author")
            {
                sortedArticles = articles.OrderBy(x => x.Author).ToList();
            }
            else if (filter == "title")
            {
                sortedArticles = articles.OrderBy(x => x.Title).ToList();
            }

            foreach (var article in sortedArticles)
            {
                Console.WriteLine(article.ToString());
            }
        }
Ejemplo n.º 22
0
        static void Main(string[] args)
        {
            var articles = Console.ReadLine()
                           .Split(", ", StringSplitOptions.RemoveEmptyEntries)
                           .ToList();

            var title   = articles[0];
            var content = articles[1];
            var author  = articles[2];

            var article = new Article(title, content, author);

            var n = int.Parse(Console.ReadLine());

            for (var i = 1; i <= n; i++)
            {
                var tokens = Console.ReadLine()
                             .Split(": ", StringSplitOptions.RemoveEmptyEntries)
                             .ToArray();

                var command  = tokens[0];
                var argument = tokens[1];

                switch (command)
                {
                case "Edit":
                    article.Edit(argument);
                    break;

                case "ChangeAuthor":
                    article.ChangeAuthor(argument);
                    break;

                case "Rename":
                    article.Rename(argument);
                    break;
                }
            }

            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 23
0
        public static void Main()
        {
            var data    = Console.ReadLine().Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries);
            var title   = data[0];
            var content = data[1];
            var author  = data[2];

            var article = new Article(title, content, author)
            {
                Title   = title,
                Content = content,
                Author  = author
            };

            var commandsCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < commandsCount; i++)
            {
                var command = Console.ReadLine().Split(new string [] { ":  ", ": ", ":" }, StringSplitOptions.RemoveEmptyEntries);

                if (command[0] == "Edit")
                {
                    var newContent = command[1];
                    article.Edit(newContent);
                }

                else if (command[0] == "ChangeAuthor")
                {
                    var newAuthor = command[1];
                    article.ChangeAuthor(newAuthor);
                }

                else
                {
                    var newTitle = command[1];
                    article.RenameTitle(newTitle);
                }
            }

            Console.WriteLine(article.ToString());
        }
Ejemplo n.º 24
0
        static void Main(string[] args)
        {
            string[] articleData = Console.ReadLine()
                                   .Split(", ")
                                   .ToArray();
            int n = int.Parse(Console.ReadLine());

            string title   = articleData[0];
            string content = articleData[1];
            string author  = articleData[2];

            Article article = new Article(title, content, author);

            for (int i = 0; i < n; i++)
            {
                string[] tokens  = Console.ReadLine().Split(": ", StringSplitOptions.RemoveEmptyEntries);
                string   command = tokens[0];

                if (command == "Edit")
                {
                    string newContent = tokens[1];
                    article.Edit(newContent);
                }
                else if (command == "ChangeAuthor")
                {
                    string newAuthor = tokens[1];
                    article.ChangeAuthor(newAuthor);
                }
                else if (command == "Rename")
                {
                    string newTitle = tokens[1];
                    article.Rename(newTitle);
                }
                else if (command == "ToString")
                {
                    author.ToString();
                }
            }
            Console.WriteLine(article.ToString());;
        }
Ejemplo n.º 25
0
        static void Main(string[] args)
        {
            string[] article = Console.ReadLine()
                               .Split(", ", StringSplitOptions.RemoveEmptyEntries);

            Article x = new Article();

            x.Title   = article[0];
            x.Content = article[1];
            x.Author  = article[2];

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                string[] cmd = Console.ReadLine()
                               .Split(": ", StringSplitOptions.RemoveEmptyEntries);
                //Edit: better content
                switch (cmd[0])
                {
                case "Edit":
                    Article.Edit(x, cmd[1]);
                    break;

                case "ChangeAuthor":
                    Article.ChangeAuthor(x, cmd[1]);
                    break;

                case "Rename":
                    Article.Rename(x, cmd[1]);
                    break;

                default:
                    break;
                }
            }

            Console.WriteLine(x.ToString());
        }
        static void Main(string[] args)
        {
            string[] article = Console.ReadLine()
                               .Split(", ", StringSplitOptions.RemoveEmptyEntries)
                               .ToArray();
            int numberOfOperations = int.Parse(Console.ReadLine());

            string title   = article[0];
            string content = article[1];
            string author  = article[2];

            Article articles = new Article(title, content, author);

            for (int i = 0; i < numberOfOperations; i++)
            {
                string[] cmdArgs = Console.ReadLine()
                                   .Split(": ", StringSplitOptions.RemoveEmptyEntries)
                                   .ToArray();
                string currentCommand = cmdArgs[0];
                string option         = cmdArgs[1];

                if (currentCommand == "Edit")
                {
                    articles.Edit(option);
                }
                else if (currentCommand == "ChangeAuthor")
                {
                    articles.ChangeAuthor(option);
                }
                else if (currentCommand == "Rename")
                {
                    articles.Rename(option);
                }
            }
            Console.WriteLine(articles.ToString());
        }