public void Remove(long index)
{
lock (Sync)
{
if (!this.writeOpened)
OpenWrite();
var key = GetKey(index, this.deleteKey);
if (key == null)
return;
if (this.deleteKey == null)
this.deleteKey = key;
else if (this.deleteKey != key)
{
if (this.deleteKey.changed)
WriteKey(this.deleteKey);
if (!CacheObjects && this.deleteKey != this.readKey && this.deleteKey != this.writeKey && this.deleteKey != this.insertKey)
this.deleteKey.objects = null;
this.deleteKey = key;
}
key.RemoveObject(index - key.index1);
key.index2 -= 1;
if (this.readKey != null && this.readKey.number > key.number)
{
this.readKey.index1 -= 1;
this.readKey.index2 -= 1;
}
if (this.writeKey != null && this.writeKey.number > key.number)
{
this.writeKey.index1 -= 1;
this.writeKey.index2 -= 1;
}
if (this.insertKey != null && this.insertKey.number > key.number)
{
this.insertKey.index1 -= 1;
this.insertKey.index2 -= 1;
}
if (key.count == 0)
{
DeleteKey(key);
this.deleteKey = null;
}
Count--;
if (Count != 0)
{
if (index == 0)
DateTime1 = Get(0).DateTime;
if (index == Count)
DateTime2 = Get(Count - 1).DateTime;
}
this.changed = true;
this.file.isModified = true;
}
}