Exemplo n.º 1
0
        public static void AssetMoveout()
        {
            System.GC.Collect();
            System.GC.Collect();

            ReadFile();
            ParseAllDir();
            RootFolderNmae();
            ParseTheVersion();
            FilesFilter();

            string path = string.Format("{0}/../../../temp/", Application.dataPath);

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }
            Directory.CreateDirectory(path);

            string path1;

            // ProjectSettings
            ABHelper.DirectoryCopy(string.Format("{0}/../{1}", Application.dataPath, "ProjectSettings"), path + "ProjectSettings");
            foreach (var v in RemoveResourcesDir)
            {
                path1 = ResFolder.Replace("Assets", "") + v;
                ABHelper.DirectoryMove(Application.dataPath + path1, path + path1);
            }
            foreach (var v in RemoveAssetsDir)
            {
                path1 = AssetsFolder.Replace("Assets", "") + v;
                ABHelper.DirectoryMove(Application.dataPath + path1, path + path1);
            }

            string path2;

            foreach (var v in NotRemoveFileList)
            {
                path1 = string.Format("{0}/../../../temp/{1}", Application.dataPath, v);
                if (!File.Exists(path1))
                {
                    continue;
                }
                path2 = Application.dataPath + "/" + v;
                if (File.Exists(path2))
                {
                    File.Delete(path2);
                }
                File.Move(path1, path2);
            }

            AssetDatabase.Refresh();
            AssetDatabase.SaveAssets();

            System.GC.Collect();
            Debug.Log("资源移出成功!!");
        }