Esempio n. 1
0
 // Token: 0x060001A7 RID: 423 RVA: 0x0000C708 File Offset: 0x0000A908
 protected override void OnDrawItem(GUIListViewDrawItemArgs args)
 {
     FindAssetUsage.AssetProxy assetProxy = args.Model as FindAssetUsage.AssetProxy;
     if (assetProxy == null)
     {
         return;
     }
     if (args.Column.IsPrimaryColumn)
     {
         Texture texture = null;
         if (assetProxy.Asset != null)
         {
             texture = AssetPreview.GetMiniTypeThumbnail(assetProxy.Asset.GetType());
         }
         else if (assetProxy.AssetType != null)
         {
             texture = AssetPreview.GetMiniTypeThumbnail(assetProxy.AssetType);
         }
         else if (!string.IsNullOrEmpty(assetProxy.AssetPath))
         {
             texture = AssetPreview.GetMiniTypeThumbnail(AssetDatabase2.GetAssetType(assetProxy.AssetPath));
         }
         if (texture == null)
         {
             texture = AssetPreview.GetMiniTypeThumbnail(typeof(TextAsset));
         }
         GUIListView.DrawItemImageHelper(ref args.ItemRect, texture, new Vector2(16f, 16f));
     }
     args.ItemRect.y      = args.ItemRect.y + 3f;
     args.ItemRect.height = args.ItemRect.height - 3f;
     FindAssetUsageWindow.Listbox.Column column = args.Column as FindAssetUsageWindow.Listbox.Column;
     column.DrawFunc(assetProxy, args);
 }
Esempio n. 2
0
 // Token: 0x060000E9 RID: 233 RVA: 0x00008BDC File Offset: 0x00006DDC
 public static List <string> GetPathsByType(Type type)
 {
     return(AssetDatabase2.GetPathsByType(new Type[]
     {
         type
     }));
 }
Esempio n. 3
0
        // Token: 0x060000E4 RID: 228 RVA: 0x00008AC0 File Offset: 0x00006CC0
        public static long GetStorageSize(string assetPath)
        {
            string text = AssetDatabase.AssetPathToGUID(assetPath);

            if (string.IsNullOrEmpty(text) || text.Length < 2)
            {
                return(-1L);
            }
            assetPath = AssetDatabase2.GUIDToLibraryPath(text);
            if (File.Exists(assetPath))
            {
                return(new FileInfo(assetPath).Length);
            }
            return(-1L);
        }
Esempio n. 4
0
        // Token: 0x060000EA RID: 234 RVA: 0x00008BFC File Offset: 0x00006DFC
        public static List <string> GetPathsByType(IEnumerable <Type> types)
        {
            string[]      allAssetPaths = AssetDatabase.GetAllAssetPaths();
            List <string> list          = new List <string>(128);

            foreach (string text in allAssetPaths)
            {
                foreach (Type type in types)
                {
                    if (AssetDatabase2.IsAssetType(text, type))
                    {
                        list.Add(text);
                        break;
                    }
                }
            }
            return(list);
        }
Esempio n. 5
0
        // Token: 0x060000E6 RID: 230 RVA: 0x00008B10 File Offset: 0x00006D10
        public static DateTime GetAssetLastWriteTime(string assetPath)
        {
            DateTime dateTime = DateTime.MinValue;

            try
            {
                dateTime = File.GetLastWriteTime(assetPath);
            }
            catch
            {
                dateTime = DateTime.MinValue;
            }
            string textMetaFilePathFromAssetPath = AssetDatabase2.GetTextMetaFilePathFromAssetPath(assetPath);

            if (string.IsNullOrEmpty(textMetaFilePathFromAssetPath))
            {
                return(DateTime.MinValue);
            }
            DateTime dateTime2;

            try
            {
                dateTime2 = File.GetLastWriteTime(textMetaFilePathFromAssetPath);
            }
            catch
            {
                dateTime2 = DateTime.MinValue;
            }
            DateTime now = DateTime.Now;
            TimeSpan t   = now - dateTime;
            TimeSpan t2  = now - dateTime2;

            if (t < t2)
            {
                return(dateTime);
            }
            return(dateTime2);
        }
Esempio n. 6
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);
        }
Esempio n. 7
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);
        }
Esempio n. 8
0
        // Token: 0x0600012B RID: 299 RVA: 0x00009F3C File Offset: 0x0000813C
        private void ShowCacheFileReadOnlyMessage(bool messagebox)
        {
            string text = string.Format("Cache file is not writable ({0}).\n\nThe cache file stores data to improve the plugin performance, especially the startup time.\n\nDo not add this file to revision control software like SVN, Perforce or Git.", AssetDatabase2.GetRelativeAssetPath(this._cachePath));

            if (messagebox)
            {
                if (EditorUtility.DisplayDialog(this._appTitle, text, "Make writable and save", "Ignore"))
                {
                    FileInfo fileInfo = new FileInfo(this._cachePath);
                    fileInfo.IsReadOnly = false;
                    Debug.Log(string.Format("{0}: Sucessfully removed read-only attribute of '{1}'.", this._appTitle, AssetDatabase2.GetRelativeAssetPath(this._cachePath)));
                    return;
                }
            }
            else
            {
                Debug.LogWarning(string.Format("{0}: {1}", this._appTitle, text));
            }
        }
Esempio n. 9
0
 // Token: 0x060000EB RID: 235 RVA: 0x00008C84 File Offset: 0x00006E84
 public static bool Reimport(List <string> paths, int confirmcount)
 {
     return(AssetDatabase2.Reimport(paths, confirmcount, 0));
 }
Esempio n. 10
0
 // Token: 0x060000E7 RID: 231 RVA: 0x00008BA0 File Offset: 0x00006DA0
 public static bool IsAssetType(string assetPath, Type type)
 {
     return(AssetDatabase2.GetAssetType(assetPath) == type);
 }