Ejemplo n.º 1
0
        public static void DeleteKeyFromNameDict(string key, bool useSort, bool usePrimary)
        {
            NameDict.Remove(key);
            NameOneMeaningDict.Remove(key);
            VietPhraseAndNameDict.Remove(key);
            VietPhraseOneMeaningDict.Remove(key);

            var selectedNameDict = usePrimary ? PrimaryNameDict : SecondaryNameDict;

            if (!selectedNameDict.Remove(key))
            {
                return;
            }

            var selectedNameDictPath = usePrimary
                ? DictionaryConfiguration.GetPrimaryNameDictPath()
                : DictionaryConfiguration.GetSecondaryNameDictPath();

            if (useSort)
            {
                SaveDictionaryToFileSorted(selectedNameDict, selectedNameDictPath);
            }
            else
            {
                SaveDictionaryToFile(selectedNameDict, selectedNameDictPath);
            }

            WriteNamesLog(key, "Deleted", usePrimary);
        }
Ejemplo n.º 2
0
        public static void DeleteVietPhrase(string key, bool useSort)
        {
            VietPhraseAndNameDict.Remove(key);
            VietPhraseOneMeaningDict.Remove(key);
            VietPhraseDict.Remove(key);

            var dictPath = DictionaryConfiguration.GetVietPhraseDictPath();

            if (useSort)
            {
                SaveDictionaryToFileSorted(VietPhraseDict, dictPath);
            }
            else
            {
                SaveDictionaryToFile(VietPhraseDict, dictPath);
            }

            WriteVietPhraseLog(key, "Deleted");
        }