diff --git a/Class/Menu/AbstractMenuEntry.cs b/Class/MenuCLI/AbstractMenuEntry.cs similarity index 94% rename from Class/Menu/AbstractMenuEntry.cs rename to Class/MenuCLI/AbstractMenuEntry.cs index 85ec884..a131baf 100644 --- a/Class/Menu/AbstractMenuEntry.cs +++ b/Class/MenuCLI/AbstractMenuEntry.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using tarot.Subscription; +using Subscription; -namespace tarot.Menu{ +namespace MenuCLI{ public abstract class AbstractMenuEntry : IMenuEntry, ISubscribable{ protected string _text; protected readonly List> _subscribers; diff --git a/Class/Menu/IMenu.cs b/Class/MenuCLI/IMenu.cs similarity index 89% rename from Class/Menu/IMenu.cs rename to Class/MenuCLI/IMenu.cs index e55728e..1356266 100644 --- a/Class/Menu/IMenu.cs +++ b/Class/MenuCLI/IMenu.cs @@ -1,4 +1,4 @@ -namespace tarot.Menu{ +namespace MenuCLI{ public interface IMenu{ public void Up(); public void Down(); diff --git a/Class/Menu/IMenuEntry.cs b/Class/MenuCLI/IMenuEntry.cs similarity index 80% rename from Class/Menu/IMenuEntry.cs rename to Class/MenuCLI/IMenuEntry.cs index 1ddbf98..303807e 100644 --- a/Class/Menu/IMenuEntry.cs +++ b/Class/MenuCLI/IMenuEntry.cs @@ -1,4 +1,4 @@ -namespace tarot.Menu{ +namespace MenuCLI{ public interface IMenuEntry{ public string GetText(); public void Select(); diff --git a/Class/Menu/ListMenu.cs b/Class/MenuCLI/ListMenu.cs similarity index 97% rename from Class/Menu/ListMenu.cs rename to Class/MenuCLI/ListMenu.cs index a65d5e6..d8dc4cd 100644 --- a/Class/Menu/ListMenu.cs +++ b/Class/MenuCLI/ListMenu.cs @@ -1,6 +1,7 @@ using System; +using tarot; -namespace tarot.Menu{ +namespace MenuCLI{ public class ListMenu : IMenu{ private IMenuEntry[] _entries; private string _cursor; diff --git a/Class/Menu/MenuEntryFunc.cs b/Class/MenuCLI/MenuEntryFunc.cs similarity index 90% rename from Class/Menu/MenuEntryFunc.cs rename to Class/MenuCLI/MenuEntryFunc.cs index cee1e0f..6ff5217 100644 --- a/Class/Menu/MenuEntryFunc.cs +++ b/Class/MenuCLI/MenuEntryFunc.cs @@ -1,7 +1,7 @@ using System; -using tarot.Subscription; +using Subscription; -namespace tarot.Menu{ +namespace MenuCLI{ public class MenuEntryFunc : AbstractMenuEntry{ private Func _func; diff --git a/Class/Subscription/ISubscribable.cs b/Class/Subscription/ISubscribable.cs index 53b27c3..f846780 100644 --- a/Class/Subscription/ISubscribable.cs +++ b/Class/Subscription/ISubscribable.cs @@ -1,4 +1,4 @@ -namespace tarot.Subscription{ +namespace Subscription{ public interface ISubscribable{ public void Subscribe(ISubscriber subscriber); public void NotifySubscribers(T value); diff --git a/Class/Subscription/ISubscriber.cs b/Class/Subscription/ISubscriber.cs index 71fe0c6..f0c11a7 100644 --- a/Class/Subscription/ISubscriber.cs +++ b/Class/Subscription/ISubscriber.cs @@ -1,4 +1,4 @@ -namespace tarot.Subscription{ +namespace Subscription{ public interface ISubscriber{ public void Notify(T value); } diff --git a/Class/Subscription/Logging/AbstractLogger.cs b/Class/Subscription/Logging/AbstractLogger.cs index 468cdff..569e0c5 100644 --- a/Class/Subscription/Logging/AbstractLogger.cs +++ b/Class/Subscription/Logging/AbstractLogger.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace tarot.Subscription.Logging{ +namespace Subscription.Logging{ abstract class AbstractLogger : ILogger{ protected List _logs; protected AbstractLogger(Log log = null){ diff --git a/Class/Subscription/Logging/ActionLogger.cs b/Class/Subscription/Logging/ActionLogger.cs index f0ad3a8..550f453 100644 --- a/Class/Subscription/Logging/ActionLogger.cs +++ b/Class/Subscription/Logging/ActionLogger.cs @@ -1,4 +1,4 @@ -namespace tarot.Subscription.Logging{ +namespace Subscription.Logging{ class ActionLogger : AbstractLogger{ private string _onSuccess; private string _onFailure; diff --git a/Class/Subscription/Logging/ILogger.cs b/Class/Subscription/Logging/ILogger.cs index 69b4c0b..982f4e7 100644 --- a/Class/Subscription/Logging/ILogger.cs +++ b/Class/Subscription/Logging/ILogger.cs @@ -1,4 +1,4 @@ -namespace tarot.Subscription.Logging{ +namespace Subscription.Logging{ public interface ILogger : ISubscriber{ public void AddLog(Log log); } diff --git a/Class/Subscription/Logging/Log.cs b/Class/Subscription/Logging/Log.cs index c4683ce..a4d7294 100644 --- a/Class/Subscription/Logging/Log.cs +++ b/Class/Subscription/Logging/Log.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace tarot.Subscription.Logging{ +namespace Subscription.Logging{ public class Log{ private List _entries; diff --git a/Class/Subscription/Logging/LogEntry.cs b/Class/Subscription/Logging/LogEntry.cs index e4a2360..12bf8e9 100644 --- a/Class/Subscription/Logging/LogEntry.cs +++ b/Class/Subscription/Logging/LogEntry.cs @@ -1,6 +1,6 @@ using System; -namespace tarot.Subscription.Logging{ +namespace Subscription.Logging{ public class LogEntry{ public DateTime Time; public string Message; diff --git a/Class/Subscription/Logging/ValueLogger.cs b/Class/Subscription/Logging/ValueLogger.cs index ae17361..8d34b9f 100644 --- a/Class/Subscription/Logging/ValueLogger.cs +++ b/Class/Subscription/Logging/ValueLogger.cs @@ -1,4 +1,4 @@ -namespace tarot.Subscription.Logging{ +namespace Subscription.Logging{ class ValueLogger : AbstractLogger{ private string _onRetrieval; public ValueLogger(string _onRetrieval, Log log = null) : base(log){ diff --git a/Program.cs b/Program.cs index 9c7b279..476bf7e 100644 --- a/Program.cs +++ b/Program.cs @@ -13,6 +13,10 @@ public class GetOptions{ public class ShuffleOptions{ [Value(0, MetaName = "type", MetaValue = "string", Default = "riffle", HelpText = "What shuffle to perform.")] public string Type{get; set;} + [Value(1, MetaName = "amount", MetaValue = "int", Default = 1, HelpText = "Number of shuffles to perform.")] + public int Amount{get; set;} + [Option('q',"quiet", HelpText = "Suppress stdout.")] + public bool Quiet{get; set;} } static int Main(string[] args){ @@ -32,21 +36,36 @@ static int Main(string[] args){ return 0; }, (ShuffleOptions options) => { + options.Amount = Math.Max(1, options.Amount); switch(options.Type.ToLower()){ case "riffle": - deck.ShuffleDeck(ShuffleType.Riffle); + for (int i = 0; i < options.Amount; i++){ + deck.ShuffleDeck(ShuffleType.Riffle); + } break; case "overhand": - deck.ShuffleDeck(ShuffleType.Overhand); + for (int i = 0; i < options.Amount; i++){ + deck.ShuffleDeck(ShuffleType.Overhand); + } break; case "fisheryates" or "perfect": - deck.ShuffleDeck(ShuffleType.FisherYates); + for (int i = 0; i < options.Amount; i++){ + deck.ShuffleDeck(ShuffleType.FisherYates); + } break; default: - Console.WriteLine("Unkown shuffletype: {0}", options.Type.ToLower()); + if (!options.Quiet){ + Console.WriteLine("Unkown shuffletype: {0}.", options.Type.ToLower()); + } return 1; } - Console.WriteLine("Performed {0} shuffle", options.Type.ToLower()); + if (!options.Quiet){ + if(options.Amount > 1){ + Console.WriteLine("Performed {0} {1} shuffles.", options.Amount, options.Type.ToLower()); + }else{ + Console.WriteLine("Performed {0} shuffle.", options.Type.ToLower()); + } + } return 0; }, errors => 1);