Esempio n. 1
0
        public void Run(UserInput currentInput)
        {
            if (currentInput.Args.Length < 2)
            {
                string output = "+----------------------------------------------------------------------------+\n";
                output += "| Pictures available to view                                                 |\n";
                output += "+----------------------------------------------------------------------------+\n";

                string line       = "";
                short  lineLength = 0;

                List <TalkerFile> talkerFiles = TalkerFile.GetFiles("pictures");
                //TODO: should I just get the names first?!??
                talkerFiles.ForEach(delegate(TalkerFile currentFile) {
                    line += String.Format("{0, -12}", currentFile.FileName.PadRight(10));

                    if (lineLength == 5)
                    {
                        output    += String.Format("| {0, -74} |\n", line);
                        line       = "";
                        lineLength = 0;
                    }
                    else
                    {
                        lineLength++;
                    }
                });


                if (!String.IsNullOrEmpty(line))                   //check for final line
                {
                    output += String.Format("| {0, -74} |\n", line);
                }
                output += "+----------------------------------------------------------------------------+\n";
                output += String.Format("| There are {0} pictures                                                      |\n", talkerFiles.Count);
                output += "+----------------------------------------------------------------------------+\n";

                currentInput.User.WriteLine(output);
            }
            else
            {
                //You preview the following picture...
                string pictureName = currentInput.Args[1];

                string picture = TalkerFile.GetFile(pictureName);

                if (!String.IsNullOrEmpty(picture))
                {
                    currentInput.User.WriteLine(String.Format("You preview the following picture..\n\n {0}", picture));
                }
                else
                {
                    currentInput.User.WriteLine("Sorry, there is no picture with that name.");
                }
            }
        }
Esempio n. 2
0
        public void Run(UserInput currentInput)
        {
            string output = "+----- Files ----------------------------------------------------------------+\n\n";

            output += "Use these files to find out more about the talker.\n\n";

            TalkerFile.GetFiles("files").ForEach(delegate(TalkerFile currentFile) {
                output += string.Format("* {0, -10} - {1}", currentFile.FileName, currentFile.Description);
            });

            output += "\n\n+----------------------------------------------------------------------------+";

            currentInput.User.WriteLine(output);
        }