public virtual void ProcessingArticle(string FullArticleTitle, Namespaces NS)
		{
			foreach (KeyValuePair<string, IMyTraceListener> t in Listeners)
			{
				t.Value.ProcessingArticle(FullArticleTitle, NS);
			}
		}
Example #2
0
        public void AddsNamespaceToOutput(Namespaces namespaces, Tag tag)
        {
            sut.UseNamespaces(namespaces);
            sut.WriteStartTagFor(tag);

            Assert.Equal($"<{tag} {namespaces}>", sut.ToString());
        }
		// Protected and public members:
		public static string GetArticleTemplate(string ArticleFullTitle, Namespaces NS)
		{
			int namesp = 0;
			string strnamespace = null;
			string templ = null;

            switch (NS)
            {
                case Namespaces.Main:
					return "#{{subst:la|" + ArticleFullTitle + "}}";

                case Namespaces.Talk:
					return "#{{subst:lat|" + Tools.RemoveNamespaceString(ArticleFullTitle).Trim() + "}}";

                default:
					namesp = (int)NS;
                    strnamespace = GetArticleTemplateRegex.Replace(Variables.Namespaces[(int) NS], "");

					if (namesp % 2 == 1) // talk
					{
						templ = "lnt";
					}
					else // not talk
					{
						templ = "ln";
					}

					return "#{{subst:" + templ + "|" + strnamespace + "|" + 
                        Tools.RemoveNamespaceString(ArticleFullTitle).Trim() + "}}";
			}
		}
Example #4
0
 public ElementFactory(Namespaces namespaces)
 {
     if (namespaces == null)
     {
         throw new ArgumentNullException(nameof(namespaces));
     }
     this.namespaces = namespaces;
 }
 public void Visit(Namespaces namespaces)
 {
     if (namespaces == null)
     {
         throw new ArgumentNullException(nameof(namespaces));
     }
     xmlBuilder.UseNamespaces(namespaces);
 }
Example #6
0
 public RootElementTests()
 {
     aNamespaces = new Namespaces();
     collector = Substitute.For<IElementCollector>();
     sut = new RootElement(aNamespaces, collector);
     downwardVisitor = Substitute.For<IDownwardElementVisitor>();
     upwardVisitor = Substitute.For<IUpwardElementVisitor>();
 }
Example #7
0
 public void UseNamespaces(Namespaces namespaces)
 {
     if (namespaces == null)
     {
         throw new ArgumentNullException(nameof(namespaces));
     }
     if (namespaces != Namespaces.EmptyNamespaces)
     {
         namespacesStack.Push(namespaces);
     }
 }
Example #8
0
 public RootElement(Namespaces namespaces, IElementCollector collector)
 {
     if (namespaces == null)
     {
         throw new ArgumentNullException(nameof(namespaces));
     }
     if (collector == null)
     {
         throw new ArgumentNullException(nameof(collector));
     }
     this.namespaces = namespaces;
     this.collector = collector;
 }
Example #9
0
 public DynamicXmlBuilder(Namespaces namespaces, Func<BaseDynamicElement, BaseDynamicElement> graphDecorator)
 {
     if (namespaces == null)
     {
         throw new ArgumentNullException(nameof(namespaces));
     }
     if (graphDecorator == null)
     {
         throw new ArgumentNullException(nameof(graphDecorator));
     }
     this.namespaces = namespaces;
     this.graphDecorator = graphDecorator;
 }
Example #10
0
 public ElementName(string name, Namespaces namespaces)
 {
     if (name == null)
     {
         throw new ArgumentNullException(nameof(name));
     }
     if (namespaces == null)
     {
         throw new ArgumentNullException(nameof(namespaces));
     }
     this.name = name;
     this.namespaces = namespaces;
     Parse();
 }
Example #11
0
        public async Task CheckMessageHeadersServiceWsdl()
        {
            var wsdl = await GetWsdlFromMetaBodyWriter <MessageHeadersService>();

            Trace.TraceInformation(wsdl);
            Assert.IsNotNull(wsdl);

            Assert.IsFalse(wsdl.Contains("name=\"\""));

            var root = XElement.Parse(wsdl);
            var nm   = Namespaces.CreateDefaultXmlNamespaceManager();

            var stringPropertyElement = root.XPathSelectElement("//xsd:element[@name='ModifiedStringProperty']", nm);

            Assert.IsNotNull(stringPropertyElement);
        }
Example #12
0
            public override void Add(Statement stmt)
            {
                string predicate = stmt.Predicate.Uri;
                string prefix;
                string localname;

                // Fill in the namespaces with nice prefixes
                if (MetadataStore.Namespaces.Normalize(predicate, out prefix, out localname))
                {
                    if (prefix != null)
                    {
                        Namespaces.AddNamespace(predicate.Remove(predicate.Length - localname.Length, localname.Length), prefix);
                    }
                }
                base.Add(stmt);
            }
        public override string ToString()
        {
            if (Namespaces?.FirstOrDefault() != null)
            {
                foreach (var ns in Namespaces)
                {
                    _stringBuilder.Append(ns + "\n");
                }
            }

            _stringBuilder.Append(welcomeText);
            _stringBuilder.Append($"\nnamespace {ClassNamespace}");
            _stringBuilder.Append("\n{");

            if (Attributes?.FirstOrDefault() != null)
            {
                foreach (var attribute in Attributes)
                {
                    _stringBuilder.Append("\n\t" + attribute);
                }
            }

            _stringBuilder.Append("\n\tpublic ");
            if (IsPartial)
            {
                _stringBuilder.Append("partial ");
            }

            _stringBuilder.Append($"class {ClassName}");
            if (Parents?.FirstOrDefault() != null)
            {
                _stringBuilder.Append(" : ");
                _stringBuilder.Append(string.Join(", ", Parents));
            }
            _stringBuilder.Append("\n\t{");

            if (Methods?.FirstOrDefault() != null)
            {
                foreach (var method in Methods)
                {
                    _stringBuilder.Append("\t" + method);
                }
            }

            _stringBuilder.Append("\n\t}\n}");
            return(_stringBuilder.ToString());
        }
Example #14
0
    private ES_NamespaceData?GetNamespace(SourceData src, ES_AstNodeBounds nodeBounds, ReadOnlySpan <char> namespaceStr)
    {
        var namespaceName = Environment !.IdPool.GetIdentifier(namespaceStr);

        if (!Environment !.Namespaces.TryGetValue(namespaceName, out var namespaceData))
        {
            var err = ES_FrontendErrors.GenNamespaceDoesntExist(
                namespaceStr.GetPooledString(),
                src,
                nodeBounds
                );
            errorList.Add(err);
            return(null);
        }

        return(namespaceData);
    }
Example #15
0
        private IEntity ResolveQualifiedName(string name, EntityType flags)
        {
            if (!IsQualifiedName(name))
            {
                return(Resolve(name, flags));
            }

            var resultingSet = Namespaces.AcquireSet();

            try {
                ResolveQualifiedName(resultingSet, name, flags);
                return(Entities.EntityFromList(resultingSet));
            }
            finally {
                Namespaces.ReleaseSet(resultingSet);
            }
        }
        public CodeGenerationModel SetCurrentNamespace(string name)
        {
            _currentNamespace = Namespaces.FirstOrDefault(x => x.Name.Equals(name, StringComparison.Ordinal));

            if (_currentNamespace == null)
            {
                _currentNamespace = new ModelNamespace
                {
                    Model = this,
                    Name  = name,
                };

                Namespaces.Add(_currentNamespace);
            }

            return(this);
        }
Example #17
0
        public void N07_ExcludeNamespacesCombined()
        {
            XElement     xElement     = XElement.Parse(@"
<AddSetter  ExcludeNamespaces='Foo'>
    <ExcludeNamespaces>
Bar
    </ExcludeNamespaces>
</AddSetter>");
            ModuleWeaver moduleWeaver = new ModuleWeaver {
                Config = xElement
            };

            Namespaces namespaces = new Namespaces(moduleWeaver);

            Assert.Equal("Foo", namespaces.ExcludeNamespaces.ElementAt(0).Line);
            Assert.Equal("Bar", namespaces.ExcludeNamespaces.ElementAt(1).Line);
        }
Example #18
0
        private void AddNamespace(StringBuilder key, ITypeDefinition cls)
        {
            lock (Namespaces)
            {
                if (InstanceExists(key.ToString()))
                {
                    return;
                }

                if (!Namespaces.ContainsKey(cls.Namespace))
                {
                    Namespaces.Add(cls.Namespace, new NamespaceProperties(cls.Namespace));
                }

                Namespaces[cls.Namespace].AddInstance(cls);
            }
        }
Example #19
0
        public INamespaceDeclaration FindNamespace(string alias)
        {
            var found = Namespaces.Where(ns => ns.Alias == alias).FirstOrDefault();

            if (found != null)
            {
                return(found);
            }
            else if (ParentElement != null)
            {
                return(ParentElement.FindNamespace(alias));
            }
            else
            {
                return(null);
            }
        }
Example #20
0
        public Namespace FindCreateNamespace(string name)
        {
            var @namespace = FindNamespace(name);

            if (@namespace == null)
            {
                @namespace = new Namespace
                {
                    Name      = name,
                    Namespace = this,
                };

                Namespaces.Add(@namespace);
            }

            return(@namespace);
        }
Example #21
0
        /// <summary>
        /// Checks if a local name in <paramref name="LocalName"/> represents a subnamespace from the point of view of the namespace
        /// in <paramref name="Namespace"/>.
        /// </summary>
        /// <param name="Namespace">Namespace.</param>
        /// <param name="LocalName">Local name.</param>
        /// <returns>If the local name represents a subnamespace.</returns>
        public static bool IsSubNamespace(string Namespace, string LocalName)
        {
            lock (synchObject)
            {
                if (!isInitialized)
                {
                    throw NotInitializedException();
                }

                if (!namespacesPerNamespace.TryGetValue(Namespace, out SortedDictionary <string, bool> Namespaces))
                {
                    return(false);
                }

                return(Namespaces.ContainsKey(Namespace + "." + LocalName));
            }
        }
Example #22
0
            public void AddsNamespacesToSet()
            {
                Type paramType1 = new EnumType
                                  (
                    "myParamTypeFqn1",
                    "myPackage",
                    "myParamType",
                    "myNamespace1",
                    new EnumMember[] { }
                                  );
                Type paramType2 = new EnumType
                                  (
                    "myParamTypeFqn2",
                    "myPackage",
                    "myParamType",
                    "myNamespace2",
                    new EnumMember[] { }
                                  );
                Method method = new Method
                                (
                    false,
                    false,
                    false,
                    name: "myMethod",
                    parameters: new[]
                {
                    new Parameter("myParam1", new TypeReference("myParamTypeFqn1")),
                    new Parameter("myParam2", new TypeReference("myParamTypeFqn2")),
                }
                                );

                Symbols.MapTypeName("myParamTypeFqn1", "MyParamType1", JsonModel.Spec.TypeKind.Enum);
                Symbols.MapTypeName("myParamTypeFqn2", "MyParamType2", JsonModel.Spec.TypeKind.Enum);
                Symbols.MapFullyQualifiedNameToType("myParamTypeFqn1", paramType1);
                Symbols.MapFullyQualifiedNameToType("myParamTypeFqn2", paramType2);
                Symbols.MapNamespace("myNamespace1", "MyNamespace1");
                Symbols.MapNamespace("myNamespace2", "MyNamespace2");
                Symbols.MapParameterName("myParam1", "myParam1");
                Symbols.MapParameterName("myParam2", "myParam2");

                method.GetParameterListSyntax(Namespaces, Symbols);

                Namespaces.Received().Add(Arg.Is <TypeReference>(r => r.FullyQualifiedName == "myParamTypeFqn1"));
                Namespaces.Received().Add(Arg.Is <TypeReference>(r => r.FullyQualifiedName == "myParamTypeFqn2"));
            }
        private void UpdateNamespaces(IEnumerable <LogViewModel> logsToInsert)
        {
            try {
                foreach (var log in logsToInsert)
                {
                    var application = Applications.FirstOrDefault(m => m.Name == log.Application);
                    if (application == null)
                    {
                        Logger.Error("[UpdateNamespaces] The application has to be set at this point.");
                        return;
                    }
                    // Try to get existing root namespace with name of application
                    var nsApplication = Namespaces.FirstOrDefault(m => m.Name == log.Application);
                    if (nsApplication == null)
                    {
                        nsApplication = new NamespaceViewModel(log.Application, application);
                        Namespaces.Add(nsApplication);
                    }

                    // Example: Verbosus.VerbTeX.View
                    string nsLogFull = log.Namespace;
                    // Example: Verbosus
                    string nsLogPart = nsLogFull.Split(new string[] { Constants.NAMESPACE_SPLITTER }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
                    // Try to get existing namespace with name Verbosus
                    var nsChild = nsApplication.Children.FirstOrDefault(m => m.Name == nsLogPart);
                    if (nsChild == null)
                    {
                        nsChild           = new NamespaceViewModel(nsLogPart, application);
                        nsChild.IsChecked = nsApplication.IsChecked;
                        nsApplication.Children.Add(nsChild);
                        nsChild.Parent = nsApplication;
                    }
                    if (nsLogFull.Contains(Constants.NAMESPACE_SPLITTER))
                    {
                        HandleNamespace(nsChild, nsLogFull.Substring(nsLogFull.IndexOf(Constants.NAMESPACE_SPLITTER) + 1), application, log);
                    }
                    else
                    {
                        SetLogCountByLevel(log, nsChild);
                    }
                }
            } catch (Exception e) {
                Console.WriteLine("Could not update namespaces: " + e);
            }
        }
 public CsdlWriterOptions GetOptions()
 {
     return(new CsdlWriterOptions
     {
         BaseUrl = BaseUrl,
         Formats = DataFormat,
         Sort = SortOutput,
         OutputDirectoryPath = OutputDirectory,
         SourceMetadataPath = SourceMetadataPath,
         Namespaces = Namespaces?.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries),
         TransformOutput = TransformOutput,
         DocumentationSetPath = DocumentationSetPath,
         Version = Version,
         SkipMetadataGeneration = SkipMetadataGeneration,
         ValidateSchema = ValidateSchema,
         AttributesOnNewLines = AttributesOnNewLines
     });
 }
Example #25
0
        public Class FindClass(string name,
                               StringComparison stringComparison = StringComparison.Ordinal)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }

            var @class = Classes.Find(c => c.Name.Equals(name, stringComparison)) ??
                         Namespaces.Select(n => n.FindClass(name, stringComparison)).FirstOrDefault(c => c != null);

            if (@class != null)
            {
                return(@class.CompleteDeclaration == null ?
                       @class : (Class)@class.CompleteDeclaration);
            }
            return(null);
        }
Example #26
0
        private void AddAssemblies(IEnumerable <Assembly> asseblies, IEnumerable <string> namespaces)
        {
            foreach (var additional in asseblies)
            {
                if (!Assemblies.Contains(additional))
                {
                    Assemblies.Add(additional);
                }
            }

            foreach (var namespaceAdditional in namespaces)
            {
                if (!Namespaces.Contains(namespaceAdditional))
                {
                    Namespaces.Add(namespaceAdditional);
                }
            }
        }
Example #27
0
        private IEntity ResolveExtensionForType(INamespace ns, IType type, string name)
        {
            var extensions = Namespaces.AcquireSet();

            try {
                if (!ns.Resolve(extensions, name, EntityType.Method | EntityType.Property))
                {
                    return(null);
                }

                Predicate <IEntity> notExtensionPredicate = item => !IsExtensionOf(type, item as IExtensionEnabled);
                extensions.RemoveAll(notExtensionPredicate);
                return(Entities.EntityFromList(extensions));
            }
            finally {
                Namespaces.ReleaseSet(extensions);
            }
        }
Example #28
0
        /// <summary>
        /// Rule: Statements -> (Statement (NEWLINE (Statement)? )* )? END ;
        /// </summary>
        protected override object EvalStatements(ParseTree tree, params object[] paramlist)
        {
            var prev = this.Parent.Token.Type.ToString();

            Namespaces.LevelDown(new Namespace(prev));
            var statements = new CodeBlock
            {
                Statements = nodes.OfTokenType(TokenType.Statement).Select(x => x.Eval(tree)).Cast <StatementBase>().ToList(),
                Node       = this
            };

            Namespaces.LevelUp();
            if (!Namespaces.Current.Children.Last().SymbolsSameLevel.Any() && !Namespaces.Current.Children.Last().Children.Any())
            {
                Namespaces.Current.Children.RemoveAt(Namespaces.Current.Children.Count - 1);
            }
            return(statements);
        }
Example #29
0
        /// <summary>
        /// Writes the URI of the specified entity to the output writer.
        /// </summary>
        /// <param name="entity">The entity.</param>
        protected override void WriteUri(Entity entity)
        {
            string prefix, localname;

            if (Namespaces.Normalize(entity.Uri, out prefix, out localname))
            {
                if (prefix != null)
                {
                    WriteEscaped(prefix);
                    Write(':');
                }
                WriteEscaped(localname);
            }
            else
            {
                base.WriteUri(entity);
            }
        }
Example #30
0
        protected internal virtual ScriptResult EngineExecute(
            string workingDirectory,
            string[] scriptArgs,
            FilePreProcessorResult result
            )
        {
            InjectScriptLibraries(workingDirectory, result, ScriptPackSession.State);
            var namespaces = Namespaces.Union(result.Namespaces);
            var references = References.Union(result.References);

            ScriptInfo.ScriptPath = result.ScriptPath;
            foreach (var loadedScript in result.LoadedScripts)
            {
                ScriptInfo.LoadedScripts.Add(loadedScript);
            }
            _log.Debug("Starting execution in engine");
            return(ScriptEngine.Execute(result.Code, scriptArgs, references, namespaces, ScriptPackSession));
        }
Example #31
0
 public XCodeCompileUnit(CodeCompileUnit source) : base()
 {
     if (source != null)
     {
         Namespaces.AddRange(source.Namespaces);
         EndDirectives.AddRange(source.EndDirectives);
         StartDirectives.AddRange(source.StartDirectives);
         AssemblyCustomAttributes.AddRange(source.AssemblyCustomAttributes);
         foreach (string name in source.ReferencedAssemblies)
         {
             ReferencedAssemblies.Add(name);
         }
         foreach (DictionaryEntry item in source.UserData)
         {
             UserData.Add(item.Key, item.Value);
         }
     }
 }
Example #32
0
        protected override void ProcessRecord()
        {
            ServiceCollection services = new ServiceCollection();

            services.AddDefaultCodeGen();
            HashSet <string> paths = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase);

            paths.Add(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
            paths.AddRange(AssemblyFolders);

            var  getAssemblyTypes = new GetAssemblyTypes(paths);
            Type converterType    = getAssemblyTypes.LoadTypeByName(Converter);

            if (!services.TryAddConverter(converterType))
            {
                throw new Exception($"codegen: Error loading converter type: ${converterType}");
            }
            var provider = services.BuildServiceProvider();


            Regex regex = null;
            IConvertObject <Type> converter = provider.GetRequiredService(converterType) as IConvertObject <Type>;

            if (!string.IsNullOrEmpty(Pattern))
            {
                regex = new Regex(Pattern, RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
            }

            getAssemblyTypes.LoadAssemblyTypes(TargetAssembly, type => {
                if (!type.IsAnonymousType() && !type.IsInterface && type.IsPublic)
                {
                    bool match = (Namespaces?.Count() ?? 0) == 0 || Namespaces.Contains(type.Namespace, StringComparer.InvariantCultureIgnoreCase);
                    if (match)
                    {
                        match = match && (regex == null || regex.IsMatch(type.FullName));
                    }
                    if (match)
                    {
                        var data = converter.Convert(type);
                        WriteObject(data);
                    }
                }
            });
        }
Example #33
0
        public Element NormalizeNamespaces()
        {
            var declarations = new List <String>();

            for (int i = 0; i < _attributes.Length; i++)
            {
                var attr = _attributes[i];

                if (attr.Prefix == Namespaces.Declaration && IsValidNamespaceDeclaration(attr.LocalName, attr.NodeValue))
                {
                    declarations.Add(attr.NodeValue);
                }
            }

            if (_ns != null)
            {
                if ((_prefix != null || !IsDefaultNamespace(_ns)) && (_prefix == null || LookupNamespaceURI(_prefix) != _ns))
                {
                    SetAttributeNS(Namespaces.XmlNS, Namespaces.DeclarationFor(_prefix), _ns);
                }
            }
            else if (LocalName != null)
            {
                //TODO
            }

            for (int i = 0; i < _attributes.Length; i++)
            {
                //TODO
                //http://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#isDefaultNamespaceAlgo
            }

            for (int i = 0; i < _children.Length; i++)
            {
                var child = _children[i] as Element;

                if (child != null)
                {
                    child.NormalizeNamespaces();
                }
            }

            return(this);
        }
Example #34
0
        public void Read(SwfReader reader)
        {
            reader.ABC = this;
            int minor = reader.ReadUInt16();
            int major = reader.ReadUInt16();

            _version = new Version(major, minor);
            if (minor == CurrentMinor && major == CurrentMajor)
            {
                //NOTE: The "0" entry of each constant pool is not used.  If the count for a given pool says there are
                //NOTE: "n" entries in the pool, there are "n-1" entries in the file, corresponding to indices 1..(n-1).
                IntPool.Read(reader);
                UIntPool.Read(reader);

                SwfReader.CheckU30 = true;
                DoublePool.Read(reader);
                StringPool.Read(reader);
                Namespaces.Read(reader);
                NamespaceSets.Read(reader);
                Multinames.Read(reader);
                Methods.Read(reader);
                Metadata.Read(reader);

                int n = (int)reader.ReadUIntEncoded();
                Instances.Read(n, reader);
                Classes.Read(n, reader);
                for (int i = 0; i < n; ++i)
                {
                    var klass    = Classes[i];
                    var instance = Instances[i];
                    instance.Class             = klass;
                    klass.Instance             = instance;
                    klass.Initializer.Instance = instance;
                }

                Scripts.Read(reader);
                MethodBodies.Read(reader);
                SwfReader.CheckU30 = false;
            }
            else
            {
                throw new NotImplementedException();
            }
        }
        /// <summary>
        /// Trims out the SPARQL preamble (BASE and PREFIX definitions) from the command text
        /// </summary>
        /// <remarks>
        /// This is done so the instance can be directly merged into another SparqlParameterizedString through the Append methods
        /// </remarks>
        private String TrimPreamble(String value)
        {
            int commandStart = 0;

            foreach (Match preambleItem in PreambleCapturePattern.Matches(value))
            {
                if (preambleItem.Groups[1].Value.ToUpper().StartsWith("BASE"))
                {
                    BaseUri = UriFactory.Create(preambleItem.Groups[3].Value);
                    Namespaces.AddNamespace("", BaseUri);
                }
                else
                {
                    Namespaces.AddNamespace(preambleItem.Groups[2].Value, UriFactory.Create(preambleItem.Groups[3].Value));
                }
                commandStart = preambleItem.Index + preambleItem.Length;
            }
            return(value.Substring(commandStart));
        }
Example #36
0
 internal void AddRDFNamespaces(Dictionary <string, string> namespaces)
 {
     foreach (KeyValuePair <string, string> pair in namespaces)
     {
         string prefixAndNamespace = pair.Key;
         string uri = pair.Value;
         if (!string.IsNullOrEmpty(prefixAndNamespace) && !string.IsNullOrEmpty(uri))
         {
             if (!Namespaces.ContainsKey(prefixAndNamespace))
             {
                 Namespaces.Add(prefixAndNamespace, uri);
             }
             else
             {
                 Namespaces[prefixAndNamespace] = uri;
             }
         }
     }
 }
Example #37
0
        public async Task CheckUnqualifiedMembersService()
        {
            var wsdl = await GetWsdlFromMetaBodyWriter <UnqualifiedMembersService>(SoapSerializer.XmlSerializer);

            Trace.TraceInformation(wsdl);

            var root = XElement.Parse(wsdl);
            var nm   = Namespaces.CreateDefaultXmlNamespaceManager();

            bool allNeededAreUnqualified = root.XPathSelectElements($"//xsd:complexType[@name='{nameof(TypeWithUnqualifiedMembers)}' or @name='{nameof(UnqType2)}']/xsd:sequence/xsd:element[contains(@name, 'Unqualified')]", nm)
                                           .All(x => x.Attribute("form")?.Value.Equals("unqualified") == true);

            Assert.IsTrue(allNeededAreUnqualified);

            bool allNeededAreQualified = root.XPathSelectElements($"//xsd:complexType[@name='{nameof(TypeWithUnqualifiedMembers)}' or @name='{nameof(UnqType2)}']/xsd:sequence/xsd:element[contains(@name, 'Qualified')]", nm)
                                         .All(x => x.Attribute("form")?.Value.Equals("unqualified") != true);

            Assert.IsTrue(allNeededAreQualified);
        }
Example #38
0
 public ProgramOptions()
 {
     // TODO Implement verbosity -v -vv, etc.
     // TODO Localizations
     // TODO Support other csc style options
     this.OptionSet = new OptionSet {
         { "version", SR.UVersion(), v => ShowLogo = LogoType.LogoExtendedVersion },
         { "?|help", SR.UHelp(), v => ShowLogo = LogoType.Usage },
         { "out=", SR.UOut(), v => OutputFile = v },
         { "no-compile", SR.UNoCompile(), v => NoCompile = true },
         { "verbose", SR.UDebug(), v => TraceLevel = HxlcTraceLevel.Trace },
         { "debug", SR.UDebug(), v => TraceLevel = HxlcTraceLevel.Debug },
         { "base-type=", SR.UBaseType(), v => BaseType = TypeReference.Parse(v) },
         { "include=", SR.UInclude(), v => Inputs.Add(v) },
         { "N|namespace:=", SR.UNamespace(), (k, v) => Namespaces.Add(k, v) },
         { "D|define:=", SR.UDefine(), (k, v) => Defines.Add(k, v) },
         { "r|reference=", SR.UReference(), v => References.Add(v) },
     };
 }
        public Route MapRoute(string name, string url, object defaults, object constraints, string[] namespaces)
        {
            if (namespaces == null && Namespaces != null)
            {
                namespaces = Namespaces.ToArray();
            }

            Route route = Routes.MapRoute(name, url, defaults, constraints, namespaces);

            route.DataTokens["area"] = AreaName;

            // disabling the namespace lookup fallback mechanism keeps this areas from accidentally picking up
            // controllers belonging to other areas
            bool useNamespaceFallback = (namespaces == null || namespaces.Length == 0);

            route.DataTokens["UseNamespaceFallback"] = useNamespaceFallback;

            return(route);
        }
Example #40
0
        public override void InitialiseFromCode(string code, int startline)
        {
            if (code == null)
            {
                return;
            }
            //Add Everything to existing Properties
            List <TextAsNamespace> tempSpace   = Helper.GetObjects <TextAsNamespace>(code, RegexString.namespaces, 0);
            List <TextAsClass>     tempClass   = new List <TextAsClass>();
            List <TextAsMethod>    tempMethods = new List <TextAsMethod>();

            tempSpace.ForEach(space => tempClass      = Helper.GetObjects <TextAsClass>(space.Code, RegexString.classWithModifiers, 0));
            tempClass.ForEach(tmpclass => tempMethods = Helper.GetObjects <TextAsMethod>(tmpclass.Code, RegexString.methods, tmpclass.StartLine));
            //...and so on for variables , enums and propperties
            Namespaces.AddRange(tempSpace);
            Classes.AddRange(tempClass);
            Methods.AddRange(tempMethods);
            //...
        }
Example #41
0
 public override void ProcessingArticle(string fullArticleTitle, Namespaces ns)
 {
     Busy();
     base.ProcessingArticle(fullArticleTitle, ns);
     NotBusy();
 }
 void IMyTraceListener.SkippedArticleRedlink(string SkippedBy, string FullArticleTitle, Namespaces NS)
 {
     Skip(SkippedBy, "Red link (article deleted)");
 }
 void IMyTraceListener.SkippedArticleBadTag(string SkippedBy, string FullArticleTitle, Namespaces NS)
 {
     Skip(SkippedBy, "Bad tag");
 }
 void IMyTraceListener.ProcessingArticle(string FullArticleTitle, Namespaces NS) { }
 public Namespaces(Namespaces other)
 {
     test = new HashSet<string>(other.test, StringComparer.OrdinalIgnoreCase);
 }
Example #46
0
		public virtual void SkippedArticleRedlink(string SkippedBy, string FullArticleTitle, Namespaces NS)
		{
			SkippedArticle(SkippedBy, "Attached article doesn't exist - maybe deleted?");
		}
 public Namespaces(Namespaces other)
 {
     namespaces = new List<string>(other.namespaces);
 }
Example #48
0
		public abstract void ProcessingArticle(string FullArticleTitle, Namespaces NS);
 public ApplicationUnderTest(ApplicationUnderTest other)
 {
     assemblies = new Assemblies(other.assemblies);
     namespaces = new Namespaces(other.namespaces);
 }
 public ApplicationUnderTest()
 {
     assemblies = new List<Assembly>();
     namespaces = new Namespaces();
     AddNamespace(GetType().Namespace);
 }
		public virtual void SkippedArticleBadTag(string SkippedBy, string FullArticleTitle, Namespaces NS)
		{
			foreach (KeyValuePair<string, IMyTraceListener> t in Listeners)
			{
				t.Value.SkippedArticleBadTag(SkippedBy, FullArticleTitle, NS);
			}
		}
 public ApplicationUnderTest(ApplicationDomain appDomain)
 {
     assemblies = new Assemblies(appDomain);
     namespaces = new Namespaces();
     AddNamespace(GetType().Namespace);
 }
 public override void ProcessingArticle(string FullArticleTitle, Namespaces NS)
 {
     base.WriteLine("<br/>" + mArticleCount + ". <a href=\"" + Variables.NonPrettifiedURL(FullArticleTitle) + "\">[[" + FullArticleTitle + "]]</a>");
     mArticleCount += 1;
 }
Example #54
0
 public DynamicXmlBuilder(Namespaces namespaces) : this(namespaces, DefaultGraphDecorator)
 {
 }
Example #55
0
        public Namespaces Namespace()
        {
            if (!Supports("NAMESPACE"))
            throw new NotSupportedException("This command is not supported by the server!");
              IdlePause();

              string command = GetTag() + "NAMESPACE";
              string response = SendCommandGetResponse(command);

              if (!response.StartsWith("* NAMESPACE")) {
            throw new Exception("Unknow server response !");
              }

              response = response.Substring(12);
              Namespaces n = new Namespaces();
              //[TODO] be sure to parse correctly namespace when not all namespaces are present. NIL character
              string reg = @"\((.*?)\) \((.*?)\) \((.*?)\)$";
              Match m = Regex.Match(response, reg);
              if (m.Groups.Count != 4)
            throw new Exception("En error occure, this command is not fully supported !");
              string reg2 = "\\(\\\"(.*?)\\\" \\\"(.*?)\\\"\\)";
              Match m2 = Regex.Match(m.Groups[1].ToString(), reg2);
              while (m2.Groups.Count > 1) {
            n.ServerNamespace.Add(new Namespace(m2.Groups[1].Value, m2.Groups[2].Value));
            m2 = m2.NextMatch();
              }
              m2 = Regex.Match(m.Groups[2].ToString(), reg2);
              while (m2.Groups.Count > 1) {
            n.UserNamespace.Add(new Namespace(m2.Groups[1].Value, m2.Groups[2].Value));
            m2 = m2.NextMatch();
              }
              m2 = Regex.Match(m.Groups[3].ToString(), reg2);
              while (m2.Groups.Count > 1) {
            n.SharedNamespace.Add(new Namespace(m2.Groups[1].Value, m2.Groups[2].Value));
            m2 = m2.NextMatch();
              }
              GetResponse();
              IdleResume();
              return n;
        }
 public void UseNamespaces(Namespaces namespaces)
 {
    xmlBuilder.UseNamespaces(namespaces);
 }
 public override void ProcessingArticle(string FullArticleTitle, Namespaces NS)
 {
     CheckCounterForUpload(); // Check counter *before* starting a new article section
     base.WriteLine(GetArticleTemplate(FullArticleTitle, NS), false);
 }
Example #58
0
		public abstract void SkippedArticleBadTag(string SkippedBy, string FullArticleTitle, Namespaces NS);
Example #59
0
 public override void SkippedArticleRedlink(string skippedBy, string fullArticleTitle, Namespaces ns)
 {
     Busy();
     base.SkippedArticleRedlink(skippedBy, fullArticleTitle, ns);
     NotBusy();
 }
 public override void SkippedArticleBadTag(string SkippedBy, string FullArticleTitle, Namespaces NS)
 {
     SkippedArticle(SkippedBy, "Bad tag");
 }