// 如果数据发生了修改,则返回true。 // // parser用于解析dict对象 public static bool EditDict(Inspector inspector, string path, object dict, IDictParser parser) { UpdateCheck(); DictionaryGUIState state = GetOrCreateCachedState(path, dict, parser); DrawSearchInput(state, inspector.options); RebuildDisplayIfNeed(state, inspector.options); return(Traversal(inspector, path, state, 0, state.display.resultKeys.Length)); }
public DictService( IConfiguration configuration, IServiceProvider serviceProvider ) { this._configuration = configuration; using var provider = serviceProvider.CreateScope(); this._dictParser = provider.ServiceProvider.GetService <IDictParser>(); this._dictSearcher = provider.ServiceProvider.GetService <IDictSearcher>(); _ = _dictParser.LoadInfoList(_configuration["DictionaryHome"]); _ = SetCurrentDict(_configuration["CurrentBookName"]); }
public CommandProcessing(IDictParser dictParser, IDictSearcher searcher, IDrawer drawer) { _dictParser = dictParser; _searcher = searcher; _drawer = drawer; }
public DictSearcher(IDictParser dictParser) { this._dictParser = dictParser; }
private static DictionaryGUIState GetOrCreateCachedState(string path, object dict, IDictParser parser) { if (!guiCache.ContainsKey(path)) { guiCache[path] = new DictionaryGUIState(); } var cached = guiCache[path]; if (cached.dict == null || cached.dict.Target != dict) { cached.dict = new WeakReference(dict); } cached.parser = parser; cached.lastVisit = DateTime.Now; return(cached); }