Move some classes to Cryville.Common.

This commit is contained in:
2023-05-03 22:51:30 +08:00
parent 8f211568be
commit b143fb49ce
90 changed files with 788 additions and 2457 deletions

View File

@@ -1,65 +0,0 @@
namespace Cryville.Common.Buffers {
/// <summary>
/// A resource pool that allows reusing instances of arrays of type <typeparamref name="T" />.
/// </summary>
/// <typeparam name="T">The item type of the arrays in the pool.</typeparam>
public class ArrayPool<T> {
private class Bucket : ObjectPool<T[]> {
readonly int _size;
public Bucket(int size, int capacity) : base(capacity) {
_size = size;
}
protected override T[] Construct() {
return new T[_size];
}
}
readonly Bucket[] _buckets;
/// <summary>
/// Creates an instance of the <see cref="ArrayPool{T}" /> class with the default maximum list size and bucket capacity.
/// </summary>
public ArrayPool() : this(0x40000000, 256) { }
/// <summary>
/// Creates an instance of the <see cref="ArrayPool{T}" /> class.
/// </summary>
/// <param name="maxSize">The maximum size of the arrays in the pool.</param>
/// <param name="capacityPerBucket">The capacity of each bucket. The pool groups arrays of similar sizes into buckets for faster access.</param>
public ArrayPool(int maxSize, int capacityPerBucket) {
if (maxSize < 16) maxSize = 16;
int num = GetID(maxSize) + 1;
_buckets = new Bucket[num];
for (int i = 0; i < num; i++) {
_buckets[i] = new Bucket(GetSize(i), capacityPerBucket);
}
}
/// <summary>
/// Rents an array that is at least the specified size from the pool.
/// </summary>
/// <param name="size">The minimum size of the array.</param>
/// <returns>An array of type <see cref="T" /> that is at least the specified size.</returns>
public T[] Rent(int size) {
int len2 = size;
if (len2 < 16) len2 = 16;
var arr = _buckets[GetID(len2)].Rent();
return arr;
}
/// <summary>
/// Returns a rented array to the pool.
/// </summary>
/// <param name="arr">The array to return.</param>
public void Return(T[] arr) {
int len2 = arr.Length;
if (len2 < 16) len2 = 16;
_buckets[GetID(len2)].Return(arr);
}
static int GetID(int size) {
size -= 1;
size >>= 4;
int num = 0;
for (; size != 0; size >>= 1) num++;
return num;
}
static int GetSize(int id) {
return 0x10 << id;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: df66519fa93e1b94ea5bb1702cc91b3f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,90 +0,0 @@
using System.Collections.Generic;
namespace Cryville.Common.Buffers {
/// <summary>
/// A set of resource pools categorized by a category type.
/// </summary>
/// <typeparam name="TCategory">The category type.</typeparam>
/// <typeparam name="TObject">The type of the objects in the pool.</typeparam>
public abstract class CategorizedPool<TCategory, TObject> where TObject : class {
/// <summary>
/// The set of underlying pools.
/// </summary>
/// <remarks>
/// <para>The <see cref="Rent(TCategory)" /> and <see cref="Return(TCategory, TObject)" /> method select an underlying pool directly from this set with the category as the key. When overridden, this set must be available since construction.</para>
/// </remarks>
protected abstract IReadOnlyDictionary<TCategory, ObjectPool<TObject>> Buckets { get; }
/// <summary>
/// The count of objects rented from the set of pools.
/// </summary>
public int RentedCount { get; private set; }
/// <summary>
/// Rents an object from the pool.
/// </summary>
/// <param name="category">The category.</param>
/// <returns>The rented object.</returns>
public TObject Rent(TCategory category) {
var obj = Buckets[category].Rent();
RentedCount++;
return obj;
}
/// <summary>
/// Returns a rented object to the pool.
/// </summary>
/// <param name="category">The category.</param>
/// <param name="obj">The object to return.</param>
public void Return(TCategory category, TObject obj) {
Buckets[category].Return(obj);
--RentedCount;
}
}
/// <summary>
/// A utility to access a categorized pool, representing a single unit that uses a shared categorized pool.
/// </summary>
/// <typeparam name="TCategory">The category type.</typeparam>
/// <typeparam name="TObject">The type of the objects in the pool.</typeparam>
public class CategorizedPoolAccessor<TCategory, TObject> where TObject : class {
readonly CategorizedPool<TCategory, TObject> _pool;
static readonly SimpleObjectPool<Dictionary<TObject, TCategory>> _dictPool
= new SimpleObjectPool<Dictionary<TObject, TCategory>>(1024);
Dictionary<TObject, TCategory> _rented;
/// <summary>
/// Creates an instance of the <see cref="CategorizedPoolAccessor{TCategory, TObject}" /> class.
/// </summary>
/// <param name="pool">The categorized pool.</param>
public CategorizedPoolAccessor(CategorizedPool<TCategory, TObject> pool) {
_pool = pool;
}
/// <summary>
/// Rents an object from the pool.
/// </summary>
/// <param name="category">The category.</param>
/// <returns>The rented object.</returns>
public TObject Rent(TCategory category) {
var obj = _pool.Rent(category);
if (_rented == null) _rented = _dictPool.Rent();
_rented.Add(obj, category);
return obj;
}
/// <summary>
/// Returns a rented object to the pool.
/// </summary>
/// <param name="obj">The object to return.</param>
public void Return(TObject obj) {
_pool.Return(_rented[obj], obj);
_rented.Remove(obj);
}
/// <summary>
/// Returns all objects rented by this accessor to the pool.
/// </summary>
public void ReturnAll() {
if (_rented == null) return;
foreach (var obj in _rented) {
_pool.Return(obj.Value, obj.Key);
}
_rented.Clear();
_dictPool.Return(_rented);
_rented = null;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: ec18f22479042d747b88c093aa90c5c0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,71 +0,0 @@
using System.Collections.Generic;
namespace Cryville.Common.Buffers {
/// <summary>
/// A resource pool that allows reusing instances of lists of type <typeparamref name="T" />.
/// </summary>
/// <typeparam name="T">The item type of the lists in the pool.</typeparam>
public class ListPool<T> {
private class Bucket : ObjectPool<List<T>> {
readonly int _size;
public Bucket(int size, int capacity) : base(capacity) {
_size = size;
}
protected override List<T> Construct() {
return new List<T>(_size);
}
}
readonly Bucket[] _buckets;
/// <summary>
/// Creates an instance of the <see cref="ListPool{T}" /> class with the default maximum list size and bucket capacity.
/// </summary>
public ListPool() : this(0x40000000, 256) { }
/// <summary>
/// Creates an instance of the <see cref="ListPool{T}" /> class.
/// </summary>
/// <param name="maxSize">The maximum size of the lists in the pool.</param>
/// <param name="capacityPerBucket">The capacity of each bucket. The pool groups lists of similar sizes into buckets for faster access.</param>
public ListPool(int maxSize, int capacityPerBucket) {
if (maxSize < 16) maxSize = 16;
int num = GetID(maxSize) + 1;
_buckets = new Bucket[num];
for (int i = 0; i < num; i++) {
_buckets[i] = new Bucket(GetSize(i), capacityPerBucket);
}
}
/// <summary>
/// Rents a list of the specified size from the pool. The size of the list must not be changed when it is rented.
/// </summary>
/// <param name="size">The size of the list.</param>
/// <returns>A <see cref="List{T}" /> of the specified size.</returns>
public List<T> Rent(int size) {
int len2 = size;
if (len2 < 16) len2 = 16;
var list = _buckets[GetID(len2)].Rent();
if (list.Count < size)
for (int i = list.Count; i < size; i++) list.Add(default(T));
else if (list.Count > size)
list.RemoveRange(size, list.Count - size);
return list;
}
/// <summary>
/// Returns a rented list to the pool.
/// </summary>
/// <param name="list">The list to return.</param>
public void Return(List<T> list) {
int len2 = list.Capacity;
if (len2 < 16) len2 = 16;
_buckets[GetID(len2)].Return(list);
}
static int GetID(int size) {
size -= 1;
size >>= 4;
int num = 0;
for (; size != 0; size >>= 1) num++;
return num;
}
static int GetSize(int id) {
return 0x10 << id;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 2b7b45ff20c33ac47b476371673b037c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,54 +0,0 @@
namespace Cryville.Common.Buffers {
/// <summary>
/// A resource pool that allows reusing instances of type <typeparamref name="T" />.
/// </summary>
/// <typeparam name="T">The type of the objects in the pool.</typeparam>
public abstract class ObjectPool<T> where T : class {
int _index;
readonly T[] _objs;
/// <summary>
/// Creates an instance of the <see cref="ObjectPool{T}" /> class.
/// </summary>
/// <param name="capacity">The capacity of the pool.</param>
public ObjectPool(int capacity) {
_objs = new T[capacity];
}
/// <summary>
/// The count of objects rented from the pool.
/// </summary>
public int RentedCount { get { return _index; } }
/// <summary>
/// Rents a object from the pool.
/// </summary>
/// <returns>The rented object.</returns>
public T Rent() {
T obj = null;
if (_index < _objs.Length) {
obj = _objs[_index];
_objs[_index++] = null;
}
if (obj == null) obj = Construct();
return obj;
}
/// <summary>
/// Returns a rented object to the pool.
/// </summary>
/// <param name="obj">The object to return.</param>
public void Return(T obj) {
if (_index > 0) {
Reset(obj);
_objs[--_index] = obj;
}
}
/// <summary>
/// Constructs a new instance of type <typeparamref name="T" />.
/// </summary>
/// <returns>The new instance.</returns>
protected abstract T Construct();
/// <summary>
/// Resets an object.
/// </summary>
/// <param name="obj">The object.</param>
protected virtual void Reset(T obj) { }
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 2745c44c3cc32be4ab3a43888c14b9a1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,16 +0,0 @@
namespace Cryville.Common.Buffers {
/// <summary>
/// A resource pool that allows reusing instances of type <typeparamref name="T" />, which has a parameterless constructor.
/// </summary>
/// <typeparam name="T">The type of the objects in the pool.</typeparam>
public class SimpleObjectPool<T> : ObjectPool<T> where T : class, new() {
/// <summary>
/// Creates an instance of the <see cref="SimpleObjectPool{T}" /> class.
/// </summary>
/// <param name="capacity">The capacity of the pool.</param>
public SimpleObjectPool(int capacity) : base(capacity) { }
protected override T Construct() {
return new T();
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: b8cd439340f088d4eb83711a5bc6384d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,135 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Cryville.Common.Buffers {
/// <summary>
/// An auto-resized <see cref="char" /> array as a variable-length string used as a target that is modified frequently.
/// </summary>
public class TargetString : IEnumerable<char> {
public event Action OnUpdate;
char[] _arr;
bool _invalidated;
/// <summary>
/// Creates an instance of the <see cref="TargetString" /> class with a capacity of 16.
/// </summary>
public TargetString() : this(16) { }
/// <summary>
/// Creates an instance of the <see cref="TargetString" /> class.
/// </summary>
/// <param name="capacity">The initial capacity of the string.</param>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="capacity" /> is less than or equal to 0.</exception>
public TargetString(int capacity) {
if (capacity <= 0) throw new ArgumentOutOfRangeException("capacity");
_arr = new char[capacity];
}
/// <summary>
/// Gets or sets one of the characters in the string.
/// </summary>
/// <param name="index">The zero-based index of the character.</param>
/// <returns>The character at the given index.</returns>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="index" /> is less than 0 or not less than <see cref="Length" />.</exception>
/// <remarks>
/// <para>Set <see cref="Length" /> to a desired value before updating the characters.</para>
/// <para>Call <see cref=" Validate" /> after all the characters are updated.</para>
/// </remarks>
public char this[int index] {
get {
if (index < 0 || index >= m_length)
throw new ArgumentOutOfRangeException("index");
return _arr[index];
}
set {
if (index < 0 || index >= m_length)
throw new ArgumentOutOfRangeException("index");
if (_arr[index] == value) return;
_arr[index] = value;
_invalidated = true;
}
}
int m_length;
/// <summary>
/// The length of the string.
/// </summary>
/// <exception cref="ArgumentOutOfRangeException">The value specified for a set operation is less than 0.</exception>
public int Length {
get {
return m_length;
}
set {
if (Length < 0) throw new ArgumentOutOfRangeException("length");
if (m_length == value) return;
if (_arr.Length < value) {
var len = _arr.Length;
while (len < value) len *= 2;
var arr2 = new char[len];
Array.Copy(_arr, arr2, m_length);
_arr = arr2;
}
m_length = value;
_invalidated = true;
}
}
/// <summary>
/// Validates the string.
/// </summary>
public void Validate() {
if (!_invalidated) return;
_invalidated = false;
var ev = OnUpdate;
if (ev != null) ev.Invoke();
}
internal char[] TrustedAsArray() { return _arr; }
/// <summary>
/// Returns an enumerator that iterates through the <see cref="TargetString" />.
/// </summary>
/// <returns>A <see cref="Enumerator" /> for the <see cref="TargetString" />.</returns>
public Enumerator GetEnumerator() {
return new Enumerator(this);
}
IEnumerator<char> IEnumerable<char>.GetEnumerator() {
return new Enumerator(this);
}
IEnumerator IEnumerable.GetEnumerator() {
return new Enumerator(this);
}
public struct Enumerator : IEnumerator<char> {
readonly TargetString _self;
int _index;
internal Enumerator(TargetString self) {
_self = self;
_index = -1;
}
public char Current {
get {
if (_index < 0)
throw new InvalidOperationException(_index == -1 ? "Enum not started" : "Enum ended");
return _self[_index];
}
}
object IEnumerator.Current { get { return Current; } }
public void Dispose() {
_index = -2;
}
public bool MoveNext() {
if (_index == -2) return false;
_index++;
if (_index >= _self.Length) {
_index = -2;
return false;
}
return true;
}
public void Reset() {
_index = -1;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f0fc34ac257793d4883a9cfcdb6941b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
using System.Collections.Generic;
namespace Cryville.Common.Collections.Generic {
public interface IPairList<TKey, TValue> : IList<KeyValuePair<TKey, TValue>> {
void Add(TKey key, TValue value);
void Insert(int index, TKey key, TValue value);
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 73fb17b484b343242bcce27c15ed7d44
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,50 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Cryville.Common.Collections.Generic {
[DebuggerDisplay("Count = {Count}"), DebuggerTypeProxy(typeof(PairCollectionDebugView<,>))]
public struct PairCollection<TKey, TValue> : IDisposable {
public void Dispose() { }
readonly IPairList<TKey, TValue> _pairList;
readonly IDictionary<TKey, TValue> _dictionary;
public PairCollection(object collection) : this() {
var type = collection.GetType();
if (typeof(IPairList<TKey, TValue>).IsAssignableFrom(type)) _pairList = (IPairList<TKey, TValue>)collection;
else if (typeof(IDictionary<TKey, TValue>).IsAssignableFrom(type)) _dictionary = (IDictionary<TKey, TValue>)collection;
else throw new ArgumentException("Parameter is not a pair collection");
}
public int Count {
get {
if (_pairList != null) return _pairList.Count;
else return _dictionary.Count;
}
}
public void Add(TKey key, TValue value) {
if (_pairList != null) _pairList.Add(key, value);
else _dictionary.Add(key, value);
}
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int index) {
if (_pairList != null) _pairList.CopyTo(array, index);
else _dictionary.CopyTo(array, index);
}
public static bool IsPairCollection(Type type) {
return typeof(IPairList<TKey, TValue>).IsAssignableFrom(type) || typeof(IDictionary<TKey, TValue>).IsAssignableFrom(type);
}
}
internal class PairCollectionDebugView<TKey, TValue> {
readonly PairCollection<TKey, TValue> _self;
public PairCollectionDebugView(PairCollection<TKey, TValue> self) {
_self = self;
}
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public KeyValuePair<TKey, TValue>[] Items {
get {
KeyValuePair<TKey, TValue>[] array = new KeyValuePair<TKey, TValue>[_self.Count];
_self.CopyTo(array, 0);
return array;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 2517e8f040bd36f46948e5fafaf5335c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,48 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Cryville.Common.Collections.Generic {
[DebuggerDisplay("Count = {Count}"), DebuggerTypeProxy(typeof(PairListDebugView<,>))]
public class PairList<TKey, TValue> : List<KeyValuePair<TKey, TValue>>, IPairList<TKey, TValue>, IPairList {
public void Add(TKey key, TValue value) {
Add(new KeyValuePair<TKey, TValue>(key, value));
}
public void Add(object key, object value) {
try {
Add((TKey)key, (TValue)value);
}
catch (InvalidCastException) {
throw new ArgumentException("Wrong key type or value type");
}
}
public void Insert(int index, TKey key, TValue value) {
Insert(index, new KeyValuePair<TKey, TValue>(key, value));
}
public void Insert(int index, object key, object value) {
try {
Insert(index, (TKey)key, (TValue)value);
}
catch (InvalidCastException) {
throw new ArgumentException("Wrong key type or value type");
}
}
}
internal class PairListDebugView<TKey, TValue> {
readonly PairList<TKey, TValue> _self;
public PairListDebugView(PairList<TKey, TValue> self) {
_self = self;
}
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public KeyValuePair<TKey, TValue>[] Items {
get {
KeyValuePair<TKey, TValue>[] array = new KeyValuePair<TKey, TValue>[_self.Count];
_self.CopyTo(array, 0);
return array;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d9ed5ea8b7b1a934287e7ec5971166c0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,106 +0,0 @@
using System;
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.Serialization;
using System.Threading;
namespace Cryville.Common.Collections {
internal static class HashHelpers {
#if FEATURE_RANDOMIZED_STRING_HASHING
public const int HashCollisionThreshold = 100;
public static bool s_UseRandomizedStringHashing = String.UseRandomizedHashing();
#endif
// Table of prime numbers to use as hash table sizes.
// A typical resize algorithm would pick the smallest prime number in this array
// that is larger than twice the previous capacity.
// Suppose our Hashtable currently has capacity x and enough elements are added
// such that a resize needs to occur. Resizing first computes 2x then finds the
// first prime in the table greater than 2x, i.e. if primes are ordered
// p_1, p_2, ..., p_i, ..., it finds p_n such that p_n-1 < 2x < p_n.
// Doubling is important for preserving the asymptotic complexity of the
// hashtable operations such as add. Having a prime guarantees that double
// hashing does not lead to infinite loops. IE, your hash function will be
// h1(key) + i*h2(key), 0 <= i < size. h2 and the size must be relatively prime.
public static readonly int[] primes = {
3, 7, 11, 17, 23, 29, 37, 47, 59, 71, 89, 107, 131, 163, 197, 239, 293, 353, 431, 521, 631, 761, 919,
1103, 1327, 1597, 1931, 2333, 2801, 3371, 4049, 4861, 5839, 7013, 8419, 10103, 12143, 14591,
17519, 21023, 25229, 30293, 36353, 43627, 52361, 62851, 75431, 90523, 108631, 130363, 156437,
187751, 225307, 270371, 324449, 389357, 467237, 560689, 672827, 807403, 968897, 1162687, 1395263,
1674319, 2009191, 2411033, 2893249, 3471899, 4166287, 4999559, 5999471, 7199369};
// Used by Hashtable and Dictionary's SeralizationInfo .ctor's to store the SeralizationInfo
// object until OnDeserialization is called.
private static ConditionalWeakTable<object, SerializationInfo> s_SerializationInfoTable;
internal static ConditionalWeakTable<object, SerializationInfo> SerializationInfoTable {
get {
if (s_SerializationInfoTable == null) {
ConditionalWeakTable<object, SerializationInfo> newTable = new ConditionalWeakTable<object, SerializationInfo>();
Interlocked.CompareExchange(ref s_SerializationInfoTable, newTable, null);
}
return s_SerializationInfoTable;
}
}
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static bool IsPrime(int candidate) {
if ((candidate & 1) != 0) {
int limit = (int)System.Math.Sqrt (candidate);
for (int divisor = 3; divisor <= limit; divisor += 2) {
if ((candidate % divisor) == 0)
return false;
}
return true;
}
return (candidate == 2);
}
internal const Int32 HashPrime = 101;
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static int GetPrime(int min) {
if (min < 0)
throw new ArgumentException("Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table.");
Contract.EndContractBlock();
for (int i = 0; i < primes.Length; i++) {
int prime = primes[i];
if (prime >= min) return prime;
}
//outside of our predefined table.
//compute the hard way.
for (int i = (min | 1); i < Int32.MaxValue; i += 2) {
if (IsPrime(i) && ((i - 1) % HashPrime != 0))
return i;
}
return min;
}
public static int GetMinPrime() {
return primes[0];
}
// Returns size of hashtable to grow to.
public static int ExpandPrime(int oldSize) {
int newSize = 2 * oldSize;
// Allow the hashtables to grow to maximum possible size (~2G elements) before encoutering capacity overflow.
// Note that this check works even when _items.Length overflowed thanks to the (uint) cast
if ((uint)newSize > MaxPrimeArrayLength && MaxPrimeArrayLength > oldSize) {
Contract.Assert(MaxPrimeArrayLength == GetPrime(MaxPrimeArrayLength), "Invalid MaxPrimeArrayLength");
return MaxPrimeArrayLength;
}
return GetPrime(newSize);
}
// This is the maximum prime smaller than Array.MaxArrayLength
public const int MaxPrimeArrayLength = 0x7FEFFFFD;
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e7fe2c6f3299681448c1a546cce4dc65
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
using System.Collections;
namespace Cryville.Common.Collections {
public interface IPairList : IList {
void Add(object key, object value);
void Insert(int index, object key, object value);
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 046617672d437de4ab7e644a55defd3b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,51 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
namespace Cryville.Common.Collections {
[DebuggerDisplay("Count = {Count}"), DebuggerTypeProxy(typeof(PairCollectionDebugView))]
public struct PairCollection : IDisposable {
public void Dispose() { }
readonly IPairList _pairList;
readonly IDictionary _dictionary;
public PairCollection(object collection) : this() {
var type = collection.GetType();
if (typeof(IPairList).IsAssignableFrom(type)) _pairList = (IPairList)collection;
else if (typeof(IDictionary).IsAssignableFrom(type)) _dictionary = (IDictionary)collection;
else throw new ArgumentException("Parameter is not a pair collection");
}
public int Count {
get {
if (_pairList != null) return _pairList.Count;
else return _dictionary.Count;
}
}
public void Add(object key, object value) {
if (_pairList != null) _pairList.Add(key, value);
else _dictionary.Add(key, value);
}
public void CopyTo(KeyValuePair<object, object>[] array, int index) {
if (_pairList != null) _pairList.CopyTo(array, index);
else _dictionary.CopyTo(array, index);
}
public static bool IsPairCollection(Type type) {
return typeof(IPairList).IsAssignableFrom(type) || typeof(IDictionary).IsAssignableFrom(type);
}
}
internal class PairCollectionDebugView {
readonly PairCollection _self;
public PairCollectionDebugView(PairCollection self) {
_self = self;
}
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public KeyValuePair<object, object>[] Items {
get {
KeyValuePair<object, object>[] array = new KeyValuePair<object, object>[_self.Count];
_self.CopyTo(array, 0);
return array;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 1f87dfb8f6a1f5640b6deae741cd715c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,29 +0,0 @@
using System.Collections.Generic;
using System.Diagnostics;
namespace Cryville.Common.Collections {
[DebuggerDisplay("Count = {Count}"), DebuggerTypeProxy(typeof(PairListDebugView))]
public class PairList : List<KeyValuePair<object, object>>, IPairList {
public void Add(object key, object value) {
Add(new KeyValuePair<object, object>(key, value));
}
public void Insert(int index, object key, object value) {
Insert(index, new KeyValuePair<object, object>(key, value));
}
}
internal class PairListDebugView {
readonly PairList _self;
public PairListDebugView(PairList self) {
_self = self;
}
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public KeyValuePair<object, object>[] Items {
get {
KeyValuePair<object, object>[] array = new KeyValuePair<object, object>[_self.Count];
_self.CopyTo(array, 0);
return array;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 57fc9f037c1fda5449e2a365a835c82c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 634536d804abc784394d4ac028a77879
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -4,12 +4,12 @@ namespace Cryville.Common {
public struct Identifier : IEquatable<Identifier> {
public static Identifier Empty = new Identifier(0);
public int Key { get; private set; }
public object Name { get { return IdentifierManager.SharedInstance.Retrieve(Key); } }
public object Name { get { return IdentifierManager.Shared.Retrieve(Key); } }
public Identifier(int key) {
Key = key;
}
public Identifier(object name) {
Key = IdentifierManager.SharedInstance.Request(name);
Key = IdentifierManager.Shared.Request(name);
}
public override bool Equals(object obj) {
if (obj == null || !(obj is Identifier)) return false;

View File

@@ -1,52 +0,0 @@
using System.Collections.Generic;
namespace Cryville.Common {
/// <summary>
/// A manager that assigns each given identifiers a unique integer ID.
/// </summary>
public class IdentifierManager {
/// <summary>
/// A shared instance of the <see cref="IdentifierManager" /> class.
/// </summary>
public static IdentifierManager SharedInstance = new IdentifierManager();
readonly Dictionary<object, int> _idents = new Dictionary<object, int>();
readonly List<object> _ids = new List<object>();
readonly object _syncRoot = new object();
/// <summary>
/// Creates an instance of the <see cref="IdentifierManager" /> class.
/// </summary>
public IdentifierManager() {
Request(this);
}
/// <summary>
/// Requests an integer ID for an identifier.
/// </summary>
/// <param name="ident">The identifier.</param>
/// <returns>The integer ID.</returns>
public int Request(object ident) {
lock (_syncRoot) {
int id;
if (!_idents.TryGetValue(ident, out id)) {
_idents.Add(ident, id = _idents.Count);
_ids.Add(ident);
}
return id;
}
}
/// <summary>
/// Retrieves the identifier assigned with an integer ID.
/// </summary>
/// <param name="id">The integer ID.</param>
/// <returns>The identifier.</returns>
public object Retrieve(int id) {
lock (_syncRoot) {
return _ids[id];
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 478086496f56eaf46be4df4e2ad37fee
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,128 +0,0 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Cryville.Common {
/// <summary>
/// A logger.
/// </summary>
public abstract class Logger {
static readonly Dictionary<string, Logger> Instances = new Dictionary<string, Logger>();
static readonly Dictionary<string, StreamWriter> Files = new Dictionary<string, StreamWriter>();
static string logPath = null;
/// <summary>
/// Sets the path where the log files shall be stored.
/// </summary>
/// <param name="path">The path.</param>
public static void SetLogPath(string path) {
logPath = path;
var dir = new DirectoryInfo(path);
if (!dir.Exists) dir.Create();
}
/// <summary>
/// Logs to the specified logger.
/// </summary>
/// <param name="key">The key of the logger.</param>
/// <param name="level">The severity level.</param>
/// <param name="module">The module that is logging.</param>
/// <param name="format">The format string.</param>
/// <param name="args">The arguments for formatting.</param>
public static void Log(string key, int level, string module, string format, params object[] args) {
if (!Instances.ContainsKey(key)) return;
Instances[key].Log(level, module, string.Format(format, args));
if (Files.ContainsKey(key)) Files[key].WriteLine("[{0:O}] [{1}] <{2}> {3}", DateTime.UtcNow, level, module, string.Format(format, args));
}
/// <summary>
/// Adds a created logger to the shared logger manager.
/// </summary>
/// <param name="key">The key of the logger.</param>
/// <param name="logger">The logger.</param>
public static void Create(string key, Logger logger) {
Instances[key] = logger;
if (logPath != null) {
Files[key] = new StreamWriter(logPath + "/" + ((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds).ToString(CultureInfo.InvariantCulture) + "-" + key + ".log") {
AutoFlush = true
};
}
}
/// <summary>
/// Closes all loggers and related file streams.
/// </summary>
public static void Close() {
Instances.Clear();
foreach (var f in Files) f.Value.Dispose();
Files.Clear();
}
/// <summary>
/// Logs to the logger.
/// </summary>
/// <param name="level">The severity level.</param>
/// <param name="module">The module that is logging.</param>
/// <param name="msg">The message.</param>
public virtual void Log(int level, string module, string msg) { }
}
/// <summary>
/// A <see cref="Logger" /> that calls a callback function on log.
/// </summary>
public class InstantLogger : Logger {
readonly Action<int, string, string> callback;
/// <summary>
/// Creates an instance of the <see cref="InstantLogger" /> class.
/// </summary>
/// <param name="callback">The callback function.</param>
/// <exception cref="ArgumentNullException"><paramref name="callback" /> is <see langword="null" />.</exception>
public InstantLogger(Action<int, string, string> callback) {
if (callback == null)
throw new ArgumentNullException("callback");
this.callback = callback;
}
/// <inheritdoc />
public override void Log(int level, string module, string msg) {
base.Log(level, module, msg);
callback(level, module, msg);
}
}
/// <summary>
/// A <see cref="Logger" /> that buffers the logs for enumeration.
/// </summary>
public class BufferedLogger : Logger {
readonly List<LogEntry> buffer = new List<LogEntry>();
/// <summary>
/// Creates an instance of the <see cref="BufferedLogger" /> class.
/// </summary>
public BufferedLogger() { }
/// <inheritdoc />
public override void Log(int level, string module, string msg) {
base.Log(level, module, msg);
lock (buffer) {
buffer.Add(new LogEntry(level, module, msg));
}
}
/// <summary>
/// Enumerates the buffered logs.
/// </summary>
/// <param name="callback">The callback function to receive the logs.</param>
public void Enumerate(Action<int, string, string> callback) {
lock (buffer) {
foreach (var i in buffer) {
callback(i.level, i.module, i.msg);
}
}
buffer.Clear();
}
}
struct LogEntry {
public int level;
public string module;
public string msg;
public LogEntry(int level, string module, string msg) {
this.level = level;
this.module = module;
this.msg = msg;
}
}
}

View File

@@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 1c1729cfde78f1c479c9f7eb166e0107
timeCreated: 1611126212
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,3 +1,4 @@
using Cryville.Common.Logging;
using Microsoft.Win32;
using System;
using System.Collections.Generic;

View File

@@ -1,3 +1,4 @@
using Cryville.Common.Logging;
using System.Collections.Generic;
using System.IO;
using System.Text;

View File

@@ -1,3 +1,4 @@
using Cryville.Common.Logging;
using System;
using System.Collections.Generic;
using System.Globalization;

View File

@@ -1,3 +1,4 @@
using Cryville.Common.Logging;
using Org.BouncyCastle.Security;
using Org.BouncyCastle.Tls;
using Org.BouncyCastle.Tls.Crypto;

View File

@@ -63,12 +63,12 @@ namespace Cryville.Common.Pdt {
public int Name { get; private set; }
public bool Forced { get; private set; }
public PushVariable(int name, bool forced = false) { Name = name; Forced = forced; }
public PushVariable(string name, bool forced = false) : this(IdentifierManager.SharedInstance.Request(name)) { Forced = forced; }
public PushVariable(string name, bool forced = false) : this(IdentifierManager.Shared.Request(name)) { Forced = forced; }
internal override void Execute(PdtEvaluatorBase etor) {
etor.PushVariable(Name, Forced);
}
public override string ToString() {
return string.Format(Forced ? "pushv ?{0}" : "pushv {0}", IdentifierManager.SharedInstance.Retrieve(Name));
return string.Format(Forced ? "pushv ?{0}" : "pushv {0}", IdentifierManager.Shared.Retrieve(Name));
}
}
public class Operate : PdtInstruction {
@@ -90,14 +90,14 @@ namespace Cryville.Common.Pdt {
public int Name { get; private set; }
public LinkedListNode<PdtInstruction> Target { get; internal set; }
public Collapse(string name, LinkedListNode<PdtInstruction> target) {
Name = IdentifierManager.SharedInstance.Request(name);
Name = IdentifierManager.Shared.Request(name);
Target = target;
}
internal override void Execute(PdtEvaluatorBase etor) {
etor.Collapse(Name, Target);
}
public override string ToString() {
return string.Format("col {0}{{{1}}}", IdentifierManager.SharedInstance.Retrieve(Name), Target.Value);
return string.Format("col {0}{{{1}}}", IdentifierManager.Shared.Retrieve(Name), Target.Value);
}
}
}

View File

@@ -1,4 +1,6 @@
using Cryville.Common.Collections;
using Cryville.Common.Logging;
using Cryville.Common.Reflection;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -266,14 +268,17 @@ namespace Cryville.Common.Pdt {
else {
MemberInfo prop = null;
bool flag = false;
if (pkey is string) prop = ReflectionHelper.TryGetMember(type, (string)pkey);
if (prop == null) flag = ReflectionHelper.TryFindMemberWithAttribute<T>(type, out prop);
if (pkey is string) prop = FieldLikeHelper.GetMember(type, (string)pkey);
if (prop == null) {
prop = FieldLikeHelper.FindMemberWithAttribute<T>(type);
flag = true;
}
if (prop == null) throw new MissingMemberException(string.Format("The property \"{0}\" is not found", pkey));
Type ptype = ReflectionHelper.GetMemberType(prop);
Type ptype = FieldLikeHelper.GetMemberType(prop);
if (flag) {
var origCollection = ReflectionHelper.GetValue(prop, result);
var origCollection = FieldLikeHelper.GetValue(prop, result);
if (origCollection == null) {
ReflectionHelper.SetValue(prop, result, origCollection = Activator.CreateInstance(ptype));
FieldLikeHelper.SetValue(prop, result, origCollection = Activator.CreateInstance(ptype));
}
using (var collection = new PairCollection(origCollection)) {
var ktype = ptype.GetGenericArguments()[0];
@@ -283,7 +288,7 @@ namespace Cryville.Common.Pdt {
collection.Add(key, value);
}
}
else ReflectionHelper.SetValue(prop, result, vfunc(ptype), _binder);
else FieldLikeHelper.SetValue(prop, result, vfunc(ptype), _binder);
}
}
/// <summary>

View File

@@ -91,7 +91,7 @@ namespace Cryville.Common.Pdt {
/// <param name="name">The name of the operator.</param>
/// <param name="paramCount">The parameter count.</param>
public PdtOperatorSignature(string name, int paramCount)
: this(IdentifierManager.SharedInstance.Request(name), paramCount) { }
: this(IdentifierManager.Shared.Request(name), paramCount) { }
/// <summary>
/// Creates an operator signature.
/// </summary>
@@ -113,7 +113,7 @@ namespace Cryville.Common.Pdt {
return _hash;
}
public override string ToString() {
return string.Format("{0}({1})", IdentifierManager.SharedInstance.Retrieve(Name), ParamCount);
return string.Format("{0}({1})", IdentifierManager.Shared.Retrieve(Name), ParamCount);
}
}
}

View File

@@ -1,185 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Cryville.Common {
/// <summary>
/// Provides a set of <see langword="static" /> methods for refletion.
/// </summary>
public static class ReflectionHelper {
static readonly object[] emptyObjectArray = {};
/// <summary>
/// Tries to find a member with the specified attribute type in a type.
/// </summary>
/// <typeparam name="T">The attribute type.</typeparam>
/// <param name="t">The type containing the member with the specified attribute type.</param>
/// <param name="mi">The member.</param>
/// <returns>Whether the member is found.</returns>
public static bool TryFindMemberWithAttribute<T>(Type t, out MemberInfo mi) where T : Attribute {
try {
mi = FindMemberWithAttribute<T>(t);
return true;
}
catch (MissingMemberException) {
mi = null;
return false;
}
}
/// <summary>
/// Finds a member with the specified attribute type in a type.
/// </summary>
/// <typeparam name="T">The attribute type.</typeparam>
/// <param name="type">The type containing the member with the specified attribute type.</param>
/// <returns></returns>
/// <exception cref="MissingMemberException">The member is not found or multiple members are found.</exception>
public static MemberInfo FindMemberWithAttribute<T>(Type type) where T : Attribute {
var mil = type.FindMembers(
MemberTypes.Field | MemberTypes.Property,
BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static,
(m, o) => m.GetCustomAttributes(typeof(T), true).Length != 0,
null
);
if (mil.Length != 1)
throw new MissingMemberException(type.Name, typeof(T).Name);
return mil[0];
}
/// <summary>
/// Gets whether a type is a <see cref="Dictionary{TKey, TValue}" />.
/// </summary>
/// <param name="type">The type.</param>
/// <returns>Whether the type is a <see cref="Dictionary{TKey, TValue}" />.</returns>
public static bool IsGenericDictionary(Type type) {
return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Dictionary<,>);
}
/// <summary>
/// Gets the member from a type with the specified name.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="name">The name of the member.</param>
/// <returns>The member.</returns>
/// <exception cref="MissingMemberException">The member is not found or multiple members are found.</exception>
public static MemberInfo GetMember(Type type, string name) {
var mil = type.GetMember(
name,
MemberTypes.Field | MemberTypes.Property,
BindingFlags.Public | BindingFlags.Instance
);
if (mil.Length != 1)
throw new MissingMemberException(type.Name, name);
return mil[0];
}
/// <summary>
/// Tries to get the member from a type with the specified name.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="name">The name of the member.</param>
/// <returns>The member. <see langword="null" /> when not found.</returns>
public static MemberInfo TryGetMember(Type type, string name) {
var mil = type.GetMember(
name,
MemberTypes.Field | MemberTypes.Property,
BindingFlags.Public | BindingFlags.Instance
);
if (mil.Length != 1) return null;
return mil[0];
}
/// <summary>
/// Gets the type of a member.
/// </summary>
/// <param name="mi">The member.</param>
/// <returns>The type of the member.</returns>
/// <exception cref="ArgumentException"><paramref name="mi" /> is not a field or a property.</exception>
public static Type GetMemberType(MemberInfo mi) {
if (mi is FieldInfo)
return ((FieldInfo)mi).FieldType;
if (mi is PropertyInfo)
return ((PropertyInfo)mi).PropertyType;
else
throw new ArgumentException("Member is not field or property.");
}
/// <summary>
/// Gets the value of a member of an object.
/// </summary>
/// <param name="mi">The member.</param>
/// <param name="obj">The object.</param>
/// <returns>The value.</returns>
/// <exception cref="ArgumentException"><paramref name="mi" /> is not a field or a property.</exception>
public static object GetValue(MemberInfo mi, object obj) {
if (mi is FieldInfo)
return ((FieldInfo)mi).GetValue(obj);
else if (mi is PropertyInfo)
return ((PropertyInfo)mi).GetValue(obj, new object[]{});
else
throw new ArgumentException();
}
/// <summary>
/// Sets the value of a member of an object.
/// </summary>
/// <param name="mi">The member.</param>
/// <param name="obj">The object.</param>
/// <param name="value">The value.</param>
/// <param name="binder">An optional binder to convert the value.</param>
/// <exception cref="ArgumentException"><paramref name="mi" /> is not a field or a property.</exception>
public static void SetValue(MemberInfo mi, object obj, object value, Binder binder = null) {
if (mi is FieldInfo)
((FieldInfo)mi).SetValue(obj, value, BindingFlags.Default, binder, null);
else if (mi is PropertyInfo)
((PropertyInfo)mi).SetValue(obj, value, BindingFlags.Default, binder, emptyObjectArray, null);
else
throw new ArgumentException();
}
/// <summary>
/// Gets all the subclasses of a type in the current app domain.
/// </summary>
/// <typeparam name="T">The type.</typeparam>
/// <returns>An array containing all the subclasses of the type in the current app domain.</returns>
public static Type[] GetSubclassesOf<T>() where T : class {
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
IEnumerable<Type> r = Enumerable.Empty<Type>();
foreach (var a in assemblies)
r = r.Concat(a.GetTypes().Where(
t => t.IsClass
&& !t.IsAbstract
&& t.IsSubclassOf(typeof(T))
));
return r.ToArray();
}
/// <summary>
/// Gets a simple name of a type.
/// </summary>
/// <param name="type">The type.</param>
/// <returns>A simple name of the class.</returns>
public static string GetSimpleName(Type type) {
string result = type.Name;
var typeargs = type.GetGenericArguments();
if (typeargs.Length > 0) {
result = string.Format("{0}[{1}]", result, string.Join(",", from a in typeargs select GetSimpleName(a)));
}
return result;
}
/// <summary>
/// Gets the namespace qualified name of a type.
/// </summary>
/// <param name="type">The type.</param>
/// <returns>The namespace qualified name of the class.</returns>
public static string GetNamespaceQualifiedName(Type type) {
string result = type.Namespace + "." + type.Name;
var typeargs = type.GetGenericArguments();
if (typeargs.Length > 0) {
result = string.Format("{0}[{1}]", result, string.Join(",", from a in typeargs select GetNamespaceQualifiedName(a)));
}
return result;
}
}
}

View File

@@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 16857d076fc8d534788424e6c6d180e0
timeCreated: 1608801352
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,3 +1,4 @@
using Cryville.Common.Reflection;
using System;
using UnityEngine;
@@ -53,7 +54,7 @@ namespace Cryville.Common.Unity.Input {
return Handler.GetHashCode() ^ Type;
}
public override string ToString() {
return string.Format("{0}:{1}", ReflectionHelper.GetSimpleName(Handler.GetType()), Handler.GetTypeName(Type));
return string.Format("{0}:{1}", TypeNameHelper.GetSimpleName(Handler.GetType()), Handler.GetTypeName(Type));
}
public static bool operator ==(InputSource lhs, InputSource rhs) {
return lhs.Equals(rhs);

View File

@@ -1,3 +1,5 @@
using Cryville.Common.Logging;
using Cryville.Common.Reflection;
using System;
using System.Collections.Generic;
using System.Reflection;
@@ -21,10 +23,10 @@ namespace Cryville.Common.Unity.Input {
var h = (InputHandler)Activator.CreateInstance(t);
_typemap.Add(t, h);
_handlers.Add(h);
Logger.Log("main", 1, "Input", "Initialized {0}", ReflectionHelper.GetSimpleName(t));
Logger.Log("main", 1, "Input", "Initialized {0}", TypeNameHelper.GetSimpleName(t));
}
catch (TargetInvocationException ex) {
Logger.Log("main", 1, "Input", "Cannot initialize {0}: {1}", ReflectionHelper.GetSimpleName(t), ex.InnerException.Message);
Logger.Log("main", 1, "Input", "Cannot initialize {0}: {1}", TypeNameHelper.GetSimpleName(t), ex.InnerException.Message);
}
}
}

View File

@@ -9,6 +9,7 @@ using System;
using System.Runtime.InteropServices;
using System.Text;
using UnityEngine;
using Logger = Cryville.Common.Logging.Logger;
namespace Cryville.Common.Unity.Input {
public class WindowsPointerHandler : InputHandler {

View File

@@ -1,4 +1,4 @@
using Cryville.Common;
using Cryville.Common.Logging;
using Cryville.Crtr.Extension;
using Mono.Cecil;
using System;

View File

@@ -8,7 +8,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEngine;
using Logger = Cryville.Common.Logger;
using Logger = Cryville.Common.Logging.Logger;
namespace Cryville.Crtr.Browsing {
internal class LegacyResourceManager : IResourceManager<ChartDetail> {

View File

@@ -67,12 +67,12 @@ namespace Cryville.Crtr {
[JsonIgnore]
public IntKeyedDictionary<PropSrc> PropSrcs { get; private set; }
protected void SubmitPropSrc(string name, PropSrc property) {
PropSrcs.Add(IdentifierManager.SharedInstance.Request(name), property);
PropSrcs.Add(IdentifierManager.Shared.Request(name), property);
}
[JsonIgnore]
public IntKeyedDictionary<PropOp> PropOps { get; private set; }
protected void SubmitPropOp(string name, PropOp property) {
PropOps.Add(IdentifierManager.SharedInstance.Request(name), property);
PropOps.Add(IdentifierManager.Shared.Request(name), property);
}
protected ChartEvent() {

View File

@@ -17,8 +17,8 @@ using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.Scripting;
using Coroutine = Cryville.Common.Coroutine;
using Logger = Cryville.Common.Logging.Logger;
using Stopwatch = System.Diagnostics.Stopwatch;
using Logger = Cryville.Common.Logger;
namespace Cryville.Crtr {
public class ChartPlayer : MonoBehaviour {

View File

@@ -1,7 +1,7 @@
using Cryville.Common;
using System;
using UnityEngine;
using Logger = Cryville.Common.Logger;
using Logger = Cryville.Common.Logging.Logger;
namespace Cryville.Crtr.Components {
public class SkinAnimation : SkinComponent {

View File

@@ -15,7 +15,7 @@ namespace Cryville.Crtr.Components {
/// <param name="name">The name of the property.</param>
/// <param name="property">The property.</param>
protected void SubmitProperty(string name, PdtOperator property, int udl = 1) {
Properties.Add(IdentifierManager.SharedInstance.Request(name), new SkinProperty(property, udl));
Properties.Add(IdentifierManager.Shared.Request(name), new SkinProperty(property, udl));
}
/// <summary>

View File

@@ -1,6 +1,6 @@
using System;
using UnityEngine;
using Logger = Cryville.Common.Logger;
using Logger = Cryville.Common.Logging.Logger;
namespace Cryville.Crtr.Components {
public class SpriteInfo {

View File

@@ -3,7 +3,7 @@ using System;
using System.IO;
using System.Text;
using UnityEngine;
using Logger = Cryville.Common.Logger;
using Logger = Cryville.Common.Logging.Logger;
namespace Cryville.Crtr.Config {
public class ConfigPanelMaster : MonoBehaviour {

View File

@@ -5,7 +5,7 @@ using System.Threading;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Logger = Cryville.Common.Logger;
using Logger = Cryville.Common.Logging.Logger;
namespace Cryville.Crtr {
public class Console : MonoBehaviour {

View File

@@ -1,7 +1,7 @@
using Discord;
using System;
using UnityEngine;
using Logger = Cryville.Common.Logger;
using Logger = Cryville.Common.Logging.Logger;
namespace Cryville.Crtr {
internal class DiscordController : MonoBehaviour {

View File

@@ -43,7 +43,7 @@ namespace Cryville.Crtr {
EffectState _currentState;
ChartEvent _ctxev;
ContainerState _ctxstate;
internal static readonly int _VAR_EFFECT_INDEX = IdentifierManager.SharedInstance.Request("effect_index");
internal static readonly int _VAR_EFFECT_INDEX = IdentifierManager.Shared.Request("effect_index");
readonly PropSrc _indexSrc;
double _startTime;
float _duration;

View File

@@ -65,8 +65,8 @@ namespace Cryville.Crtr.Event {
get { return cs.Container; }
}
static readonly int _var_current_time = IdentifierManager.SharedInstance.Request("current_time");
static readonly int _var_invisible_bounds = IdentifierManager.SharedInstance.Request("invisible_bounds");
static readonly int _var_current_time = IdentifierManager.Shared.Request("current_time");
static readonly int _var_invisible_bounds = IdentifierManager.Shared.Request("invisible_bounds");
public readonly IntKeyedDictionary<PropSrc> PropSrcs = new IntKeyedDictionary<PropSrc>();
SkinContainer skinContainer;
protected Judge judge;
@@ -81,13 +81,13 @@ namespace Cryville.Crtr.Event {
Anchor a_cur;
Anchor a_head;
Anchor a_tail;
static readonly int _a_cur = IdentifierManager.SharedInstance.Request("cur");
static readonly int _a_head = IdentifierManager.SharedInstance.Request("head");
static readonly int _a_tail = IdentifierManager.SharedInstance.Request("tail");
static readonly int _a_cur = IdentifierManager.Shared.Request("cur");
static readonly int _a_head = IdentifierManager.Shared.Request("head");
static readonly int _a_tail = IdentifierManager.Shared.Request("tail");
double atime_head;
double atime_tail;
public Anchor RegisterAnchor(int name, bool dyn = false, int propSrcCount = 0) {
var strname = IdentifierManager.SharedInstance.Retrieve(name);
var strname = IdentifierManager.Shared.Retrieve(name);
var go = new GameObject("." + strname).transform;
go.SetParent(RootTransform, false);
var result = new Anchor(name, go, propSrcCount);
@@ -273,7 +273,7 @@ namespace Cryville.Crtr.Event {
}
public void PushAnchorEvent(double time, int name) {
if (!DynamicAnchors.ContainsKey(name))
throw new ArgumentException(string.Format("Specified anchor \"{0}\" not found", IdentifierManager.SharedInstance.Retrieve(name)));
throw new ArgumentException(string.Format("Specified anchor \"{0}\" not found", IdentifierManager.Shared.Retrieve(name)));
if (name == _a_head) atime_head = time;
else if (name == _a_tail) atime_tail = time;
DynamicAnchorSetTime[name] = time;

View File

@@ -256,7 +256,7 @@ namespace Cryville.Crtr.Event {
return (T)GetComputedValue(key);
}
static readonly int n_pt = IdentifierManager.SharedInstance.Request("pt");
static readonly int n_pt = IdentifierManager.Shared.Request("pt");
public Vector2 ScreenPoint {
get {
var mv = GetComputedValue<Vec2>(n_pt);
@@ -264,7 +264,7 @@ namespace Cryville.Crtr.Event {
}
}
static readonly int n_dir = IdentifierManager.SharedInstance.Request("dir");
static readonly int n_dir = IdentifierManager.Shared.Request("dir");
public Vector3 Direction {
get {
Vec3 r = GetComputedValue<Vec3>(n_dir);
@@ -272,7 +272,7 @@ namespace Cryville.Crtr.Event {
}
}
static readonly int n_normal = IdentifierManager.SharedInstance.Request("normal");
static readonly int n_normal = IdentifierManager.Shared.Request("normal");
public Vector3 Normal {
get {
Vec3 r = GetComputedValue<Vec3>(n_normal);
@@ -286,22 +286,22 @@ namespace Cryville.Crtr.Event {
}
}
static readonly int n_sv = IdentifierManager.SharedInstance.Request("sv");
static readonly int n_svm = IdentifierManager.SharedInstance.Request("svm");
static readonly int n_sv = IdentifierManager.Shared.Request("sv");
static readonly int n_svm = IdentifierManager.Shared.Request("svm");
public float ScrollVelocity {
get {
return GetComputedValue<Vec1>(n_sv).Value * GetComputedValue<Vec1m>(n_svm).Value;
}
}
static readonly int n_dist = IdentifierManager.SharedInstance.Request("dist");
static readonly int n_dist = IdentifierManager.Shared.Request("dist");
public float Distance {
get {
return GetComputedValue<Vec1>(n_dist).Value;
}
}
static readonly int n_track = IdentifierManager.SharedInstance.Request("track");
static readonly int n_track = IdentifierManager.Shared.Request("track");
public float Track {
get {
return GetComputedValue<Vec1>(n_track).Value;

View File

@@ -30,7 +30,7 @@ namespace Cryville.Crtr.Event {
}
}
readonly IntKeyedDictionary<ObjectPool<MotionCache>> m_buckets;
protected override IReadOnlyDictionary<int, ObjectPool<MotionCache>> Buckets { get { return m_buckets; } }
protected override IDictionary<int, ObjectPool<MotionCache>> Buckets { get { return m_buckets; } }
public MotionCachePool() {
m_buckets = new IntKeyedDictionary<ObjectPool<MotionCache>>(ChartPlayer.motionRegistry.Count);
foreach (var reg in ChartPlayer.motionRegistry)

View File

@@ -20,7 +20,7 @@ namespace Cryville.Crtr.Event {
}
}
readonly IntKeyedDictionary<ObjectPool<RealtimeMotionValue>> m_buckets;
protected override IReadOnlyDictionary<int, ObjectPool<RealtimeMotionValue>> Buckets { get { return m_buckets; } }
protected override IDictionary<int, ObjectPool<RealtimeMotionValue>> Buckets { get { return m_buckets; } }
public RMVPool() {
m_buckets = new IntKeyedDictionary<ObjectPool<RealtimeMotionValue>>(ChartPlayer.motionRegistry.Count);
foreach (var reg in ChartPlayer.motionRegistry)

View File

@@ -1,7 +1,7 @@
using Cryville.Audio;
using Cryville.Audio.Source;
using Cryville.Common;
using Cryville.Common.Font;
using Cryville.Common.Logging;
using Cryville.Common.Unity;
using Cryville.Common.Unity.Input;
using Cryville.Common.Unity.UI;
@@ -11,7 +11,7 @@ using Newtonsoft.Json;
using System;
using System.IO;
using UnityEngine;
using Logger = Cryville.Common.Logger;
using Logger = Cryville.Common.Logging.Logger;
namespace Cryville.Crtr {
public static class Game {

View File

@@ -1,5 +1,7 @@
using Cryville.Common;
using Cryville.Common.Logging;
using Cryville.Common.Pdt;
using Cryville.Common.Reflection;
using Cryville.Common.Unity.Input;
using Cryville.Crtr.Config;
using System;
@@ -53,7 +55,7 @@ namespace Cryville.Crtr {
config.Clear();
foreach (var p in _tproxies) {
config.Add((string)p.Key.Name, new RulesetConfig.InputEntry {
handler = ReflectionHelper.GetNamespaceQualifiedName(p.Value.Source.Value.Handler.GetType()),
handler = TypeNameHelper.GetNamespaceQualifiedName(p.Value.Source.Value.Handler.GetType()),
type = p.Value.Source.Value.Type
});
}
@@ -89,7 +91,7 @@ namespace Cryville.Crtr {
bool IsCompleted(Identifier name) {
return name.Key == _var_pause || _use[name] != 0 || _tproxies.ContainsKey(name);
}
static readonly int _var_pause = IdentifierManager.SharedInstance.Request("pause");
static readonly int _var_pause = IdentifierManager.Shared.Request("pause");
void IncrementUseRecursive(Identifier name) {
BroadcastProxyChanged(name);
var passes = _ruleset.inputs[name].pass;
@@ -172,7 +174,7 @@ namespace Cryville.Crtr {
}
}
static readonly int _var_value = IdentifierManager.SharedInstance.Request("value");
static readonly int _var_value = IdentifierManager.Shared.Request("value");
const int MAX_DEPTH = 15;
const int MAX_DIMENSION = 3;
readonly InputVectorSrc[] _vecsrcs = new InputVectorSrc[MAX_DEPTH + 1];
@@ -247,8 +249,8 @@ namespace Cryville.Crtr {
}
}
}
static readonly int _var_fv = IdentifierManager.SharedInstance.Request("fv");
static readonly int _var_tv = IdentifierManager.SharedInstance.Request("tv");
static readonly int _var_fv = IdentifierManager.Shared.Request("input_vec_from");
static readonly int _var_tv = IdentifierManager.Shared.Request("input_vec_to");
unsafe void OnInput(InputIdentifier id, Identifier target, float ft, float tt, bool nullflag, int depth = 0) {
if (depth >= MAX_DEPTH) throw new InputProxyException("Input propagation limit reached\nThe ruleset has invalid input definitions");
var def = _ruleset.inputs[target];

View File

@@ -19,7 +19,7 @@ namespace Cryville.Crtr {
= new Dictionary<Identifier, List<JudgeEvent>>();
readonly Dictionary<Identifier, List<JudgeEvent>> activeEvs
= new Dictionary<Identifier, List<JudgeEvent>>();
static readonly int _var_pause = IdentifierManager.SharedInstance.Request("pause");
static readonly int _var_pause = IdentifierManager.Shared.Request("pause");
readonly JudgeDefinition _judgePause;
public struct JudgeEvent {
public double StartTime { get; set; }
@@ -91,15 +91,15 @@ namespace Cryville.Crtr {
void InitJudges() {
foreach (var i in _rs.judges) {
var id = i.Key;
judgeMap.Add(id.Key, IdentifierManager.SharedInstance.Request("judge_" + id.Name));
judgeMap.Add(id.Key, IdentifierManager.Shared.Request("judge_" + id.Name));
}
}
static bool _flag;
static readonly PropOp.Boolean _flagop = new PropOp.Boolean(v => _flag = v);
static readonly int _var_fn = IdentifierManager.SharedInstance.Request("fn");
static readonly int _var_tn = IdentifierManager.SharedInstance.Request("tn");
static readonly int _var_ft = IdentifierManager.SharedInstance.Request("ft");
static readonly int _var_tt = IdentifierManager.SharedInstance.Request("tt");
static readonly int _var_fn = IdentifierManager.Shared.Request("judge_clip_from");
static readonly int _var_tn = IdentifierManager.Shared.Request("judge_clip_to");
static readonly int _var_ft = IdentifierManager.Shared.Request("input_time_from");
static readonly int _var_tt = IdentifierManager.Shared.Request("input_time_to");
float _numbuf1, _numbuf2, _numbuf3, _numbuf4;
readonly PropSrc _numsrc1, _numsrc2, _numsrc3, _numsrc4;
unsafe void LoadNum(byte[] buffer, float value) {
@@ -236,7 +236,7 @@ namespace Cryville.Crtr {
void InitScores() {
foreach (var s in _rs.scores) {
var key = s.Key.Key;
var strkey = IdentifierManager.SharedInstance.Request("_score_" + (string)s.Key.Name);
var strkey = IdentifierManager.Shared.Request("_score_" + (string)s.Key.Name);
scoreStringKeys.Add(key, strkey);
scoreStringKeysRev.Add(strkey, key);
scoreSrcs.Add(key, new PropSrc.Float(() => scores[key]));
@@ -262,7 +262,7 @@ namespace Cryville.Crtr {
scoreFullBuf.Clear();
foreach (var s in scores) {
var id = s.Key;
scoreFullBuf.AppendFormat(flag ? "\n{0}: " : "{0}: ", (string)IdentifierManager.SharedInstance.Retrieve(id));
scoreFullBuf.AppendFormat(flag ? "\n{0}: " : "{0}: ", (string)IdentifierManager.Shared.Retrieve(id));
scoreFullBuf.AppendFormat(scoreFormatCache[id], scores[id]);
flag = true;
}

View File

@@ -162,7 +162,7 @@ namespace Cryville.Crtr {
}
}
readonly Dictionary<Type, ObjectPool<MotionNode>> m_buckets;
protected override IReadOnlyDictionary<Type, ObjectPool<MotionNode>> Buckets { get { return m_buckets; } }
protected override IDictionary<Type, ObjectPool<MotionNode>> Buckets { get { return m_buckets; } }
public MotionNodePool() {
m_buckets = new Dictionary<Type, ObjectPool<MotionNode>>();
foreach (var reg in ChartPlayer.motionRegistry) {

View File

@@ -19,9 +19,9 @@ namespace Cryville.Crtr {
SectionalGameObject[] sgos;
readonly Dictionary<Chart.Judge, JudgeState> judges = new Dictionary<Chart.Judge, JudgeState>();
class JudgeState {
static readonly int _var_judge_result = IdentifierManager.SharedInstance.Request("judge_result");
static readonly int _var_judge_time_absolute = IdentifierManager.SharedInstance.Request("judge_time_absolute");
static readonly int _var_judge_time_relative = IdentifierManager.SharedInstance.Request("judge_time_relative");
static readonly int _var_judge_result = IdentifierManager.Shared.Request("judge_result");
static readonly int _var_judge_time_absolute = IdentifierManager.Shared.Request("judge_time_absolute");
static readonly int _var_judge_time_relative = IdentifierManager.Shared.Request("judge_time_relative");
public Anchor StaticAnchor { get; private set; }
public float AbsoluteTime { get; private set; }
PropSrc _jtabsPropSrc;

View File

@@ -17,13 +17,13 @@ namespace Cryville.Crtr {
readonly byte[] _numbuf = new byte[4];
readonly PropSrc _vecsrc;
Vector _vec;
static readonly int _var_w = IdentifierManager.SharedInstance.Request("w");
static readonly int _var_h = IdentifierManager.SharedInstance.Request("h");
static readonly int _var_inf = IdentifierManager.SharedInstance.Request("inf");
static readonly int _var_true = IdentifierManager.SharedInstance.Request("true");
static readonly int _var_false = IdentifierManager.SharedInstance.Request("false");
static readonly int _var_null = IdentifierManager.SharedInstance.Request("null");
static readonly int _var_current_time = IdentifierManager.SharedInstance.Request("current_time");
static readonly int _var_w = IdentifierManager.Shared.Request("w");
static readonly int _var_h = IdentifierManager.Shared.Request("h");
static readonly int _var_inf = IdentifierManager.Shared.Request("inf");
static readonly int _var_true = IdentifierManager.Shared.Request("true");
static readonly int _var_false = IdentifierManager.Shared.Request("false");
static readonly int _var_null = IdentifierManager.Shared.Request("null");
static readonly int _var_current_time = IdentifierManager.Shared.Request("current_time");
protected override void GetVariable(int name, bool forced, out int type, out byte[] value) {
if (name == _var_w) { LoadNum(ChartPlayer.hitRect.width); type = PdtInternalType.Number; value = _numbuf; }
else if (name == _var_h) { LoadNum(ChartPlayer.hitRect.height); type = PdtInternalType.Number; value = _numbuf; }
@@ -75,8 +75,8 @@ namespace Cryville.Crtr {
unsafe void LoadNum(float value) {
fixed (byte* ptr = _numbuf) *(float*)ptr = value;
}
static readonly int _op_sep = IdentifierManager.SharedInstance.Request(",");
static readonly int _func_int_map = IdentifierManager.SharedInstance.Request("int_map");
static readonly int _op_sep = IdentifierManager.Shared.Request(",");
static readonly int _func_int_map = IdentifierManager.Shared.Request("int_map");
protected override PdtOperator GetOperator(PdtOperatorSignature sig) {
PdtOperator result;
if (_shortops.TryGetValue(sig, out result)) {
@@ -98,12 +98,12 @@ namespace Cryville.Crtr {
else throw new KeyNotFoundException(string.Format("Undefined operator {0}", sig));
}
static readonly int _colop_and = IdentifierManager.SharedInstance.Request("&");
static readonly int _colop_or = IdentifierManager.SharedInstance.Request("|");
static readonly int _colop_and = IdentifierManager.Shared.Request("&");
static readonly int _colop_or = IdentifierManager.Shared.Request("|");
protected override bool Collapse(int name, PdtVariableMemory param) {
if (name == _colop_and) return param.Type == PdtInternalType.Number && param.AsNumber() <= 0;
else if (name == _colop_or) return param.Type != PdtInternalType.Number || param.AsNumber() > 0;
else throw new KeyNotFoundException(string.Format("Undefined collapse operator {0}", IdentifierManager.SharedInstance.Retrieve(name)));
else throw new KeyNotFoundException(string.Format("Undefined collapse operator {0}", IdentifierManager.Shared.Retrieve(name)));
}
public ChartEvent ContextEvent { get; set; }
@@ -173,25 +173,25 @@ namespace Cryville.Crtr {
_shortops.Add(new PdtOperatorSignature("interval", 3), new func_interval());
_shortops.Add(new PdtOperatorSignature("is", 2), new func_is());
_ctxops.Add(IdentifierManager.SharedInstance.Request("screen_edge"), new func_screen_edge(() => ContextTransform));
_ctxops.Add(IdentifierManager.SharedInstance.Request("int"), new func_int(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.SharedInstance.Request("clamp"), new func_clamp(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.SharedInstance.Request("min"), new func_min(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.SharedInstance.Request("max"), new func_max(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.SharedInstance.Request("abs"), new func_abs(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.SharedInstance.Request("anim"), new func_anim(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.SharedInstance.Request("cubic_bezier"), new func_cubic_bezier(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.SharedInstance.Request("ease"), new func_cubic_bezier_fixed(0.25f, 0.1f, 0.25f, 1f, () => ContextSelfValue));
_ctxops.Add(IdentifierManager.SharedInstance.Request("ease_in"), new func_cubic_bezier_fixed(0.42f, 0f, 1f, 1f, () => ContextSelfValue));
_ctxops.Add(IdentifierManager.SharedInstance.Request("ease_out"), new func_cubic_bezier_fixed(0f, 0f, 0.58f, 1f, () => ContextSelfValue));
_ctxops.Add(IdentifierManager.SharedInstance.Request("ease_in_out"), new func_cubic_bezier_fixed(0.42f, 0f, 0.58f, 1f, () => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("screen_edge"), new func_screen_edge(() => ContextTransform));
_ctxops.Add(IdentifierManager.Shared.Request("int"), new func_int(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("clamp"), new func_clamp(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("min"), new func_min(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("max"), new func_max(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("abs"), new func_abs(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("anim"), new func_anim(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("cubic_bezier"), new func_cubic_bezier(() => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("ease"), new func_cubic_bezier_fixed(0.25f, 0.1f, 0.25f, 1f, () => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("ease_in"), new func_cubic_bezier_fixed(0.42f, 0f, 1f, 1f, () => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("ease_out"), new func_cubic_bezier_fixed(0f, 0f, 0.58f, 1f, () => ContextSelfValue));
_ctxops.Add(IdentifierManager.Shared.Request("ease_in_out"), new func_cubic_bezier_fixed(0.42f, 0f, 0.58f, 1f, () => ContextSelfValue));
Func<int, PropSrc> cccb = k => ContextCascadeLookup(k);
_ctxops.Add(IdentifierManager.SharedInstance.Request("attack_timing"), new func_attack_timing(cccb));
_ctxops.Add(IdentifierManager.SharedInstance.Request("enter_timing"), new func_enter_timing(cccb));
_ctxops.Add(IdentifierManager.SharedInstance.Request("release_timing"), new func_release_timing(cccb));
_ctxops.Add(IdentifierManager.SharedInstance.Request("leave_timing"), new func_leave_timing(cccb));
_ctxops.Add(IdentifierManager.SharedInstance.Request("contact_timing"), new func_contact_timing(cccb));
_ctxops.Add(IdentifierManager.Shared.Request("attack_timing"), new func_attack_timing(cccb));
_ctxops.Add(IdentifierManager.Shared.Request("enter_timing"), new func_enter_timing(cccb));
_ctxops.Add(IdentifierManager.Shared.Request("release_timing"), new func_release_timing(cccb));
_ctxops.Add(IdentifierManager.Shared.Request("leave_timing"), new func_leave_timing(cccb));
_ctxops.Add(IdentifierManager.Shared.Request("contact_timing"), new func_contact_timing(cccb));
}
#region Operators
#pragma warning disable IDE1006
@@ -600,12 +600,12 @@ namespace Cryville.Crtr {
}
#endregion
#region Judge Functions
static readonly int _var_fn = IdentifierManager.SharedInstance.Request("judge_clip_from");
static readonly int _var_tn = IdentifierManager.SharedInstance.Request("judge_clip_to");
static readonly int _var_ft = IdentifierManager.SharedInstance.Request("input_time_from");
static readonly int _var_tt = IdentifierManager.SharedInstance.Request("input_time_to");
static readonly int _var_fv = IdentifierManager.SharedInstance.Request("input_vec_from");
static readonly int _var_tv = IdentifierManager.SharedInstance.Request("input_vec_to");
static readonly int _var_fn = IdentifierManager.Shared.Request("judge_clip_from");
static readonly int _var_tn = IdentifierManager.Shared.Request("judge_clip_to");
static readonly int _var_ft = IdentifierManager.Shared.Request("input_time_from");
static readonly int _var_tt = IdentifierManager.Shared.Request("input_time_to");
static readonly int _var_fv = IdentifierManager.Shared.Request("input_vec_from");
static readonly int _var_tv = IdentifierManager.Shared.Request("input_vec_to");
abstract class JudgeFunction : PdtOperator {
readonly Func<int, PropSrc> _ctxcb;
protected JudgeFunction(int pc, Func<int, PropSrc> ctxcb) : base(pc) {

View File

@@ -109,7 +109,7 @@ namespace Cryville.Crtr {
throw new ArgumentException("Type is not enum");
var names = typeof(T).GetFields(BindingFlags.Public | BindingFlags.Static);
for (int i = 0; i < names.Length; i++)
_cache[IdentifierManager.SharedInstance.Request(names[i].Name)] = Convert.ToInt32(names[i].GetValue(null));
_cache[IdentifierManager.Shared.Request(names[i].Name)] = Convert.ToInt32(names[i].GetValue(null));
}
public Enum(Action<T> cb, Func<int, T> caster) {
_cb = cb;

View File

@@ -113,13 +113,13 @@ namespace Cryville.Crtr {
public int Name { get; private set; }
public PropertyKey(PropertyType type, string name) {
Type = type;
Name = IdentifierManager.SharedInstance.Request(name);
Name = IdentifierManager.Shared.Request(name);
}
public override string ToString() {
switch (Type) {
case PropertyType.Property: return (string)IdentifierManager.SharedInstance.Retrieve(Name);
case PropertyType.Variable: return string.Format("@var {0}", IdentifierManager.SharedInstance.Retrieve(Name));
default: return string.Format("<{0}> {1}", Type, IdentifierManager.SharedInstance.Retrieve(Name));
case PropertyType.Property: return (string)IdentifierManager.Shared.Retrieve(Name);
case PropertyType.Variable: return string.Format("@var {0}", IdentifierManager.Shared.Retrieve(Name));
default: return string.Format("<{0}> {1}", Type, IdentifierManager.Shared.Retrieve(Name));
}
}
}

View File

@@ -12,30 +12,30 @@ namespace Cryville.Crtr {
public static SkinPropertyKey Construct(HashSet<string> a, IReadOnlyList<string> k, bool compKeyFlag) {
if (a.Remove("has")) {
if (k.Count != 1) throw new FormatException("Invalid anchor name");
return new CreateAnchor(a, IdentifierManager.SharedInstance.Request(k[0]));
return new CreateAnchor(a, IdentifierManager.Shared.Request(k[0]));
}
else if (a.Remove("at")) {
if (k.Count != 1) throw new FormatException("Invalid anchor name");
return new SetAnchor(a, IdentifierManager.SharedInstance.Request(k[0]));
return new SetAnchor(a, IdentifierManager.Shared.Request(k[0]));
}
else if (a.Remove("emit")) {
if (k.Count != 1) throw new FormatException("Invalid effect name");
return new EmitEffect(a, IdentifierManager.SharedInstance.Request(k[0]));
return new EmitEffect(a, IdentifierManager.Shared.Request(k[0]));
}
else if (a.Remove("emit_self")) {
if (k.Count != 1) throw new FormatException("Invalid effect name");
return new EmitEffect(a, IdentifierManager.SharedInstance.Request(k[0]), true);
return new EmitEffect(a, IdentifierManager.Shared.Request(k[0]), true);
}
else if (a.Remove("var")) {
if (k.Count != 1) throw new FormatException("Invalid variable name");
return new SetVariable(a, IdentifierManager.SharedInstance.Request(k[0]));
return new SetVariable(a, IdentifierManager.Shared.Request(k[0]));
}
switch (k.Count) {
case 1:
if (compKeyFlag) return new CreateComponent(a, GetComponentByName(k[0]));
else return new SetProperty(a, typeof(TransformInterface), IdentifierManager.SharedInstance.Request(k[0]));
else return new SetProperty(a, typeof(TransformInterface), IdentifierManager.Shared.Request(k[0]));
case 2:
return new SetProperty(a, GetComponentByName(k[0]), IdentifierManager.SharedInstance.Request(k[1]));
return new SetProperty(a, GetComponentByName(k[0]), IdentifierManager.Shared.Request(k[1]));
default:
throw new FormatException("Unknown error");
}
@@ -77,7 +77,7 @@ namespace Cryville.Crtr {
Name = name;
}
public override string ToString() {
return string.Format("{0}.{1}", Component.Name, IdentifierManager.SharedInstance.Retrieve(Name));
return string.Format("{0}.{1}", Component.Name, IdentifierManager.Shared.Retrieve(Name));
}
public override bool IsValueRequired { get { return true; } }
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars) {
@@ -100,13 +100,13 @@ namespace Cryville.Crtr {
var comp = (SkinComponent)obj.GetComponent(ctype);
if (comp == null) throw new InvalidOperationException(string.Format(
"Trying to set property \"{0}\" but the component is not found",
IdentifierManager.SharedInstance.Retrieve(Name)
IdentifierManager.Shared.Retrieve(Name)
));
SkinProperty result;
if (!comp.Properties.TryGetValue(Name, out result))
throw new InvalidOperationException(string.Format(
"Property \"{0}\" not found on component",
IdentifierManager.SharedInstance.Retrieve(Name)
IdentifierManager.Shared.Retrieve(Name)
));
return result;
}
@@ -117,7 +117,7 @@ namespace Cryville.Crtr {
Name = name;
}
public override string ToString() {
return string.Format("@has {0}", IdentifierManager.SharedInstance.Retrieve(Name));
return string.Format("@has {0}", IdentifierManager.Shared.Retrieve(Name));
}
public override bool IsValueRequired { get { return false; } }
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars) {
@@ -134,7 +134,7 @@ namespace Cryville.Crtr {
_timeOp = new PropOp.Float(v => _time = v);
}
public override string ToString() {
return string.Format("@at {0}", IdentifierManager.SharedInstance.Retrieve(Name));
return string.Format("@at {0}", IdentifierManager.Shared.Retrieve(Name));
}
public override bool IsValueRequired { get { return true; } }
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars) {
@@ -161,7 +161,7 @@ namespace Cryville.Crtr {
_op = new PropOp.Float(v => _index = v);
}
public override string ToString() {
return string.Format(IsSelf ? "@emit_self {0}" : "@emit {0}", IdentifierManager.SharedInstance.Retrieve(Name));
return string.Format(IsSelf ? "@emit_self {0}" : "@emit {0}", IdentifierManager.Shared.Retrieve(Name));
}
public override bool IsValueRequired { get { return true; } }
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars) {
@@ -182,7 +182,7 @@ namespace Cryville.Crtr {
Name = name;
}
public override string ToString() {
return string.Format("@var {0}", IdentifierManager.SharedInstance.Retrieve(Name));
return string.Format("@var {0}", IdentifierManager.Shared.Retrieve(Name));
}
public override bool IsValueRequired { get { return true; } }
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars) {
@@ -195,7 +195,7 @@ namespace Cryville.Crtr {
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars, int dl) {
SkinVariable v;
if (!vars.TryGetValue(Name, out v))
throw new InvalidOperationException(string.Format("Variable \"{0}\" not defined", IdentifierManager.SharedInstance.Retrieve(Name)));
throw new InvalidOperationException(string.Format("Variable \"{0}\" not defined", IdentifierManager.Shared.Retrieve(Name)));
if (!ChartPlayer.etor.Evaluate(v.Op, exp))
throw new EvaluationFailureException();
}

View File

@@ -81,9 +81,9 @@ namespace Cryville.Crtr {
public class Anchor : SkinSelector {
public int Name { get; private set; }
public Anchor(string name) {
Name = IdentifierManager.SharedInstance.Request(name);
Name = IdentifierManager.Shared.Request(name);
}
public override string ToString() { return string.Format(".{0}", IdentifierManager.SharedInstance.Retrieve(Name)); }
public override string ToString() { return string.Format(".{0}", IdentifierManager.Shared.Retrieve(Name)); }
public override IEnumerable<SkinContext> MatchStatic(ISkinnableGroup g, SkinContext c) {
IReadOnlyCollection<CAnchor> anchors;
@@ -96,9 +96,9 @@ namespace Cryville.Crtr {
public class AtAnchor : SkinSelector {
public int Name { get; private set; }
public AtAnchor(string name) {
Name = IdentifierManager.SharedInstance.Request(name);
Name = IdentifierManager.Shared.Request(name);
}
public override string ToString() { return string.Format("..{0}", IdentifierManager.SharedInstance.Retrieve(Name)); }
public override string ToString() { return string.Format("..{0}", IdentifierManager.Shared.Retrieve(Name)); }
public override SkinContext MatchDynamic(ISkinnableGroup g, SkinContext c) {
return g.OpenedAnchorName == Name ? c : null;

Binary file not shown.

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: bac705fb1491fd84b8d4feb7a4dae3b0
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,261 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Cryville.Common.Buffers</name>
</assembly>
<members>
<member name="T:Cryville.Common.Buffers.ArrayPool`1">
<summary>
A resource pool that allows reusing instances of arrays of type <typeparamref name="T" />.
</summary>
<typeparam name="T">The item type of the arrays in the pool.</typeparam>
</member>
<member name="M:Cryville.Common.Buffers.ArrayPool`1.#ctor">
<summary>
Creates an instance of the <see cref="T:Cryville.Common.Buffers.ArrayPool`1" /> class with the default maximum list size and bucket capacity.
</summary>
</member>
<member name="M:Cryville.Common.Buffers.ArrayPool`1.#ctor(System.Int32,System.Int32)">
<summary>
Creates an instance of the <see cref="T:Cryville.Common.Buffers.ArrayPool`1" /> class.
</summary>
<param name="maxSize">The maximum size of the arrays in the pool.</param>
<param name="capacityPerBucket">The capacity of each bucket. The pool groups arrays of similar sizes into buckets for faster access.</param>
</member>
<member name="M:Cryville.Common.Buffers.ArrayPool`1.Rent(System.Int32)">
<summary>
Rents an array that is at least the specified size from the pool.
</summary>
<param name="size">The minimum size of the array.</param>
<returns>An array of type <typeparamref name="T" /> that is at least the specified size.</returns>
</member>
<member name="M:Cryville.Common.Buffers.ArrayPool`1.Return(`0[])">
<summary>
Returns a rented array to the pool.
</summary>
<param name="arr">The array to return.</param>
</member>
<member name="T:Cryville.Common.Buffers.CategorizedPool`2">
<summary>
A set of resource pools categorized by a category type.
</summary>
<typeparam name="TCategory">The category type.</typeparam>
<typeparam name="TObject">The type of the objects in the pool.</typeparam>
</member>
<member name="P:Cryville.Common.Buffers.CategorizedPool`2.Buckets">
<summary>
The set of underlying pools.
</summary>
<remarks>
<para>The <see cref="M:Cryville.Common.Buffers.CategorizedPool`2.Rent(`0)" /> and <see cref="M:Cryville.Common.Buffers.CategorizedPool`2.Return(`0,`1)" /> method select an underlying pool directly from this set with the category as the key. When overridden, this set must be available since construction.</para>
</remarks>
</member>
<member name="P:Cryville.Common.Buffers.CategorizedPool`2.RentedCount">
<summary>
The count of objects rented from the set of pools.
</summary>
</member>
<member name="M:Cryville.Common.Buffers.CategorizedPool`2.Rent(`0)">
<summary>
Rents an object from the pool.
</summary>
<param name="category">The category.</param>
<returns>The rented object.</returns>
</member>
<member name="M:Cryville.Common.Buffers.CategorizedPool`2.Return(`0,`1)">
<summary>
Returns a rented object to the pool.
</summary>
<param name="category">The category.</param>
<param name="obj">The object to return.</param>
</member>
<member name="T:Cryville.Common.Buffers.CategorizedPoolAccessor`2">
<summary>
A utility to access a categorized pool, representing a single unit that uses a shared categorized pool.
</summary>
<typeparam name="TCategory">The category type.</typeparam>
<typeparam name="TObject">The type of the objects in the pool.</typeparam>
</member>
<member name="M:Cryville.Common.Buffers.CategorizedPoolAccessor`2.#ctor(Cryville.Common.Buffers.CategorizedPool{`0,`1})">
<summary>
Creates an instance of the <see cref="T:Cryville.Common.Buffers.CategorizedPoolAccessor`2" /> class.
</summary>
<param name="pool">The categorized pool.</param>
</member>
<member name="M:Cryville.Common.Buffers.CategorizedPoolAccessor`2.Rent(`0)">
<summary>
Rents an object from the pool.
</summary>
<param name="category">The category.</param>
<returns>The rented object.</returns>
</member>
<member name="M:Cryville.Common.Buffers.CategorizedPoolAccessor`2.Return(`1)">
<summary>
Returns a rented object to the pool.
</summary>
<param name="obj">The object to return.</param>
</member>
<member name="M:Cryville.Common.Buffers.CategorizedPoolAccessor`2.ReturnAll">
<summary>
Returns all objects rented by this accessor to the pool.
</summary>
</member>
<member name="T:Cryville.Common.Buffers.ListPool`1">
<summary>
A resource pool that allows reusing instances of lists of type <typeparamref name="T" />.
</summary>
<typeparam name="T">The item type of the lists in the pool.</typeparam>
</member>
<member name="M:Cryville.Common.Buffers.ListPool`1.#ctor">
<summary>
Creates an instance of the <see cref="T:Cryville.Common.Buffers.ListPool`1" /> class with the default maximum list size and bucket capacity.
</summary>
</member>
<member name="M:Cryville.Common.Buffers.ListPool`1.#ctor(System.Int32,System.Int32)">
<summary>
Creates an instance of the <see cref="T:Cryville.Common.Buffers.ListPool`1" /> class.
</summary>
<param name="maxSize">The maximum size of the lists in the pool.</param>
<param name="capacityPerBucket">The capacity of each bucket. The pool groups lists of similar sizes into buckets for faster access.</param>
</member>
<member name="M:Cryville.Common.Buffers.ListPool`1.Rent(System.Int32)">
<summary>
Rents a list of the specified size from the pool. The size of the list must not be changed when it is rented.
</summary>
<param name="size">The size of the list.</param>
<returns>A <see cref="T:System.Collections.Generic.List`1" /> of the specified size.</returns>
</member>
<member name="M:Cryville.Common.Buffers.ListPool`1.Return(System.Collections.Generic.List{`0})">
<summary>
Returns a rented list to the pool.
</summary>
<param name="list">The list to return.</param>
</member>
<member name="T:Cryville.Common.Buffers.ObjectPool`1">
<summary>
A resource pool that allows reusing instances of type <typeparamref name="T" />.
</summary>
<typeparam name="T">The type of the objects in the pool.</typeparam>
</member>
<member name="M:Cryville.Common.Buffers.ObjectPool`1.#ctor(System.Int32)">
<summary>
Creates an instance of the <see cref="T:Cryville.Common.Buffers.ObjectPool`1" /> class.
</summary>
<param name="capacity">The capacity of the pool.</param>
</member>
<member name="P:Cryville.Common.Buffers.ObjectPool`1.RentedCount">
<summary>
The count of objects rented from the pool.
</summary>
</member>
<member name="M:Cryville.Common.Buffers.ObjectPool`1.Rent">
<summary>
Rents a object from the pool.
</summary>
<returns>The rented object.</returns>
</member>
<member name="M:Cryville.Common.Buffers.ObjectPool`1.Return(`0)">
<summary>
Returns a rented object to the pool.
</summary>
<param name="obj">The object to return.</param>
</member>
<member name="M:Cryville.Common.Buffers.ObjectPool`1.Construct">
<summary>
Constructs a new instance of type <typeparamref name="T" />.
</summary>
<returns>The new instance.</returns>
</member>
<member name="M:Cryville.Common.Buffers.ObjectPool`1.Reset(`0)">
<summary>
Resets an object.
</summary>
<param name="obj">The object.</param>
</member>
<member name="T:Cryville.Common.Buffers.SimpleObjectPool`1">
<summary>
A resource pool that allows reusing instances of type <typeparamref name="T" />, which has a parameterless constructor.
</summary>
<typeparam name="T">The type of the objects in the pool.</typeparam>
</member>
<member name="M:Cryville.Common.Buffers.SimpleObjectPool`1.#ctor(System.Int32)">
<summary>
Creates an instance of the <see cref="T:Cryville.Common.Buffers.SimpleObjectPool`1" /> class.
</summary>
<param name="capacity">The capacity of the pool.</param>
</member>
<member name="M:Cryville.Common.Buffers.SimpleObjectPool`1.Construct">
<inheritdoc />
</member>
<member name="T:Cryville.Common.Buffers.TargetString">
<summary>
An auto-resized <see cref="T:System.Char" /> array as a variable-length string used as a target that is modified frequently.
</summary>
</member>
<member name="E:Cryville.Common.Buffers.TargetString.OnUpdate">
<summary>
Occurs when <see cref="M:Cryville.Common.Buffers.TargetString.Validate" /> is called if the string is invalidated.
</summary>
</member>
<member name="M:Cryville.Common.Buffers.TargetString.#ctor">
<summary>
Creates an instance of the <see cref="T:Cryville.Common.Buffers.TargetString" /> class with a capacity of 16.
</summary>
</member>
<member name="M:Cryville.Common.Buffers.TargetString.#ctor(System.Int32)">
<summary>
Creates an instance of the <see cref="T:Cryville.Common.Buffers.TargetString" /> class.
</summary>
<param name="capacity">The initial capacity of the string.</param>
<exception cref="T:System.ArgumentOutOfRangeException"><paramref name="capacity" /> is less than or equal to 0.</exception>
</member>
<member name="P:Cryville.Common.Buffers.TargetString.Item(System.Int32)">
<summary>
Gets or sets one of the characters in the string.
</summary>
<param name="index">The zero-based index of the character.</param>
<returns>The character at the given index.</returns>
<exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index" /> is less than 0 or not less than <see cref="P:Cryville.Common.Buffers.TargetString.Length" />.</exception>
<remarks>
<para>Set <see cref="P:Cryville.Common.Buffers.TargetString.Length" /> to a desired value before updating the characters.</para>
<para>Call <see cref="M:Cryville.Common.Buffers.TargetString.Validate" /> after all the characters are updated.</para>
<para>Changing any character invalidates the string.</para>
</remarks>
</member>
<member name="P:Cryville.Common.Buffers.TargetString.Length">
<summary>
The length of the string.
</summary>
<exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set operation is less than 0.</exception>
<remarks>
<para>Changing the length of the string invalidates the string.</para>
</remarks>
</member>
<member name="M:Cryville.Common.Buffers.TargetString.Validate">
<summary>
Validates the string.
</summary>
</member>
<member name="M:Cryville.Common.Buffers.TargetString.GetEnumerator">
<summary>
Returns an enumerator that iterates through the <see cref="T:Cryville.Common.Buffers.TargetString" />.
</summary>
<returns>A <see cref="T:Cryville.Common.Buffers.TargetString.Enumerator" /> for the <see cref="T:Cryville.Common.Buffers.TargetString" />.</returns>
</member>
<member name="T:Cryville.Common.Buffers.TargetString.Enumerator">
<inheritdoc />
</member>
<member name="P:Cryville.Common.Buffers.TargetString.Enumerator.Current">
<inheritdoc />
</member>
<member name="M:Cryville.Common.Buffers.TargetString.Enumerator.Dispose">
<inheritdoc />
</member>
<member name="M:Cryville.Common.Buffers.TargetString.Enumerator.MoveNext">
<inheritdoc />
</member>
<member name="M:Cryville.Common.Buffers.TargetString.Enumerator.Reset">
<inheritdoc />
</member>
</members>
</doc>

View File

@@ -1,7 +1,6 @@
fileFormatVersion: 2
guid: 53f4e3167a1eee2478b0abc6302aee8f
folderAsset: yes
DefaultImporter:
guid: 99281b8f6cabd2c43a28a49de5441a8c
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 49987e8d1061c94418bce1d5deeed761
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Cryville.Common.Collections.PairCollection</name>
</assembly>
<members>
</members>
</doc>

View File

@@ -1,7 +1,6 @@
fileFormatVersion: 2
guid: c4ef48e4a4983de4e9c31483df2a918e
folderAsset: yes
DefaultImporter:
guid: c553d68d14b3650448c6955705f2255d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:

Binary file not shown.

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 7012af44c8041284fb5d52726b57773c
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,83 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Cryville.Common.Logging</name>
</assembly>
<members>
<member name="T:Cryville.Common.Logging.Logger">
<summary>
A logger.
</summary>
</member>
<member name="M:Cryville.Common.Logging.Logger.SetLogPath(System.String)">
<summary>
Sets the path where the log files shall be stored.
</summary>
<param name="path">The path.</param>
</member>
<member name="M:Cryville.Common.Logging.Logger.Log(System.String,System.Int32,System.String,System.String,System.Object[])">
<summary>
Logs to the specified logger.
</summary>
<param name="key">The key of the logger.</param>
<param name="level">The severity level.</param>
<param name="module">The module that is logging.</param>
<param name="format">The format string.</param>
<param name="args">The arguments for formatting.</param>
</member>
<member name="M:Cryville.Common.Logging.Logger.Create(System.String,Cryville.Common.Logging.Logger)">
<summary>
Adds a created logger to the shared logger manager.
</summary>
<param name="key">The key of the logger.</param>
<param name="logger">The logger.</param>
</member>
<member name="M:Cryville.Common.Logging.Logger.Close">
<summary>
Closes all loggers and related file streams.
</summary>
</member>
<member name="M:Cryville.Common.Logging.Logger.Log(System.Int32,System.String,System.String)">
<summary>
Logs to the logger.
</summary>
<param name="level">The severity level.</param>
<param name="module">The module that is logging.</param>
<param name="msg">The message.</param>
</member>
<member name="T:Cryville.Common.Logging.InstantLogger">
<summary>
A <see cref="T:Cryville.Common.Logging.Logger" /> that calls a callback function on log.
</summary>
</member>
<member name="M:Cryville.Common.Logging.InstantLogger.#ctor(System.Action{System.Int32,System.String,System.String})">
<summary>
Creates an instance of the <see cref="T:Cryville.Common.Logging.InstantLogger" /> class.
</summary>
<param name="callback">The callback function.</param>
<exception cref="T:System.ArgumentNullException"><paramref name="callback" /> is <see langword="null" />.</exception>
</member>
<member name="M:Cryville.Common.Logging.InstantLogger.Log(System.Int32,System.String,System.String)">
<inheritdoc />
</member>
<member name="T:Cryville.Common.Logging.BufferedLogger">
<summary>
A <see cref="T:Cryville.Common.Logging.Logger" /> that buffers the logs for enumeration.
</summary>
</member>
<member name="M:Cryville.Common.Logging.BufferedLogger.#ctor">
<summary>
Creates an instance of the <see cref="T:Cryville.Common.Logging.BufferedLogger" /> class.
</summary>
</member>
<member name="M:Cryville.Common.Logging.BufferedLogger.Log(System.Int32,System.String,System.String)">
<inheritdoc />
</member>
<member name="M:Cryville.Common.Logging.BufferedLogger.Enumerate(System.Action{System.Int32,System.String,System.String})">
<summary>
Enumerates the buffered logs.
</summary>
<param name="callback">The callback function to receive the logs.</param>
</member>
</members>
</doc>

View File

@@ -1,7 +1,6 @@
fileFormatVersion: 2
guid: 9ec674235c0dd6744af2dab2b58dd53c
folderAsset: yes
DefaultImporter:
guid: ce092ccbdda2afa499ccd5e379ad2521
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:

Binary file not shown.

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: b51b9c8b4886f7e4484ffdc790ccd7f6
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,75 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Cryville.Common.Reflection</name>
</assembly>
<members>
<member name="T:Cryville.Common.Reflection.FieldLikeHelper">
<summary>
Provides a set of <see langword="static" /> methods for field and property.
</summary>
</member>
<member name="M:Cryville.Common.Reflection.FieldLikeHelper.FindMemberWithAttribute``1(System.Type)">
<summary>
Finds the member with the specified attribute type in the specified type.
</summary>
<typeparam name="T">The attribute type.</typeparam>
<param name="type">The type containing the member with the specified attribute type.</param>
<returns>The member with the specified attribute type in the specified type. <see langword="null" /> when the member is not found or multiple members are found.</returns>
</member>
<member name="M:Cryville.Common.Reflection.FieldLikeHelper.GetMember(System.Type,System.String)">
<summary>
Gets the member from a type with the specified name.
</summary>
<param name="type">The type.</param>
<param name="name">The name of the member.</param>
<returns>The member. <see langword="null" /> when the member is not found or multiple members are found.</returns>
</member>
<member name="M:Cryville.Common.Reflection.FieldLikeHelper.GetMemberType(System.Reflection.MemberInfo)">
<summary>
Gets the type of a member.
</summary>
<param name="mi">The member.</param>
<returns>The type of the member.</returns>
<exception cref="T:System.ArgumentException"><paramref name="mi" /> is not a field or a property.</exception>
</member>
<member name="M:Cryville.Common.Reflection.FieldLikeHelper.GetValue(System.Reflection.MemberInfo,System.Object)">
<summary>
Gets the value of a member of an object.
</summary>
<param name="mi">The member.</param>
<param name="obj">The object.</param>
<returns>The value.</returns>
<exception cref="T:System.ArgumentException"><paramref name="mi" /> is not a field or a property.</exception>
</member>
<member name="M:Cryville.Common.Reflection.FieldLikeHelper.SetValue(System.Reflection.MemberInfo,System.Object,System.Object,System.Reflection.Binder)">
<summary>
Sets the value of a member of an object.
</summary>
<param name="mi">The member.</param>
<param name="obj">The object.</param>
<param name="value">The value.</param>
<param name="binder">An optional binder to convert the value.</param>
<exception cref="T:System.ArgumentException"><paramref name="mi" /> is not a field or a property.</exception>
</member>
<member name="T:Cryville.Common.Reflection.TypeNameHelper">
<summary>
Provides a set of <see langword="static" /> methods for getting type name.
</summary>
</member>
<member name="M:Cryville.Common.Reflection.TypeNameHelper.GetSimpleName(System.Type)">
<summary>
Gets a simple name of a type.
</summary>
<param name="type">The type.</param>
<returns>A simple name of the class.</returns>
</member>
<member name="M:Cryville.Common.Reflection.TypeNameHelper.GetNamespaceQualifiedName(System.Type)">
<summary>
Gets the namespace qualified name of a type.
</summary>
<param name="type">The type.</param>
<returns>The namespace qualified name of the class.</returns>
</member>
</members>
</doc>

View File

@@ -1,7 +1,6 @@
fileFormatVersion: 2
guid: f68b44d5226a73441b94e7dd5873529f
folderAsset: yes
DefaultImporter:
guid: 9691dcb3d841ff44ca8d611967ac5e73
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:

Binary file not shown.

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 0b115809ca063be4dbb8b057946c4b70
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,43 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Cryville.Common.SurrogateHash</name>
</assembly>
<members>
<member name="T:Cryville.Common.Collections.Specialized.IntKeyedDictionary`1">
<summary>
Represents a collection of <see cref="T:System.Int32" /> keys and values. Identical to <see cref="!:Dictionary&lt;int, T&gt;" /> but much faster.
</summary>
<typeparam name="T">The type of the values in the dictionary.</typeparam>
</member>
<member name="T:Cryville.Common.IdentifierManager">
<summary>
A manager that assigns each given identifiers a unique integer ID.
</summary>
</member>
<member name="F:Cryville.Common.IdentifierManager.Shared">
<summary>
A shared instance of the <see cref="T:Cryville.Common.IdentifierManager" /> class.
</summary>
</member>
<member name="M:Cryville.Common.IdentifierManager.#ctor">
<summary>
Creates an instance of the <see cref="T:Cryville.Common.IdentifierManager" /> class.
</summary>
</member>
<member name="M:Cryville.Common.IdentifierManager.Request(System.Object)">
<summary>
Requests an integer ID for an identifier.
</summary>
<param name="ident">The identifier.</param>
<returns>The integer ID.</returns>
</member>
<member name="M:Cryville.Common.IdentifierManager.Retrieve(System.Int32)">
<summary>
Retrieves the identifier assigned with an integer ID.
</summary>
<param name="id">The integer ID.</param>
<returns>The identifier.</returns>
</member>
</members>
</doc>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: cbfca5369f624d841bda04da273ea9e3
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: