Inheritance: ResourceBuildResult
Example #1
0
        public static ResourceBuildResult FindResource(string url)
        {
            bool isExternal = (url != null) && (url.IndexOf("://") > 0);

            object buildResult;

            if (isExternal)
            {
                buildResult = null;
            }
            else
            {
                buildResult = BuildManager.CreateInstanceFromVirtualPath(url, typeof(object));
            }

            ResourceBuildResult resource;

            if (buildResult is ResourceBuildResult)
            {
                resource = (ResourceBuildResult)buildResult;
            }
            else if (isExternal || buildResult is IBuildResult)
            {
                resource = new ScriptBuildResult(url, buildResult as IBuildResult);
            }
            else
            {
                throw new ArgumentException(String.Format(
                                                "Error loading resources for \"{0}\".\r\n" +
                                                "This can be caused by an invalid path, build errors, or incorrect configuration.\r\n" +
                                                "Check http://help.jsonfx.net/instructions for troubleshooting.",
                                                url));
            }

            return(resource);
        }
        public static ResourceBuildResult FindResource(string url)
        {
            bool isExternal = (url != null) && (url.IndexOf("://") > 0);

            object buildResult;
            if (isExternal)
            {
                buildResult = null;
            }
            else
            {
                buildResult = BuildManager.CreateInstanceFromVirtualPath(url, typeof(object));
            }

            ResourceBuildResult resource;

            if (buildResult is ResourceBuildResult)
            {
                resource = (ResourceBuildResult)buildResult;
            }
            else if (isExternal || buildResult is IBuildResult)
            {
                resource = new ScriptBuildResult(url, buildResult as IBuildResult);
            }
            else
            {
                throw new ArgumentException(String.Format(
                    "Error loading resources for \"{0}\".\r\n"+
                    "This can be caused by an invalid path, build errors, or incorrect configuration.\r\n"+
                    "Check http://help.jsonfx.net/instructions for troubleshooting.",
                    url));
            }

            return resource;
        }