示例#1
0
 internal override string FormatType(NdrFormatter formatter)
 {
     if (IsConstant)
     {
         string name = formatter.IidToName(Iid);
         if (name != null)
         {
             return(formatter.FormatPointer(name));
         }
         return($"{formatter.FormatComment("Unknown IID: {0}", Iid)} {formatter.FormatPointer("IUnknown")}");
     }
     else
     {
         return($"{formatter.FormatComment("iid_is param offset: {0}", IidIsDescriptor.Offset)} {formatter.FormatPointer("IUnknown")}");
     }
 }
        internal string Format(NdrFormatter context)
        {
            NdrStringBuilder builder = new NdrStringBuilder();

            builder.AppendLine("[Guid(\"{0}\")]", Iid);
            string base_name = context.IidToName(BaseIid);

            if (base_name == null)
            {
                base_name = $"/* Unknown IID {BaseIid} */ IUnknown";
            }

            builder.AppendLine("interface {0} : {1} {{", context.DemangleComName(Name), base_name);
            builder.PushIndent(' ', 4);
            foreach (NdrProcedureDefinition proc in Procedures)
            {
                builder.AppendLine(proc.FormatProcedure(context));
            }
            builder.PopIndent();
            builder.AppendLine("}").AppendLine();
            return(builder.ToString());
        }