Ejemplo n.º 1
0
        IEnumerator FindAsset(Hashtable _definition)
        {
            // just for nice asynch effect
            for (int i = 0; i < 10; i++)
            {
                yield return(null);
            }

            if (_cancelFlag)
            {
                yield break;
            }

            if (_definition == null)
            {
                Debug.LogWarning("FindAsset failed, details are missing");
                yield break;
            }

            string _name = (string)_definition["Name"];

            AssetItem _item = AssetItem.AssetItemFromHashTable(_definition);

            AssetsList[_name] = _item;

            yield return(null);

            // get the scan methods
            ArrayList _scanMethods = (ArrayList)_definition["ScanMethods"];

            if (_scanMethods == null)
            {
                if (OutputInConsole)
                {
                    Debug.LogWarning("Scanning failed for " + _definition["Name"] + ": missing 'ScanMethod' definitions");
                }
                yield break;
            }

            bool _found = false;

            foreach (Hashtable entry in _scanMethods)
            {
                if (entry.ContainsKey("FindByFile"))
                {
                    _found = MyUtils.DoesFileExistsAssets((string)entry["FindByFile"]);
                }
                else if (entry.ContainsKey("FindByClass"))
                {
                    _found = MyUtils.isClassDefined((string)entry["FindByClass"]);
                }

                if (_found)
                {
                    // get the version
                    _item.ProjectVersion = new VersionInfo(GetAssetVersion(_definition));
                    if (OutputInConsole)
                    {
                        Debug.Log(_definition["Name"] + " <color=green>found</color> in Project, version: " + _item.ProjectVersion);
                    }

                    _item.FoundInProject = true;

                    ArrayUtility.Add <string>(ref AssetsFoundList, _name);

                    yield break;
                }
                yield return(null);
            }

            if (OutputInConsole)
            {
                Debug.Log(_definition["Name"] + " <color=red>not found</color> in Project");
            }

            yield break;
        }
Ejemplo n.º 2
0
        IEnumerator FindAsset(Hashtable _definition)
        {
            // just for nice asynch effect
            for (int i = 0; i < 10; i++)
            {
                yield return(null);
            }

            if (_cancelFlag)
            {
                yield break;
            }

            if (_definition == null)
            {
                Debug.LogWarning("FindAsset failed, details are missing");
                yield break;
            }

            string _name = (string)_definition["Name"];

            AssetItem _item = AssetItem.AssetItemFromHashTable(_definition);


            AssetsList[_name] = _item;

            yield return(null);

            // get the scan methods
            ArrayList _scanMethods = (ArrayList)_definition["ScanMethods"];

            if (_scanMethods == null)
            {
                if (OutputInConsole)
                {
                    Debug.LogWarning("Scanning failed for " + _definition["Name"] + ": missing 'ScanMethod' definitions");
                }
                yield break;
            }

            bool _found = false;

            foreach (Hashtable entry in _scanMethods)
            {
                if (entry.ContainsKey("FindByFile"))
                {
                    _found = MyUtils.DoesFileExistsAssets((string)entry["FindByFile"]);
                }
                else if (entry.ContainsKey("FindByClass"))
                {
                    _found = MyUtils.isClassDefined((string)entry["FindByClass"]);
                }
                else if (entry.ContainsKey("FindByNamespace"))
                {
                    _found = MyUtils.isNamespaceDefined((string)entry["FindByNamespace"]);
                }

                if (_found)
                {
                    // get the version
                    _item.ProjectVersion = new VersionInfo(GetAssetVersion(_definition));
                    if (OutputInConsole)
                    {
                        Debug.Log(_definition["Name"] + " <color=green>found</color> in Project, version: " + _item.ProjectVersion);
                    }

                    _item.FoundInProject = true;

                    ArrayUtility.Add <string>(ref AssetsFoundList, _name);

                    yield return(null);

                    continue;
                }
                else
                {
                    ArrayUtility.Add <string>(ref AssetsNotFoundList, _name);
                }

                yield return(null);
            }

            // append automatically to selected list
            // TODO: give the user some higher level settings like ignore all unfound toggle or something.
            // TODO: also remember user preference.
            if (_found)
            {
                AssetsSelectedList.Remove(_name);
                AssetsSelectedList.Add(_name);
                _item.SelectAllCategories();
            }

            if (OutputInConsole)
            {
                Debug.Log(_definition["Name"] + " <color=red>not found</color> in Project");
            }

            yield break;
        }