public void generateMap(int level, ICardContext cardContext, float ratioEmptyCard = 1) { Random rnd = new Random(); Entity[,] entities = MapGenerator.generateMapCard(this.width, this.height, level); for (int x = 0; x < this.width; x++) { for (int y = 0; y < this.height; y++) { if (entities[x, y] == null) { int value = rnd.Next(100); if (value > (100 * ratioEmptyCard)) { this.setCard(x, y, null); } else { this.setCard(x, y, new Card(null, cardContext)); } } else { this.setCard(x, y, new Card(entities[x, y], cardContext)); } } } }
/// <inheritdoc /> public virtual void Attach(ICardContext context, string readerName) { _context = context; ReaderName = readerName; _card = IntPtr.Zero; _protocol = Protocol.T0; }
public Map(int x, int y, ICardContext cardContext, int width, int height) { this.mapX = x; this.mapY = y; this.width = width; this.height = height; this.mapCard = new Card[this.width, this.height]; }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="context"></param> /// <param name="readerNames"></param> public StatusChangeMonitor(ICardContext context, string[] readerNames) { _context = context; _readerNames = readerNames; _readerStates = new AbstractReaderState[_readerNames.Length]; _thread = new Thread(WaitForChanges); _initDone = false; _threadContinue = false; }
public async Task RouteMessage(ICardContext context, IUserMessage message) { var card = ActiveCard; if (card != null) { card.Context = context; var cardResult = await card.MessageReceived(message); if (cardResult != CardResult.Continue) { await CloseCard(card, cardResult); } } }
public async Task <bool> ShowCard(ICard card, IMessage message, ICardContext cardContext) { // push the card onto the stack card.CardStack = this; card.Context = cardContext; Stack.Push(card); var result = await card.MessageReceived(message); if (result != CardResult.Continue) { await CloseCard(card, result); } return(true); }
public CardOperations(ICardContext cardContext, ICardEventHandler cardEventHandler, ILogger <CardOperations> logger) { _cardContext = cardContext; _cardEventHandler = cardEventHandler; _logger = logger; }
/// <inheritdoc /> public void Attach(ICardContext context, string readerName) { RequestLayer(null, SearchMode.Top).Attach(context, readerName); }
/// <inheritdoc cref="CardChannel(ICardContext,string)"/> public CardChannelLayer(ICardContext context, string readerName) : base(context, readerName, new JavaCardT0ForTB100Adapter(new JavaCardApplet())) { }
/// <inheritdoc /> public virtual void Attach(ICardContext context, string readerName) { _context = context; ReaderName = readerName; Protocol = Protocol.T0; }
/// <summary> /// Constructor (<seealso cref="Attach"/>). /// </summary> /// <param name="context">Resource manager context to attach.</param> /// <param name="readerName">Name of the reader to use.</param> /// <param name="fakeCard"></param> public CardChannelCore(ICardContext context, string readerName, IFakeCard fakeCard) : this(fakeCard) { Attach(context, readerName); }
private static void PrintReadersAndReaderGroups(ICardContext context) { Console.WriteLine($"Groups: {context.Groups.Aggregate("", (a, g) => $"{a} {g};")}"); Console.WriteLine($"Readers: {context.Readers.Aggregate("", (a, r) => $"{a} {r};")}"); }
/// <inheritdoc cref="CardChannel(WSCT.Core.ICardContext,string)"/> public CardChannelLayer(ICardContext context, string readerName) : base(context, readerName) { }
/// <summary> /// Constructor (<seealso cref="Attach"/>). /// </summary> /// <param name="context">Resource manager context to attach.</param> /// <param name="readerName">Name of the reader to use.</param> public CardChannelCore(ICardContext context, string readerName) : this() { Attach(context, readerName); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="context"><b>ICardContext</b> instance to wrap.</param> public CardContextObservable(ICardContext context) { this.context = context; }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="context"></param> public StatusChangeMonitor(ICardContext context) : this(context, context.Readers) { }
public void Attach(ICardContext context, string readerName) { stack.RequestLayer(this, SearchMode.Next).Attach(context, readerName); }
/// <summary> /// Encapsulates an <see cref="ICardContext"/> and add <see cref="ICardContextObservable"/> behaviour. /// </summary> /// <param name="context">Card context to encapsulate.</param> /// <returns></returns> public static ICardContextObservable ToObservable(this ICardContext context) { var observable = context as ICardContextObservable; return(observable ?? new CardContextObservable(context)); }
/// <inheritdoc /> public void Attach(ICardContext context, string readerName) { _cardChannel.Attach(context, readerName); }
/// <inheritdoc cref="CardChannelCore(ICardContext,string,IFakeCard)" /> public CardChannel(ICardContext context, string readerName, IFakeCard fakeCard) : base(new CardChannelCore(context, readerName, fakeCard)) { }
/// <summary> /// Initializes a new instance using a factory to obtain the <see cref="IFakeCard"/> instance on reset (<seealso cref="Attach"/>). /// </summary> /// <param name="context">Resource manager context to attach.</param> /// <param name="readerName">Name of the reader to use.</param> /// <param name="fakeCardFactory"></param> public CardChannelCore(ICardContext context, string readerName, Func <IFakeCard> fakeCardFactory) : this(fakeCardFactory) { Attach(context, readerName); }
/// <inheritdoc cref="CardChannelCore(ICardContext,string,Func<IFakeCard>)" /> public CardChannel(ICardContext context, string readerName, Func <IFakeCard> fakeCardFactory) : base(new CardChannelCore(context, readerName, fakeCardFactory)) { }
public CardUow(ICardContext context, IRepositoryProvider repositoryProvider) : base(context, repositoryProvider) { }
/// <inheritdoc cref="CardChannelCore(ICardContext,string)" /> public CardChannel(ICardContext context, string readerName) : base(new CardChannelCore(context, readerName)) { }