예제 #1
0
            // Token: 0x060001AF RID: 431 RVA: 0x0000CA94 File Offset: 0x0000AC94
            private List <Object> GetSelectedAssets()
            {
                List <Object> list = new List <Object>();

                object[]      selectedItems = base.SelectedItems;
                List <Object> result;

                using (EditorGUI2.ModalProgressBar modalProgressBar = new EditorGUI2.ModalProgressBar("Loading assets...", true))
                {
                    for (int i = 0; i < selectedItems.Length; i++)
                    {
                        FindAssetUsage.AssetProxy assetProxy = selectedItems[i] as FindAssetUsage.AssetProxy;
                        if (assetProxy != null)
                        {
                            if (modalProgressBar.TotalElapsedTime > 1f && modalProgressBar.ElapsedTime > 0.1f)
                            {
                                float  progress = (float)i / (float)selectedItems.Length;
                                string text     = string.Format("[{1} remaining] {0}", assetProxy.Name, selectedItems.Length - i - 1);
                                if (modalProgressBar.Update(text, progress))
                                {
                                    break;
                                }
                            }
                            Object @object = assetProxy.LoadAsset();
                            if (@object != null)
                            {
                                list.Add(@object);
                            }
                        }
                    }
                    result = list;
                }
                return(result);
            }
예제 #2
0
        // Token: 0x060000ED RID: 237 RVA: 0x00008DB0 File Offset: 0x00006FB0
        public static void Delete(List <string> paths)
        {
            if (paths == null || paths.Count == 0)
            {
                return;
            }
            StringBuilder stringBuilder = new StringBuilder(128);
            int           num           = 0;

            foreach (string str in paths)
            {
                if (num < 3)
                {
                    stringBuilder.AppendLine("'" + str + "'");
                }
                else if (num == 3)
                {
                    stringBuilder.AppendLine("...");
                }
                num++;
            }
            stringBuilder.AppendLine();
            stringBuilder.AppendLine("You cannot undo this action.");
            string text = "Delete asset?";

            if (paths.Count > 1)
            {
                text = string.Format("Delete {0} assets?", paths.Count);
            }
            if (!EditorUtility.DisplayDialog(text, stringBuilder.ToString(), "Delete", "Cancel"))
            {
                return;
            }
            using (EditorGUI2.ModalProgressBar modalProgressBar = new EditorGUI2.ModalProgressBar("Deleting...", true))
            {
                for (int i = 0; i < paths.Count; i++)
                {
                    string text2 = paths[i];
                    if (paths.Count > 10)
                    {
                        float progress = (float)i / (float)paths.Count;
                        if (modalProgressBar.Update(text2, progress))
                        {
                            break;
                        }
                    }
                    AssetDatabase.DeleteAsset(text2);
                }
            }
            AssetDatabase.Refresh();
        }
예제 #3
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);
        }
예제 #4
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);
        }