private void InsertCassettesCommand()
        {
            var reader = ReaderSelector.Select(_parametres);

            if (reader == null)
            {
                Console.WriteLine(ConsoleLanguagePack.FormatIsntDetected);
                _result = true;
            }
            try
            {
                if (reader != null)
                {
                    _atm.InsertCassettes(reader.Read(_parametres));
                }
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine(ConsoleLanguagePack.FileNotFound);
                _result = true;
            }
            catch (SerializationException)
            {
                Console.WriteLine(ConsoleLanguagePack.FileCantBeRead);
                _result = true;
            }
            catch
            {
                _result = false;
            }
            Console.WriteLine(ConsoleLanguagePack.ReadSuccessfully);
            _result = true;
        }
Exemple #2
0
        private static void InsertCassette(string path, CashMachine atm)
        {
            var reader = ReaderSelector.Select(path);

            if (reader == null)
            {
                Console.WriteLine(ConsoleLanguagePack.FormatIsntDetected);
                return;
            }
            try
            {
                atm.InsertCassettes(reader.Read(path));
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine(ConsoleLanguagePack.FileNotFound);
                return;
            }
            catch (SerializationException)
            {
                Console.WriteLine(ConsoleLanguagePack.FileCantBeRead);
                return;
            }
            Console.WriteLine(ConsoleLanguagePack.ReadSuccessfully);
        }
Exemple #3
0
        private void inputCassettesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var openFileDialog = new OpenFileDialog
            {
                Filter = @"Json (*.json)|*.json|Xml (*.xml*)|*.xml*|CSV (*.csv*)|*.csv*"
            };

            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            var reader = ReaderSelector.Select(openFileDialog.FileName);

            Atm.InsertCassettes(reader.Read(openFileDialog.FileName));
            buttonEnter.Enabled = true;
        }