Example #1
0
        public void Setup()
        {
            _coreCache = new ClassTypeCache();
            _coreCache.AddTypeWithAttribute <Monobehavior2, ValidateAttribute>();
            _logger = new AssetValidatorLogger();

            _sValidatorManager = new ActiveSceneValidatorManager(_coreCache, _logger);
        }
        public void Setup()
        {
            _coreCache = new ClassTypeCache();
            _coreCache.AddTypeWithAttribute <MonoBehaviourTwo, ValidateAttribute>();
            _logCache = new LogCache();

            _pValidatorManager = new ProjectAssetValidatorManager(_coreCache, _logCache);
        }
        public void Setup()
        {
            _coreCache = new ClassTypeCache();
            _coreCache.AddTypeWithAttribute <MonoBehaviourTwo, ValidateAttribute>();
            _logCache = new LogCache();

            _sValidatorManager = new ActiveSceneValidatorManager(_coreCache, _logCache);
        }
        public BaseInstanceValidatorManager(ClassTypeCache cache, AssetValidatorLogger logger)
            : base(logger)
        {
            _cache = cache;
            _instanceValidatorCache = new InstanceValidatorCache();

            InitValidatorLookup();
        }
        public void FindAndAddMissingTypes()
        {
            var classCache = new ClassTypeCache();

            classCache.IgnoreAttribute <OnlyIncludeInTestsAttribute>();
            classCache.AddTypeWithAttribute <BaseFieldValidator, ValidatorTargetAttribute>();
            classCache.AddTypeWithAttribute <BaseObjectValidator, ValidatorTargetAttribute>();
            classCache.AddTypeWithAttribute <BaseCrossSceneValidator, ValidatorTargetAttribute>();
            classCache.AddTypeWithAttribute <BaseProjectValidator, ValidatorTargetAttribute>();

            var validatorTargets = classCache.Types.Select(x =>
            {
                var vValidatorAttr = (ValidatorTargetAttribute)x.GetCustomAttributes(typeof(ValidatorTargetAttribute), false)[0];
                return(vValidatorAttr);
            }).ToArray();

            if (OverrideItems == null)
            {
                OverrideItems = new List <OverrideItem>();
            }

            // Remove any missing override items that no longer exist
            for (var i = OverrideItems.Count - 1; i > 0; i--)
            {
                if (validatorTargets.Any(x => x.Symbol == OverrideItems[i].symbol))
                {
                    continue;
                }

                OverrideItems.Remove(OverrideItems[i]);
            }

            for (var i = 0; i < validatorTargets.Length; i++)
            {
                var vValidatorAttr = validatorTargets[i];

                // If we have never cached this type before, create a reference to it by way of symbol
                // Otherwise grab the existing reference and reassign the type.
                if (OverrideItems.All(x => x.symbol != vValidatorAttr.Symbol))
                {
                    var oItem = new OverrideItem()
                    {
                        enabled = true,
                        symbol  = vValidatorAttr.Symbol,
                        type    = classCache[i]
                    };
                    OverrideItems.Add(oItem);
                }
                else
                {
                    var overrideItem = OverrideItems.First(x => x.symbol == vValidatorAttr.Symbol);
                    overrideItem.type = classCache[i];
                }
            }
        }
        public AssetValidatorRunner(AssetValidatorLogger logger, SceneValidationMode vmode)
        {
            _scenePaths = AssetValidatorUtility.GetScenePaths(vmode);

            _logger = logger;

            _cache = new ClassTypeCache();

            // Ensure any unit test types do not get picked up for validation.
            _cache.IgnoreType <Monobehavior2>();
            _cache.IgnoreAttribute <OnlyIncludeInTestsAttribute>();

            // Find all objects for validation
            _cache.AddTypeWithAttribute <MonoBehaviour, ValidateAttribute>();

            // Add all disabled logs for this run
            AssetValidatorOverrideConfig.FindOrCreate().AddDisabledLogs(logger);

            _isRunning   = true;
            _runningTime = EditorApplication.timeSinceStartup;
        }
 public void Setup()
 {
     classTypeCache = new ClassTypeCache();
 }
 public ProjectAssetValidatorManager(ClassTypeCache cache, AssetValidatorLogger logger)
     : base(cache, logger)
 {
     _continueSearchProgress = 0;
     _allPrefabGUIDs         = AssetDatabase.FindAssets("t:Prefab");
 }
 public ActiveSceneValidatorManager(ClassTypeCache cache, AssetValidatorLogger logger)
     : base(cache, logger)
 {
 }