public IResult Parse(IDataToImport dataToImport, IDataSourceLocation dataSourceLocation, Type type) { if (!(dataSourceLocation is XMLDataSourceLocation)) { return new ParsingResult(ResultLevel.FATAL, dataSourceLocation.GetType().ToString() + " is not supported by XML Node Parser", null, dataSourceLocation); } if (!(dataToImport is XMLDataToImport)) { return new ParsingResult(ResultLevel.FATAL, dataToImport.GetType().ToString() + " is not supported by XML Node Parser", null, dataSourceLocation); } var castedDataToImport = dataToImport as XMLDataToImport; var castedDataSourceLocation = dataSourceLocation as XMLDataSourceLocation; try { var rawData = GetRawDataValue(castedDataSourceLocation, castedDataToImport); var parsedValue = ParseRawValue(type, rawData); return new ParsingResult(ResultLevel.INFO, "Parsing value successfully", parsedValue, dataSourceLocation); } catch (Exception e) { return new ParsingResult(ResultLevel.FATAL, "Exception caught: " + e, null, dataSourceLocation); } }
public IResult Parse(IDataToImport dataToImport, IDataSourceLocation dataSourceLocation, Type type) { if (!(dataSourceLocation is CSVDataSourceLocation)) { return new ParsingResult(ResultLevel.FATAL, dataSourceLocation.GetType().ToString() + " is not supported by CSV Cell Parser", null, null); } if (!(dataToImport is CSVDataToImport)) { return new ParsingResult(ResultLevel.FATAL, dataToImport.GetType().ToString() + " is not supported by CSV Cell Parser", null, null); } var castedDataToImport = dataToImport as CSVDataToImport; var castedDataSourceLocation = dataSourceLocation as CSVDataSourceLocation; try { var rawData = GetRawDataValue(castedDataSourceLocation, castedDataToImport); var parsedValue = ParseRawValue(type, rawData); return new ParsingResult(ResultLevel.INFO, "Parsing value successfully", parsedValue, castedDataSourceLocation); } catch (IndexOutOfRangeException) { return new ParsingResult(ResultLevel.FATAL, "Index is out of range", null, castedDataSourceLocation); } }
public IResult Parse(IDataToImport dataToImport, IDataSourceLocation dataSourceLocation, Type type) { if (!(dataSourceLocation is XMLDataSourceLocation)) { return(new ParsingResult(ResultLevel.FATAL, dataSourceLocation.GetType().ToString() + " is not supported by XML Node Parser", null, dataSourceLocation)); } if (!(dataToImport is XMLDataToImport)) { return(new ParsingResult(ResultLevel.FATAL, dataToImport.GetType().ToString() + " is not supported by XML Node Parser", null, dataSourceLocation)); } var castedDataToImport = dataToImport as XMLDataToImport; var castedDataSourceLocation = dataSourceLocation as XMLDataSourceLocation; try { var rawData = GetRawDataValue(castedDataSourceLocation, castedDataToImport); var parsedValue = ParseRawValue(type, rawData); return(new ParsingResult(ResultLevel.INFO, "Parsing value successfully", parsedValue, dataSourceLocation)); } catch (Exception e) { return(new ParsingResult(ResultLevel.FATAL, "Exception caught: " + e, null, dataSourceLocation)); } }
public IResult Parse(IDataToImport dataToImport, IDataSourceLocation dataSourceLocation, Type type) { if (!(dataSourceLocation is CSVDataSourceLocation)) { return(new ParsingResult(ResultLevel.FATAL, dataSourceLocation.GetType().ToString() + " is not supported by CSV Cell Parser", null, null)); } if (!(dataToImport is CSVDataToImport)) { return(new ParsingResult(ResultLevel.FATAL, dataToImport.GetType().ToString() + " is not supported by CSV Cell Parser", null, null)); } var castedDataToImport = dataToImport as CSVDataToImport; var castedDataSourceLocation = dataSourceLocation as CSVDataSourceLocation; try { var rawData = GetRawDataValue(castedDataSourceLocation, castedDataToImport); var parsedValue = ParseRawValue(type, rawData); return(new ParsingResult(ResultLevel.INFO, "Parsing value successfully", parsedValue, castedDataSourceLocation)); } catch (IndexOutOfRangeException) { return(new ParsingResult(ResultLevel.FATAL, "Index is out of range", null, castedDataSourceLocation)); } }