You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

65 lines
1.9 KiB

using System;
using System.Collections.Generic;
#if false
namespace Sog
{
//一个key,成员是列表,比如商店使用
public abstract class Cfg1GroupMgrTemplate<TManager, TKey1, TItem> : Singleton<TManager>, IConfigManager
where TManager : class, new()
where TItem : ITabItemWith1Key<TKey1>, new()
{
protected SortedList<TKey1, List<TItem>> m_ItemTable = new SortedList<TKey1, List<TItem>>();
public virtual SortedList<TKey1, List<TItem>> ItemTable { get { return m_ItemTable; } }
protected int m_ErrorCount = 0;
public virtual void ReadComplete()
{
}
public virtual bool Init(string fileName, string fileContent)
{
m_ItemTable.Clear();
TabTextFile tf = new TabTextFile(fileName, fileContent);
while (tf.Next())
{
TItem item = new TItem();
if (item.ReadItem(tf) == false)
{
TraceLog.Error("Failed to init TabManager:{0}, read line error, line:{1}", this.ToString(), tf.CurrentLine);
m_ErrorCount++;
return false;
}
if (GetGroup(item.GetKey1()) == null)
{
m_ItemTable.Add(item.GetKey1(), new List<TItem>());
}
m_ItemTable[item.GetKey1()].Add(item);
}
return true;
}
public virtual List<TItem> GetGroup(TKey1 key1)
{
if (m_ItemTable.ContainsKey(key1))
{
return m_ItemTable[key1];
}
return null;
}
public virtual List<TItem> this[TKey1 key1]
{
get { return GetGroup(key1); }
}
public virtual int GetErrorCount()
{
return m_ErrorCount;
}
}
}
#endif