/// <summary> /// アイテムを追加する。 /// </summary> /// <param name="id">識別文字列</param> /// <param name="item">格納するインスタンス</param> /// <exception cref="DuplicateEnumException">IDが重複した場合</exception> public void Add(string id, TypeSafeEnum <T> item) { if (ItemDic.ContainsKey(id)) { throw new DuplicateEnumException(); } ItemDic.Add(id, item); }
private void InitField() { langSupportDic = new LanguageDic(); itemDicCollection = new ItemDicDic(); langDefault = null; itemDicDefault = new ItemDic(); langSelected = null; itemDicSelected = new ItemDic(); selectLocker = new object(); }
public bool SetLanguage(string abbreviation) { lock (selectLocker) { LanguageInfo temp = langSelected; if (langSupportDic.TryGetValue(abbreviation, out langSelected)) { itemDicSelected = itemDicCollection[abbreviation]; return(true); } else { langSelected = temp; return(false); } } }
private void AnalysisItemDetails(XmlElement detailsElement) { foreach (XmlElement item_ItemList in detailsElement.GetElementsByTagName("ItemList")) { string abbreviation = item_ItemList.GetAttribute("language"); ItemDic itemList = new ItemDic(); foreach (XmlElement item_iteminfo in item_ItemList.GetElementsByTagName("Item")) { string id = item_iteminfo.GetAttribute("id"); string content = item_iteminfo.GetAttribute("content"); itemList.Add(id, new ItemInfo(id, content)); } itemDicCollection.Add(abbreviation, itemList); } }
private void InitSelected() { langSelected = langDefault; itemDicSelected = itemDicDefault; }