From f5b40b7c7c5796908224ee334345704dd1d4ab4e Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 20 Apr 2016 02:33:59 -0700 Subject: [PATCH] Change handling of files --- DATabase/Import.cs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/DATabase/Import.cs b/DATabase/Import.cs index 74c5557a..48de577e 100644 --- a/DATabase/Import.cs +++ b/DATabase/Import.cs @@ -55,18 +55,7 @@ namespace SabreTools /// Logger object for file or console output public Import(string filepath, string connectionString, Logger logger) { - // Take care of quotes - filepath = filepath.Replace("\"", ""); - - if (File.Exists(filepath)) - { - _filepath = filepath; - } - else - { - throw new IOException("File " + filepath + " does not exist!"); - } - + _filepath = filepath.Replace("\"", ""); _connectionString = connectionString; _logger = logger; } @@ -77,6 +66,13 @@ namespace SabreTools /// True if the data was imported, false otherwise public bool ImportData () { + // If file doesn't exist, error and return + if (!File.Exists(_filepath)) + { + _logger.Error("File '" + _filepath + "' doesn't exist"); + return false; + } + // Determine which dattype we have string filename = Path.GetFileName(_filepath); GroupCollection fileinfo;