internal static RuntimeConfig GetConfig(VirtualPath path)
 {
     if (!HttpConfigurationSystem.UseHttpConfigurationSystem)
     {
         return GetClientRuntimeConfig();
     }
     return CachedPathData.GetVirtualPathData(path, true).RuntimeConfig;
 }
 internal static RuntimeConfig GetRootWebConfig()
 {
     if (!HttpConfigurationSystem.UseHttpConfigurationSystem)
     {
         return GetClientRuntimeConfig();
     }
     return CachedPathData.GetRootWebPathData().RuntimeConfig;
 }
Ejemplo n.º 3
0
        //
        // GetMachineConfig() - returns the machine configuration.
        //
        // For config derived from ConfigurationSection, this will either
        // return a non-null object or throw an exception.
        //
        // For config implemented with IConfigurationSectionHandler, this
        // may return null, non-null, or throw an exception.
        //
        static internal RuntimeConfig GetMachineConfig()
        {
            if (!HttpConfigurationSystem.UseHttpConfigurationSystem)
            {
                return(GetClientRuntimeConfig());
            }

            return(CachedPathData.GetMachinePathData().RuntimeConfig);
        }
        // GetAppSection
        //
        // Get the Config for a specific path
        //
        static internal object GetApplicationSection(string sectionName)
        {
            Debug.Assert(UseHttpConfigurationSystem, "UseHttpConfigurationSystem");

            CachedPathData pathData;

            pathData = CachedPathData.GetApplicationPathData();

            return(pathData.ConfigRecord.GetSection(sectionName));
        }
        // GetSection
        //
        // Get the Config for a specific path
        //
        static internal object GetSection(string sectionName, VirtualPath path)
        {
            Debug.Assert(UseHttpConfigurationSystem, "UseHttpConfigurationSystem");

            CachedPathData pathData;

            pathData = CachedPathData.GetVirtualPathData(path, true);

            return(pathData.ConfigRecord.GetSection(sectionName));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Calculates the paths and stores them into a structure given by the argument <paramref name="cachedPathData"/>.
        /// </summary>
        /// <param name="scatterSymbol">ScatterSymbol, already processed via <see cref="CalculateOverriddenScatterSymbol"/></param>
        /// <param name="symbolSize">The size of the symbol for which to calculate the paths.</param>
        /// <param name="cachedPathData">The cached path data.</param>
        /// <returns>True if new paths have been calculated; false if the previously cached data could be used.</returns>
        private bool CalculatePaths(IScatterSymbol scatterSymbol, double symbolSize, ref CachedPathData cachedPathData)
        {
            if (symbolSize == cachedPathData.SymbolSize)
            {
                return(false); // we assume that the structure already contains valid data.
            }
            cachedPathData.SymbolSize = symbolSize;
            cachedPathData.FillPath   = cachedPathData.FramePath = cachedPathData.InsetPath = null;

            if (scatterSymbol is NoSymbol)
            {
                return(true);
            }

            double?overrideRelativeStructureWidth = null;

            if (_overrideStructureWidthOffset.HasValue || _overrideStructureWidthFactor.HasValue)
            {
                overrideRelativeStructureWidth = (_overrideStructureWidthFactor ?? 0) + (_overrideStructureWidthOffset ?? 0) / symbolSize;
            }
            scatterSymbol.CalculatePolygons(overrideRelativeStructureWidth, out var framePolygon, out var insetPolygon, out var fillPolygon);

            // calculate the path only once
            if (null != insetPolygon)
            {
                cachedPathData.InsetPath = new GraphicsPath();
                foreach (var list in insetPolygon)
                {
                    cachedPathData.InsetPath.AddPolygon(ToPointFArray(list, symbolSize));
                }
            }

            if (null != fillPolygon)
            {
                cachedPathData.FillPath = new GraphicsPath();
                foreach (var list in fillPolygon)
                {
                    cachedPathData.FillPath.AddPolygon(ToPointFArray(list, symbolSize));
                }
            }

            if (null != framePolygon)
            {
                cachedPathData.FramePath = new GraphicsPath();
                foreach (var list in framePolygon)
                {
                    cachedPathData.FramePath.AddPolygon(ToPointFArray(list, symbolSize));
                }
            }

            return(true);
        }
Ejemplo n.º 7
0
        public void Paint(Graphics g, IPlotArea layer, Processed2DPlotData pdata, Processed2DPlotData prevItemData, Processed2DPlotData nextItemData)
        {
            // adjust the skip frequency if it was not set appropriate
            if (_skipFreq <= 0)
            {
                _skipFreq = 1;
            }

            if (_scatterSymbol is NoSymbol)
            {
                return;
            }

            var cachedPathData  = new CachedPathData();
            var cachedBrushData = new CachedBrushData();

            PlotRangeList rangeList = pdata.RangeList;

            PointF[] plotPositions = pdata.PlotPointsInAbsoluteLayerCoordinates;

            if (!_independentOnShiftingGroupStyles && (0 != _cachedLogicalShiftX || 0 != _cachedLogicalShiftY))
            {
                plotPositions = Processed2DPlotData.GetPlotPointsInAbsoluteLayerCoordinatesWithShift(pdata, layer, _cachedLogicalShiftX, _cachedLogicalShiftY);
            }

            // Calculate current scatterSymbol overridden with frame and inset
            var scatterSymbol = CalculateOverriddenScatterSymbol();

            if (_ignoreMissingDataPoints)
            {
                // in case we ignore the missing points, all ranges can be plotted
                // as one range, i.e. continuously
                // for this, we create the totalRange, which contains all ranges
                var totalRange = new PlotRangeCompound(rangeList);
                PaintOneRange(g, layer, plotPositions, totalRange, scatterSymbol, ref cachedPathData, ref cachedBrushData);
            }
            else // we not ignore missing points, so plot all ranges separately
            {
                for (int i = 0; i < rangeList.Count; i++)
                {
                    PaintOneRange(g, layer, plotPositions, rangeList[i], scatterSymbol, ref cachedPathData, ref cachedBrushData);
                }
            }

            cachedBrushData.Clear();
            cachedPathData.Clear();
        }
Ejemplo n.º 8
0
        public RectangleF PaintSymbol(System.Drawing.Graphics g, System.Drawing.RectangleF bounds)
        {
            if (_scatterSymbol is NoSymbol)
            {
                return(bounds);
            }

            var cachedPathData  = new CachedPathData();
            var cachedBrushData = new CachedBrushData();
            var scatterSymbol   = CalculateOverriddenScatterSymbol();

            CalculatePaths(scatterSymbol, _symbolSize, ref cachedPathData);
            CalculateBrushes(scatterSymbol, _color, cachedPathData, ref cachedBrushData);

            GraphicsState gs = g.Save();

            g.TranslateTransform(bounds.X + 0.5f * bounds.Width, bounds.Y + 0.5f * bounds.Height);

            if (null != cachedPathData.InsetPath)
            {
                g.FillPath(cachedBrushData.InsetBrush, cachedPathData.InsetPath);
            }

            if (null != cachedPathData.FillPath)
            {
                g.FillPath(cachedBrushData.FillBrush, cachedPathData.FillPath);
            }

            if (null != cachedPathData.FramePath)
            {
                g.FillPath(cachedBrushData.FrameBrush, cachedPathData.FramePath);
            }

            cachedBrushData.Clear();
            cachedPathData.Clear();

            g.Restore(gs);

            if (SymbolSize > bounds.Height)
            {
                bounds.Inflate(0, (float)(SymbolSize - bounds.Height));
            }

            return(bounds);
        }
Ejemplo n.º 9
0
        private static NameValueCollection GetAppSettingsSection()
        {
            // DevDiv #353926 - Fall back to reading App.config if System.Web types are being consumed outside an ASP.NET application
            if (!HostingEnvironment.IsHosted)
            {
                return(ConfigurationManager.AppSettings);
            }

            // Check the app-level config. Ignore configuration errors
            CachedPathData appPathData = CachedPathData.GetApplicationPathData();

            if (appPathData != null && appPathData.ConfigRecord != null)
            {
                return(appPathData.ConfigRecord.GetSection("appSettings") as NameValueCollection);
            }

            // nothing found
            return(null);
        }
Ejemplo n.º 10
0
		public RectangleF PaintSymbol(System.Drawing.Graphics g, System.Drawing.RectangleF bounds)
		{
			if (_scatterSymbol is NoSymbol)
				return bounds;

			var cachedPathData = new CachedPathData();
			var cachedBrushData = new CachedBrushData();
			var scatterSymbol = CalculateOverriddenScatterSymbol();
			CalculatePaths(scatterSymbol, _symbolSize, ref cachedPathData);
			CalculateBrushes(scatterSymbol, _color, cachedPathData, ref cachedBrushData);

			GraphicsState gs = g.Save();
			g.TranslateTransform(bounds.X + 0.5f * bounds.Width, bounds.Y + 0.5f * bounds.Height);

			if (null != cachedPathData.InsetPath)
				g.FillPath(cachedBrushData.InsetBrush, cachedPathData.InsetPath);

			if (null != cachedPathData.FillPath)
				g.FillPath(cachedBrushData.FillBrush, cachedPathData.FillPath);

			if (null != cachedPathData.FramePath)
				g.FillPath(cachedBrushData.FrameBrush, cachedPathData.FramePath);

			cachedBrushData.Clear();
			cachedPathData.Clear();

			g.Restore(gs);

			if (this.SymbolSize > bounds.Height)
				bounds.Inflate(0, (float)(this.SymbolSize - bounds.Height));

			return bounds;
		}
Ejemplo n.º 11
0
        private static bool IsUserAllowedToFile(HttpContext context, string fileName)
        {
            ////////////////////////////////////////////////////////////
            // Step 1: Check if this is WindowsLogin
            // It's not a windows authenticated user: allow access
            if (!IsWindowsIdentity(context))
            {
                return(true);
            }

            if (fileName == null)
            {
                fileName = context.Request.PhysicalPathInternal;
            }

            bool           isAnonymousUser = (context.User == null || !context.User.Identity.IsAuthenticated);
            CachedPathData pathData        = null;
            int            iAccess         = 3;
            HttpVerb       verb            = context.Request.HttpVerb;

            if (verb == HttpVerb.GET ||
                verb == HttpVerb.POST ||
                verb == HttpVerb.HEAD ||
                context.Request.HttpMethod == "OPTIONS")
            {
                iAccess = 1;

                ////////////////////////////////////////////////////////////
                // iff it's a GET or POST or HEAD or OPTIONs verb, we can use the cached result
                if (!CachedPathData.DoNotCacheUrlMetadata)
                {
                    pathData = context.GetConfigurationPathData();
                    // as a perf optimization, we cache results for annoymous access
                    //  to CachedPathData.PhysicalPath, and avoid doing the full check
                    if (!StringUtil.EqualsIgnoreCase(fileName, pathData.PhysicalPath))
                    {
                        // set to null so we don't attempt to update it after the full check below
                        pathData = null;
                    }
                    else
                    {
                        if (pathData.AnonymousAccessAllowed)   // fast path when everyone has access
                        {
                            Debug.Trace("FAM", "IsUserAllowedToFile: pathData.AnonymousAccessAllowed");
                            return(true);
                        }
                        if (pathData.AnonymousAccessChecked && isAnonymousUser)   // fast path for anonymous user
                        // another thread could be modifying CachedPathData, so return the
                        // value of AnonymousAccessAllowed instead of assuming it is false
                        {
                            Debug.Trace("FAM", "IsUserAllowedToFile: pathData.AnonymousAccessChecked && isAnonymousUser");
                            return(pathData.AnonymousAccessAllowed);
                        }
                    }
                }
            }


            // Step 3: Check the cache for the file-security-descriptor
            //        for the requested file
            bool freeDescriptor;
            FileSecurityDescriptorWrapper oSecDesc = GetFileSecurityDescriptorWrapper(fileName, out freeDescriptor);

            ////////////////////////////////////////////////////////////
            // Step 4: Check if access is allowed
            bool fAllowed;

            if (iAccess == 1)   // iff it's a GET or POST or HEAD or OPTIONs verb, we can cache the result
            {
                if (oSecDesc._AnonymousAccessChecked && isAnonymousUser)
                {
                    Debug.Trace("FAM", "IsUserAllowedToFile: oSecDesc._AnonymousAccessChecked && isAnonymousUser");
                    fAllowed = oSecDesc._AnonymousAccess;
                }
                else
                {
                    Debug.Trace("FAM", "IsUserAllowedToFile: calling oSecDesc.IsAccessAllowed with iAccess == 1");
                    fAllowed = oSecDesc.IsAccessAllowed(context.WorkerRequest.GetUserToken(), iAccess);
                }

                if (!oSecDesc._AnonymousAccessChecked && isAnonymousUser)
                {
                    oSecDesc._AnonymousAccess        = fAllowed;
                    oSecDesc._AnonymousAccessChecked = true;
                }

                // Cache results in CachedPathData if the file exists and annonymous access has been checked.
                // Note that if CachedPathData.Exists is false, then it does not have a dependency on the file path,
                // and won't be expunged if the file changes.
                if (pathData != null && pathData.Exists && oSecDesc._AnonymousAccessChecked)
                {
                    Debug.Trace("FAM", "IsUserAllowedToFile: updating pathData");
                    pathData.AnonymousAccessAllowed = oSecDesc._AnonymousAccess;
                    pathData.AnonymousAccessChecked = true;
                }
            }
            else
            {
                Debug.Trace("FAM", "IsUserAllowedToFile: calling oSecDesc.IsAccessAllowed with iAccess != 1");
                fAllowed = oSecDesc.IsAccessAllowed(context.WorkerRequest.GetUserToken(), iAccess); // don't cache this anywhere
            }

            ////////////////////////////////////////////////////////////
            // Step 5: Free the security descriptor if adding to cache failed
            if (freeDescriptor)
            {
                oSecDesc.FreeSecurityDescriptor();
            }

            if (fAllowed)
            {
                WebBaseEvent.RaiseSystemEvent(null, WebEventCodes.AuditFileAuthorizationSuccess);
            }
            else
            {
                if (!isAnonymousUser)
                {
                    WebBaseEvent.RaiseSystemEvent(null, WebEventCodes.AuditFileAuthorizationFailure);
                }
            }

            return(fAllowed);
        }
Ejemplo n.º 12
0
		/// <summary>
		/// Calculates the paths and stores them into a structure given by the argument <paramref name="cachedPathData"/>.
		/// </summary>
		/// <param name="scatterSymbol">ScatterSymbol, already processed via <see cref="CalculateOverriddenScatterSymbol"/></param>
		/// <param name="symbolSize">The size of the symbol for which to calculate the paths.</param>
		/// <param name="cachedPathData">The cached path data.</param>
		/// <returns>True if new paths have been calculated; false if the previously cached data could be used.</returns>
		private bool CalculatePaths(IScatterSymbol scatterSymbol, double symbolSize, ref CachedPathData cachedPathData)
		{
			if (symbolSize == cachedPathData.SymbolSize)
				return false; // we assume that the structure already contains valid data.

			cachedPathData.SymbolSize = symbolSize;
			cachedPathData.FillPath = cachedPathData.FramePath = cachedPathData.InsetPath = null;

			if (scatterSymbol is NoSymbol)
			{
				return true;
			}

			List<List<ClipperLib.IntPoint>> insetPolygon = null;
			List<List<ClipperLib.IntPoint>> framePolygon = null;
			List<List<ClipperLib.IntPoint>> fillPolygon = null;

			double? overrideRelativeStructureWidth = null;
			if (_overrideStructureWidthOffset.HasValue || _overrideStructureWidthFactor.HasValue)
			{
				overrideRelativeStructureWidth = (_overrideStructureWidthFactor ?? 0) + (_overrideStructureWidthOffset ?? 0) / symbolSize;
			}
			scatterSymbol.CalculatePolygons(overrideRelativeStructureWidth, out framePolygon, out insetPolygon, out fillPolygon);

			// calculate the path only once
			if (null != insetPolygon)
			{
				cachedPathData.InsetPath = new GraphicsPath();
				foreach (var list in insetPolygon)
					cachedPathData.InsetPath.AddPolygon(ToPointFArray(list, symbolSize));
			}

			if (null != fillPolygon)
			{
				cachedPathData.FillPath = new GraphicsPath();
				foreach (var list in fillPolygon)
					cachedPathData.FillPath.AddPolygon(ToPointFArray(list, symbolSize));
			}

			if (null != framePolygon)
			{
				cachedPathData.FramePath = new GraphicsPath();
				foreach (var list in framePolygon)
					cachedPathData.FramePath.AddPolygon(ToPointFArray(list, symbolSize));
			}

			return true;
		}
Ejemplo n.º 13
0
        /// <summary>
        /// Calculates the brushes.
        /// </summary>
        /// <param name="scatterSymbol">ScatterSymbol, already processed via <see cref="CalculateOverriddenScatterSymbol"/></param>
        /// <param name="plotColor">The current plot color.</param>
        /// <param name="cachedPathData">The cached path data.</param>
        /// <param name="cachedBrushData">Cached brush data, which will be filled-in during this call..</param>
        /// <returns>True if new cached brush data were calculated; false if the cached data were up-to-date.</returns>
        private bool CalculateBrushes(IScatterSymbol scatterSymbol, NamedColor plotColor, CachedPathData cachedPathData, ref CachedBrushData cachedBrushData)
        {
            if (plotColor == cachedBrushData.PlotColor)
            {
                return(false); // cached data valid and could be reused;
            }
            cachedBrushData.Clear();
            cachedBrushData.PlotColor = plotColor;

            var plotColorInfluence = _overridePlotColorInfluence ?? scatterSymbol.PlotColorInfluence;

            if (null != cachedPathData.InsetPath)
            {
                var insetColor = _overrideInsetColor ?? scatterSymbol.Inset.Color;
                if (plotColorInfluence.HasFlag(PlotColorInfluence.InsetColorFull))
                {
                    insetColor = plotColor;
                }
                else if (plotColorInfluence.HasFlag(PlotColorInfluence.InsetColorPreserveAlpha))
                {
                    insetColor = plotColor.NewWithAlphaValue(insetColor.Color.A);
                }

                cachedBrushData.InsetBrush = new SolidBrush(insetColor);
            }

            if (null != cachedPathData.FillPath)
            {
                var fillColor = _overrideFillColor ?? scatterSymbol.FillColor;
                if (plotColorInfluence.HasFlag(PlotColorInfluence.FillColorFull))
                {
                    fillColor = plotColor;
                }
                else if (plotColorInfluence.HasFlag(PlotColorInfluence.FillColorPreserveAlpha))
                {
                    fillColor = plotColor.NewWithAlphaValue(fillColor.Color.A);
                }

                cachedBrushData.FillBrush = new SolidBrush(fillColor);
            }

            if (null != cachedPathData.FramePath)
            {
                var frameColor = _overrideFrameColor ?? scatterSymbol.Frame.Color;
                if (plotColorInfluence.HasFlag(PlotColorInfluence.FrameColorFull))
                {
                    frameColor = plotColor;
                }
                else if (plotColorInfluence.HasFlag(PlotColorInfluence.FrameColorPreserveAlpha))
                {
                    frameColor = plotColor.NewWithAlphaValue(frameColor.Color.A);
                }

                cachedBrushData.FrameBrush = new SolidBrush(frameColor);
            }

            return(true);
        }
Ejemplo n.º 14
0
        private void PaintOneRange(
            Graphics g,
            IPlotArea layer,
            PointF[] plotPositions,
            IPlotRange range,
            IScatterSymbol scatterSymbol,
            ref CachedPathData cachedPathData,
            ref CachedBrushData cachedBrushData)
        {
            var ptArray = plotPositions;

            float xpos = 0, ypos = 0;
            float xdiff, ydiff;

            int originalIndex;

            // save the graphics stat since we have to translate the origin
            System.Drawing.Drawing2D.GraphicsState gs = g.Save();

            if (null == _cachedSymbolSizeForIndexFunction && null == _cachedColorForIndexFunction) // using a constant symbol size
            {
                // calculate the path only once
                CalculatePaths(scatterSymbol, _symbolSize, ref cachedPathData);
                CalculateBrushes(scatterSymbol, _color, cachedPathData, ref cachedBrushData);

                for (int plotPointIndex = range.LowerBound; plotPointIndex < range.UpperBound; plotPointIndex += _skipFreq)
                {
                    xdiff = ptArray[plotPointIndex].X - xpos;
                    ydiff = ptArray[plotPointIndex].Y - ypos;
                    xpos  = ptArray[plotPointIndex].X;
                    ypos  = ptArray[plotPointIndex].Y;
                    g.TranslateTransform(xdiff, ydiff);

                    if (null != cachedPathData.InsetPath)
                    {
                        g.FillPath(cachedBrushData.InsetBrush, cachedPathData.InsetPath);
                    }

                    if (null != cachedPathData.FillPath)
                    {
                        g.FillPath(cachedBrushData.FillBrush, cachedPathData.FillPath);
                    }

                    if (null != cachedPathData.FramePath)
                    {
                        g.FillPath(cachedBrushData.FrameBrush, cachedPathData.FramePath);
                    }
                } // end for
            }
            else  // using a variable symbol size or variable symbol color
            {
                CalculatePaths(scatterSymbol, _symbolSize, ref cachedPathData);
                CalculateBrushes(scatterSymbol, _color, cachedPathData, ref cachedBrushData);

                for (int plotPointIndex = range.LowerBound; plotPointIndex < range.UpperBound; plotPointIndex += _skipFreq)
                {
                    originalIndex = range.GetOriginalRowIndexFromPlotPointIndex(plotPointIndex);

                    if (null == _cachedColorForIndexFunction)
                    {
                        double customSymbolSize = _cachedSymbolSizeForIndexFunction(originalIndex);
                        CalculatePaths(scatterSymbol, customSymbolSize, ref cachedPathData);
                    }
                    else
                    {
                        double customSymbolSize  = null == _cachedSymbolSizeForIndexFunction ? _symbolSize : _cachedSymbolSizeForIndexFunction(originalIndex);
                        var    customSymbolColor = _cachedColorForIndexFunction(originalIndex);
                        CalculatePaths(scatterSymbol, customSymbolSize, ref cachedPathData);
                        CalculateBrushes(scatterSymbol, NamedColor.FromArgb(customSymbolColor.A, customSymbolColor.R, customSymbolColor.G, customSymbolColor.B), cachedPathData, ref cachedBrushData);
                    }

                    xdiff = ptArray[plotPointIndex].X - xpos;
                    ydiff = ptArray[plotPointIndex].Y - ypos;
                    xpos  = ptArray[plotPointIndex].X;
                    ypos  = ptArray[plotPointIndex].Y;
                    g.TranslateTransform(xdiff, ydiff);

                    if (null != cachedPathData.InsetPath)
                    {
                        g.FillPath(cachedBrushData.InsetBrush, cachedPathData.InsetPath);
                    }

                    if (null != cachedPathData.FillPath)
                    {
                        g.FillPath(cachedBrushData.FillBrush, cachedPathData.FillPath);
                    }

                    if (null != cachedPathData.FramePath)
                    {
                        g.FillPath(cachedBrushData.FrameBrush, cachedPathData.FramePath);
                    }
                }
            }

            g.Restore(gs); // Restore the graphics state
        }
 private static void EnsureSettingsLoaded()
 {
     if (!_settingsInitialized)
     {
         lock (_appSettingsLock)
         {
             if (!_settingsInitialized)
             {
                 NameValueCollection section = null;
                 try
                 {
                     CachedPathData applicationPathData = CachedPathData.GetApplicationPathData();
                     if ((applicationPathData != null) && (applicationPathData.ConfigRecord != null))
                     {
                         section = applicationPathData.ConfigRecord.GetSection("appSettings") as NameValueCollection;
                     }
                 }
                 finally
                 {
                     if ((section == null) || !bool.TryParse(section["aspnet:UseHostHeaderForRequestUrl"], out _useHostHeaderForRequestUrl))
                     {
                         _useHostHeaderForRequestUrl = false;
                     }
                     if ((section == null) || !bool.TryParse(section["aspnet:ScriptResourceAllowNonJsFiles"], out _scriptResourceAllowNonJsFiles))
                     {
                         _scriptResourceAllowNonJsFiles = false;
                     }
                     if ((section == null) || !bool.TryParse(section["aspnet:UseLegacyEncryption"], out _useLegacyEncryption))
                     {
                         _useLegacyEncryption = false;
                     }
                     if ((section == null) || !bool.TryParse(section["aspnet:UseLegacyMachineKeyEncryption"], out _useLegacyMachineKeyEncryption))
                     {
                         _useLegacyMachineKeyEncryption = false;
                     }
                     if ((section == null) || !bool.TryParse(section["aspnet:AllowRelaxedRelativeUrl"], out _allowRelaxedRelativeUrl))
                     {
                         _allowRelaxedRelativeUrl = false;
                     }
                     if ((section == null) || !bool.TryParse(section["aspnet:RestrictXmlControls"], out _restrictXmlControls))
                     {
                         _restrictXmlControls = false;
                     }
                     if ((section == null) || !bool.TryParse(section["aspnet:UseLegacyFormsAuthenticationTicketCompatibility"], out _useLegacyFormsAuthenticationTicketCompatibility))
                     {
                         _useLegacyFormsAuthenticationTicketCompatibility = false;
                     }
                     if ((section == null) || !bool.TryParse(section["aspnet:AllowRelaxedHttpUserName"], out _allowRelaxedHttpUserName))
                     {
                         _allowRelaxedHttpUserName = false;
                     }
                     if (((section == null) || !int.TryParse(section["aspnet:MaxHttpCollectionKeys"], out _maxHttpCollectionKeys)) || (_maxHttpCollectionKeys < 0))
                     {
                         _maxHttpCollectionKeys = 0x3e8;
                     }
                     if (((section == null) || !int.TryParse(section["aspnet:MaxJsonDeserializerMembers"], out _maxJsonDeserializerMembers)) || (_maxJsonDeserializerMembers < 0))
                     {
                         _maxJsonDeserializerMembers = 0x3e8;
                     }
                     _settingsInitialized = true;
                 }
             }
         }
     }
 }
 internal static object GetSection(string sectionName, VirtualPath path)
 {
     return(CachedPathData.GetVirtualPathData(path, true).ConfigRecord.GetSection(sectionName));
 }
Ejemplo n.º 17
0
		public void Paint(Graphics g, IPlotArea layer, Processed2DPlotData pdata, Processed2DPlotData prevItemData, Processed2DPlotData nextItemData)
		{
			// adjust the skip frequency if it was not set appropriate
			if (_skipFreq <= 0)
				_skipFreq = 1;

			if (this._scatterSymbol is NoSymbol)
				return;

			CachedPathData cachedPathData = new CachedPathData();
			CachedBrushData cachedBrushData = new CachedBrushData();

			PlotRangeList rangeList = pdata.RangeList;
			PointF[] plotPositions = pdata.PlotPointsInAbsoluteLayerCoordinates;

			if (!_independentOnShiftingGroupStyles && (0 != _cachedLogicalShiftX || 0 != _cachedLogicalShiftY))
			{
				plotPositions = Processed2DPlotData.GetPlotPointsInAbsoluteLayerCoordinatesWithShift(pdata, layer, _cachedLogicalShiftX, _cachedLogicalShiftY);
			}



			// Calculate current scatterSymbol overridden with frame and inset
			var scatterSymbol = CalculateOverriddenScatterSymbol();


			if (this._ignoreMissingDataPoints)
			{
				// in case we ignore the missing points, all ranges can be plotted
				// as one range, i.e. continuously
				// for this, we create the totalRange, which contains all ranges
				var totalRange = new PlotRangeCompound(rangeList);
				this.PaintOneRange(g, layer, plotPositions, totalRange, scatterSymbol, ref cachedPathData, ref cachedBrushData);
			}
			else // we not ignore missing points, so plot all ranges separately
			{
				for (int i = 0; i < rangeList.Count; i++)
				{
					this.PaintOneRange(g, layer, plotPositions, rangeList[i], scatterSymbol, ref cachedPathData, ref cachedBrushData);
				}
			}


			cachedBrushData.Clear();
			cachedPathData.Clear();
		}
Ejemplo n.º 18
0
		private void PaintOneRange(
			Graphics g,
			IPlotArea layer,
			PointF[] plotPositions,
			IPlotRange range,
			IScatterSymbol scatterSymbol,
			ref CachedPathData cachedPathData,
			ref CachedBrushData cachedBrushData)
		{
			var ptArray = plotPositions;

			float xpos = 0, ypos = 0;
			float xdiff, ydiff;

			int originalIndex;

			// save the graphics stat since we have to translate the origin
			System.Drawing.Drawing2D.GraphicsState gs = g.Save();

			if (null == _cachedSymbolSizeForIndexFunction && null == _cachedColorForIndexFunction) // using a constant symbol size
			{
				// calculate the path only once
				CalculatePaths(scatterSymbol, _symbolSize, ref cachedPathData);
				CalculateBrushes(scatterSymbol, _color, cachedPathData, ref cachedBrushData);



				for (int plotPointIndex = range.LowerBound; plotPointIndex < range.UpperBound; plotPointIndex += _skipFreq)
				{
					xdiff = ptArray[plotPointIndex].X - xpos;
					ydiff = ptArray[plotPointIndex].Y - ypos;
					xpos = ptArray[plotPointIndex].X;
					ypos = ptArray[plotPointIndex].Y;
					g.TranslateTransform(xdiff, ydiff);

					if (null != cachedPathData.InsetPath)
						g.FillPath(cachedBrushData.InsetBrush, cachedPathData.InsetPath);

					if (null != cachedPathData.FillPath)
						g.FillPath(cachedBrushData.FillBrush, cachedPathData.FillPath);

					if (null != cachedPathData.FramePath)
						g.FillPath(cachedBrushData.FrameBrush, cachedPathData.FramePath);
				} // end for


			}
			else // using a variable symbol size or variable symbol color
			{
				CalculatePaths(scatterSymbol, _symbolSize, ref cachedPathData);
				CalculateBrushes(scatterSymbol, _color, cachedPathData, ref cachedBrushData);

				for (int plotPointIndex = range.LowerBound; plotPointIndex < range.UpperBound; plotPointIndex += _skipFreq)
				{
					originalIndex = range.GetOriginalRowIndexFromPlotPointIndex(plotPointIndex);

					if (null == _cachedColorForIndexFunction)
					{
						double customSymbolSize = _cachedSymbolSizeForIndexFunction(originalIndex);
						CalculatePaths(scatterSymbol, customSymbolSize, ref cachedPathData);
					}
					else
					{
						double customSymbolSize = null == _cachedSymbolSizeForIndexFunction ? _symbolSize : _cachedSymbolSizeForIndexFunction(originalIndex);
						var customSymbolColor = _cachedColorForIndexFunction(originalIndex);
						CalculatePaths(scatterSymbol, customSymbolSize, ref cachedPathData);
						CalculateBrushes(scatterSymbol, NamedColor.FromArgb(customSymbolColor.A, customSymbolColor.R, customSymbolColor.G, customSymbolColor.B), cachedPathData, ref cachedBrushData);
					}

					xdiff = ptArray[plotPointIndex].X - xpos;
					ydiff = ptArray[plotPointIndex].Y - ypos;
					xpos = ptArray[plotPointIndex].X;
					ypos = ptArray[plotPointIndex].Y;
					g.TranslateTransform(xdiff, ydiff);

					if (null != cachedPathData.InsetPath)
						g.FillPath(cachedBrushData.InsetBrush, cachedPathData.InsetPath);

					if (null != cachedPathData.FillPath)
						g.FillPath(cachedBrushData.FillBrush, cachedPathData.FillPath);

					if (null != cachedPathData.FramePath)
						g.FillPath(cachedBrushData.FrameBrush, cachedPathData.FramePath);

				}
			}

			g.Restore(gs); // Restore the graphics state
		}
Ejemplo n.º 19
0
		/// <summary>
		/// Calculates the brushes.
		/// </summary>
		/// <param name="scatterSymbol">ScatterSymbol, already processed via <see cref="CalculateOverriddenScatterSymbol"/></param>
		/// <param name="plotColor">The current plot color.</param>
		/// <param name="cachedPathData">The cached path data.</param>
		/// <param name="cachedBrushData">Cached brush data, which will be filled-in during this call..</param>
		/// <returns>True if new cached brush data were calculated; false if the cached data were up-to-date.</returns>
		private bool CalculateBrushes(IScatterSymbol scatterSymbol, NamedColor plotColor, CachedPathData cachedPathData, ref CachedBrushData cachedBrushData)
		{
			if (plotColor == cachedBrushData.PlotColor)
				return false; // cached data valid and could be reused;

			cachedBrushData.Clear();
			cachedBrushData.PlotColor = plotColor;

			var plotColorInfluence = _overridePlotColorInfluence ?? scatterSymbol.PlotColorInfluence;

			if (null != cachedPathData.InsetPath)
			{
				var insetColor = _overrideInsetColor ?? scatterSymbol.Inset.Color;
				if (plotColorInfluence.HasFlag(PlotColorInfluence.InsetColorFull))
					insetColor = plotColor;
				else if (plotColorInfluence.HasFlag(PlotColorInfluence.InsetColorPreserveAlpha))
					insetColor = plotColor.NewWithAlphaValue(insetColor.Color.A);

				cachedBrushData.InsetBrush = new SolidBrush(insetColor);
			}

			if (null != cachedPathData.FillPath)
			{
				var fillColor = _overrideFillColor ?? scatterSymbol.FillColor;
				if (plotColorInfluence.HasFlag(PlotColorInfluence.FillColorFull))
					fillColor = plotColor;
				else if (plotColorInfluence.HasFlag(PlotColorInfluence.FillColorPreserveAlpha))
					fillColor = plotColor.NewWithAlphaValue(fillColor.Color.A);

				cachedBrushData.FillBrush = new SolidBrush(fillColor);
			}

			if (null != cachedPathData.FramePath)
			{
				var frameColor = _overrideFrameColor ?? scatterSymbol.Frame.Color;
				if (plotColorInfluence.HasFlag(PlotColorInfluence.FrameColorFull))
					frameColor = plotColor;
				else if (plotColorInfluence.HasFlag(PlotColorInfluence.FrameColorPreserveAlpha))
					frameColor = plotColor.NewWithAlphaValue(frameColor.Color.A);

				cachedBrushData.FrameBrush = new SolidBrush(frameColor);
			}

			return true;
		}
 internal static object GetApplicationSection(string sectionName)
 {
     return(CachedPathData.GetApplicationPathData().ConfigRecord.GetSection(sectionName));
 }
        private static bool IsUserAllowedToFile(HttpContext context, string fileName)
        {
            bool flag2;
            bool flag3;

            if (!IsWindowsIdentity(context))
            {
                return(true);
            }
            if (fileName == null)
            {
                fileName = context.Request.PhysicalPathInternal;
            }
            bool           flag = (context.User == null) || !context.User.Identity.IsAuthenticated;
            CachedPathData configurationPathData = null;
            int            iAccess  = 3;
            HttpVerb       httpVerb = context.Request.HttpVerb;

            if (((httpVerb == HttpVerb.GET) || (httpVerb == HttpVerb.POST)) || ((httpVerb == HttpVerb.HEAD) || (context.Request.HttpMethod == "OPTIONS")))
            {
                iAccess = 1;
                if (!CachedPathData.DoNotCacheUrlMetadata)
                {
                    configurationPathData = context.GetConfigurationPathData();
                    if (!StringUtil.EqualsIgnoreCase(fileName, configurationPathData.PhysicalPath))
                    {
                        configurationPathData = null;
                    }
                    else
                    {
                        if (configurationPathData.AnonymousAccessAllowed)
                        {
                            return(true);
                        }
                        if (configurationPathData.AnonymousAccessChecked && flag)
                        {
                            return(configurationPathData.AnonymousAccessAllowed);
                        }
                    }
                }
            }
            FileSecurityDescriptorWrapper fileSecurityDescriptorWrapper = GetFileSecurityDescriptorWrapper(fileName, out flag2);

            if (iAccess == 1)
            {
                if (fileSecurityDescriptorWrapper._AnonymousAccessChecked && flag)
                {
                    flag3 = fileSecurityDescriptorWrapper._AnonymousAccess;
                }
                else
                {
                    flag3 = fileSecurityDescriptorWrapper.IsAccessAllowed(context.WorkerRequest.GetUserToken(), iAccess);
                }
                if (!fileSecurityDescriptorWrapper._AnonymousAccessChecked && flag)
                {
                    fileSecurityDescriptorWrapper._AnonymousAccess        = flag3;
                    fileSecurityDescriptorWrapper._AnonymousAccessChecked = true;
                }
                if (((configurationPathData != null) && configurationPathData.Exists) && fileSecurityDescriptorWrapper._AnonymousAccessChecked)
                {
                    configurationPathData.AnonymousAccessAllowed = fileSecurityDescriptorWrapper._AnonymousAccess;
                    configurationPathData.AnonymousAccessChecked = true;
                }
            }
            else
            {
                flag3 = fileSecurityDescriptorWrapper.IsAccessAllowed(context.WorkerRequest.GetUserToken(), iAccess);
            }
            if (flag2)
            {
                fileSecurityDescriptorWrapper.FreeSecurityDescriptor();
            }
            if (flag3)
            {
                WebBaseEvent.RaiseSystemEvent(null, 0xfa4);
                return(flag3);
            }
            if (!flag)
            {
                WebBaseEvent.RaiseSystemEvent(null, 0xfa8);
            }
            return(flag3);
        }