Exemple #1
0
        private static void Convert(Importer importer, string inputFile, string outputFile)
        {
            Transactions transactions = importer.ImportTransations(inputFile);

            //IOutput output = new ConsoleOutput();
            using (FileOutput output = new FileOutput(outputFile))
            {
                TabbedOutput tabbedOutput = new TabbedOutput(output);
                transactions.ExportTabbedTo(tabbedOutput);
            }
        }
Exemple #2
0
        private static void ConvertAny(Importer importer, string[] args)
        {
            foreach(string arg in args)
            {
                bool success = Convert(importer, arg);
                if(!success)
                {
                    Console.WriteLine($"Unhandled argument: {arg}");
                }

                Console.WriteLine();
            }
        }
Exemple #3
0
        private static bool Convert(Importer importer, string filename)
        {
            string prefix = "";
            string suffix = "";

            if(SplitName(filename,ref prefix, ref suffix) && suffix.Equals("csv"))
            {
                string inputFile = filename;
                string outputFile = $"{prefix}.ofx";
                Console.WriteLine($"Converting \n  {inputFile}\nto\n  {outputFile}.");
                Convert(importer, inputFile, outputFile);
                return true;
            }
            else
            {
                return false;
            }
        }
Exemple #4
0
        public static void Main(string[] args)
        {
            try
            {
                Configuration configuration = Configuration.LoadDefaultConfiguration();
                Console.WriteLine("Exporting...\n");

                Importer importer = new Importer(configuration);
                ConvertAny(importer, args);
                Console.WriteLine("...done!");

            }
            catch (Exception ex)
            {
                Console.WriteLine("Could not load config.csv.");
                Console.WriteLine(ex.StackTrace);

                CreateConfig();
            }

            Console.ReadLine();
        }