Bugfix batch addition mode

This commit is contained in:
Starbeamrainbowlabs 2018-09-11 22:04:41 +01:00
parent 03c2629a35
commit c663882726
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -159,11 +159,13 @@ namespace SearchBoxCLI
string nextLine = ""; string nextLine = "";
while ((nextLine = Source.ReadLine()) != null) { while ((nextLine = Source.ReadLine()) != null) {
string[] parts = nextLine.Split('|'); string[] parts = nextLine.Split('|');
if (parts[0].Trim().Length == 0)
continue;
try { try {
searchBox.AddDocument( searchBox.AddDocument(
parts[0].Trim(), parts[1].Trim(),
Regex.Split(parts[1], @",\s*"), Regex.Split(parts[2], @",\s*"),
File.ReadAllText(parts[2].Trim()) File.ReadAllText(parts[0].Trim())
); );
Console.Error.WriteLine($"[Searchbox] [add] {parts[0].Trim()}"); Console.Error.WriteLine($"[Searchbox] [add] {parts[0].Trim()}");
} catch (FileNotFoundException) { } catch (FileNotFoundException) {