Inheritance: MonoBehaviour
Exemplo n.º 1
0
        /// <summary>
        /// Creates a cache dependency based on the specified virtual paths.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The path to the primary virtual resource.</param>
        /// <returns>
        /// A <see cref="T:System.Web.Caching.CacheDependency"/> object for the specified virtual resources.
        /// </returns>
        public virtual CacheDependency GetCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
        {
            CacheDependency result = this.GetCurrentCacheDependency(definition, virtualPath, virtualPathDependencies, utcStart);

            //If the requested file does not exist in the current resolver then keep these dependencies and add dependencies of the next resolver.
            //This will allow the resolvers higher in the chain to be pinged again when the file might be available to them.
            if (this.Next != null && !this.CurrentExists(definition, virtualPath))
            {
                var nextDependencies = this.Next.GetCacheDependency(definition, virtualPath, virtualPathDependencies, utcStart);
                if (nextDependencies != null)
                {
                    if (result != null)
                    {
                        var aggr = new AggregateCacheDependency();
                        aggr.Add(result, nextDependencies);
                        result = aggr;
                    }
                    else
                    {
                        result = nextDependencies;
                    }
                }
            }

            return result;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Determines whether a file with the specified virtual path exists.
        /// </summary>
        /// <param name="virtualPath">The virtual path to check.</param>
        public virtual bool Exists(PathDefinition definition, string virtualPath)
        {
            virtualPath = this.RemoveParams(virtualPath);

            var resolverStrategy = ObjectFactory.Resolve<IResourceResolverStrategy>();
            return resolverStrategy.Exists(definition, virtualPath);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Opens the the file with the specified virtual path.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The virtual path of the file to open.</param>
        /// <returns></returns>
        public virtual Stream Open(PathDefinition definition, string virtualPath)
        {
            if (this.Next != null && !this.CurrentExists(definition, virtualPath))
                return this.Next.Open(definition, virtualPath);

            return this.CurrentOpen(definition, virtualPath);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Opens the the file with the specified virtual path.
        /// </summary>
        /// <param name="virtualPath">The virtual path of the file to open.</param>
        public virtual Stream Open(PathDefinition definition, string virtualPath)
        {
            virtualPath = this.virtualPathBuilder.RemoveParams(virtualPath);

            var resolverStrategy = ObjectFactory.Resolve<IResourceResolverStrategy>();
            return resolverStrategy.Open(definition, virtualPath);
        }
 /// <summary>
 /// Gets the control presentation that contains the requested resource from the database.
 /// </summary>
 /// <param name="virtualPathDefinition">The definition.</param>
 /// <param name="virtualPath">The virtual path.</param>
 /// <returns></returns>
 protected override ControlPresentation GetControlPresentation(PathDefinition virtualPathDefinition, string virtualPath)
 {
     if (this.ControlPresentationResult.ContainsKey(virtualPath))
         return this.ControlPresentationResult[virtualPath];
     else
         return null;
 }
Exemplo n.º 6
0
        /// <summary>
        /// Creates a cache dependency based on the specified virtual paths.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The path to the primary virtual resource.</param>
        /// <returns>
        /// A <see cref="T:System.Web.Caching.CacheDependency"/> object for the specified virtual resources.
        /// </returns>
        public virtual CacheDependency GetCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
        {
            virtualPath = this.virtualPathBuilder.RemoveParams(virtualPath);

            var resolverStrategy = ObjectFactory.Resolve<IResourceResolverStrategy>();
            return resolverStrategy.GetCacheDependency(definition, virtualPath, virtualPathDependencies, utcStart);
        }
Exemplo n.º 7
0
 /// <inheritdoc />
 protected override Stream CurrentOpen(PathDefinition definition, string virtualPath)
 {
     Assembly assembly = this.GetAssembly(definition);
     var resourceName = this.GetResourceName(definition, virtualPath);
     var resources = assembly.GetManifestResourceNames();
     var caseSensitiveName = resources.First(r => string.Equals(resourceName, r, StringComparison.OrdinalIgnoreCase));
     var stream = assembly.GetManifestResourceStream(caseSensitiveName);
     return stream;
 }
        /// <inheritdoc />
        protected override Stream CurrentOpen(PathDefinition definition, string virtualPath)
        {
            var controlPresentation = this.GetControlPresentation(definition, virtualPath);
            if (controlPresentation != null && !controlPresentation.Data.IsNullOrEmpty())
            {
                var bytes = RouteHelper.GetContentWithPreamble(controlPresentation.Data);
                return new MemoryStream(bytes);
            }

            throw new ArgumentException("Could not find resource at " + virtualPath + " in the database.");
        }
 /// <inheritdoc />
 public override CacheDependency GetCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
 {
     if (this.GetCacheDependencyMock != null)
     {
         return this.GetCacheDependencyMock(definition, virtualPath, virtualPathDependencies, utcStart);
     }
     else
     {
         return base.GetCacheDependency(definition, virtualPath, virtualPathDependencies, utcStart);
     }
 }
Exemplo n.º 10
0
        /// <inheritdoc />
        protected override bool CurrentExists(PathDefinition definition, string virtualPath)
        {
            if (definition.ResourceLocation.IsNullOrEmpty())
                return false;

            Assembly assembly = this.GetAssembly(definition);
            var resourceName = this.GetResourceName(definition, virtualPath);
            var resources = assembly.GetManifestResourceNames();

            return resources.Contains(resourceName, StringComparer.OrdinalIgnoreCase);
        }
        /// <inheritdoc />
        protected override CacheDependency GetCurrentCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
        {
            var controlPresentation = this.GetControlPresentation(definition, virtualPath);
            if (controlPresentation != null)
            {
                return new ControlPresentationCacheDependency(controlPresentation.Id.ToString());
            }

            // Change to any ControlPresentation record will invalidate the cache for this virtual path.
            return new ControlPresentationCacheDependency(typeof(ControlPresentation));
        }
        /// <inheritdoc />
        protected override IEnumerable<string> GetCurrentFiles(PathDefinition definition, string path)
        {
            var mappedPath = this.GetFileName(definition, path);
            if (mappedPath != null && Directory.Exists(mappedPath))
            {
                return Directory.GetFiles(mappedPath)
                                .Select(f => f.Replace(mappedPath, path));
            }

            return null;
        }
Exemplo n.º 13
0
        /// <summary>
        /// Gets the control presentation that contains the requested resource from the database.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The virtual path.</param>
        protected virtual ControlPresentation GetControlPresentation(PathDefinition definition, string virtualPath)
        {
            var resourceName = VirtualPathUtility.ToAppRelative(virtualPath);
            var areaName = VirtualPathUtility.AppendTrailingSlash(VirtualPathUtility.ToAppRelative(definition.VirtualPath));
            var extension = VirtualPathUtility.GetExtension(virtualPath).ToLower();

            var controlPresentation = PageManager.GetManager().GetPresentationItems<ControlPresentation>()
                .FirstOrDefault(cp => cp.AreaName == areaName && cp.NameForDevelopers == resourceName
                    && cp.DataType == extension);
            return controlPresentation;
        }
Exemplo n.º 14
0
 /// <inheritdoc />
 public override bool Exists(PathDefinition definition, string virtualPath)
 {
     if (this.ExistsMock != null)
     {
         return this.ExistsMock(definition, virtualPath);
     }
     else
     {
         return base.Exists(definition, virtualPath);
     }
 }
 public System.Web.Caching.CacheDependency GetCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
 {
     var id = this.ResolveFormDescriptionId(virtualPath);
     if (id != null && this.DescriptionExists(id.Value))
     {
         return new DataItemSystemCacheDependency(typeof(FormDescription), itemId: id.Value.ToString("D"));
     }
     else
     {
         return new DataItemSystemCacheDependency(typeof(FormDescription));
     }
 }
        /// <inheritdoc />
        protected override IEnumerable<string> GetCurrentFiles(PathDefinition definition, string path)
        {
            var resourceName = this.GetResourceName(definition, path);
            if (resourceName != null)
            {
                var assembly = this.GetAssembly(definition);
                return assembly.GetManifestResourceNames()
                    .Where(r => r.StartsWith(resourceName, StringComparison.OrdinalIgnoreCase))
                    .Select(r => r.Replace(resourceName, path));
            }

            return null;
        }
        public void GetLayoutName_WithoutMasterSuffix_ReturnsNull()
        {
            // Arrange
            var testVirtualPath = "~/TestPrefix/TestTitle.test";
            var pathDefinition = new PathDefinition();
            pathDefinition.VirtualPath = "~/TestPrefix";

            // Act
            var layoutVirtualPathBuilder = new LayoutVirtualPathBuilder();
            var resultLayoutName = layoutVirtualPathBuilder.GetLayoutName(pathDefinition, testVirtualPath);

            // Assert
            Assert.IsNull(resultLayoutName, "The result layout name should be null if the virtual path doesn't end with 'master'.");
        }
        public void GetLayoutName_VirtualPath_ResolvesLayoutFileName()
        {
            // Arrange
            var expectedLayoutName = "TestTitle";
            var testVirtualPath = "~/TestPrefix/TestTitle....master";
            var pathDefinition = new PathDefinition { VirtualPath = "~/TestPrefix" };

            // Act
            var layoutVirtualPathBuilder = new LayoutVirtualPathBuilder();
            var resultLayoutName = layoutVirtualPathBuilder.GetLayoutName(pathDefinition, testVirtualPath);

            // Assert
            Assert.AreEqual(expectedLayoutName, resultLayoutName, "The layout name is not extracted correctly.");
        }
        /// <summary>
        /// Creates a cache dependency based on the specified virtual paths.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The path to the primary virtual resource.</param>
        /// <returns>
        /// A <see cref="T:System.Web.Caching.CacheDependency"/> object for the specified virtual resources.
        /// </returns>
        public CacheDependency GetCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
        {
            virtualPath = this.virtualPathBuilder.RemoveParams(virtualPath);
            virtualPath = VirtualPathUtility.ToAppRelative(virtualPath);

            var layoutVirtualPathBuilder = new LayoutVirtualPathBuilder();
            string viewName = layoutVirtualPathBuilder.GetLayoutName(definition, virtualPath);
            var layoutTemplateBuilder = new LayoutRenderer();

            if (string.IsNullOrEmpty(viewName))
                return null;

            var viewPath = layoutTemplateBuilder.LayoutViewPath(viewName);
            return HostingEnvironment.VirtualPathProvider.GetCacheDependency(viewPath, virtualPathDependencies, utcStart);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Determines whether a file with the specified virtual path exists.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The virtual path to check.</param>
        public virtual bool Exists(PathDefinition definition, string virtualPath)
        {
            virtualPath = VirtualPathUtility.ToAppRelative(virtualPath);

            var vpBuilder = new LayoutVirtualPathBuilder();
            string viewName = vpBuilder.GetLayoutName(definition, virtualPath);
            var layoutTemplateBuilder = new LayoutRenderer();

            if (string.IsNullOrEmpty(viewName))
                return false;

            if (virtualPath.StartsWith(string.Format("~/{0}", LayoutVirtualFileResolver.ResolverPath)))
                return layoutTemplateBuilder.LayoutExists(viewName);
            else
                return false;
        }
Exemplo n.º 21
0
        /// <summary>
        /// Gets the path definition for the given assembly that is used by the virtual file resolvers.
        /// </summary>
        /// <param name="assembly">The assembly.</param>
        public PathDefinition GetPathDefinition(Assembly assembly)
        {
            if (assembly == null)
                throw new ArgumentNullException("assembly");

            var name = assembly.GetName().Name;
            var result = new PathDefinition()
            {
                IsWildcard = true,
                ResolverName = name,
                ResourceLocation = assembly.CodeBase,
                VirtualPath = "~/" + VirtualPathBuilder.frontendAssemblyBasePath.Arrange(name),
            };
            result.Items.Add("Assembly", assembly);
            return result;
        }
        /// <summary>
        /// Gets the layout file name from virtual path.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The virtual path.</param>
        /// <returns></returns>
        public virtual string GetLayoutName(PathDefinition definition, string virtualPath)
        {
            if (!virtualPath.EndsWith(LayoutVirtualPathBuilder.LayoutSuffix, StringComparison.OrdinalIgnoreCase))
                return null;

            var definitionVp = VirtualPathUtility.AppendTrailingSlash(VirtualPathUtility.ToAppRelative(definition.VirtualPath));
            var pageTemplateNameLength = virtualPath.Length - definitionVp.Length - LayoutVirtualPathBuilder.LayoutSuffix.Length - 1;
            string pageTemplateName = virtualPath.Substring(definitionVp.Length, pageTemplateNameLength);

            while (!string.IsNullOrEmpty(pageTemplateName) && pageTemplateName.EndsWith(".", StringComparison.Ordinal))
            {
                pageTemplateName = pageTemplateName.Substring(0, pageTemplateName.Length - 1);
            }

            return pageTemplateName;
        }
Exemplo n.º 23
0
        /// <summary>
        /// Gets the assembly which is specified in the PathDefinition.
        /// </summary>
        /// <param name="definition">The path definition.</param>
        /// <exception cref="System.InvalidOperationException">Invalid PathDefinition.</exception>
        protected virtual Assembly GetAssembly(PathDefinition definition)
        {
            object assembly;
            if (!definition.Items.TryGetValue("Assembly", out assembly))
            {
                lock (this)
                {
                    if (!definition.Items.TryGetValue("Assembly", out assembly))
                    {
                        assembly = Assembly.LoadFrom(definition.ResourceLocation);
                        definition.Items.Add("Assembly", assembly);
                    }
                }
            }

            return (Assembly)assembly;
        }
        public Stream Open(PathDefinition definition, string virtualPath)
        {
            var formManager = FormsManager.GetManager();

            var id = this.ResolveFormDescriptionId(virtualPath);
            var form = formManager.GetForm(id.Value);

            var output = new MemoryStream();
            var writer = new StreamWriter(output);

            FrontendModule.Current.DependencyResolver.Get<IFormRenderer>().Render(writer, form);

            writer.Flush();
            output.Seek(0, SeekOrigin.Begin);

            return output;
        }
        /// <summary>
        /// Determines whether a file with the specified virtual path exists.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The virtual path to check.</param>
        public virtual bool Exists(PathDefinition definition, string virtualPath)
        {
            virtualPath = this.virtualPathBuilder.RemoveParams(virtualPath);
            virtualPath = VirtualPathUtility.ToAppRelative(virtualPath);

            var layoutVirtualPathBuilder = new LayoutVirtualPathBuilder();
            string viewName = layoutVirtualPathBuilder.GetLayoutName(definition, virtualPath);
            var layoutTemplateBuilder = new LayoutRenderer();

            if (string.IsNullOrEmpty(viewName))
                return false;

            if (virtualPath.StartsWith(string.Format(System.Globalization.CultureInfo.InvariantCulture, "~/{0}", LayoutVirtualFileResolver.ResolverPath), StringComparison.Ordinal))
                return layoutTemplateBuilder.LayoutExists(viewName);
            else
                return false;
        }
Exemplo n.º 26
0
    public void Start()
    {
        Path = GameObject.FindGameObjectWithTag ("waterPath").GetComponent<PathDefinition> ();

        if (Path == null)
        {
            Debug.LogError("Path cannot be null", gameObject);
            return;
        }

        _currentPoint = Path.GetPathsEnumerator ();
        _currentPoint.MoveNext ();

        if (_currentPoint.Current == null)
            return;

        //transform.position = _currentPoint.Current.position;
    }
Exemplo n.º 27
0
        /// <summary>
        /// Gets the path definition for the given assembly that is used by the virtual file resolvers.
        /// </summary>
        /// <param name="assembly">The assembly.</param>
        public PathDefinition GetPathDefinition(Assembly assembly)
        {
            if (assembly == null)
                throw new ArgumentNullException("assembly");

            var name = assembly.GetName().Name;

            var result = new PathDefinition
            {
                IsWildcard = true,
                ResolverName = name,
                ResourceLocation = assembly.CodeBase,
                VirtualPath = string.Format(CultureInfo.InvariantCulture, "~/{0}", VirtualPathBuilder.FrontendAssemblyBasePath.Arrange(name))
            };

            result.Items.Add("Assembly", assembly);
            return result;
        }
        /// <summary>
        /// Opens the the file with the specified virtual path.
        /// </summary>
        /// <param name="virtualPath">The virtual path of the file to open.</param>
        public virtual Stream Open(PathDefinition definition, string virtualPath)
        {
            virtualPath = this.virtualPathBuilder.RemoveParams(virtualPath);

            MemoryStream outPutStream = null;
            virtualPath = VirtualPathUtility.ToAppRelative(virtualPath);
            var virtualBuilder = new LayoutVirtualPathBuilder();
            var viewName = virtualBuilder.GetLayoutName(definition, virtualPath);
            var layoutHtmlString = this.RenderLayout(viewName);

            if (!string.IsNullOrEmpty(layoutHtmlString))
            {
                var layoutBytes = Encoding.Default.GetBytes(layoutHtmlString.ToCharArray());
                outPutStream = new MemoryStream(layoutBytes);
            }

            return outPutStream;
        }
Exemplo n.º 29
0
        /// <summary>
        /// Gets the resource name based on the virtual path.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The virtual path.</param>
        protected virtual string GetResourceName(PathDefinition definition, string virtualPath)
        {
            string assemblyName = this.GetAssembly(definition).GetName().Name;
            string path;
            if (definition.IsWildcard)
            {
                var definitionVp = VirtualPathUtility.AppendTrailingSlash(VirtualPathUtility.ToAppRelative(definition.VirtualPath));
                var vp = VirtualPathUtility.ToAppRelative(virtualPath);
                var dir = VirtualPathUtility.GetDirectory(vp);
                vp = Regex.Replace(dir, @"[ \-]", "_") + Path.GetFileName(vp);
                path = assemblyName + "." + vp.Substring(definitionVp.Length).Replace('/', '.');
            }
            else
            {
                path = assemblyName;
            }

            return path;
        }
        /// <summary>
        /// Opens the the file with the specified virtual path.
        /// </summary>
        /// <param name="virtualPath">The virtual path of the file to open.</param>
        public virtual Stream Open(PathDefinition definition, string virtualPath)
        {
            var placeholdersOnly = virtualPath.EndsWith(".master", StringComparison.OrdinalIgnoreCase);
            virtualPath = this.virtualPathBuilder.RemoveParams(virtualPath);

            MemoryStream outPutStream = null;
            virtualPath = VirtualPathUtility.ToAppRelative(virtualPath);
            var virtualBuilder = new LayoutVirtualPathBuilder();
            var viewName = virtualBuilder.GetLayoutName(definition, virtualPath);
            var layoutHtmlString = this.RenderLayout(viewName, placeholdersOnly);

            if (!string.IsNullOrEmpty(layoutHtmlString))
            {
                var layoutBytes = Encoding.UTF8.GetBytes(layoutHtmlString.ToCharArray());
                outPutStream = new MemoryStream(layoutBytes);
            }

            return outPutStream;
        }
Exemplo n.º 31
0
 private IDisposableNodeViewProvider Create(IValue value, PathDefinition path)
 => _nodeFactory.Create(value, path);
        protected override string CurrentGetFileHash(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies)
        {
            var assembly = this.GetAssembly(definition);

            return(assembly.GetName().Version.ToString());
        }
Exemplo n.º 33
0
 /// <inheritdoc />
 public System.IO.Stream Open(PathDefinition definition, string virtualPaht)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 34
0
 public bool AffectsPath(PathDefinition path) => _rule(path);
Exemplo n.º 35
0
 /// <summary>
 /// Determines whether a file with the specified virtual path exists in the current resolver node.
 /// </summary>
 /// <param name="definition">The definition.</param>
 /// <param name="virtualPath">The virtual path to check.</param>
 protected abstract bool CurrentExists(PathDefinition definition, string virtualPath);
        /// <inheritdoc />
        protected override bool CurrentExists(PathDefinition definition, string virtualPath)
        {
            var fn = this.GetFileName(definition, virtualPath);

            return(fn != null && File.Exists(fn));
        }
Exemplo n.º 37
0
 public TrackingValueCalculationContext(INodeRepository nodeRepository, PathDefinition currentPath)
 {
     _nodeRepository = nodeRepository;
     CurrentPath     = currentPath;
 }
Exemplo n.º 38
0
 private string GetFilesCacheKey(PathDefinition definition, string virtualPath)
 {
     return("{0}_{1}_GetFiles_{2}".Arrange(this.GetType().Name, definition.ResolverName, virtualPath.GetHashCode()));
 }
Exemplo n.º 39
0
        /// <inheritdoc />
        protected override System.Web.Caching.CacheDependency GetCurrentCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
        {
            bool   isValidControlPresentationPath;
            string name;
            IEnumerable <string> controllers;

            string[] areaNames;

            ControlPresentationCacheDependency cacheDependency = null;

            if (this.TryResolveControlPresentationParams(definition, virtualPath, out isValidControlPresentationPath, out name, out controllers, out areaNames) &&
                isValidControlPresentationPath)
            {
                foreach (string areaName in areaNames)
                {
                    var item = this.GetControlPresentationItem(controllers, name, areaName);
                    if (item != null)
                    {
                        cacheDependency = new ControlPresentationCacheDependency(item.Id.ToString());
                        break;
                    }
                }

                if (cacheDependency == null)
                {
                    List <CacheDependencyKey> keys = new List <CacheDependencyKey>();
                    foreach (string areaName in areaNames)
                    {
                        foreach (var controller in controllers)
                        {
                            var key = string.Concat(name, controller, areaName);
                            if (cacheDependency == null)
                            {
                                cacheDependency = new ControlPresentationCacheDependency(key);
                            }
                            else
                            {
                                cacheDependency.AddAdditionalKey(key);
                            }
                        }
                    }
                }
            }

            return(cacheDependency);
        }
Exemplo n.º 40
0
 public Transformable(PathDefinition path, IValueTransformable transformable)
 {
     _path          = path;
     _transformable = transformable;
 }
Exemplo n.º 41
0
        /// <inheritdoc />
        protected override System.Web.Caching.CacheDependency GetCurrentCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
        {
            bool isValidControlPresentationPath;
            ControlPresentation controlPresentation = this.GetControlPresentation(definition, virtualPath, out isValidControlPresentationPath);

            if (!isValidControlPresentationPath)
            {
                // Return null for virtual paths that are not ControlPresentation paths since they do not depend on Control Presentations.
                return(null);
            }

            if (controlPresentation != null)
            {
                return(new ControlPresentationCacheDependency(controlPresentation.Id.ToString()));
            }

            // Change to any ControlPresentation record will invalidate the cache for this virtual path.
            return(new ControlPresentationCacheDependency(typeof(ControlPresentation)));
        }
 /// <inheritdoc />
 protected override CacheDependency GetCurrentCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
 {
     // Embedded resources cannot change therefore no dependency is needed.
     return(null);
 }
 private static ConvertedBaseValue CreateSut(PathDefinition path = null) =>
 new ConvertedBaseValue(path);
Exemplo n.º 44
0
 /// <summary>
 /// Gets the available files in the given path using the current resolver node.
 /// </summary>
 /// <param name="definition">The definition.</param>
 /// <param name="path">The path.</param>
 protected abstract IEnumerable <string> GetCurrentFiles(PathDefinition definition, string path);
Exemplo n.º 45
0
        public bool Exists(PathDefinition definition, string virtualPath)
        {
            var id = this.ResolveFormDescriptionId(virtualPath);

            return(id != null && this.DescriptionExists(id.Value));
        }
Exemplo n.º 46
0
 /// <summary>
 /// Creates a cache dependency based on the specified virtual path and on the current resolver node.
 /// </summary>
 /// <param name="definition">The definition.</param>
 /// <param name="virtualPath">The path to the virtual resource.</param>
 /// <param name="virtualPathDependencies">The virtual path dependencies.</param>
 /// <param name="utcStart">The UTC start.</param>
 /// <returns>
 /// A <see cref="T:System.Web.Caching.CacheDependency" /> object for the specified virtual resources.
 /// </returns>
 protected abstract CacheDependency GetCurrentCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart);
Exemplo n.º 47
0
 /// <summary>
 /// Determines whether a file with the specified virtual path exists.
 /// </summary>
 /// <param name="definition">The definition.</param>
 /// <param name="virtualPath">The virtual path to check.</param>
 public virtual bool Exists(PathDefinition definition, string virtualPath)
 {
     return(this.CurrentExists(definition, virtualPath) ||
            (this.Next != null && this.Next.Exists(definition, virtualPath)));
 }
Exemplo n.º 48
0
 /// <summary>
 /// Simulates that resource always exists on the searched location.
 /// </summary>
 /// <param name="definition">The definition.</param>
 /// <param name="virtualPath">The virtual path.</param>
 /// <returns></returns>
 public bool Exists(PathDefinition definition, string virtualPath)
 {
     return(true);
 }
Exemplo n.º 49
0
 /// <summary>
 /// Opens the the file with the specified virtual path using the current resolver node.
 /// </summary>
 /// <param name="definition">The definition.</param>
 /// <param name="virtualPath">The virtual path of the file to open.</param>
 /// <returns></returns>
 protected abstract Stream CurrentOpen(PathDefinition definition, string virtualPath);
Exemplo n.º 50
0
        private string GetFilesCacheKey(PathDefinition definition, string virtualPath)
        {
            string moduleName = definition.Parameters[ModuleNameParam];

            return("{0}_{1}_{2}_GetFiles_{3}".Arrange(this.GetType().Name, moduleName, definition.ResolverName, virtualPath.GetHashCode()));
        }
Exemplo n.º 51
0
 public BaseValue(IStat stat, PathDefinition path)
 {
     _stat = stat;
     _path = path;
 }
Exemplo n.º 52
0
 /// <summary>
 /// Returns a hash of the specified virtual paths.
 /// </summary>
 /// <param name="definition">The file resolver definition.</param>
 /// <param name="virtualPath">The path to the primary virtual resource.</param>
 /// <param name="virtualPathDependencies">An array of paths to other virtual resources required by the primary virtual resource.</param>
 /// <returns>
 /// A hash of the specified virtual paths.
 /// </returns>
 public string GetFileHash(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies)
 {
     return(Guid.NewGuid().ToString());
 }
Exemplo n.º 53
0
        private ModifierNodeCollection GetModifierNodeCollection(Modifier modifier)
        {
            var path = new PathDefinition(modifier.Source);

            return(GetModifierNodeCollection(new FormNodeSelector(modifier.Form, path)));
        }
Exemplo n.º 54
0
 /// <summary>
 /// Creates a cache dependency based on the specified virtual paths.
 /// </summary>
 /// <param name="definition">The definition.</param>
 /// <param name="virtualPath">The path to the primary virtual resource.</param>
 /// <returns>
 /// A <see cref="T:System.Web.Caching.CacheDependency"/> object for the specified virtual resources.
 /// </returns>
 public CacheDependency GetCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
 {
     return(null);
 }
 /// <inheritdoc />
 protected override Stream CurrentOpen(PathDefinition definition, string virtualPath)
 {
     return(File.OpenRead(this.GetFileName(definition, virtualPath)));
 }
Exemplo n.º 56
0
 /// <inheritdoc />
 public System.Web.Caching.CacheDependency GetCacheDependency(PathDefinition definition, string virtualPath, System.Collections.IEnumerable virtualPathDependencies, DateTime utcStart)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 57
0
 public override bool AffectsPath(PathDefinition path)
 => path.ConversionStats.IsEmpty();
Exemplo n.º 58
0
 /// <inheritdoc />
 protected override IEnumerable <string> GetCurrentFiles(PathDefinition definition, string path)
 {
     return(null);
 }
Exemplo n.º 59
0
        /// <inheritdoc />
        protected override bool CurrentExists(PathDefinition definition, string virtualPath)
        {
            var controlPresentation = this.GetControlPresentation(definition, virtualPath);

            return(controlPresentation != null && !controlPresentation.Data.IsNullOrEmpty());
        }
Exemplo n.º 60
0
 public abstract bool AffectsPath(PathDefinition path);