public void MigemoAllCharTest() { if (!Migemo.IsEnable()) { var solutionDir = Directory.GetParent(Directory.GetParent(Directory.GetParent(Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName).FullName).FullName).FullName; var migemoDllPath = Path.Combine(solutionDir, "assemblies", "Migemo"); var migemoDictionaryPath = Path.Combine(solutionDir, "assemblies", "Migemo", "dict", "migemo-dict"); //Console.WriteLine(settings.MigemoDllPath); //Console.WriteLine(settings.MigemoDictionaryPath); Migemo.Initialize(migemoDllPath, migemoDictionaryPath); } if (!Migemo.IsEnable()) { // Fail: Migemo initialize Assert.Fail(); } for (var test = Convert.ToChar(0); test <= 255; test++) { try { var ret = Migemo.GetRegex(test.ToString()); //Console.WriteLine("{0}, {1}", test, ret.ToString()); } catch { Assert.Fail(); } } }
private bool CanUseMigemo(string input) { if (input.Length > 1 && Migemo.IsEnable() && UIAssistantAPI.Instance.UIAssistantSettings.UseMigemo) { return(_ascii.IsMatch(input)); } return(false); }
public DefaultFilter() { var api = UIAssistantAPI.Instance; try { if (!Migemo.IsEnable() && api.UIAssistantSettings.UseMigemo) { Migemo.Initialize(api.UIAssistantSettings.MigemoDllPath, api.UIAssistantSettings.MigemoDictionaryPath); } } catch (Exception ex) { api.NotificationAPI.NotifyWarnMessage("Load Migemo Error", $"{ex.Message}"); api.LogAPI.WriteErrorMessage(ex); } }
public void MigemoTest() { if (!Migemo.IsEnable()) { var solutionDir = Directory.GetParent(Directory.GetParent(Directory.GetParent(Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName).FullName).FullName).FullName; var settings = UIAssistantAPI.Instance.UIAssistantSettings; settings.UseMigemo = true; settings.MigemoDllPath = Path.Combine(solutionDir, "assemblies", "Migemo"); settings.MigemoDictionaryPath = Path.Combine(solutionDir, "assemblies", "Migemo", "dict", "migemo-dict"); } var migemoFilter = new DefaultFilter(); if (!Migemo.IsEnable()) { // Fail: Migemo initialize Assert.Fail(); } var results = migemoFilter.Filter(_collection, "gamen"); Assert.AreEqual(9, results.Count()); results = migemoFilter.Filter(_collection, "здравствуйте"); Assert.AreEqual(1, results.Count()); }