private static AttributeHelper.MonoMenuItem[] ExtractMenuCommands(Assembly assembly, bool modifiedSinceLastReload) { BindingFlags bindingFlags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; if (modifiedSinceLastReload) { bindingFlags |= BindingFlags.Instance; } bool @bool = EditorPrefs.GetBool("InternalMode", false); Dictionary <string, AttributeHelper.MonoMenuItem> dictionary = new Dictionary <string, AttributeHelper.MonoMenuItem>(); Type[] typesFromAssembly = AssemblyHelper.GetTypesFromAssembly(assembly); Type[] array = typesFromAssembly; for (int i = 0; i < array.Length; i++) { Type type = array[i]; MethodInfo[] methods = type.GetMethods(bindingFlags); for (int j = 0; j < methods.GetLength(0); j++) { MethodInfo methodInfo = methods[j]; object[] customAttributes = methodInfo.GetCustomAttributes(typeof(MenuItem), false); if (customAttributes.Length > 0 && type.IsGenericTypeDefinition) { UnityEngine.Debug.LogWarningFormat("Method {0}.{1} cannot be used for menu commands because class {0} is an open generic type.", new object[] { type.Name, methodInfo.Name }); } else { object[] array2 = customAttributes; int k = 0; while (k < array2.Length) { MenuItem menuItem = (MenuItem)array2[k]; AttributeHelper.MonoMenuItem value = (!dictionary.ContainsKey(menuItem.menuItem)) ? default(AttributeHelper.MonoMenuItem) : dictionary[menuItem.menuItem]; if (!AttributeHelper.ValidateMethodForMenuCommand(methodInfo, false)) { break; } if (!menuItem.menuItem.StartsWith("internal:", StringComparison.Ordinal)) { value.menuItem = menuItem.menuItem; goto IL_154; } if (@bool) { value.menuItem = menuItem.menuItem.Substring(9); goto IL_154; } IL_1D0: k++; continue; IL_154: if (menuItem.validate) { value.validateType = type; value.validateMethod = methodInfo; value.validateName = methodInfo.Name; } else { value.index = j; value.priority = menuItem.priority; value.executeType = type; value.executeMethod = methodInfo; value.executeName = methodInfo.Name; } dictionary[menuItem.menuItem] = value; goto IL_1D0; } } } } AttributeHelper.MonoMenuItem[] array3 = dictionary.Values.ToArray <AttributeHelper.MonoMenuItem>(); Array.Sort(array3, new AttributeHelper.CompareMenuIndex()); return(array3); }