| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using UnityEngine; |
| | 4 | |
|
| | 5 | | public class ProfanityWordProviderFromCsv : IProfanityWordProvider |
| | 6 | | { |
| | 7 | | private readonly string explicitCsvFilePath; |
| | 8 | | private readonly string nonExplicitCsvFilePath; |
| | 9 | |
|
| 0 | 10 | | public ProfanityWordProviderFromCsv(string explicitCsvFilePath, |
| | 11 | | string nonExplicitCsvFilePath) |
| | 12 | | { |
| 0 | 13 | | this.explicitCsvFilePath = explicitCsvFilePath; |
| 0 | 14 | | this.nonExplicitCsvFilePath = nonExplicitCsvFilePath; |
| 0 | 15 | | } |
| | 16 | |
|
| 0 | 17 | | public IEnumerable<string> GetExplicitWords() => Load(explicitCsvFilePath); |
| | 18 | |
|
| 0 | 19 | | public IEnumerable<string> GetNonExplicitWords() => Load(nonExplicitCsvFilePath); |
| | 20 | |
|
| | 21 | | private IEnumerable<string> Load(string csvFilePath) |
| | 22 | | { |
| 0 | 23 | | var asset = Resources.Load<TextAsset>(csvFilePath); |
| 0 | 24 | | return asset.text.Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries); |
| | 25 | | } |
| | 26 | | } |