diff --git a/src/Segmenter/ConfigManager.cs b/src/Segmenter/ConfigManager.cs index 0813be5..d800d72 100644 --- a/src/Segmenter/ConfigManager.cs +++ b/src/Segmenter/ConfigManager.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.IO.Compression; using System.Reflection; namespace JiebaNet.Segmenter @@ -26,7 +27,9 @@ public class ConfigManager private static T ReadFile(string name, Func read) { - using var stream = typeof(ConfigManager).Assembly.GetManifestResourceStream($"JiebaNet.Segmenter.Resources.{name}"); + using var zipStream = typeof(ConfigManager).Assembly.GetManifestResourceStream("Resources.zip") ?? throw new InvalidOperationException("Missing Resources.zip."); + using var zipArchive = new ZipArchive(zipStream, ZipArchiveMode.Read); + using var stream = zipArchive.GetEntry(name)?.Open() ?? throw new InvalidOperationException($"Missing {name} from Resources.zip."); return read(stream); } } diff --git a/src/Segmenter/Segmenter.csproj b/src/Segmenter/Segmenter.csproj index a980952..a5a1877 100644 --- a/src/Segmenter/Segmenter.csproj +++ b/src/Segmenter/Segmenter.csproj @@ -18,8 +18,12 @@ + + + + - +