コード例 #1
0
 public static void Clear(bool onlyClearMemory = true)
 {
     if (!onlyClearMemory)
     {
         GTXmlHelper.ClearAll(XmlPath);
     }
     if (Dict != null)
     {
         Dict.Clear();
     }
 }
コード例 #2
0
 public static void Update(int key, TVal obj)
 {
     if (Dict.ContainsKey(key))
     {
         GTXmlHelper.Update(XmlPath, key.ToString(), obj, KeyType);
     }
     else
     {
         Insert(key, obj);
     }
 }
コード例 #3
0
    public static void Read(string path, EDataKeyType keyType)
    {
        XmlPath = path;
        KeyType = keyType;
        XmlNodeList nodeList = GTXmlHelper.GetXmlNodeList(XmlPath);

        for (int i = 0; i < nodeList.Count; i++)
        {
            XmlElement xe = nodeList.Item(i) as XmlElement;
            if (xe == null)
            {
                continue;
            }
            int key = xe.GetAttribute(KeyType.ToString()).ToInt32();
            for (int j = 0; j < xe.Attributes.Count; j++)
            {
                string name  = xe.Attributes[j].Name;
                string value = xe.Attributes[j].Value;
                AppendAttribute(key, name, value);
            }
        }
    }
コード例 #4
0
 public static void Delete(int key)
 {
     Dict.Remove(key);
     GTXmlHelper.Delete(XmlPath, key.ToString(), KeyType);
 }
コード例 #5
0
 public static void Insert(int key, TVal obj)
 {
     Dict[key] = obj;
     GTXmlHelper.Append(XmlPath, key.ToString(), obj, KeyType);
 }