Changeset 306 for binary-improvements/AllocsCommands/Commands/ListItems.cs
- Timestamp:
- Aug 2, 2017, 6:46:15 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/ListItems.cs
r273 r306 16 16 } 17 17 18 public override string GetHelp () { 19 return "List all available item names\n" + 20 "Usage:\n" + 21 " 1. listitems <searchString>\n" + 22 " 2. listitems *\n" + 23 "1. List only names that contain the given string.\n" + 24 "2. List all names."; 25 } 26 18 27 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) 19 28 { … … 24 33 } 25 34 26 int n = 0; 27 foreach (string s in ItemList.Instance.ItemNames) { 28 if (s.ToLower ().Contains (_params [0].ToLower ()) || _params[0].Trim().Equals("*")) { 35 int count = ItemClass.ItemNames.Count; 36 bool showAll = _params[0].Trim().Equals("*"); 37 38 int listed = 0; 39 for (int i = 0; i < count; i++) { 40 string s = ItemClass.ItemNames [i]; 41 if (showAll || s.IndexOf (_params [0], StringComparison.OrdinalIgnoreCase) >= 0) { 29 42 SdtdConsole.Instance.Output (" " + s); 30 n++;43 listed++; 31 44 } 32 45 } 33 46 34 SdtdConsole.Instance.Output ("Listed " + n+ " matching items.");47 SdtdConsole.Instance.Output ("Listed " + listed + " matching items."); 35 48 } catch (Exception e) { 36 49 Log.Out ("Error in ListItems.Run: " + e);
Note:
See TracChangeset
for help on using the changeset viewer.