本文整理汇总了C#中Microsoft.Ddue.Tools.SyntaxWriter.WriteReferenceLink方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxWriter.WriteReferenceLink方法的具体用法?C# SyntaxWriter.WriteReferenceLink怎么用?C# SyntaxWriter.WriteReferenceLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Ddue.Tools.SyntaxWriter
的用法示例。
在下文中一共展示了SyntaxWriter.WriteReferenceLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteNormalTypeReference
// DONE
private void WriteNormalTypeReference(string api, SyntaxWriter writer)
{
switch (api)
{
case "T:System.Void":
writer.WriteReferenceLink(api, "unit");
break;
case "T:System.String":
writer.WriteReferenceLink(api, "string");
break;
case "T:System.Boolean":
writer.WriteReferenceLink(api, "bool");
break;
case "T:System.Byte":
writer.WriteReferenceLink(api, "byte");
break;
case "T:System.SByte":
writer.WriteReferenceLink(api, "sbyte");
break;
case "T:System.Char":
writer.WriteReferenceLink(api, "char");
break;
case "T:System.Int16":
writer.WriteReferenceLink(api, "int16");
break;
case "T:System.Int32":
writer.WriteReferenceLink(api, "int");
break;
case "T:System.Int64":
writer.WriteReferenceLink(api, "int64");
break;
case "T:System.UInt16":
writer.WriteReferenceLink(api, "uint16");
break;
case "T:System.UInt32":
writer.WriteReferenceLink(api, "uint32");
break;
case "T:System.UInt64":
writer.WriteReferenceLink(api, "uint64");
break;
case "T:System.Single":
writer.WriteReferenceLink(api, "float32");
break;
case "T:System.Double":
writer.WriteReferenceLink(api, "float");
break;
case "T:System.Decimal":
writer.WriteReferenceLink(api, "decimal");
break;
default:
writer.WriteReferenceLink(api);
break;
}
}
示例2: WriteEventSyntax
public override void WriteEventSyntax(XPathNavigator reflection, SyntaxWriter writer)
{
string name = (string)reflection.Evaluate(apiNameExpression);
XPathNavigator handler = reflection.SelectSingleNode(apiHandlerOfEventExpression);
XPathNavigator args = reflection.SelectSingleNode(apiEventArgsExpression);
bool isVirtual = (bool)reflection.Evaluate(apiIsVirtualExpression) && !(bool)reflection.Evaluate(apiIsAbstractProcedureExpression);
int iterations = isVirtual ? 2 : 1;
for (int i = 0; i < iterations; i++)
{
WriteAttributes(reflection, writer);
WriteVisibility(reflection, writer);
if (isVirtual)
if (i == 0)
{
writer.WriteKeyword("abstract");
writer.WriteString(" ");
}
else
{
writer.WriteKeyword("override");
writer.WriteString(" ");
}
else
{
WriteMemberKeyword(reflection, writer);
}
writer.WriteIdentifier(name);
writer.WriteString(" : ");
writer.WriteReferenceLink("T:Microsoft.FSharp.Control.IEvent");
writer.WriteString("<");
WriteTypeReference(handler, writer);
writer.WriteString(",");
writer.WriteLine();
writer.WriteString(" ");
if (args == null)
{
writer.WriteReferenceLink("T:System.EventArgs");
}
else
{
WriteTypeReference(args, writer);
}
writer.WriteString(">");
if (i == 0)
writer.WriteLine();
}
}
示例3: WriteAttribute
// Attributes
private void WriteAttribute(string reference, SyntaxWriter writer)
{
writer.WriteString("[<");
writer.WriteReferenceLink(reference);
writer.WriteString(">]");
writer.WriteLine();
}
示例4: WriteAttachedEventSyntax
public virtual void WriteAttachedEventSyntax(XPathNavigator reflection, SyntaxWriter writer)
{
string adderId = (string)reflection.Evaluate(attachedEventAdderExpression);
string removerId = (string)reflection.Evaluate(attachedEventRemoverExpression);
if (!(string.IsNullOrEmpty(adderId) && string.IsNullOrEmpty(removerId)))
{
writer.WriteString("See ");
writer.WriteReferenceLink(adderId);
writer.WriteString(", ");
writer.WriteReferenceLink(removerId);
}
}
示例5: ObjectElementUsageForClassStruct
private void ObjectElementUsageForClassStruct(XPathNavigator reflection, SyntaxWriter writer)
{
string typeName = (string)reflection.Evaluate(apiNameExpression);
bool isGeneric = (bool)reflection.Evaluate(apiIsGenericExpression);
string xamlBlockId = System.Enum.GetName(typeof(XamlHeadingID), XamlHeadingID.xamlObjectElementUsageHeading);
string contentPropertyId = (string)reflection.Evaluate(contentPropertyIdExpression);
if (contentPropertyId == "")
contentPropertyId = (string)reflection.Evaluate(ancestorContentPropertyIdExpression);
// start the syntax block
writer.WriteStartSubBlock(xamlBlockId);
writer.WriteString("<");
if (isGeneric)
{
writer.WriteIdentifier(typeName);
// for generic types show the type arguments
XPathNodeIterator templates = (XPathNodeIterator)reflection.Evaluate(apiTemplatesExpression);
if (templates.Count > 0)
{
writer.WriteString(" x:TypeArguments=\"");
while (templates.MoveNext())
{
XPathNavigator template = templates.Current;
string name = template.GetAttribute("name", String.Empty);
writer.WriteString(name);
if (templates.CurrentPosition < templates.Count)
writer.WriteString(",");
}
writer.WriteString("\"");
}
}
else
{
// for non-generic types just show the name
writer.WriteIdentifier(typeName);
}
if (contentPropertyId == string.Empty)
{
writer.WriteString(" .../>");
}
else
{
// close the start tag
writer.WriteString(">");
// the inner xml of the Object Element syntax for a type with a content property
// is a link to the content property
writer.WriteLine();
writer.WriteString(" ");
writer.WriteReferenceLink(contentPropertyId);
writer.WriteLine();
// write the end tag
writer.WriteString("</");
writer.WriteIdentifier(typeName);
writer.WriteString(">");
}
// end the sub block
writer.WriteEndSubBlock();
}
示例6: WriteMemberReference
private void WriteMemberReference (XPathNavigator member, SyntaxWriter writer) {
string api = member.GetAttribute("api", String.Empty);
writer.WriteReferenceLink(api);
}
示例7: WriteAttachedPropertySyntax
public virtual void WriteAttachedPropertySyntax(XPathNavigator reflection, SyntaxWriter writer)
{
string getterId = (string)reflection.Evaluate(attachedPropertyGetterExpression);
string setterId = (string)reflection.Evaluate(attachedPropertySetterExpression);
if (!string.IsNullOrEmpty(getterId))
{
writer.WriteString("See ");
writer.WriteReferenceLink(getterId);
}
if (!string.IsNullOrEmpty(setterId))
{
if (!string.IsNullOrEmpty(getterId))
writer.WriteString(", ");
writer.WriteReferenceLink(setterId);
}
}
示例8: WriteNormalTypeReference
private void WriteNormalTypeReference (string reference, SyntaxWriter writer) {
switch (reference) {
case "T:System.Void":
writer.WriteReferenceLink(reference, "void");
break;
case "T:System.Boolean":
writer.WriteReferenceLink(reference, "boolean");
break;
case "T:System.Byte":
writer.WriteReferenceLink(reference, "byte");
break;
case "T:System.Char":
writer.WriteReferenceLink(reference, "char");
break;
case "T:System.Int16":
writer.WriteReferenceLink(reference, "short");
break;
case "T:System.Int32":
writer.WriteReferenceLink(reference, "int");
break;
case "T:System.Int64":
writer.WriteReferenceLink(reference, "long");
break;
case "T:System.Single":
writer.WriteReferenceLink(reference, "float");
break;
case "T:System.Double":
writer.WriteReferenceLink(reference, "double");
break;
default:
writer.WriteReferenceLink(reference);
break;
}
}
示例9: 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);
}
示例10: WriteNormalTypeReference
private void WriteNormalTypeReference (string reference, SyntaxWriter writer) {
switch (reference) {
case "T:System.Int16":
writer.WriteReferenceLink(reference, "Short");
break;
case "T:System.Int32":
writer.WriteReferenceLink(reference, "Integer");
break;
case "T:System.Int64":
writer.WriteReferenceLink(reference, "Long");
break;
case "T:System.UInt16":
writer.WriteReferenceLink(reference, "UShort");
break;
case "T:System.UInt32":
writer.WriteReferenceLink(reference, "UInteger");
break;
case "T:System.UInt64":
writer.WriteReferenceLink(reference, "ULong");
break;
default:
writer.WriteReferenceLink(reference);
break;
}
}
示例11: WriteAttribute
private void WriteAttribute (string reference, SyntaxWriter writer, bool newline) {
writer.WriteString("/** @attribute ");
writer.WriteReferenceLink(reference);
writer.WriteString(" */ ");
if (newline) writer.WriteLine();
}
示例12: WriteAttribute
private void WriteAttribute (string reference, bool newLine, SyntaxWriter writer) {
writer.WriteString("<");
writer.WriteReferenceLink(reference);
writer.WriteString(">");
if (newLine) {
writer.WriteString(" _");
writer.WriteLine();
}
}
示例13: WriteNormalTypeReference
/// <summary>
/// Write out a normal type reference
/// </summary>
/// <param name="api">The API name</param>
/// <param name="writer">The syntax writer to which it is written</param>
private static void WriteNormalTypeReference(string api,
SyntaxWriter writer)
{
switch(api)
{
case "T:System.Byte":
writer.WriteReferenceLink(api, "Byte");
break;
case "T:System.SByte":
writer.WriteReferenceLink(api, "SByte");
break;
case "T:System.Char":
writer.WriteReferenceLink(api, "Char");
break;
case "T:System.Int16":
writer.WriteReferenceLink(api, "Int16");
break;
case "T:System.Int32":
writer.WriteReferenceLink(api, "Int32");
break;
case "T:System.Int64":
writer.WriteReferenceLink(api, "Int64");
break;
case "T:System.UInt16":
writer.WriteReferenceLink(api, "UInt16");
break;
case "T:System.UInt32":
writer.WriteReferenceLink(api, "UInt32");
break;
case "T:System.UInt64":
writer.WriteReferenceLink(api, "UInt64");
break;
case "T:System.Single":
writer.WriteReferenceLink(api, "Single");
break;
case "T:System.Double":
writer.WriteReferenceLink(api, "Double");
break;
case "T:System.Decimal":
writer.WriteReferenceLink(api, "Decimal");
break;
case "T:System.Boolean":
writer.WriteReferenceLink(api, "Boolean");
break;
default:
{
string text = api.Substring(2);
if(text.StartsWith("System.", StringComparison.Ordinal))
{
int num = text.LastIndexOf('.');
text = text.Substring(num + 1);
}
writer.WriteReferenceLink(api, text);
break;
}
}
}
示例14: WriteEventSyntax
private void WriteEventSyntax (XPathNavigator reflection, SyntaxWriter writer, string prefix) {
string name = (string)reflection.Evaluate(nameExpression);
string declaringType = (string)reflection.Evaluate(declaringTypeExpression);
string handlerType = (string)reflection.Evaluate(eventHandlerTypeExpression);
writer.WriteStartBlock(Language);
writer.WriteString("<");
writer.WriteString(prefix);
writer.WriteString(":");
writer.WriteReferenceLink(declaringType);
writer.WriteString(" ");
writer.WriteString("On");
writer.WriteString(name);
writer.WriteString("=\"");
writer.WriteReferenceLink(handlerType);
writer.WriteString("\" />");
writer.WriteEndBlock();
}
示例15: WritePropertySyntax
private void WritePropertySyntax (XPathNavigator reflection, SyntaxWriter writer, string prefix) {
bool set = (bool) reflection.Evaluate(propertyIsSettable);
if (!set) return;
string name = (string) reflection.Evaluate(nameExpression);
string declaringType = (string) reflection.Evaluate(declaringTypeExpression);
string propertyType = (string) reflection.Evaluate(propertyTypeExpression);
bool isInnerProperty = (bool)reflection.Evaluate(propertyIsInnerProperty);
writer.WriteStartBlock(Language);
if (isInnerProperty) {
// inner property logic
writer.WriteString("<");
writer.WriteString(prefix);
writer.WriteString(":");
writer.WriteReferenceLink(declaringType);
writer.WriteString(">");
writer.WriteLine();
writer.WriteString("\t");
writer.WriteString("<");
writer.WriteString(name);
writer.WriteString(">");
if (String.IsNullOrEmpty(propertyType)) {
writer.WriteParameter("value");
} else {
if (propertyType == "T:System.Boolean") {
writer.WriteString("True|False");
} else {
writer.WriteReferenceLink(propertyType);
}
}
writer.WriteString("</");
writer.WriteString(name);
writer.WriteString(">");
writer.WriteLine();
writer.WriteString("</");
writer.WriteString(prefix);
writer.WriteString(":");
writer.WriteReferenceLink(declaringType);
writer.WriteString(">");
} else {
// normal property logic
writer.WriteString("<");
writer.WriteString(prefix);
writer.WriteString(":");
writer.WriteReferenceLink(declaringType);
writer.WriteString(" ");
writer.WriteString(name);
writer.WriteString("=\"");
if (String.IsNullOrEmpty(propertyType)) {
writer.WriteParameter("value");
} else {
if (propertyType == "T:System.Boolean") {
writer.WriteString("True|False");
} else {
writer.WriteReferenceLink(propertyType);
}
}
writer.WriteString("\" />");
}
writer.WriteEndBlock();
}