/*You show the following picture to the room... * Test shows the following picture...*/ public void Run(UserInput currentInput) { if (currentInput.Args.Length < 2) { currentInput.User.WriteLine(".picture <picture>"); return; } string pictureName = currentInput.Args[1]; string picture = TalkerFile.GetFile(pictureName); if (!String.IsNullOrEmpty(picture)) { List <User> WriteAllButUsers = new List <User>(); WriteAllButUsers.Add(currentInput.User); Server.ClientList.ForEach(delegate(User currentUser) { if (currentUser.Ignores.HasFlag(User.Ignore.Pics) || currentUser.Ignores.HasFlag(User.Ignore.All)) { //The user has on an ignore, so don't write them WriteAllButUsers.Add(currentUser); } }); currentInput.User.Room.WriteAllBut(String.Format("{0} shows the following picture..\n\n {1}\n\n", currentInput.User.Name, picture), WriteAllButUsers); currentInput.User.WriteLine(String.Format("You show the following picture..\n\n {0}\n", picture)); } else { currentInput.User.WriteLine("Sorry, there is no picture with that name."); } }
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."); } } }
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); }
public void Run(UserInput currentInput) { //TODO: should I Cache the pictures or something for speed? if (currentInput.Args.Length < 3) { currentInput.User.WriteLine(".ptell <user> <picture>"); return; } string userTo = currentInput.Message.Substring(0, currentInput.Message.IndexOf(' ')); string pictureName = currentInput.Args[2]; User userObjTo = Server.FindClientByName(userTo); if (userObjTo == null) { currentInput.User.WriteLine("No such named \"" + userTo + "\"user."); } else { if (!userObjTo.Ignores.HasFlag(User.Ignore.Pics) && userObjTo.Ignores.HasFlag(User.Ignore.All)) { string picture = TalkerFile.GetFile(pictureName); string fromMessage = ""; if (!String.IsNullOrEmpty(picture)) { userObjTo.WriteLine(String.Format("{0} shows you the following picture..\n\n {1}\n", currentInput.User.Name, picture)); fromMessage = String.Format("You show the following picture to {0}\n\n {1}\n", userTo, picture); } else { fromMessage = "Sorry, there is no picture with that name.\n\n"; } currentInput.User.WriteLine(fromMessage); } else { currentInput.User.WriteLine(String.Format("{0} is ignoring pictures at the moment", userTo)); } } }
public void Run(UserInput currentInput) { currentInput.User.WriteLine(TalkerFile.GetFile("rules")); }