summaryrefslogtreecommitdiff
path: root/Thronefall_1_57/Decompile/Ara/ElasticArray.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2024-05-19 17:03:57 +0800
committerchai <215380520@qq.com>2024-05-19 17:03:57 +0800
commitcf58771365b5953c6eac548b172aae880d1f0acd (patch)
treea49757a4b5c447cbf877584d482367a6bfe33b10 /Thronefall_1_57/Decompile/Ara/ElasticArray.cs
parenteed315deae356ddfb17f28305e7cde6cdfc43313 (diff)
* rename
Diffstat (limited to 'Thronefall_1_57/Decompile/Ara/ElasticArray.cs')
-rw-r--r--Thronefall_1_57/Decompile/Ara/ElasticArray.cs160
1 files changed, 0 insertions, 160 deletions
diff --git a/Thronefall_1_57/Decompile/Ara/ElasticArray.cs b/Thronefall_1_57/Decompile/Ara/ElasticArray.cs
deleted file mode 100644
index 038435c..0000000
--- a/Thronefall_1_57/Decompile/Ara/ElasticArray.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace Ara;
-
-public class ElasticArray<T> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable
-{
- private T[] data = new T[16];
-
- private int count;
-
- public int Count => count;
-
- public bool IsReadOnly => false;
-
- public T this[int index]
- {
- get
- {
- return data[index];
- }
- set
- {
- data[index] = value;
- }
- }
-
- public T[] Data => data;
-
- public IEnumerator<T> GetEnumerator()
- {
- int i = 0;
- while (i < count)
- {
- yield return data[i];
- int num = i + 1;
- i = num;
- }
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- public void Add(T item)
- {
- EnsureCapacity(count + 1);
- data[count++] = item;
- }
-
- public void Clear()
- {
- count = 0;
- }
-
- public bool Contains(T item)
- {
- for (int i = 0; i < count; i++)
- {
- if (data[i].Equals(item))
- {
- return true;
- }
- }
- return false;
- }
-
- public void CopyTo(T[] array, int arrayIndex)
- {
- if (array == null)
- {
- throw new ArgumentNullException();
- }
- if (array.Length - arrayIndex < count)
- {
- throw new ArgumentException();
- }
- Array.Copy(data, 0, array, arrayIndex, count);
- }
-
- public bool Remove(T item)
- {
- bool flag = false;
- for (int i = 0; i < count; i++)
- {
- if (!flag && data[i].Equals(item))
- {
- flag = true;
- }
- if (flag && i < count - 1)
- {
- data[i] = data[i + 1];
- }
- }
- if (flag)
- {
- count--;
- }
- return flag;
- }
-
- public int IndexOf(T item)
- {
- return Array.IndexOf(data, item);
- }
-
- public void Insert(int index, T item)
- {
- if (index < 0 || index > count)
- {
- throw new ArgumentOutOfRangeException();
- }
- EnsureCapacity(++count);
- for (int i = count - 1; i > index; i++)
- {
- data[i] = data[i - 1];
- }
- data[index] = item;
- }
-
- public void RemoveAt(int index)
- {
- for (int i = index; i < count; i++)
- {
- if (i < count - 1)
- {
- data[i] = data[i + 1];
- }
- }
- count--;
- }
-
- public void SetCount(int count)
- {
- EnsureCapacity(count);
- this.count = count;
- }
-
- public void EnsureCapacity(int capacity)
- {
- if (capacity >= data.Length)
- {
- Array.Resize(ref data, capacity * 2);
- }
- }
-
- public void Reverse()
- {
- int num = 0;
- int num2 = count - 1;
- while (num < num2)
- {
- T val = data[num];
- data[num++] = data[num2];
- data[num2--] = val;
- }
- }
-}