• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Tools.SyntaxWriter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.Ddue.Tools.SyntaxWriter的典型用法代码示例。如果您正苦于以下问题:C# SyntaxWriter类的具体用法?C# SyntaxWriter怎么用?C# SyntaxWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SyntaxWriter类属于Microsoft.Ddue.Tools命名空间,在下文中一共展示了SyntaxWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: WriteDelegateSyntax

        public override void WriteDelegateSyntax(XPathNavigator reflection, SyntaxWriter writer)
        {

            string name = (string)reflection.Evaluate(apiNameExpression);
            bool isSerializable = (bool)reflection.Evaluate(apiIsSerializableTypeExpression);

            if (isSerializable) WriteAttribute("T:System.SerializableAttribute", writer);

            WriteAttributes(reflection, writer);

            writer.WriteKeyword("type");
            writer.WriteString(" ");
            writer.WriteIdentifier(name);
            writer.WriteString(" = ");
            writer.WriteLine();
            writer.WriteString("    ");
            writer.WriteKeyword("delegate");
            writer.WriteString(" ");
            writer.WriteKeyword("of");
            writer.WriteString(" ");

            WriteParameters(reflection, writer);

            writer.WriteKeyword("->");
            writer.WriteString(" ");
            WriteReturnValue(reflection, writer);

        }
开发者ID:jongalloway,项目名称:dotnetopenid,代码行数:28,代码来源:FSharpDeclarationSyntax.cs


示例2: WriteClassSyntax

		public override void WriteClassSyntax (XPathNavigator reflection, SyntaxWriter writer) {

			if (IsUnsupportedGeneric(reflection, writer)) return;

			string name = reflection.Evaluate(apiNameExpression).ToString();
			bool isAbstract = (bool) reflection.Evaluate(apiIsAbstractTypeExpression);
			bool isSealed = (bool) reflection.Evaluate(apiIsSealedTypeExpression);
			bool isSerializable = (bool) reflection.Evaluate(apiIsSerializableTypeExpression);

			if (isSerializable) WriteAttribute("T:System.SerializableAttribute", writer);
			WriteAttributes(reflection, writer);
			WriteVisibility(reflection, writer);
			writer.WriteString(" ");
			if (isSealed) {
				writer.WriteKeyword("final");
				writer.WriteString(" ");
			} else if (isAbstract) {
				writer.WriteKeyword("abstract");
				writer.WriteString(" ");
			}
			writer.WriteKeyword("class");
			writer.WriteString(" ");
			writer.WriteIdentifier(name);

			XPathNavigator baseClass = reflection.SelectSingleNode(apiBaseClassExpression);
			if ((baseClass != null) && !((bool) baseClass.Evaluate(typeIsObjectExpression))) {
				writer.WriteString(" ");
				writer.WriteKeyword("extends");
				writer.WriteString(" ");
				WriteTypeReference(baseClass, writer);
			}

			WriteImplementedInterfaces(reflection, writer);

		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:35,代码来源:JSharpDeclarationSyntax.cs


示例3: WriteClassSyntax

        // class: done
		public override void WriteClassSyntax (XPathNavigator reflection, SyntaxWriter writer) {

			string name = (string) reflection.Evaluate(apiNameExpression);
			bool isAbstract = (bool) reflection.Evaluate(apiIsAbstractTypeExpression);
			bool isSealed = (bool) reflection.Evaluate(apiIsSealedTypeExpression);
			bool isSerializable = (bool) reflection.Evaluate(apiIsSerializableTypeExpression);

			if (isSerializable) WriteAttribute("T:System.SerializableAttribute", writer);
			WriteAttributes(reflection, writer);
			WriteVisibility(reflection, writer);
			writer.WriteString(" ");
			if (isAbstract) {
				if (isSealed) {
					// static -- VB doesn't really handle this case
					writer.WriteKeyword("NotInheritable");
					writer.WriteString(" ");
				} else {
					writer.WriteKeyword("MustInherit");
					writer.WriteString(" ");
				}
			} else if (isSealed) {
				writer.WriteKeyword("NotInheritable");
				writer.WriteString(" ");
			}
			writer.WriteKeyword("Class");
			writer.WriteString(" ");
			writer.WriteIdentifier(name);
			WriteGenericTemplates(reflection, writer);
			WriteBaseClass(reflection, writer);
			WriteImplementedInterfaces(reflection, writer);
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:32,代码来源:VisualBasicDeclarationSyntax.cs


示例4: WriteGenericTemplates

        private void WriteGenericTemplates(XPathNavigator type, SyntaxWriter writer, bool writeVariance)
        {
            XPathNodeIterator templates = type.Select(apiTemplatesExpression);

            if (templates.Count == 0) return;
            writer.WriteString("(");
            writer.WriteKeyword("Of");
            writer.WriteString(" ");
            while (templates.MoveNext())
            {
                XPathNavigator template = templates.Current;
                if (templates.CurrentPosition > 1) writer.WriteString(", ");
                if (writeVariance)
                {
                    bool contravariant = (bool)template.Evaluate(templateIsContravariantExpression);
                    bool covariant = (bool)template.Evaluate(templateIsCovariantExpression);

                    if (contravariant)
                    {
                        writer.WriteKeyword("In");
                        writer.WriteString(" ");
                    }
                    if (covariant)
                    {
                        writer.WriteKeyword("Out");
                        writer.WriteString(" ");
                    }
                }

                string name = template.GetAttribute("name", String.Empty);
                writer.WriteString(name);
            }
            writer.WriteString(")");

        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:35,代码来源:VisualBasicUsageSyntax.cs


示例5: WriteSyntax

        public override void WriteSyntax (XPathNavigator reflection, SyntaxWriter writer) {

            string group = (string)reflection.Evaluate(groupExpression);
            string subgroup = (string)reflection.Evaluate(subgroupExpression);

            if (group == "type" && subgroup == "class") {
                string prefix = WebControlPrefix(reflection);
                if (!String.IsNullOrEmpty(prefix)) {
                    WriteClassSyntax(reflection, writer, prefix);
                }
            }

            if (group == "member") {

                string prefix = null;
                XPathNavigator containingType = reflection.SelectSingleNode(containingTypeExpression);
                if (containingType != null) prefix = WebControlPrefix(containingType);

                if (!String.IsNullOrEmpty(prefix)) {
                    if (subgroup == "property") {
                        WritePropertySyntax(reflection, writer, prefix);
                    } else if (subgroup == "event") {
                        WriteEventSyntax(reflection, writer, prefix);
                    }
                }
            }


        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:29,代码来源:AspNetSyntax.cs


示例6: WriteSyntax

        public override void WriteSyntax(XPathNavigator reflection, SyntaxWriter writer)
        {
            writer.WriteStartBlock(Language);

            // Check the list of assemblies for which to generate XAML syntax
            string assemblyName = (string)reflection.Evaluate(apiContainingAssemblyExpression);
            string namespaceName = (string)reflection.Evaluate(apiContainingNamespaceNameExpression);
            if (!xamlAssemblies.ContainsKey(assemblyName.ToLower()))
            {
                WriteXamlBoilerplate(XamlBoilerplateID.nonXamlAssemblyBoilerplate, writer);
            }
            else
            {
                string group = (string)reflection.Evaluate(apiGroupExpression);
                switch (group)
                {
                    case "namespace":
                        WriteNamespaceSyntax(reflection, writer);
                        break;
                    case "type":
                        WriteTypeSyntax(reflection, writer);
                        break;
                    case "member":
                        WriteMemberSyntax(reflection, writer);
                        break;
                }
                WriteXamlXmlnsUri(assemblyName, namespaceName, writer);
            }

            writer.WriteEndBlock();
        }
开发者ID:hnlshzx,项目名称:DotNetOpenAuth,代码行数:31,代码来源:XamlUsageSyntax.cs


示例7: WriteNamespaceSyntax

        public override void WriteNamespaceSyntax (XPathNavigator reflection, SyntaxWriter writer) {
            string name = (string)reflection.Evaluate(apiNameExpression);

            writer.WriteKeyword("package");
            writer.WriteString(" ");
            writer.WriteIdentifier(name);
        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:7,代码来源:JScriptDeclarationSyntax.cs


示例8: WriteClassSyntax

        // class: done
		public override void WriteClassSyntax (XPathNavigator reflection, SyntaxWriter writer) {

			string name = reflection.Evaluate(apiNameExpression).ToString();
			bool isAbstract = (bool) reflection.Evaluate(apiIsAbstractTypeExpression);
			bool isSealed = (bool) reflection.Evaluate(apiIsSealedTypeExpression);
			bool isSerializable = (bool) reflection.Evaluate(apiIsSerializableTypeExpression);

			if (isSerializable) WriteAttribute("T:System.SerializableAttribute", writer);
			WriteAttributes(reflection, writer);
			WriteVisibility(reflection, writer);
			writer.WriteString(" ");
			if (isAbstract) {
				if (isSealed) {
					writer.WriteKeyword("static");
				} else {
					writer.WriteKeyword("abstract");
				}
				writer.WriteString(" ");
			} else {
				if (isSealed) {
					writer.WriteKeyword("sealed");
					writer.WriteString(" ");
				}
			}
			writer.WriteKeyword("class");
			writer.WriteString(" ");
			writer.WriteIdentifier(name);
			WriteGenericTemplates(reflection, writer);
			WriteBaseClassAndImplementedInterfaces(reflection, writer);
			WriteGenericTemplateConstraints(reflection, writer);

		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:33,代码来源:CSharpDeclarationSyntax.cs


示例9: WriteEnumerationSyntax

        public override void WriteEnumerationSyntax (XPathNavigator reflection, SyntaxWriter writer) {
            string name = (string)reflection.Evaluate(apiNameExpression);

            WriteAttributeList(reflection, writer);
            WriteAccessModifier(reflection, writer);
            writer.WriteKeyword("enum");
            writer.WriteString(" ");
            writer.WriteString(name);
            // no JScript support for underlying types
        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:10,代码来源:JScriptDeclarationSyntax.cs


示例10: WriteInterfaceSyntax

        public override void WriteInterfaceSyntax (XPathNavigator reflection, SyntaxWriter writer) {
            if (IsUnsupportedGeneric(reflection, writer)) return;

            string name = (string)reflection.Evaluate(apiNameExpression);

            WriteAttributeList(reflection, writer);
            WriteAccessModifier(reflection, writer);
            writer.WriteKeyword("interface");
            writer.WriteString(" ");
            writer.WriteString(name);
            WriteInterfaceList("extends", reflection, writer);
        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:12,代码来源:JScriptDeclarationSyntax.cs


示例11: WriteEnumerationSyntax

        public override void WriteEnumerationSyntax(XPathNavigator reflection, SyntaxWriter writer)
        {

            string name = (string)reflection.Evaluate(apiNameExpression);
            bool isSerializable = (bool)reflection.Evaluate(apiIsSerializableTypeExpression);

            if (isSerializable) WriteAttribute("T:System.SerializableAttribute", writer);
            WriteAttributes(reflection, writer);
            writer.WriteKeyword("type");
            writer.WriteString(" ");
            WriteVisibility(reflection, writer);
            writer.WriteIdentifier(name);
        }
开发者ID:jongalloway,项目名称:dotnetopenid,代码行数:13,代码来源:FSharpDeclarationSyntax.cs


示例12: WriteInterfaceSyntax

        // interface: done
		public override void WriteInterfaceSyntax (XPathNavigator reflection, SyntaxWriter writer) {

			string name = (string) reflection.Evaluate(apiNameExpression);

			WriteAttributes(reflection, writer);
			WriteVisibility(reflection, writer);
			writer.WriteString(" ");
			writer.WriteKeyword("Interface");
			writer.WriteString(" ");
			writer.WriteIdentifier(name);
            WriteGenericTemplates(reflection, writer, true); // Need to write variance info for interfaces and delegates
			WriteImplementedInterfaces(reflection, writer);
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:14,代码来源:VisualBasicDeclarationSyntax.cs


示例13: WriteConstructorSyntax

        public override void WriteConstructorSyntax (XPathNavigator reflection, SyntaxWriter writer) {
            bool isStatic = (bool)reflection.Evaluate(apiIsStaticExpression);
            if (isStatic) {
                writer.WriteMessage("UnsupportedStaticConstructor_" + Language);
            } else {
                if (IsUnsupportedUnsafe(reflection, writer)) return;
                XPathNavigator declaringType = reflection.SelectSingleNode(apiContainingTypeExpression);

                WriteAttributeList(reflection, writer);
                WriteAccessModifier(reflection, writer);
                writer.WriteKeyword("function");
                writer.WriteString(" ");
                WriteTypeReference(declaringType, writer);
                WriteParameterList(reflection, writer);
            }
        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:16,代码来源:JScriptDeclarationSyntax.cs


示例14: WriteInterfaceSyntax

		public override void WriteInterfaceSyntax (XPathNavigator reflection, SyntaxWriter writer) {

			string name = (string) reflection.Evaluate(apiNameExpression);

			WriteAttributes(reflection, writer);

			WriteGenericTemplates(reflection, writer);

			WriteVisibility(reflection, writer);
			writer.WriteString(" ");
			writer.WriteKeyword("interface class");
			writer.WriteString(" ");
			writer.WriteIdentifier(name);
			WriteImplementedInterfaces(reflection, writer);

		}
开发者ID:jongalloway,项目名称:dotnetopenid,代码行数:16,代码来源:CPlusPlusDeclarationSyntax.cs


示例15: WriteStructureSyntax

        // structure: done
		public override void WriteStructureSyntax (XPathNavigator reflection, SyntaxWriter writer) {

			string name = (string) reflection.Evaluate(apiNameExpression);
			bool isSerializable = (bool) reflection.Evaluate(apiIsSerializableTypeExpression);

			if (isSerializable) WriteAttribute("T:System.SerializableAttribute", writer);
			WriteAttributes(reflection, writer);
			WriteVisibility(reflection, writer);
			writer.WriteString(" ");
			writer.WriteKeyword("struct");
			writer.WriteString(" ");
			writer.WriteIdentifier(name);
			WriteGenericTemplates(reflection, writer);
			WriteImplementedInterfaces(reflection, writer);
			WriteGenericTemplateConstraints(reflection, writer);

		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:18,代码来源:CSharpDeclarationSyntax.cs


示例16: WriteXamlXmlnsUri

 private void WriteXamlXmlnsUri(string assemblyName, string namespaceName, SyntaxWriter writer)
 {
     Dictionary<string, List<string>> clrNamespaces;
     if (xamlAssemblies.TryGetValue(assemblyName.ToLower(), out clrNamespaces))
     {
         List<string> xmlnsUriList;
         if (clrNamespaces.TryGetValue(namespaceName, out xmlnsUriList))
         {
             foreach (string xmlnsUri in xmlnsUriList)
             {
                 // start the syntax block
                 writer.WriteStartSubBlock("xamlXmlnsUri");
                 writer.WriteString(xmlnsUri);
                 writer.WriteEndSubBlock();
             }
         }
     }
 }
开发者ID:hnlshzx,项目名称:DotNetOpenAuth,代码行数:18,代码来源:XamlUsageSyntax.cs


示例17: IsUnsupported

        /// <summary>
        /// Determines whether the feature is unsupported by this language.
        /// </summary>
        /// <param name="reflection"></param>
        /// <param name="writer"></param>
        /// <returns></returns>
        private bool IsUnsupported(XPathNavigator reflection, SyntaxWriter writer) {
            if (IsUnsupportedGeneric(reflection, writer)) {
                return true;
            }

            if (IsUnsupportedExplicit(reflection, writer)) {
                return true;
            }

            if (IsUnsupportedUnsafe(reflection, writer)) {
                return true;
            }

            if (HasAttribute(reflection, "System.NonScriptableAttribute")) {
                writer.WriteMessage("UnsupportedType_ScriptSharp");
                return true;
            }

            return false;
        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:26,代码来源:ScriptSharpDeclarationSyntax.cs


示例18: WriteClassSyntax

        public override void WriteClassSyntax (XPathNavigator reflection, SyntaxWriter writer) {
            if (IsUnsupportedGeneric(reflection, writer)) return;

            string name = (string)reflection.Evaluate(apiNameExpression);
            bool isAbstract = (bool)reflection.Evaluate(apiIsAbstractTypeExpression);
            bool isSealed = (bool)reflection.Evaluate(apiIsSealedTypeExpression);

            WriteAttributeList(reflection, writer);
            WriteAccessModifier(reflection, writer);
            if (isSealed) {
                writer.WriteKeyword("final");
                writer.WriteString(" ");
            } else if (isAbstract) {
                writer.WriteKeyword("abstract");
                writer.WriteString(" ");
            }
            writer.WriteKeyword("class");
            writer.WriteString(" ");
            writer.WriteString(name);
            WriteBaseClass(reflection, writer);
            WriteInterfaceList(reflection, writer);
        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:22,代码来源:JScriptDeclarationSyntax.cs


示例19: TypeDeclaration

        private void TypeDeclaration (XPathNavigator reflection, SyntaxWriter writer, bool writeVariance) {
            string name = (string)reflection.Evaluate(apiNameExpression);
            XPathNavigator declaringType = reflection.SelectSingleNode(apiContainingTypeExpression);

            writer.WriteKeyword("Dim");
            writer.WriteString(" ");
            writer.WriteParameter("instance");
            writer.WriteString(" ");
            writer.WriteKeyword("As");
            writer.WriteString(" ");
            if (declaringType != null) {
                WriteTypeReference(declaringType, writer);
                writer.WriteString(".");
            }
            if (reservedWords.ContainsKey(name)) {
                writer.WriteString("[");
                writer.WriteIdentifier(name);
                writer.WriteString("]");
            } else {
                writer.WriteIdentifier(name);
            }
            WriteGenericTemplates(reflection, writer, writeVariance);
        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:23,代码来源:VisualBasicUsageSyntax.cs


示例20: WriteStructureSyntax

		public override void WriteStructureSyntax (XPathNavigator reflection, SyntaxWriter writer) {

			if (IsUnsupportedGeneric(reflection, writer)) return;

			string name = (string) reflection.Evaluate(apiNameExpression);
			bool isSerializable = (bool) reflection.Evaluate(apiIsSerializableTypeExpression);

			if (isSerializable) WriteAttribute("T:System.SerializableAttribute", writer);
			WriteAttributes(reflection, writer);
			WriteVisibility(reflection, writer);
			writer.WriteString(" ");
			writer.WriteKeyword("final");
			writer.WriteString(" ");
			writer.WriteKeyword("class");
			writer.WriteString(" ");
			writer.WriteIdentifier(name);

			writer.WriteString(" ");
			writer.WriteKeyword("extends");
			writer.WriteString(" ");
			writer.WriteReferenceLink("T:System.ValueType");

			WriteImplementedInterfaces(reflection, writer);
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:24,代码来源:JSharpDeclarationSyntax.cs



注:本文中的Microsoft.Ddue.Tools.SyntaxWriter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WindowsInstaller.Record类代码示例发布时间:2022-05-26
下一篇:
C# Interop.Sqlite3StmtHandle类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap