Exemplo n.º 1
0
        public async void LoginFailure()
        {
            var client = new FlashcardClient("https://*****:*****@yahoo.com", "Pa$$w0rd");

            user.Should().BeNull();
        }
Exemplo n.º 2
0
        private void FlashcardVerifyHandler(GlobalOptions global, SerialPortOptions serialPortOptions, FileInfo input, IConsole console)
        {
            string response = String.Empty;

            byte[] content = File.ReadAllBytes(input.FullName);

            using (progressBar = new ProgressBar(100, "Initializing", ProgressBarStyling.Options))
            {
                Progress <string> progress = new Progress <string>(message => {
                    if (global.Verbose)
                    {
                        progressBar.WriteLine(message);
                    }
                });
                FlashcardClient proxy = new FlashcardClient(progress);

                // Add event handlers
                proxy.ProgressChanged += OnProgressChanged;

                // Actual writing to card
                response = proxy.VerifyRomFile(serialPortOptions.PortName, serialPortOptions.Baudrate, content);
            }

            if (global.Verbose)
            {
                console.Out.Write($"Response from flashcard:\r\n{response}");
            }
        }
Exemplo n.º 3
0
        private void EepromWriteHandler(GlobalOptions global, SerialPortOptions serialPortOptions, EepromWriteOptions writeOptions, IConsole console)
        {
            string response = String.Empty;

            byte[] content = File.ReadAllBytes(writeOptions.File.FullName);

            using (progressBar = new ProgressBar(100, "Initializing", ProgressBarStyling.Options))
            {
                Progress <string> progress = new Progress <string>(message => {
                    if (global.Verbose)
                    {
                        progressBar.WriteLine(message);
                    }
                });
                FlashcardClient proxy = new FlashcardClient(progress);

                // Add event handlers
                proxy.ProgressChanged += OnProgressChanged;

                IEnumerable <byte[]> parts = content.Slices(4, false);

                // Actual writing to card
                response = proxy.WriteEepromFile(serialPortOptions.PortName, serialPortOptions.Baudrate, parts, true);
            }

            if (global.Verbose)
            {
                console.Out.Write("Response from flashcard:");
                console.Out.Write(response);
            }
        }
Exemplo n.º 4
0
        public async void LoginSuccess()
        {
            var client = new FlashcardClient("https://*****:*****@yahoo.com", "Pa$$w0rd");

            user.Should().NotBeNull();
            user.DisplayName.Should().Be("Dilip Agheda");
            user.Token.Should().NotBeNull();
        }
Exemplo n.º 5
0
        private static Command CreateDirectCommand(string name, string description, char message)
        {
            Command command = new Command(name, description)
                              .AddSerialPortOptions(DEFAULT_BAUDRATE);

            command.Handler = CommandHandler.Create((SerialPortOptions options) => {
                FlashcardClient client = new FlashcardClient();
                string response        = client.SendMessageAndReceiveText(options.PortName, options.Baudrate, message);
                Console.WriteLine(response);
            });
            return(command);
        }
Exemplo n.º 6
0
        private void FlashcardProxyHandler(GlobalOptions global, SerialPortOptions serialPortOptions, FlashcardSettings settings, IConsole console)
        {
            FlashcardClient client = new FlashcardClient();

            string response = String.Empty;

            if (settings.Modus.HasValue)
            {
                response = client.SendMessageAndReceiveText(serialPortOptions.PortName, serialPortOptions.Baudrate, (char)settings.Modus.Value);
            }

            if (!String.IsNullOrEmpty(settings.Size))
            {
                char size = Sizes[settings.Size.ToLower()];
                response = client.SendMessageAndReceiveText(serialPortOptions.PortName, serialPortOptions.Baudrate, size);
            }

            if (settings.Language.HasValue)
            {
                response = client.SendMessageAndReceiveText(serialPortOptions.PortName,
                                                            serialPortOptions.Baudrate, (char)settings.Language.Value);
            }

            // Rate should be last setting to change, as it requires a new baudrate for communication
            if (settings.Rate.HasValue)
            {
                char rate = Baudrates[settings.Rate.Value];
                response = client.SendMessageAndReceiveText(serialPortOptions.PortName, serialPortOptions.Baudrate, rate);
                serialPortOptions.Baudrate = settings.Rate.Value;
            }

            if (global.Verbose)
            {
                var color = Console.ForegroundColor;
                //Console.ForegroundColor = ConsoleColor.DarkGreen;
                console.Out.Write(response);
                //Console.ForegroundColor = color;
            }
            else
            {
                console.Out.Write("Settings changed. (Specify --verbose for details)");
            }
        }
Exemplo n.º 7
0
 public HomeController(ILogger <HomeController> logger, FlashcardClient flashcardClient)
 {
     _logger          = logger;
     _flashcardClient = flashcardClient;
 }
 public AccountController(FlashcardClient flashcardClient)
 {
     _flashcardClient = flashcardClient;
 }
Exemplo n.º 9
0
 public DeckDetailController(FlashcardClient flashcardClient)
 {
     _flashcardClient = flashcardClient;
 }
Exemplo n.º 10
0
 public QuizController(FlashcardClient flashcardClient)
 {
     _flashcardClient = flashcardClient;
 }