Пример #1
0
        public static void CheckForHardCodedAttribute(this XamlElementProcessor source, string fileName, string elementName, string attributeName, AttributeType types, string descriptionFormat, string xamlElement, ITextSnapshot snapshot, int offset, string guidFallbackAttributeName, Guid elementIdentifier, TagList tags, List <TagSuppression> suppressions, ProjectType projType)
        {
            if (source.TryGetAttribute(xamlElement, attributeName, types, out AttributeType foundAttributeType, out int tbIndex, out int length, out string value))
            {
                if (!string.IsNullOrWhiteSpace(value) && char.IsLetterOrDigit(value[0]))
                {
                    var tagDeps = source.CreateBaseTagDependencies(
                        new Span(offset + tbIndex, length),
                        snapshot,
                        fileName);

                    var(uidExists, uidValue) = source.GetOrGenerateUid(xamlElement, guidFallbackAttributeName);

                    var tag = new HardCodedStringTag(tagDeps, elementName, attributeName, projType)
                    {
                        AttributeType = foundAttributeType,
                        Value         = value,
                        Description   = descriptionFormat.WithParams(value),
                        UidExists     = uidExists,
                        UidValue      = uidValue,
                        ElementGuid   = elementIdentifier,
                    };

                    tags.TryAdd(tag, xamlElement, suppressions);
                }
            }
        }
Пример #2
0
 public HardCodedStringAction(string file, ITextView view, HardCodedStringTag tag)
     : base(file)
 {
     this.View        = view;
     this.DisplayText = StringRes.UI_MoveHardCodedString;
     this.Tag         = tag;
 }
 public HardCodedStringAction(string file, ITextView view, HardCodedStringTag tag, IVisualStudioTextManipulation vstm = null)
     : base(file)
 {
     this.View        = view;
     this.DisplayText = StringRes.UI_MoveHardCodedString;
     this.Tag         = tag;
     this.vstm        = vstm;
 }
Пример #4
0
        protected void CheckForHardCodedAttribute(string fileName, string elementName, string attributeName, AttributeType types, string descriptionFormat, string xamlElement, ITextSnapshot snapshot, int offset, bool uidExists, string uidValue, Guid elementIdentifier, TagList tags, List <TagSuppression> suppressions, ProjectType projType)
        {
            if (this.TryGetAttribute(xamlElement, attributeName, types, out AttributeType foundAttributeType, out int tbIndex, out int length, out string value))
            {
                if (!string.IsNullOrWhiteSpace(value) && char.IsLetterOrDigit(value[0]))
                {
                    var tag = new HardCodedStringTag(new Span(offset + tbIndex, length), snapshot, fileName, elementName, attributeName, this.Logger, projType)
                    {
                        AttributeType = foundAttributeType,
                        Value         = value,
                        Description   = descriptionFormat.WithParams(value),
                        UidExists     = uidExists,
                        UidValue      = uidValue,
                        ElementGuid   = elementIdentifier,
                    };

                    tags.TryAdd(tag, xamlElement, suppressions);
                }
            }
        }