Beispiel #1
0
        private static void InitCollabDelegates(Assembly assembly)
        {
            try
            {
                var collabAccessType     = assembly.GetType("UnityEditor.Web.CollabAccess");
                var collabAccessInstance = collabAccessType.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public).GetValue(null, null);
                var collabAccessMethod   = collabAccessInstance.GetType().GetMethod("IsServiceEnabled", BindingFlags.Instance | BindingFlags.Public);
                _isCollabEnabled = (Func <bool>)Delegate.CreateDelegate(typeof(Func <bool>), collabAccessInstance, collabAccessMethod);

                var collabHookType = assembly.GetType("UnityEditor.Collaboration.CollabProjectHook");
                var collabHook     = collabHookType.GetMethod("OnProjectWindowItemIconOverlay", BindingFlags.Static | BindingFlags.Public);
                _drawCollabOverlay = (ProjectWindowItemCallback)Delegate.CreateDelegate(typeof(ProjectWindowItemCallback), collabHook);
            }
            catch (SystemException ex)
            {
                if (!(ex is NullReferenceException) && !(ex is ArgumentNullException))
                {
                    throw;
                }
                _isCollabEnabled = () => false;

                #if RAINBOW_FOLDERS_DEVEL
                Debug.LogWarning(ex);
                #endif
            }
        }
Beispiel #2
0
        //---------------------------------------------------------------------
        // Helpers
        //---------------------------------------------------------------------

        private static void InitVcsDelegates(Assembly assembly)
        {
            try
            {
                _isVcsEnabled = () => Provider.isActive;

                var vcsHookType = assembly.GetType("UnityEditorInternal.VersionControl.ProjectHooks");
                var vcsHook     = vcsHookType.GetMethod("OnProjectWindowItem", BindingFlags.Static | BindingFlags.Public);
                _drawVcsOverlay = (ProjectWindowItemCallback)Delegate.CreateDelegate(typeof(ProjectWindowItemCallback), vcsHook);
            }
            catch (SystemException ex)
            {
                if (!(ex is NullReferenceException) && !(ex is ArgumentNullException))
                {
                    throw;
                }
                _isVcsEnabled = () => false;

                #if RAINBOW_FOLDERS_DEVEL
                Debug.LogException(ex);
                #endif
            }
        }