feat: add basic autotranslate support

This commit is contained in:
Anna
2022-05-29 21:34:51 -04:00
parent de0309e428
commit 70cecf4a6d
6 changed files with 449 additions and 21 deletions
+5 -5
View File
@@ -1,23 +1,23 @@
namespace ChatTwo.Util;
namespace ChatTwo.Util;
internal class Lender<T> {
private readonly Func<T> _ctor;
private readonly List<T> _items = new();
private int _counter;
internal Lender(Func<T> ctor) {
this._ctor = ctor;
}
internal void ResetCounter() {
this._counter = 0;
}
internal T Borrow() {
if (this._items.Count <= this._counter) {
this._items.Add(this._ctor());
}
return this._items[this._counter++];
}
}