public override SyntaxNode VisitUsingDirective(UsingDirectiveSyntax node)
        {
            var text = node.ToString().Trim();

            if (_usingTrack.Add(text))
            {
                return(base.VisitUsingDirective(node));
            }
            Altered = true;
            return(null);
        }
        // "using UnityEngine;"
        public override void VisitUsingDirective(UsingDirectiveSyntax node)
        {
            string nodeText = node.ToString();

            foreach (string ns in _namespaceToCheck)
            {
                if (Regex.Match(nodeText, ns).Success)
                {
                    return;
                }
            }
        }
예제 #3
0
        public override void VisitUsingDirective(UsingDirectiveSyntax node)
        {
            long startTicks = Log.APPLICATIONSERVICES("Enter", Common.LOG_CATEGORY);

            if (_targetPatternRegEx.Match(node.ToString()).Success)
            {
                RecordMatchAndContext(node, BlockType.None);
            }

            base.VisitUsingDirective(node);

            Log.APPLICATIONSERVICES("Exit", Common.LOG_CATEGORY, startTicks);
        }
예제 #4
0
        public override void VisitUsingDirective(UsingDirectiveSyntax node)
        {
            // Only collect "using XXX"
            if (node.UsingKeyword.IsMissing)
            {
                return;
            }

            var nodeName       = node.Name.ToString();
            var namespaceParts = nodeName.Split('.');

            if (namespaceParts[0] == "System")
            {
                SystemImports.Add(node.ToString());
            }
            else if (!collectedNamespaces.Contains(nodeName)) // Did we already collect the sources from the namespace?
            {
                // Find the configured Path for the Namespace
                var sourcePath = additionalSources.FirstOrDefault(x => x.Name == namespaceParts[0]);
                if (sourcePath == null)
                {
                    throw new SourceMergerException($"The namespace '{nodeName}' is not configured in AdditionalSources");
                }

                // Create the folder path
                // using Namespace.UnderNamespace => NamespacePath\UnderNamespace
                var folderPath = Path.Combine(sourcePath.Path, Path.Combine(namespaceParts.Skip(1).ToArray()));
                if (!Directory.Exists(folderPath))
                {
                    throw new SourceMergerException($"The folder '{folderPath}' for the namespace '{node.Name}' could not be found.");
                }

                // Collect all content from the files in the folder
                collectedNamespaces.Add(nodeName);
                CollectFolderContent(folderPath, SearchOption.TopDirectoryOnly);
            }
        }
예제 #5
0
            public override void VisitUsingDirective(UsingDirectiveSyntax node)
            {
                Usings.Add(node.ToString());

                base.VisitUsingDirective(node);
            }
 public override void VisitUsingDirective(UsingDirectiveSyntax node)
 {
     _2JS.AppendLine("@" + node.ToString());
     base.VisitUsingDirective(node);
 }