public virtual bool Reload()
        {
            if (!VirtualPathProviderHelper.FileExists(this.Location))
            {
                return(false);
            }

            var file = VirtualPathProviderHelper.GetFile(this.Location);

            this.ContentsReader = () => new StreamReader(VirtualPathProviderHelper.Open(file));

            return(true);
        }
        private ViewLocationResult FindView(IEnumerable<string> locations, string viewName, string fileNameFormat = "{0}", bool throwException = false)
        {
            var checkedLocations = new List<string>();
            var viewFound = false;
            var context = new HttpContextWrapper(HttpContext.Current);

            var viewNameWithExtension = string.Format(fileNameFormat, viewName);

            ViewLocationResult foundView = null;

            var themeDirectory = ThemeDirectory;
            var cacheKey = string.Format("{0}-{1}", themeDirectory, viewNameWithExtension);

            if (!string.IsNullOrEmpty(themeDirectory))
            {
                // check cache first
                foundView = ViewLocationCache.GetViewLocation(context, cacheKey) as ViewLocationResult;
                if (foundView != null) return foundView;

                foreach (var fullPath in locations.Select(viewLocation => Combine(this._baseDirectoryPath, themeDirectory, viewLocation, viewNameWithExtension)))
                {
                    var file = VirtualPathProviderHelper.GetFile(fullPath);
                    if (file != null)
                    {
                        foundView = new FileViewLocationResult(file, file.VirtualPath);
                        viewFound = true;
                        break;
                    }

                    checkedLocations.Add(fullPath);
                }

                // now search in global location
                // App_Data/Themes/_Global
                if (!viewFound)
                {
                    foreach (var fullPath in
                        locations.Select(
                            viewLocation => Combine(this._baseDirectoryPath, "_global", viewLocation, viewNameWithExtension)))
                    {
                        var file = VirtualPathProviderHelper.GetFile(fullPath);
                        if (file != null)
                        {
                            foundView = new FileViewLocationResult(file, file.VirtualPath);
                            viewFound = true;
                            break;
                        }

                        checkedLocations.Add(Path.Combine(this._baseDirectoryPath, fullPath));
                    }
                }
            }

            if (foundView == null /*!viewFound && throwException*/)
            {
                foundView = new ViewLocationResult(checkedLocations.ToArray());
            }

            ViewLocationCache.InsertViewLocation(context, cacheKey, foundView);

            return foundView;
        }