/// <summary>
        ///     Determine <see cref="LocationFlags"/> for the current position.
        /// </summary>
        /// <returns>
        ///     <see cref="LocationFlags"/> describing the position.
        /// </returns>
        private LocationFlags ComputeLocationFlags(SourceNode node, int absolutePosition)
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }

            LocationFlags flags = LocationFlags.None;

            if (!node.IsValid)
            {
                flags |= LocationFlags.Invalid;
            }

            switch (node)
            {
            case SourceWhitespace whitespace:
            {
                flags |= LocationFlags.Whitespace | LocationFlags.Element | LocationFlags.Value;

                break;
            }
            }

            return(flags);
        }
Пример #2
0
 public bool CheckPointAgainstBlockedDirection(GridPoint point)
 {
     if (blockedLocationDirections.Count > 0)
     {
         LocationFlags pointFlags = CurrentLocationBoundary.ComputeOutCode(point.X, point.Y);
         return(blockedLocationDirections.Contains(pointFlags));
     }
     return(false);
 }
Пример #3
0
 internal PublishingContextStruct(LocationFlags location, ObjectType objectType, int maxExpressionLength, PublishingErrorContext errorContext)
 {
     m_location            = location;
     m_objectType          = objectType;
     m_objectName          = null;
     m_prefixPropertyName  = null;
     m_maxExpressionLength = maxExpressionLength;
     m_errorContext        = errorContext;
 }
Пример #4
0
 internal ExpressionContext(ExpressionType expressionType, ConstantType constantType, LocationFlags location, ObjectType objectType, string objectName, string propertyName, string dataSetName, bool parseExtended)
 {
     m_expressionType = expressionType;
     m_constantType   = constantType;
     m_location       = location;
     m_objectType     = objectType;
     m_objectName     = objectName;
     m_propertyName   = propertyName;
     m_dataSetName    = dataSetName;
     m_parseExtended  = parseExtended;
 }
        /// <summary>
        /// Function for cheking if the trigger should cause a screenshot
        /// </summary>
        /// <param name="key">Optional, used for keypress</param>
        /// <returns>True if the rule should trigger</returns>
        public bool CheckTrigger(SButton key = SButton.None)
        {
#if DEBUG
            MTrace($"m_triggered = {m_triggered}");
#endif
            if (m_triggered)
            {
                return(false);
            }
            DateFlags     current_date     = GetDate();
            WeatherFlags  current_weather  = GetWeather();
            LocationFlags current_location = GetLocation();
            if (current_weather != (current_weather & Weather))
            {
                return(false);
            }
            if (current_location != (current_location & Location))
            {
                return(false);
            }
            if (current_date != (current_date & Days))
            {
                // Trigger will never be valid for this day,
                // wait for the next to reset.
                // Some mods can mess with weather
                m_triggered = true;
                return(false);
            }

            // Some mods can mess with time so don't set triggered flag
            if (!CheckTime(Game1.timeOfDay))
            {
                return(false);
            }

            // Keys is not a flags enum, only one can be set at a time
            if (Key != key)
            {
                return(false);
            }


            // If it is button based, allow another screenshot after this one for this day
            if (SButton.None == key)
            {
                m_triggered = true;
            }

            return(true);
        }
 public AutomaticSubtotalContext(AspNetCore.ReportingServices.ReportIntermediateFormat.Report report, List <ICreateSubtotals> createSubtotals, List <AspNetCore.ReportingServices.ReportIntermediateFormat.Grouping> domainScopeGroups, NameValidator reportItemNameValidator, NameValidator scopeNameValidator, NameValidator variableNameValidator, Dictionary <string, AspNetCore.ReportingServices.ReportIntermediateFormat.ISortFilterScope> reportScopes, List <AspNetCore.ReportingServices.ReportIntermediateFormat.ReportItemCollection> reportItemCollections, List <AspNetCore.ReportingServices.ReportIntermediateFormat.IAggregateHolder> aggregateHolders, List <AspNetCore.ReportingServices.ReportIntermediateFormat.IRunningValueHolder> runningValueHolders, Holder <int> variableSequenceIdCounter, Holder <int> textboxSequenceIdCounter, ScopeTree scopeTree)
 {
     this.m_createSubtotals         = createSubtotals;
     this.m_domainScopeGroups       = domainScopeGroups;
     this.m_reportItemNameValidator = reportItemNameValidator;
     this.m_scopeNameValidator      = scopeNameValidator;
     this.m_variableNameValidator   = variableNameValidator;
     this.m_report = report;
     this.m_variableSequenceIdCounter        = variableSequenceIdCounter;
     this.m_textboxSequenceIdCounter         = textboxSequenceIdCounter;
     this.m_dynamicWithStaticPeerEncountered = false;
     this.m_location          = LocationFlags.None;
     this.m_objectName        = null;
     this.m_objectType        = ObjectType.Tablix;
     this.m_currentDataRegion = null;
     this.m_cellLists         = null;
     this.m_tablixColumns     = null;
     this.m_rows                                = null;
     this.m_scopeNameMap                        = new Dictionary <string, string>(StringComparer.Ordinal);
     this.m_reportItemNameMap                   = new Dictionary <string, string>(StringComparer.Ordinal);
     this.m_aggregateMap                        = new Dictionary <string, string>(StringComparer.Ordinal);
     this.m_lookupMap                           = new Dictionary <string, string>(StringComparer.Ordinal);
     this.m_variableNameMap                     = new Dictionary <string, string>(StringComparer.Ordinal);
     this.m_currentScope                        = null;
     this.m_currentScopeBeingCloned             = null;
     this.m_startIndex                          = new Holder <int>();
     this.m_currentIndex                        = new Holder <int>();
     this.m_headerLevel                         = 0;
     this.m_originalColumnCount                 = 0;
     this.m_originalRowCount                    = 0;
     this.m_reportScopes                        = reportScopes;
     this.m_reportItemCollections               = reportItemCollections;
     this.m_aggregateHolders                    = aggregateHolders;
     this.m_runningValueHolders                 = runningValueHolders;
     this.m_expressionsWithReportItemReferences = new List <AspNetCore.ReportingServices.ReportIntermediateFormat.ExpressionInfo>();
     this.m_visibilitiesWithToggleToUpdate      = new List <AspNetCore.ReportingServices.ReportIntermediateFormat.Visibility>();
     this.m_reportItemsWithRepeatWithToUpdate   = new List <AspNetCore.ReportingServices.ReportIntermediateFormat.ReportItem>();
     this.m_endUserSortWithTarget               = new List <AspNetCore.ReportingServices.ReportIntermediateFormat.EndUserSort>();
     this.m_scopeNamesToClone                   = new Dictionary <string, IRIFDataScope>(StringComparer.Ordinal);
     this.m_headerLevelHasStaticArray           = null;
     this.m_currentDataRegionClone              = null;
     this.m_currentMapClone                     = null;
     this.m_outerAggregate                      = null;
     this.m_scopeTree                           = scopeTree;
     this.m_currentDataScope                    = null;
     this.m_currentMapVectorLayerClone          = null;
 }
Пример #7
0
        /// <summary>
        ///     Create a new <see cref="SourceLocation"/>.
        /// </summary>
        /// <param name="position">
        ///     The location's position, in line / column form.
        /// </param>
        /// <param name="absolutePosition">
        ///     The location's (0-based) absolute position.
        /// </param>
        /// <param name="node">
        ///     The <see cref="SourceNode"/> closest to the location's position.
        /// </param>
        /// <param name="flags">
        ///     <see cref="LocationFlags"/> describing the location.
        /// </param>
        public SourceLocation(Position position, int absolutePosition, SourceNode node, LocationFlags flags)
        {
            if (position == null)
            {
                throw new ArgumentNullException(nameof(position));
            }

            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }

            Position         = position;
            AbsolutePosition = absolutePosition;
            Node             = node;
            Flags            = flags;
        }
        /// <summary>
        ///     Inspect the specified location in the XML.
        /// </summary>
        /// <param name="position">
        ///     The location's position.
        /// </param>
        /// <returns>
        ///     An <see cref="SourceLocation"/> representing the result of the inspection.
        /// </returns>
        public SourceLocation Inspect(Position position)
        {
            if (position == null)
            {
                throw new ArgumentNullException(nameof(position));
            }

            // Internally, we always use 1-based indexing because this is what the System.Xml APIs (and I'd rather keep things simple).
            position = position.ToOneBased();

            SourceNode nodeAtPosition = FindNode(position);

            if (nodeAtPosition == null)
            {
                return(null);
            }

            // If we're on the (seamless, i.e. overlapping) boundary between 2 nodes, select the next node.
            if (nodeAtPosition.NextSibling != null)
            {
                if (position == nodeAtPosition.Range.End && position == nodeAtPosition.NextSibling.Range.Start)
                {
                    Serilog.Log.Debug("XmlLocator.Inspect moves to next sibling ({NodeKind} @ {NodeRange} -> {NextSiblingKind} @ {NextSiblingRange}).",
                                      nodeAtPosition.Kind,
                                      nodeAtPosition.Range,
                                      nodeAtPosition.NextSibling.Kind,
                                      nodeAtPosition.NextSibling.Range
                                      );

                    nodeAtPosition = nodeAtPosition.NextSibling;
                }
            }

            int absolutePosition = _documentPositions.GetAbsolutePosition(position);

            LocationFlags  flags            = ComputeLocationFlags(nodeAtPosition, absolutePosition);
            SourceLocation inspectionResult = new SourceLocation(position, absolutePosition, nodeAtPosition, flags);

            return(inspectionResult);
        }
Пример #9
0
        public LocationFlags ComputeOutCode(double x, double y)
        {
            LocationFlags code = LocationFlags.None;

            if (x < tl.X)                     // to the left of center
            {
                code |= LocationFlags.Left;
            }
            else if (x > br.X)                // to the right of center
            {
                code |= LocationFlags.Right;
            }
            if (y > br.Y)                     // below the center
            {
                code |= LocationFlags.Bottom;
            }
            else if (y < tl.Y)                // above the center
            {
                code |= LocationFlags.Top;
            }
            return(code);
        }