Esempio n. 1
0
        public async void ChooseMecabDic()
        {
            // Create OpenFileDialog
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            // Set filter for file extension and default file extension
            dlg.DefaultExt = ".eh";
            dlg.Filter     = "IpaDic.eh file (*.eh) | *.eh";

            // Display OpenFileDialog by calling ShowDialog method
            bool?result = dlg.ShowDialog();

            // Get the selected file name and display in a TextBox
            if (result is true)
            {
                // Open document
                string filename = dlg.FileName;
                await Task.Run(() => ZipFile.ExtractToDirectory(filename, DataRepository.AppDataDir + @"\dic"))
                .ConfigureAwait(false);

                if (mecabHelper.CanCreateTagger)
                {
                    File.Delete(filename);
                    mecabHelper.CreateTagger();
                    CanEnableMecab = true;
                    Log.Info("Loaded mecab-dic");
                }
                else
                {
                    ModernWpf.MessageBox.Show("Load mecab-dic failed", "Eroge Helper");
                }
            }
        }
Esempio n. 2
0
        public GameViewDataService(MecabHelper mecabHelper)
        {
            this.mecabHelper = mecabHelper;

            if (mecabHelper.CanCreateTagger)
            {
                mecabHelper.CreateTagger();
            }
            else
            {
                if (DataRepository.EnableMecab)
                {
                    DataRepository.EnableMecab = false;
                }
            }
        }