jellyfin/MediaBrowser.Tests/ConsistencyTests/TextIndexing/WordIndex.cs
softworkz aa434d591e Add StringUsageReporter
StringUsageReporter reports usages of localization strings in the web
application and can also list all unused strings
2016-07-26 05:34:32 +02:00

40 lines
1014 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MediaBrowser.Tests.ConsistencyTests.TextIndexing
{
public class WordIndex : Dictionary<string, WordOccurrences>
{
public WordIndex() : base(StringComparer.InvariantCultureIgnoreCase)
{
}
public void AddWordOccurrence(string word, string fileName, string fullPath, int lineNumber, int wordIndex)
{
WordOccurrences current;
if (!this.TryGetValue(word, out current))
{
current = new WordOccurrences();
this[word] = current;
}
current.AddOccurrence(fileName, fullPath, lineNumber, wordIndex);
}
public WordOccurrences Find(string word)
{
WordOccurrences found;
if (this.TryGetValue(word, out found))
{
return found;
}
return null;
}
}
}