Example #1
0
    /// <summary>
    /// Add files to be copied to the new project.
    /// </summary>
    /// <param name="results">Where to save the resulting files</param>
    /// <param name="projectPath">Path to the root of the project</param>
    /// <param name="path">Current path in the project to add files from</param>
    /// <param name="count">Number of files added so far</param>
    private static int AddFiles(Report results, string projectPath, string path, int count)
    {
        // Add all the files in this Directory
        string[] foundFiles = Directory.GetFiles(path);
        foreach (string file in foundFiles)
        {
            if (!file.EndsWith("meta"))
            {
                string trimmedFile = file.Replace(projectPath, "").TrimStart(new char[] { '/', '\\' });
                results.AddItems(NormalizePath(trimmedFile));
                EditorUtility.DisplayProgressBar("Collecting Project Statistics", trimmedFile, 0);
                count++;
            }

            if ((count % 1000) == 0)
            {
                Resources.UnloadUnusedAssets();
            }
        }

        // Now Process sub directories
        string[] foundDirs = Directory.GetDirectories(path);
        foreach (string foundDir in foundDirs)
        {
            count = AddFiles(results, projectPath, foundDir, count);
        }

        return(count);
    }