BudgetAnalyser.Engine.Statement.AnzVisaStatementImporterV1.TasteTestAsync C# (CSharp) Method

TasteTestAsync() public method

Test the given file to see if this importer implementation can read and import it. This will open and read some of the contents of the file.
public TasteTestAsync ( string fileName ) : Task
fileName string
return Task
        public async Task<bool> TasteTestAsync(string fileName)
        {
            this.importUtilities.AbortIfFileDoesntExist(fileName);
            string[] lines = await ReadFirstTwoLinesAsync(fileName);
            if (lines == null || lines.Length != 2 || lines[0].IsNothing() || lines[1].IsNothing())
            {
                return false;
            }

            try
            {
                if (!VerifyColumnHeaderLine(lines[0])) return false;
                if (!VerifyFirstDataLine(lines[1])) return false;
            }
            catch (Exception)
            {
                return false;
            }

            return true;
        }