mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Change handling of files
This commit is contained in:
@@ -55,18 +55,7 @@ namespace SabreTools
|
|||||||
/// <param name="logger">Logger object for file or console output</param>
|
/// <param name="logger">Logger object for file or console output</param>
|
||||||
public Import(string filepath, string connectionString, Logger logger)
|
public Import(string filepath, string connectionString, Logger logger)
|
||||||
{
|
{
|
||||||
// Take care of quotes
|
_filepath = filepath.Replace("\"", "");
|
||||||
filepath = filepath.Replace("\"", "");
|
|
||||||
|
|
||||||
if (File.Exists(filepath))
|
|
||||||
{
|
|
||||||
_filepath = filepath;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new IOException("File " + filepath + " does not exist!");
|
|
||||||
}
|
|
||||||
|
|
||||||
_connectionString = connectionString;
|
_connectionString = connectionString;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
@@ -77,6 +66,13 @@ namespace SabreTools
|
|||||||
/// <returns>True if the data was imported, false otherwise</returns>
|
/// <returns>True if the data was imported, false otherwise</returns>
|
||||||
public bool ImportData ()
|
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
|
// Determine which dattype we have
|
||||||
string filename = Path.GetFileName(_filepath);
|
string filename = Path.GetFileName(_filepath);
|
||||||
GroupCollection fileinfo;
|
GroupCollection fileinfo;
|
||||||
|
|||||||
Reference in New Issue
Block a user