private VirtualDirectoryMapping(VirtualPath virtualDirectory, string physicalDirectory, bool isAppRoot, string configFileBaseName) {
            _virtualDirectory = virtualDirectory;
            _isAppRoot = isAppRoot;

            PhysicalDirectory = physicalDirectory;
            ConfigFileBaseName = configFileBaseName;
        }
    internal PageThemeBuildProvider(VirtualPath virtualDirPath) {
        _virtualDirPath = virtualDirPath;

        // 

        SetVirtualPath(virtualDirPath);
    }
    // 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;
    }
        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);
        }
    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;
    }
Exemple #6
0
		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);
		}               
 // 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;
 }
Exemple #8
0
 public NTFSDirectory(NTFSFileSystemProvider fileSystemProvider, string name, VirtualPath path)
 {
     this.fileSystemProvider = fileSystemProvider;
     Name = name;
     if (path.IsRoot)
         Name = string.Empty;
     Path = path;
 }
 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;
 }
 internal BuildProvidersCompiler(VirtualPath configPath, bool supportLocalization, 
     string outputAssemblyName) {
     _configPath = configPath;
     _supportLocalization = supportLocalization;
     _compConfig = MTConfigUtil.GetCompilationConfig(_configPath);
     _referencedAssemblies = BuildManager.GetReferencedAssemblies(CompConfig);
     _outputAssemblyName = outputAssemblyName;
 }
 internal BuildProvidersCompiler(VirtualPath configPath, bool supportLocalization,
     string generatedFilesDir, int index) {
     _configPath = configPath;
     _supportLocalization = supportLocalization;
     _compConfig = MTConfigUtil.GetCompilationConfig(_configPath);
     _referencedAssemblies = BuildManager.GetReferencedAssemblies(CompConfig, index);
     _generatedFilesDir = generatedFilesDir;
 }
    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);
    }
        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);
        }
    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;
    }
 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);
     }
 }
 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;
 }
    IHttpHandler IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType,
        VirtualPath virtualPath, String physicalPath) {

        // If it's a derived class, we must call the old (less efficient) GetHandler, in
        // case it was overriden
        if (_isInheritedInstance) {
            return GetHandler(context, requestType, virtualPath.VirtualPathString, physicalPath);
        }

        return GetHandlerHelper(context, requestType, virtualPath, physicalPath);
    }
Exemple #18
0
		protected override TextReader SpecialOpenReader (VirtualPath virtualPath, out string physicalPath)
		{
			// We need this hack to support out-of-application wsdl helpers
			if (virtualPath.IsFake) {
				physicalPath = virtualPath.PhysicalPath;
				return new StreamReader (physicalPath);
			} else
				physicalPath = null;
			
			return base.SpecialOpenReader (virtualPath, out physicalPath);
		}
        public IResource GetResource(VirtualPath path)
        {
            var resourceName = String.Join(".",
                new[] { RootNamespace }.Concat(path.Parts)
            );
            var name = this.Assembly.GetManifestResourceNames().FirstOrDefault
                (x => x.Equals(resourceName, StringComparison.OrdinalIgnoreCase));
            if (name == null) return null;

            return new AssemblyResource(this.Assembly, name);
        }
        public IResource GetResource(VirtualPath path)
        {
            if (_initialResource != null) {
                var result = _initialResource;
                _initialResource = null;
                return result;
            }

            var info = _registry.GetViewInfo(path);
            return info.Location(info.RelativePath, _serviceLocator);
        }
 public NustacheView(NustacheViewEngine engine, VirtualPath path, IResource resource, IResourceResolver resolver)
 {
     _engine = engine;
     _path = path;
     _resolver = resolver;
     using (var stream = resource.Open())
     using (var reader = new StreamReader(stream)) {
         Template = new Template();
         Template.Load(reader);
     }
 }
 public IResource GetResource(VirtualPath path)
 {
     var parts = new string[] { Root }.Concat(path.Parts).ToArray();
     var physicalPath = Path.Combine(parts);
     if (File.Exists(physicalPath)) {
         return new FileResource(physicalPath);
     }
     else {
         return null;
     }
 }
    IHttpHandler IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType,
        VirtualPath virtualPath, String physicalPath) {

        BuildResultCompiledType result = (BuildResultCompiledType)BuildManager.GetVPathBuildResult(
            context, virtualPath);

        // Make sure the type has the correct base class (ASURT 123677)
        Util.CheckAssignableType(typeof(IHttpHandler), result.ResultType);

        return (IHttpHandler) result.CreateInstance();
    }
    private IHttpHandler GetHandlerHelper(HttpContext context, string requestType,
        VirtualPath virtualPath, string physicalPath) {

        Page page = BuildManager.CreateInstanceFromVirtualPath(
            virtualPath, typeof(Page), context, true /*allowCrossApp*/) as Page;
        if (page == null)
            return null;

        page.TemplateControlVirtualPath = virtualPath;

        return page;
    }
        private void GetPathConfigFilenameWorker(string siteID, VirtualPath path, out string directory, out string baseName) {
            directory = MapPathCaching(siteID, path);
            if (directory != null) {
                baseName = HttpConfigurationSystem.WebConfigFileName;
            }
            else {
                baseName = null;
            }

            Debug.Trace("MapPath", "ProcHostMP.GetPathConfigFilename(" + siteID + ", " + path + ")\n" +
                    " result = " + directory + " and " + baseName + "\n");
        }
        public IResource GetResource(VirtualPath path)
        {
            var candidates =
                from mapping in _mappings
                let mine = mapping.Root.GetSubPath(path, true)
                where mine != null
                orderby mapping.Root.Parts.Count descending
                let resource = mapping.GetResource(mine)
                where resource != null
                select resource;

            return candidates.FirstOrDefault();
        }
        internal HttpHandlerAction FindMapping(String verb, VirtualPath path) {
            ValidateHandlers();

            for (int i = 0; i < Handlers.Count; i++) {
                HttpHandlerAction m = (HttpHandlerAction)Handlers[i];

                if (m.IsMatch(verb, path)) {
                    return m;
                }
            }

            return null;
        }
    #pragma warning restore 0649

    internal static BuildResult CreateBuildResultFromCode(BuildResultTypeCode code,
        VirtualPath virtualPath) {

        BuildResult ret = null;

        switch (code) {
            case BuildResultTypeCode.BuildResultCompiledAssembly:
                ret = new BuildResultCompiledAssembly();
                break;

            case BuildResultTypeCode.BuildResultCompiledType:
                ret = new BuildResultCompiledType();
                break;

            case BuildResultTypeCode.BuildResultCompiledTemplateType:
                ret = new BuildResultCompiledTemplateType();
                break;

            case BuildResultTypeCode.BuildResultCompiledGlobalAsaxType:
                ret = new BuildResultCompiledGlobalAsaxType();
                break;

            case BuildResultTypeCode.BuildResultCustomString:
                ret = new BuildResultCustomString();
                break;

            case BuildResultTypeCode.BuildResultMainCodeAssembly:
                ret = new BuildResultMainCodeAssembly();
                break;

            case BuildResultTypeCode.BuildResultResourceAssembly:
                ret = new BuildResultResourceAssembly();
                break;

            case BuildResultTypeCode.BuildResultCodeCompileUnit:
                ret = new BuildResultCodeCompileUnit();
                break;

            default:
                Debug.Assert(false, "code=" + code);
                return null;
        }

        ret.VirtualPath = virtualPath;

        // Set _nextUpToDateCheck to MinValue, to make sure the next call to IsUpToDate()
        // actually makes the check
        ret._nextUpToDateCheck = DateTime.MinValue;

        return ret;
    }
 public static Uri GetAbsoluteUrl(this IRequest request, VirtualPath path)
 {
     switch (path.Type)
     {
         case VirtualPathType.Absolute:
             return new Uri(request.Url, "/" + path.Path);
         case VirtualPathType.AppRelative:
             return new Uri(request.Url, "/" + request.Path.Append(path).Path);
         case VirtualPathType.RequestRelative:
             return new Uri(request.Url, path.Path);
         default:
             throw new ArgumentException("The path has an invalid type.", "path");
     }
 }
        public IView GetView(VirtualPath pathToView, IResourceResolver resolver)
        {
            if (_settings.Debug)
            {
                return CreateView(pathToView, resolver);
            }

            IView result = null;
            string key = pathToView.Path;
            if (!_cache.TryGetValue(key, out result)) {
                result = CreateView(pathToView, resolver);
                _cache[key] = result;
            }
            return result;
        }
        /*
         * Compile a nested .ascx file (a User Control) and return its Type
         */

        protected internal Type GetUserControlType(string virtualPath)
        {
            return(GetUserControlType(VirtualPath.Create(virtualPath)));
        }
 internal WebHandlerParser(HttpContext context, VirtualPath virtualPath, TextReader reader)
     : this(context, virtualPath, null, reader)
 {
 }
 internal Type GetReferencedType(VirtualPath virtualPath)
 {
     return(GetReferencedType(virtualPath, true /*allowNoCompile*/));
 }
        public DatePickerJsModuleIncludeDescriptor(RootModuleDescriptor module)
            : base(module, "bcms.datepicker")
        {
            Links = new IActionProjection[]
            {
                new JavaScriptModuleLink(this, "calendarImageUrl", VirtualPath.Combine(module.CssBasePath, "images", "icn-calendar.png"))
            };

            Globalization = new IActionProjection[]
            {
                new JavaScriptModuleGlobalization(this, "dateFormat", () =>
                {
                    // C# date format map to jQuery date picked.
                    // References:
                    //  * http://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
                    //  * http://www.phpeveryday.com/articles/jQuery-UI-Changing-the-date-format-for-Datepicker-P1023.html

                    var datePattern = Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern;

                    // Year:
                    if (datePattern.Contains("yyyy"))
                    {
                        // year (four digits).
                        datePattern = datePattern.Replace("yyyy", "yy");
                    }
                    else if (datePattern.Contains("yy"))
                    {
                        // year (two digits).
                        datePattern = datePattern.Replace("yy", "y");
                    }

                    // Month:
                    if (datePattern.Contains("MMMM"))
                    {
                        // long month name.
                        datePattern = datePattern.Replace("MMMM", "MM");
                    }
                    else if (datePattern.Contains("MMM"))
                    {
                        // short month name.
                        datePattern = datePattern.Replace("MMM", "M");
                    }
                    else if (datePattern.Contains("MM"))
                    {
                        // month of year (two digits).
                        datePattern = datePattern.Replace("MM", "mm");
                    }
                    else if (datePattern.Contains("M"))
                    {
                        // month of year (single digit where applicable).
                        datePattern = datePattern.Replace("M", "m");
                    }

                    // Day:
                    if (datePattern.Contains("dddd"))
                    {
                        // full day name.
                        datePattern = datePattern.Replace("dddd", "DD");
                    }
                    else if (datePattern.Contains("ddd"))
                    {
                        // short day name.
                        datePattern = datePattern.Replace("ddd", "D");
                    }

                    return(datePattern);
                }),
                new JavaScriptModuleGlobalization(this, "currentCulture", () => Thread.CurrentThread.CurrentCulture.Name),
            };
        }
 internal WebHandlerParser(HttpContext context, VirtualPath virtualPath, string physicalPath, TextReader reader)
     : base(context, virtualPath.Original, physicalPath, reader)
 {
 }
Exemple #36
0
 public ExpressionBuilderContext(string virtualPath)
 {
     _virtualPath = System.Web.VirtualPath.Create(virtualPath);
 }
Exemple #37
0
 protected VirtualFile(string virtualPath)
 {
     base._virtualPath = VirtualPath.Create(virtualPath);
 }
        internal override void ProcessDirective(string directiveName, IDictionary directive)
        {
            if (StringUtil.EqualsIgnoreCase(directiveName, "register"))
            {
                // Register directive

                // Get the tagprefix, which is required
                string tagPrefix = Util.GetAndRemoveNonEmptyIdentifierAttribute(directive,
                                                                                "tagprefix", true /*required*/);

                string tagName = Util.GetAndRemoveNonEmptyIdentifierAttribute(directive,
                                                                              _tagnameString, false /*required*/);

                VirtualPath src = Util.GetAndRemoveVirtualPathAttribute(directive,
                                                                        _sourceString, false /*required*/);

                string ns = Util.GetAndRemoveNonEmptyNoSpaceAttribute(directive,
                                                                      _namespaceString, false /*required*/);

                // An Assembly can optionally be specified (ASURT 61326/VSWhidbey 87050)
                string assemblyName = Util.GetAndRemoveNonEmptyAttribute(directive, "assembly",
                                                                         false /*required*/);

                RegisterDirectiveEntry registerEntry;
                if (tagName != null)
                {
                    // It's a user control registration

                    // 'src' is required
                    if (src == null)
                    {
                        throw new HttpException(SR.GetString(SR.Missing_attr, _sourceString));
                    }

                    // 'namespace' is not allowed
                    if (ns != null)
                    {
                        throw new HttpException(
                                  SR.GetString(SR.Invalid_attr, _namespaceString, "tagname"));
                    }

                    // 'assembly' is not allowed
                    if (assemblyName != null)
                    {
                        throw new HttpException(
                                  SR.GetString(SR.Invalid_attr, "assembly", "tagname"));
                    }

                    UserControlRegisterEntry ucRegisterEntry = new UserControlRegisterEntry(tagPrefix, tagName);
                    ucRegisterEntry.UserControlSource = src;
                    registerEntry = ucRegisterEntry;

                    TypeMapper.ProcessUserControlRegistration(ucRegisterEntry);
                }
                else if (src != null)
                {
                    // It's missing the tagname attribute.
                    throw new HttpException(SR.GetString(SR.Missing_attr, _tagnameString));
                }
                else
                {
                    // It's a namespace prefix registration
                    // 'namespace' is required
                    if (ns == null)
                    {
                        throw new HttpException(SR.GetString(SR.Missing_attr, _namespaceString));
                    }

                    TagNamespaceRegisterEntry nsRegisterEntry = new TagNamespaceRegisterEntry(tagPrefix, ns, assemblyName);
                    registerEntry = nsRegisterEntry;

                    TypeMapper.ProcessTagNamespaceRegistration(nsRegisterEntry);
                }

                registerEntry.Line        = _lineNumber;
                registerEntry.VirtualPath = CurrentVirtualPathString;

                // If there are some attributes left, fail
                Util.CheckUnknownDirectiveAttributes(directiveName, directive);
            }
            else
            {
                base.ProcessDirective(directiveName, directive);
            }
        }
        /*
         * Compile a .aspx/.ascx file and return its Type
         */

        protected Type GetReferencedType(string virtualPath)
        {
            return(GetReferencedType(VirtualPath.Create(virtualPath)));
        }
Exemple #40
0
 public string MapPath(string siteID, string path)
 {
     return(MapPath(siteID, VirtualPath.Create(path)));
 }
 internal static bool IsUserAllowedToPath(HttpContext context, VirtualPath virtualPath)
 {
     return(IsUserAllowedToFile(context, virtualPath.MapPath()));
 }
        public static bool CheckFileAccessForUser(String virtualPath, IntPtr token, string verb)
        {
            if (virtualPath == null)
            {
                throw new ArgumentNullException("virtualPath");
            }
            if (token == IntPtr.Zero)
            {
                throw new ArgumentNullException("token");
            }
            if (verb == null)
            {
                throw new ArgumentNullException("verb");
            }
            VirtualPath vPath = VirtualPath.Create(virtualPath);

            if (!vPath.IsWithinAppRoot)
            {
                throw new ArgumentException(SR.GetString(SR.Virtual_path_outside_application_not_supported), "virtualPath");
            }

            if (!s_EnabledDetermined)
            {
                if (HttpRuntime.UseIntegratedPipeline)
                {
                    s_Enabled = true; // always enabled in Integrated Mode
                }
                else
                {
                    HttpModulesSection modulesSection = RuntimeConfig.GetConfig().HttpModules;
                    int len = modulesSection.Modules.Count;
                    for (int iter = 0; iter < len; iter++)
                    {
                        HttpModuleAction module = modulesSection.Modules[iter];
                        if (Type.GetType(module.Type, false) == typeof(FileAuthorizationModule))
                        {
                            s_Enabled = true;
                            break;
                        }
                    }
                }
                s_EnabledDetermined = true;
            }
            if (!s_Enabled)
            {
                return(true);
            }
            ////////////////////////////////////////////////////////////
            // Step 3: Check the cache for the file-security-descriptor
            //        for the requested file
            bool freeDescriptor;
            FileSecurityDescriptorWrapper oSecDesc = GetFileSecurityDescriptorWrapper(vPath.MapPath(), out freeDescriptor);

            ////////////////////////////////////////////////////////////
            // Step 4: Check if access is allowed
            int iAccess = 3;

            if (verb == "GET" || verb == "POST" || verb == "HEAD" || verb == "OPTIONS")
            {
                iAccess = 1;
            }
            bool fAllowed = oSecDesc.IsAccessAllowed(token, iAccess);

            ////////////////////////////////////////////////////////////
            // Step 5: Free the security descriptor if adding to cache failed
            if (freeDescriptor)
            {
                oSecDesc.FreeSecurityDescriptor();
            }
            return(fAllowed);
        }
Exemple #43
0
        public override void GenerateCode(AssemblyBuilder assemblyBuilder)
        {
            string str2;

            if (!s_triedToGetWebRefType)
            {
                s_indigoWebRefProviderType = BuildManager.GetType("System.Web.Compilation.WCFBuildProvider", false);
                s_triedToGetWebRefType     = true;
            }
            if (s_indigoWebRefProviderType != null)
            {
                BuildProvider provider = (BuildProvider)HttpRuntime.CreateNonPublicInstance(s_indigoWebRefProviderType);
                provider.SetVirtualPath(base.VirtualPathObject);
                provider.GenerateCode(assemblyBuilder);
            }
            VirtualPath webRefDirectoryVirtualPath = HttpRuntime.WebRefDirectoryVirtualPath;
            string      virtualPath = this._vdir.VirtualPath;

            if (webRefDirectoryVirtualPath.VirtualPathString.Length == virtualPath.Length)
            {
                str2 = string.Empty;
            }
            else
            {
                string[] strArray = UrlPath.RemoveSlashFromPathIfNeeded(virtualPath).Substring(webRefDirectoryVirtualPath.VirtualPathString.Length).Split(new char[] { '/' });
                for (int i = 0; i < strArray.Length; i++)
                {
                    strArray[i] = Util.MakeValidTypeNameFromString(strArray[i]);
                }
                str2 = string.Join(".", strArray);
            }
            CodeNamespace          proxyCode     = new CodeNamespace(str2);
            WebReferenceCollection webReferences = new WebReferenceCollection();
            bool flag = false;

            foreach (VirtualFile file in this._vdir.Files)
            {
                if (UrlPath.GetExtension(file.VirtualPath).ToLower(CultureInfo.InvariantCulture) == ".discomap")
                {
                    string topLevelFilename          = HostingEnvironment.MapPath(file.VirtualPath);
                    DiscoveryClientProtocol protocol = new DiscoveryClientProtocol {
                        AllowAutoRedirect = true,
                        Credentials       = CredentialCache.DefaultCredentials
                    };
                    protocol.ReadAll(topLevelFilename);
                    WebReference reference        = new WebReference(protocol.Documents, proxyCode);
                    string       str5             = Path.ChangeExtension(UrlPath.GetFileName(file.VirtualPath), null);
                    string       appSettingUrlKey = str2 + "." + str5;
                    WebReference webReference     = new WebReference(protocol.Documents, proxyCode, reference.ProtocolName, appSettingUrlKey, null);
                    webReferences.Add(webReference);
                    flag = true;
                }
            }
            if (flag)
            {
                CodeCompileUnit codeCompileUnit = new CodeCompileUnit();
                codeCompileUnit.Namespaces.Add(proxyCode);
                WebReferenceOptions options = new WebReferenceOptions {
                    CodeGenerationOptions = CodeGenerationOptions.GenerateOldAsync | CodeGenerationOptions.GenerateNewAsync | CodeGenerationOptions.GenerateProperties,
                    Style   = ServiceDescriptionImportStyle.Client,
                    Verbose = true
                };
                ServiceDescriptionImporter.GenerateWebReferences(webReferences, assemblyBuilder.CodeDomProvider, codeCompileUnit, options);
                assemblyBuilder.AddCodeCompileUnit(this, codeCompileUnit);
            }
        }
Exemple #44
0
 internal GlobalPageThemeBuildProvider(VirtualPath virtualDirPath) : base(virtualDirPath)
 {
     this._virtualDirPath = virtualDirPath;
 }
Exemple #45
0
 internal BuildProvidersCompiler(VirtualPath configPath, string outputAssemblyName) :
     this(configPath, false, outputAssemblyName)
 {
 }
Exemple #46
0
 public void GetPathConfigFilename(
     string siteID, string path, out string directory, out string baseName)
 {
     GetPathConfigFilename(siteID, VirtualPath.Create(path), out directory, out baseName);
 }
Exemple #47
0
 public StaticResult(VirtualPath path)
 {
     this.Path = path;
 }
Exemple #48
0
 internal ExpressionBuilderContext(VirtualPath virtualPath)
 {
     _virtualPath = virtualPath;
 }
        internal Type GetReferencedType(VirtualPath virtualPath, bool allowNoCompile)
        {
            virtualPath = ResolveVirtualPath(virtualPath);

            // If we have a page parser filter, make sure the reference is allowed
            if (_pageParserFilter != null && !_pageParserFilter.AllowVirtualReference(CompConfig, virtualPath))
            {
                ProcessError(SR.GetString(SR.Reference_not_allowed, virtualPath));
            }

            BuildResult result = null;
            Type        t      = null;

            try {
                result = BuildManager.GetVPathBuildResult(virtualPath);
            }
            catch (HttpCompileException e) {
                // Add the path depdencies properly so we know when
                // to invalidate the cached result.
                if (e.VirtualPathDependencies != null)
                {
                    foreach (string vPath in e.VirtualPathDependencies)
                    {
                        AddSourceDependency(VirtualPath.Create(vPath));
                    }
                }

                throw;
            }
            catch {
                // Add the virtualPath to the dependency so that
                // we know when to check again. This could happen if the
                // virtualPath points to a file not created yet.
                // This only affects designtime code path since we do want to return
                // partial result even if there is an error, and that result is
                // cached. VSWhidbey 372585
                if (IgnoreParseErrors)
                {
                    AddSourceDependency(virtualPath);
                }

                throw;
            }

            // Is it a no-compile page/uc
            BuildResultNoCompileTemplateControl noCompileResult = result as BuildResultNoCompileTemplateControl;

            if (noCompileResult != null)
            {
                // If no-compile is not acceptable, return null
                if (!allowNoCompile)
                {
                    return(null);
                }

                // In the no-compile case, use the base type, since we don't compile a type
                t = noCompileResult.BaseType;
            }
            else if (result is BuildResultCompiledType)
            {
                BuildResultCompiledType compiledResult = (BuildResultCompiledType)result;
                Debug.Assert(compiledResult != null);

                t = compiledResult.ResultType;
            }
            else
            {
                throw new HttpException(SR.GetString(SR.Invalid_typeless_reference, _sourceString));
            }

            Debug.Assert(t != null);

            // Add a dependency on the Type
            AddTypeDependency(t);

            // Add a dependency on the BuildResult
            AddBuildResultDependency(result);

            return(t);
        }