2020-09-09 19:15:47 +10:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using MelonLoader;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Explorer.Tests
|
|
|
|
|
{
|
|
|
|
|
public class TestClass
|
|
|
|
|
{
|
|
|
|
|
public static TestClass Instance => m_instance ?? (m_instance = new TestClass());
|
|
|
|
|
private static TestClass m_instance;
|
|
|
|
|
|
2020-09-11 00:17:13 +10:00
|
|
|
|
public TestClass()
|
|
|
|
|
{
|
|
|
|
|
ILHashSetTest = new Il2CppSystem.Collections.Generic.HashSet<string>();
|
|
|
|
|
ILHashSetTest.Add("1");
|
|
|
|
|
ILHashSetTest.Add("2");
|
|
|
|
|
ILHashSetTest.Add("3");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// test HashSets
|
|
|
|
|
|
|
|
|
|
public static HashSet<string> HashSetTest = new HashSet<string>
|
|
|
|
|
{
|
|
|
|
|
"One",
|
|
|
|
|
"Two",
|
|
|
|
|
"Three"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public static Il2CppSystem.Collections.Generic.HashSet<string> ILHashSetTest;
|
|
|
|
|
|
2020-09-10 18:02:41 +10:00
|
|
|
|
// Test indexed parameter
|
2020-09-09 19:15:47 +10:00
|
|
|
|
|
|
|
|
|
public string this[int arg0, string arg1]
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return $"arg0: {arg0}, arg1: {arg1}";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-10 18:02:41 +10:00
|
|
|
|
// Test basic list
|
|
|
|
|
|
2020-09-09 19:15:47 +10:00
|
|
|
|
public static List<string> TestList = new List<string>
|
|
|
|
|
{
|
|
|
|
|
"1",
|
|
|
|
|
"2",
|
|
|
|
|
"3",
|
|
|
|
|
"etc..."
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-10 18:02:41 +10:00
|
|
|
|
// Test a nested dictionary
|
|
|
|
|
|
|
|
|
|
public static Dictionary<int, Dictionary<string, int>> NestedDictionary = new Dictionary<int, Dictionary<string, int>>
|
2020-09-09 19:15:47 +10:00
|
|
|
|
{
|
|
|
|
|
{
|
2020-09-10 18:02:41 +10:00
|
|
|
|
1,
|
|
|
|
|
new Dictionary<string, int>
|
2020-09-09 19:15:47 +10:00
|
|
|
|
{
|
2020-09-10 18:02:41 +10:00
|
|
|
|
{
|
|
|
|
|
"Sub 1", 123
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"Sub 2", 456
|
|
|
|
|
},
|
2020-09-09 19:15:47 +10:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
2020-09-10 18:02:41 +10:00
|
|
|
|
2,
|
|
|
|
|
new Dictionary<string, int>
|
2020-09-09 19:15:47 +10:00
|
|
|
|
{
|
2020-09-10 18:02:41 +10:00
|
|
|
|
{
|
|
|
|
|
"Sub 3", 789
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"Sub 4", 000
|
|
|
|
|
},
|
2020-09-09 19:15:47 +10:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-10 18:02:41 +10:00
|
|
|
|
// Test a basic method
|
|
|
|
|
|
2020-09-09 19:15:47 +10:00
|
|
|
|
public static Color TestMethod(float r, float g, float b, float a)
|
|
|
|
|
{
|
|
|
|
|
return new Color(r, g, b, a);
|
|
|
|
|
}
|
2020-09-10 18:02:41 +10:00
|
|
|
|
|
|
|
|
|
// A method with default arguments
|
|
|
|
|
|
|
|
|
|
public static Vector3 TestDefaultArgs(float arg0, float arg1, float arg2 = 5.0f)
|
|
|
|
|
{
|
|
|
|
|
return new Vector3(arg0, arg1, arg2);
|
|
|
|
|
}
|
2020-09-09 19:15:47 +10:00
|
|
|
|
}
|
|
|
|
|
}
|