public void AddImportedFile(ImportFileResult file)
 {
     if (file == null) throw new ArgumentNullException("file");
     _importedFiles.Add(file);
 }
Beispiel #2
0
        private ImportFileResult ProcessFile(string file, IElasticClient client)
        {
            ImportFileResult result;

            try
            {
                Tweet[] tweets = _parser.GetTweets(file).ToArray();

                result = tweets.Any() ? BuildFileResultFromClientResponse(file, client.IndexMany(tweets)) : new ImportFileResult(file, tweets.Count());
            }
            catch (JsonReaderException jsonReaderException)
            {
                // Dodgy file/invalid json
                result = new ImportFileResult(file, "File contains invalid JSON. Exception: " + jsonReaderException.Message);
            }

            return result;
        }