2021-03-05 16:56:51 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections;
|
|
|
|
using System;
|
|
|
|
using System.Linq;
|
|
|
|
using Aurora.Utils;
|
|
|
|
|
|
|
|
namespace Aurora.Cursor
|
|
|
|
{
|
|
|
|
|
|
|
|
public class CursorList<T> : SortedList<string, T> where T : ICursorObject
|
|
|
|
{
|
|
|
|
|
|
|
|
public CursorList()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public CursorList<T> Add(T item)
|
|
|
|
{
|
2021-03-06 00:09:42 +00:00
|
|
|
string id = item.Id;
|
|
|
|
if (item.Id == null)
|
|
|
|
{
|
|
|
|
id = HashUtil.GetHash(new string[] { item.GetHashCode().ToString() }).ToString();
|
|
|
|
item.Id = id;
|
|
|
|
}
|
2021-04-13 00:58:44 +00:00
|
|
|
this.Add(id, item);
|
2021-03-05 16:56:51 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|