Beispiel #1
0
 // Token: 0x060000E9 RID: 233 RVA: 0x00008BDC File Offset: 0x00006DDC
 public static List <string> GetPathsByType(Type type)
 {
     return(AssetDatabase2.GetPathsByType(new Type[]
     {
         type
     }));
 }
Beispiel #2
0
        // Token: 0x06000187 RID: 391 RVA: 0x0000BA4C File Offset: 0x00009C4C
        public static FindAssetUsage.Result InProject(IEnumerable <Object> findobjs, IEnumerable <Type> findtypes)
        {
            EditorUtility2.UnloadUnusedAssetsImmediate();
            Dictionary <Object, Dictionary <string, string> > dictionary = new Dictionary <Object, Dictionary <string, string> >();

            foreach (Object @object in findobjs)
            {
                if (@object != null && !dictionary.ContainsKey(@object))
                {
                    dictionary.Add(@object, new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase));
                }
            }
            string text = "";

            foreach (Type type in findtypes)
            {
                if (!string.IsNullOrEmpty(text))
                {
                    text += ", ";
                }
                text += type.Name;
            }
            using (EditorGUI2.ModalProgressBar modalProgressBar = new EditorGUI2.ModalProgressBar(string.Format("Searching {0} assets...", text), true))
            {
                List <string> pathsByType = AssetDatabase2.GetPathsByType(findtypes);
                for (int i = 0; i < pathsByType.Count; i++)
                {
                    string text2 = pathsByType[i];
                    if (modalProgressBar.TotalElapsedTime > 1f && modalProgressBar.ElapsedTime > 0.1f)
                    {
                        float  progress = (float)i / (float)pathsByType.Count;
                        string text3    = string.Format("[{1} remaining] {0}", FileUtil2.GetFileNameWithoutExtension(text2), pathsByType.Count - i - 1);
                        if (modalProgressBar.Update(text3, progress))
                        {
                            break;
                        }
                    }
                    Object   object2 = AssetDatabase.LoadMainAssetAtPath(text2);
                    Object[] array   = EditorUtility.CollectDependencies(new Object[]
                    {
                        object2
                    });
                    foreach (Object object3 in array)
                    {
                        Dictionary <string, string> dictionary2;
                        if (!(object3 == null) && dictionary.TryGetValue(object3, out dictionary2))
                        {
                            dictionary2[text2] = text2;
                        }
                    }
                    if (i % 25 == 0)
                    {
                        EditorUtility2.UnloadUnusedAssetsImmediate();
                    }
                }
            }
            FindAssetUsage.Result result = new FindAssetUsage.Result();
            foreach (KeyValuePair <Object, Dictionary <string, string> > keyValuePair in dictionary)
            {
                FindAssetUsage.ResultEntry resultEntry = new FindAssetUsage.ResultEntry();
                resultEntry.Asset = keyValuePair.Key;
                foreach (KeyValuePair <string, string> keyValuePair2 in keyValuePair.Value)
                {
                    resultEntry.Add(keyValuePair2.Key);
                }
                result.Entries.Add(resultEntry);
            }
            return(result);
        }
Beispiel #3
0
        // Token: 0x06000186 RID: 390 RVA: 0x0000B7BC File Offset: 0x000099BC
        public static FindAssetUsage.Result InProject(IEnumerable <string> findpaths, IEnumerable <Type> findtypes)
        {
            EditorUtility2.UnloadUnusedAssetsImmediate();
            Dictionary <string, Dictionary <string, string> > dictionary = new Dictionary <string, Dictionary <string, string> >();

            foreach (string text in findpaths)
            {
                if (!string.IsNullOrEmpty(text) && !dictionary.ContainsKey(text))
                {
                    dictionary.Add(text, new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase));
                }
            }
            string text2 = "";

            foreach (Type type in findtypes)
            {
                if (!string.IsNullOrEmpty(text2))
                {
                    text2 += ", ";
                }
                text2 += type.Name;
            }
            using (EditorGUI2.ModalProgressBar modalProgressBar = new EditorGUI2.ModalProgressBar(string.Format("Searching {0} assets...", text2), true))
            {
                List <string> pathsByType = AssetDatabase2.GetPathsByType(findtypes);
                for (int i = 0; i < pathsByType.Count; i++)
                {
                    string text3 = pathsByType[i];
                    if (modalProgressBar.TotalElapsedTime > 1f && modalProgressBar.ElapsedTime > 0.1f)
                    {
                        float  progress = (float)i / (float)pathsByType.Count;
                        string text4    = string.Format("[{1} remaining] {0}", FileUtil2.GetFileNameWithoutExtension(text3), pathsByType.Count - i - 1);
                        if (modalProgressBar.Update(text4, progress))
                        {
                            break;
                        }
                    }
                    string[] dependencies = AssetDatabase.GetDependencies(new string[]
                    {
                        text3
                    });
                    foreach (string text5 in dependencies)
                    {
                        Dictionary <string, string> dictionary2;
                        if (!string.Equals(text5, text3, StringComparison.OrdinalIgnoreCase) && dictionary.TryGetValue(text5, out dictionary2))
                        {
                            dictionary2[text3] = text3;
                        }
                    }
                }
            }
            FindAssetUsage.Result result = new FindAssetUsage.Result();
            foreach (KeyValuePair <string, Dictionary <string, string> > keyValuePair in dictionary)
            {
                FindAssetUsage.ResultEntry resultEntry = new FindAssetUsage.ResultEntry();
                resultEntry.AssetPath = keyValuePair.Key;
                foreach (KeyValuePair <string, string> keyValuePair2 in keyValuePair.Value)
                {
                    resultEntry.Add(keyValuePair2.Key);
                }
                result.Entries.Add(resultEntry);
            }
            return(result);
        }