1 // 2 // Copyright (c) 2010-2018 Antmicro 3 // Copyright (c) 2011-2015 Realtime Embedded 4 // 5 // This file is licensed under the MIT License. 6 // Full license text is available in 'licenses/MIT.txt'. 7 // 8 using System; 9 using AntShell.Commands; 10 using System.Collections.Generic; 11 using Antmicro.Renode.UserInterface.Tokenizer; 12 using System.Linq; 13 14 namespace Antmicro.Renode.UserInterface.Commands 15 { 16 public class NumbersModeCommand : AutoLoadCommand 17 { PrintHelp(ICommandInteraction writer)18 public override void PrintHelp(ICommandInteraction writer) 19 { 20 base.PrintHelp(writer); 21 writer.WriteLine(); 22 23 writer.WriteLine(string.Format("Current mode: {0}", monitor.CurrentNumberFormat)); 24 writer.WriteLine(); 25 writer.WriteLine("Options:"); 26 foreach(var item in typeof(Monitor.NumberModes).GetEnumNames()) 27 { 28 writer.WriteLine(item); 29 } 30 } 31 32 [Runnable] Run(ICommandInteraction writer, [Values(R, R, R)] LiteralToken format)33 public void Run(ICommandInteraction writer, 34 [Values("Both", "Decimal", "Hexadecimal")] LiteralToken format) 35 { 36 monitor.CurrentNumberFormat = (Monitor.NumberModes)Enum.Parse(typeof(Monitor.NumberModes), format.Value); 37 } 38 NumbersModeCommand(Monitor monitor)39 public NumbersModeCommand(Monitor monitor):base(monitor, "numbersMode", "sets the way numbers are displayed.") 40 { 41 42 } 43 } 44 } 45 46