当前位置: 首页>>代码示例>>C#>>正文


C# VirtualPath.MapPathInternal方法代码示例

本文整理汇总了C#中VirtualPath.MapPathInternal方法的典型用法代码示例。如果您正苦于以下问题:C# VirtualPath.MapPathInternal方法的具体用法?C# VirtualPath.MapPathInternal怎么用?C# VirtualPath.MapPathInternal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VirtualPath的用法示例。


在下文中一共展示了VirtualPath.MapPathInternal方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDirectoryHash

 internal static string GetDirectoryHash(VirtualPath virtualDir) {
     HashCodeCombiner hashCodeCombiner = new HashCodeCombiner();
     hashCodeCombiner.AddDirectory(virtualDir.MapPathInternal());
     return hashCodeCombiner.CombinedHashString;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:5,代码来源:HashCodeCombiner.cs

示例2: OpenFileAndGetDependency

        ///
        /// Open a stream from either a virtual or physical path, and if possible get a CacheDependency
        /// for the resulting Stream.
        ///
        internal Stream OpenFileAndGetDependency(VirtualPath virtualPath, string physicalPath, out CacheDependency dependency) {

            // Only one of the paths should be non-null
            Debug.Assert((virtualPath == null) != (physicalPath == null));

            // If we got a virtual path, and we're using the default VPP, call MapPath
            if (physicalPath == null && HostingEnvironment.UsingMapPathBasedVirtualPathProvider) {
                physicalPath = virtualPath.MapPathInternal(TemplateControlVirtualDirectory,
                    true /*allowCrossAppMapping*/);
            }

            Stream stream;
            if (physicalPath != null) {
                // Security check
                HttpRuntime.CheckFilePermission(physicalPath);

                // Work directly with the physical file, bypassing the VPP
                stream = new FileStream(physicalPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                dependency = new CacheDependency(0, physicalPath);
            }
            else {
                // It's non file system based, so go though the VirtualPathProvider
                stream = virtualPath.OpenFile();
                dependency = VirtualPathProvider.GetCacheDependency(virtualPath);
            }

            return stream;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:32,代码来源:Control.cs

示例3: VirtualDirectoryExistsWithAssert

    private static bool VirtualDirectoryExistsWithAssert(VirtualPath virtualDir) {
        try {
            String physicalDir = virtualDir.MapPathInternal();
            if (physicalDir != null) {
                new FileIOPermission(FileIOPermissionAccess.Read, physicalDir).Assert();
            }

            return virtualDir.DirectoryExists();
        }
        catch {
            return false;
        }
    }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:13,代码来源:Util.cs

示例4: VirtualFileExistsWithAssert

    internal static bool VirtualFileExistsWithAssert(VirtualPath virtualPath) {
        string physicalDir = virtualPath.MapPathInternal();

        if (physicalDir != null) {
            (InternalSecurityPermissions.PathDiscovery(physicalDir)).Assert();
        }

        return virtualPath.FileExists();
    }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:9,代码来源:Util.cs

示例5: MapPathBasedVirtualPathEnumerator

    internal MapPathBasedVirtualPathEnumerator(VirtualPath virtualPath, RequestedEntryType requestedEntryType) {

        if (virtualPath.IsRelative) {
            throw new ArgumentException(SR.GetString(SR.Invalid_app_VirtualPath), "virtualPath");
        }

        _virtualPath = virtualPath;
        _requestedEntryType = requestedEntryType;

        string physicalPath;
        if (!ServerConfig.UseServerConfig) {
            // Use the hosting environment to map the virtual path
            physicalPath = _virtualPath.MapPathInternal();
        }
        else {
            IServerConfig serverConfig = ServerConfig.GetInstance();
            _serverConfig2 = serverConfig as IServerConfig2;
            
            // Use serverConfig to map the virtual path
            physicalPath = serverConfig.MapPath(null, _virtualPath);

            if (_requestedEntryType != RequestedEntryType.Files) {
                // For MetabaseServerConfig, get the subdirs that are not in the application, and add them to the exclude list.
                if (_serverConfig2 == null) {
                    string [] virtualSubdirsNotInApp = serverConfig.GetVirtualSubdirs(_virtualPath, false);
                    if (virtualSubdirsNotInApp != null) {
                        _exclude = new Hashtable(StringComparer.OrdinalIgnoreCase);
                        foreach (string subdir in virtualSubdirsNotInApp) {
                            _exclude[subdir] = subdir;
                        }
                    }
                }

                // Get subdirs that are virtual directories, and record their physical mappings.
                // Ignore the virtualPaths if we only need files, since it only contains directories
                string [] virtualSubdirsInApp = serverConfig.GetVirtualSubdirs(_virtualPath, true);
                if (virtualSubdirsInApp != null) {
                    _virtualPaths = new Hashtable(StringComparer.OrdinalIgnoreCase);
                    foreach (string subdir in virtualSubdirsInApp) {
                        VirtualPath subpath = _virtualPath.SimpleCombineWithDir(subdir);
                        string subPhysicalPath = serverConfig.MapPath(null, subpath);
                        if (FileUtil.DirectoryExists(subPhysicalPath)) {
                            _virtualPaths[subdir] = new MapPathBasedVirtualDirectory(subpath.VirtualPathString);
                        }
                    }

                    // Create enumerator for the virtual paths
                    _virtualEnumerator = _virtualPaths.Values.GetEnumerator();
                }
            }
        }

        // Create an enumerator for the physical files and directories at this path
        _fileEnumerator = FileEnumerator.Create(physicalPath);

        // Reset the enumerator. Note that we don't support the Reset method.
        _useFileEnumerator = false;
    }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:58,代码来源:MapPathBasedVirtualPathProvider.cs

示例6: ComputeSourceDependenciesHashCode

    internal override string ComputeSourceDependenciesHashCode(VirtualPath virtualPath) {

        // If no virtual path was passed in, use the one from the BuildResult
        if (virtualPath == null)
            virtualPath = VirtualPath;

        // We don't want to use the default ComputeSourceDependenciesHashCode imnplementation,
        // as it would use all files in the resources dir to calculate the hash.  Instead,
        // we only want the hash the be based on the culture neutral resources, so that
        // changes to culture specific files don't cause a rebuild of the main res assembly
        HashCodeCombiner hashCodeCombiner = new HashCodeCombiner();
        hashCodeCombiner.AddResourcesDirectory(virtualPath.MapPathInternal());
        return hashCodeCombiner.CombinedHashString;
    }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:14,代码来源:BuildResult.cs


注:本文中的VirtualPath.MapPathInternal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。