Пример #1
0
 public void Dictionary()
 {
     using (var dict = new YomichanTermDictionary(TestDataPaths.Kenkyusha5, TestDataPaths.Kenkyusha5 + ".cache"))
     {
         var entries = dict.Lookup("発行市場");
         var entry   = entries.Single();
         Assert.AreEqual(entry.Reading, "");
         Assert.AreEqual(entry.Glossary.Single(),
                         "発行市場 〔株式などの〕 an ┏issue [investment] market; a primary market.\n");
     }
 }
        private static EpwingDictionaries CreateEpwing(string dataDirectory, string cacheDirectory)
        {
            var dictionaries = new EpwingDictionaries();

            try
            {
                var dataPath = Path.Combine(dataDirectory, "epwing");
                var zipFiles = new List <ZipFile2>();
                try
                {
                    foreach (var zipFullPath in Directory.EnumerateFiles(dataPath, "*.zip"))
                    {
                        var zipFile = new ZipFile2(zipFullPath);
                        zipFiles.Add(zipFile);
                        var zipFileName = Path.GetFileName(zipFullPath);
                        var dictionary  = new YomichanTermDictionary(zipFile, Path.Combine(cacheDirectory, "epwing", zipFileName + ".cache"));
                        dictionaries.Add(dictionary);
                    }
                }
                finally
                {
                    foreach (var zipFile in zipFiles)
                    {
                        zipFile.Dispose();
                    }
                }
            }
            catch (DirectoryNotFoundException)
            {
            }
            catch (InvalidOperationException)
            {
            }

            return(dictionaries);
        }
 // Add method instead of constructor is provided by design
 public void Add(YomichanTermDictionary dict)
 {
     dicts.Add(dict);
 }
Пример #4
0
 public EpwingDataSource(YomichanTermDictionary dict, IKanaProperties kana)
 {
     this.dict = dict;
     this.kana = kana;
 }