Exemplo n.º 1
0
        private static void Initialize()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            Type[] types = AssemblyLoader.LoadFrom(Managed.ManagedCallbacksDll).GetTypes();
            Type   type1 = (Type)null;

            foreach (Type type2 in types)
            {
                if (((IEnumerable <Type>)type2.GetInterfaces()).Contains <Type>(typeof(ICallbackManager)))
                {
                    type1 = type2;
                    break;
                }
            }
            Managed._callbackManager = type1.GetConstructor(new Type[0]).Invoke(new object[0]) as ICallbackManager;
            Managed._callbackManager.Initialize();
            Delegate[] delegates = Managed._callbackManager.GetDelegates();
            for (int index = 0; index < delegates.Length; ++index)
            {
                try
                {
                    Managed.PassManagedEngineCallbackMethodPointers(delegates[index]);
                }
                catch (Exception ex)
                {
                    Managed.PassManagedEngineCallbackMethodPointers((Delegate)null);
                    // ISSUE: variable of a boxed type
                    __Boxed <int> local = (ValueType)index;
                    Console.WriteLine(ex.ToString() + " " + (object)local);
                }
            }
            LibraryApplicationInterface.SetObjects(Managed._callbackManager.GetScriptingInterfaceObjects());
        }
Exemplo n.º 2
0
        internal static string GetEnumNamesOfField(string className, string fieldName)
        {
            string typeName = Managed.GetFieldOfClass(className, fieldName).FieldType.FullName;
            string str      = typeName.Substring(0, typeName.IndexOf('.'));

            if (str != null && str != "" && str != Assembly.GetExecutingAssembly().GetName().Name)
            {
                typeName = typeName + ", " + str;
            }
            Type type = Type.GetType(typeName);

            if (type == (Type)null)
            {
                int    startIndex = typeName.IndexOf(',');
                string name       = typeName.Remove(startIndex);
                foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    type = assembly.GetType(name);
                    if (type != (Type)null)
                    {
                        break;
                    }
                }
            }
            type.GetEnumValues();
            return(string.Join(" ", type.GetEnumNames()));
        }
Exemplo n.º 3
0
        internal static bool IsFieldClass(string className, string fieldName)
        {
            Type fieldType = Managed.GetFieldOfClass(className, fieldName).FieldType;

            if (fieldType.IsClass)
            {
                return(true);
            }
            return(fieldType.IsValueType && !fieldType.IsPrimitive);
        }
Exemplo n.º 4
0
        internal static int GetClassFieldSize(string className, string fieldName)
        {
            Type fieldType = Managed.GetFieldOfClass(className, fieldName).FieldType;
            int  num       = -1;

            if (fieldType == typeof(byte))
            {
                num = 1;
            }
            else if (fieldType == typeof(sbyte))
            {
                num = 1;
            }
            else if (fieldType == typeof(short))
            {
                num = 2;
            }
            else if (fieldType == typeof(ushort))
            {
                num = 2;
            }
            else if (fieldType == typeof(int))
            {
                num = 4;
            }
            else if (fieldType == typeof(uint))
            {
                num = 4;
            }
            else if (fieldType == typeof(long))
            {
                num = 8;
            }
            else if (fieldType == typeof(ulong))
            {
                num = 8;
            }
            else if (fieldType == typeof(float))
            {
                num = 4;
            }
            else if (fieldType == typeof(double))
            {
                num = 4;
            }
            else if (fieldType == typeof(long))
            {
                num = 4;
            }
            else if (fieldType == typeof(bool))
            {
                num = 1;
            }
            return(num);
        }
Exemplo n.º 5
0
 public static void Start(IEnumerable <IManagedComponent> components)
 {
     Managed._components.AddRange(components);
     Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
     AppDomain.CurrentDomain.AppendPrivatePath(ManagedDllFolder.Name);
     AssemblyLoader.Initialize();
     Managed._initializer = new ManagedInitializeMethod(Managed.Initialize);
     Managed.PassManagedInitializeMethodPointer((Delegate)Managed._initializer);
     for (int index = 0; index < Managed._components.Count; ++index)
     {
         Managed._components[index].OnStart();
     }
 }
Exemplo n.º 6
0
 public static string GetStackTraceRaw(int skipCount = 0) => Managed.GetStackTraceRaw(new StackTrace(0, false), skipCount);
Exemplo n.º 7
0
 internal static bool IsFieldEnum(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName).FieldType.IsEnum;
Exemplo n.º 8
0
 internal static bool IsFieldBoolean(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName).FieldType == typeof(bool);
Exemplo n.º 9
0
        internal static bool IsFieldFloatingPoint(string className, string fieldName)
        {
            FieldInfo fieldOfClass = Managed.GetFieldOfClass(className, fieldName);

            return(fieldOfClass.FieldType == typeof(float) || fieldOfClass.FieldType == typeof(double));
        }
Exemplo n.º 10
0
 internal static string GetFieldClassName(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName).FieldType.Name;
Exemplo n.º 11
0
        internal static bool IsFieldUnsigned(string className, string fieldName)
        {
            Type fieldType = Managed.GetFieldOfClass(className, fieldName).FieldType;

            return(fieldType == typeof(byte) || fieldType == typeof(ushort) || fieldType == typeof(uint) || fieldType == typeof(ulong));
        }
Exemplo n.º 12
0
        internal static bool IsFieldFixedPoint(string className, string fieldName)
        {
            Type fieldType = Managed.GetFieldOfClass(className, fieldName).FieldType;

            return(fieldType == typeof(byte) || fieldType == typeof(sbyte) || (fieldType == typeof(short) || fieldType == typeof(ushort)) || (fieldType == typeof(int) || fieldType == typeof(uint) || fieldType == typeof(long)) || fieldType == typeof(ulong));
        }
Exemplo n.º 13
0
 internal static bool IsClassFieldExists(string className, string fieldName) => Managed.GetFieldOfClass(className, fieldName) != (FieldInfo)null;