本文整理汇总了C#中VirtualPath类的典型用法代码示例。如果您正苦于以下问题:C# VirtualPath类的具体用法?C# VirtualPath怎么用?C# VirtualPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VirtualPath类属于命名空间,在下文中一共展示了VirtualPath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
// Create a PageParserFilter and initialize it
internal static PageParserFilter Create(PagesSection pagesConfig, VirtualPath virtualPath, TemplateParser parser) {
PageParserFilter pageParserFilter = pagesConfig.CreateControlTypeFilter();
if (pageParserFilter != null)
pageParserFilter.InitializeInternal(virtualPath, parser);
return pageParserFilter;
}
示例2: VirtualDirectoryMapping
private VirtualDirectoryMapping(VirtualPath virtualDirectory, string physicalDirectory, bool isAppRoot, string configFileBaseName) {
_virtualDirectory = virtualDirectory;
_isAppRoot = isAppRoot;
PhysicalDirectory = physicalDirectory;
ConfigFileBaseName = configFileBaseName;
}
示例3: PageThemeBuildProvider
internal PageThemeBuildProvider(VirtualPath virtualDirPath) {
_virtualDirPath = virtualDirPath;
//
SetVirtualPath(virtualDirPath);
}
示例4: GetView
public IView GetView(VirtualPath path)
{
if (path.Parts.Count == 0) return null;
var filename = "../" + path.Parts.Last();
var candidatePaths = new VirtualPath[] { path }
.Concat(
from ext in _registry.GetRegisteredExtensions()
select path.Append(filename + "." + ext)
);
var infos =
from c in candidatePaths
let info = _registry.GetViewInfo(path)
let resource = info.Location(info.RelativePath, _serviceLocator)
where resource != null && resource.IsFile
select new {
Path = c,
Resource = resource
};
var viewInfo = infos.FirstOrDefault();
if (viewInfo == null) return null;
var resourceResolver = new ViewResourceResolver(_registry, _serviceLocator, viewInfo.Resource);
var extension = viewInfo.Path.Parts.Last().Split('.').Last();
var viewEngine = _registry.GetViewEngine(extension);
return viewEngine.GetView(viewInfo.Path, resourceResolver);
}
示例5: NTFSDirectory
public NTFSDirectory(NTFSFileSystemProvider fileSystemProvider, string name, VirtualPath path)
{
this.fileSystemProvider = fileSystemProvider;
Name = name;
if (path.IsRoot)
Name = string.Empty;
Path = path;
}
示例6: InvalidOperationException
// if appHost is null, we use the site name for the current application
string IServerConfig.MapPath(IApplicationHost appHost, VirtualPath path) {
string siteName = (appHost == null) ? _siteNameForCurrentApplication : appHost.GetSiteName();
string physicalPath = ProcessHostConfigUtils.MapPathActual(siteName, path);
if (FileUtil.IsSuspiciousPhysicalPath(physicalPath)) {
throw new InvalidOperationException(SR.GetString(SR.Cannot_map_path, path.VirtualPathString));
}
return physicalPath;
}
示例7: ResourceMapping
public ResourceMapping(VirtualPath root, IResourceLocation location)
{
if (root.Type != VirtualPathType.AppRelative) {
throw new ArgumentException("The root path must be app-relative.");
}
Root = root;
Location = location;
}
示例8: MapPath
protected override string MapPath (VirtualPath virtualPath)
{
// We need this hack to support out-of-application wsdl helpers
if (virtualPath.IsFake)
return virtualPath.PhysicalPath;
return base.MapPath (virtualPath);
}
示例9: BuildProvidersCompiler
internal BuildProvidersCompiler(VirtualPath configPath, bool supportLocalization,
string outputAssemblyName) {
_configPath = configPath;
_supportLocalization = supportLocalization;
_compConfig = MTConfigUtil.GetCompilationConfig(_configPath);
_referencedAssemblies = BuildManager.GetReferencedAssemblies(CompConfig);
_outputAssemblyName = outputAssemblyName;
}
示例10: CodeBlockBuilder
internal CodeBlockBuilder(CodeBlockType blockType, string content, int lineNumber, int column, VirtualPath virtualPath, bool encode) {
_content = content;
_blockType = blockType;
_column = column;
IsEncoded = encode;
Line = lineNumber;
VirtualPath = virtualPath;
}
示例11: CreateView
protected override IView CreateView(VirtualPath pathToView, IResourceResolver resolver)
{
var resource = resolver.GetResource(pathToView);
if (resource == null || !resource.IsFile) {
return null;
}
return new NustacheView(this, pathToView, resource, resolver);
}
示例12: GetChildTemplate
private Template GetChildTemplate(string path)
{
var newPath = new VirtualPath(path);
if (newPath.Type != VirtualPathType.AppRelative) {
throw new NotSupportedException("The Nustache view engine only supports app-relative paths at present.");
}
var result = _engine.GetView(newPath, _resolver) as NustacheView;
if (result == null) return null;
return result.Template;
}
示例13: DotLiquidView
public DotLiquidView(VirtualPath path, IResource resource, IResourceResolver resolver)
{
_path = path;
_resolver = resolver;
using (var stream = resource.Open())
using (var reader = new StreamReader(stream)) {
string tpl = reader.ReadToEnd();
_template = Template.Parse(tpl);
}
}
示例14: ReadBuildResultFromFile
internal BuildResult ReadBuildResultFromFile(VirtualPath virtualPath, string preservationFile, long hashCode, bool ensureIsUpToDate) {
// Ignore if the preservation file doesn't exist
if (!FileUtil.FileExists(preservationFile)) {
Debug.Trace("PreservationFileReader", "Can't find preservation file " + Path.GetFileName(preservationFile));
return null;
}
BuildResult result = null;
try {
result = ReadFileInternal(virtualPath, preservationFile, hashCode, ensureIsUpToDate);
}
catch (SecurityException) {
// We eat all exceptions, except for SecurityException's, because they
// are ususally a sign that something is not set up correctly, and we
// don't want to lose the stack (VSWhidbey 269566)
throw;
}
catch {
if (!_precompilationMode) {
// The preservation file can't be used, so get rid of it
Util.RemoveOrRenameFile(preservationFile);
}
}
return result;
}
示例15: AddDependency
protected void AddDependency(VirtualPath virtualPath) {
virtualPath = ResolveVirtualPath(virtualPath);
Debug.Trace("Template", "Parsed dependency: " + _virtualPath + " depends on " + virtualPath);
if (_virtualPathDependencies == null)
_virtualPathDependencies = new CaseInsensitiveStringSet();
_virtualPathDependencies.Add(virtualPath.VirtualPathString);
}