コード例 #1
0
        /// <summary>
        /// Helper method to perform a safety check that ensures us we won't accidentally
        /// create two resources of the same type with the same name that result in the same
        /// path when the Resources folders are compiled for a runtime player.
        /// </summary>
        /// <param name="manifest"></param>
        /// <param name="path"></param>
        /// <returns><c>false if the 'Resources' relative path already exists within the manifest</c></returns>
        static bool SafetyCheck(ResourceManifest manifest, string path, Type type)
        {
            foreach (string val in manifest.AllPaths())
            {
                if (path == val)
                {
                    //TODO: We need a faster way of doing this. Large projects
                    //will suffer a lot in this section, I suspect.
                    //THIS CAN BE SUPER SLOW
                    if (manifest.GetResourceFromPath(path, type) != null)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }