private void doEmptyFolderCheck(TreeNode node, List <string> dirs, List <string> all) { if (node.isDirectory) { //UnityEditor var found = AssetDatabase.FindAssets("", new[] { node.path }).ToList(); PUSelection.ClearWarnings(); if (!found.Except(dirs).Any() && all.Exists(a => a.Equals(node.path, StringComparison.OrdinalIgnoreCase))) { node.isChecked = true; node.lastCheckedState = true; } foreach (var child in node.children) { doEmptyFolderCheck(child, dirs, all); } } }
public void PrepareForUnimport(string file2import, string tempPath) { // test absolute if (!File.Exists(file2import)) { // test relative file2import = Path.Combine(Environment.CurrentDirectory, file2import); if (!File.Exists(file2import)) { throw new FileNotFoundException(file2import); } } if (!file2import.ToLower().EndsWith(".unitypackage")) { throw new Exception("You must select *.unitypackage files."); } if (!Directory.Exists(tempPath)) { Directory.CreateDirectory(tempPath); } EditorUtility.DisplayProgressBar("Uninstalling Package", "Initializing...", .25f); HolyGZip(file2import, tempPath); EditorUtility.DisplayProgressBar("Uninstalling Package", "Fetching Package Structure...", .5f); List <AssetPath> fileList = GenerateAssetList(tempPath); var assetList = AssetDatabase.GetAllAssetPaths().ToList(); var foundList = new List <string>(); foreach (var item in assetList) { if (fileList.Exists((f) => f.filePath.Equals(item, StringComparison.OrdinalIgnoreCase))) { foundList.Add(item); } } var dirs = PUSelection.DirectoriesPathList(fileList); EditorUtility.ClearProgressBar(); bool goOn = true; if (foundList.Count <= 0) { if (!EditorUtility.DisplayDialog("No files found.", "It seems that '" + Path.GetFileNameWithoutExtension(file2import) + "' doesn't exist in your project. Do you want to continue anyway?", "Continue Anyway", "No")) { goOn = false; PUSelection.RemoveMess(tempPath); } } if (goOn) { PUSelection pus = ScriptableObject.CreateInstance <PUSelection>(); pus.fileList = fileList; pus.directories = dirs; pus.foundList = foundList; pus.packageName = Path.GetFileNameWithoutExtension(file2import); pus.packagePath = file2import; pus.tempPath = tempPath; pus.titleContent = new GUIContent(""); pus.minSize = new Vector2(300, 200); pus.ShowUtility(); } }