BudgetAnalyser.Engine.Statement.AnzAccountStatementImporterV1.TasteTestAsync C# (CSharp) 메소드

TasteTestAsync() 공개 메소드

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
리턴 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;
        }