当前位置: 首页>>代码示例>>C#>>正文


C# XmlDictionaryWriter.WriteBinHex方法代码示例

本文整理汇总了C#中System.Xml.XmlDictionaryWriter.WriteBinHex方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryWriter.WriteBinHex方法的具体用法?C# XmlDictionaryWriter.WriteBinHex怎么用?C# XmlDictionaryWriter.WriteBinHex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlDictionaryWriter的用法示例。


在下文中一共展示了XmlDictionaryWriter.WriteBinHex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteContent

            public override void WriteContent(XmlDictionaryWriter writer, SecurityKeyIdentifierClause clause)
            {
                writer.WriteStartElement(XD.SecurityJan2004Dictionary.Prefix.Value, XD.SecurityJan2004Dictionary.KeyIdentifier, XD.SecurityJan2004Dictionary.Namespace);
                writer.WriteAttributeString(XD.SecurityJan2004Dictionary.ValueType, null, this.ValueTypeUri);
                if (this.tokenSerializer.EmitBspRequiredAttributes)
                {
                    writer.WriteAttributeString(XD.SecurityJan2004Dictionary.EncodingType, null, this.DefaultEncodingType);
                }
                string defaultEncodingType = this.DefaultEncodingType;
                byte[] buffer = (clause as BinaryKeyIdentifierClause).GetBuffer();
                switch (defaultEncodingType)
                {
                    case "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary":
                        writer.WriteBase64(buffer, 0, buffer.Length);
                        break;

                    case "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#HexBinary":
                        writer.WriteBinHex(buffer, 0, buffer.Length);
                        break;

                    case "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Text":
                        writer.WriteString(new UTF8Encoding().GetString(buffer, 0, buffer.Length));
                        break;
                }
                writer.WriteEndElement();
            }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:WSSecurityJan2004.cs

示例2: WriteObjectContent

        public override void WriteObjectContent(XmlDictionaryWriter writer, object graph)
        {
            if (this.isCustomSerialization)
            {
                DataContractJsonSerializer ser = new DataContractJsonSerializer(this.type);

                using (MemoryStream ms = new MemoryStream())
                {
                    if (m_IsCompress)
                    {
                        using (DeflateStream ds = new DeflateStream(ms, CompressionMode.Compress))
                        {
                            ser.WriteObject(ds, graph);
                            ds.Flush();
                            ds.Close();
                        }
                    }
                    else
                    {
                        ser.WriteObject(ms, graph);
                    }

                    byte[] compressed = ms.ToArray();

                    if (!m_IsCompress)
                    {
                        switch (m_ContentType)
                        {
                            case SerializeContentTypes.String:
                                string value = Encoding.UTF8.GetString(compressed);
                                writer.WriteString(value);
                                break;
                            case SerializeContentTypes.BinHex:
                                writer.WriteBinHex(compressed, 0, compressed.Length);
                                break;
                        }
                    }
                    else
                    {
                        writer.WriteBinHex(compressed, 0, compressed.Length);
                    }
                }
            }
            else
            {
                this.fallbackSerializer.WriteObjectContent(writer, graph);
            }
        }
开发者ID:JackFong,项目名称:GenericWcfServiceHostAndClient,代码行数:48,代码来源:JsonSerializer.cs

示例3: WriteContent

            public override void WriteContent(XmlDictionaryWriter writer, SecurityKeyIdentifierClause clause)
            {
                writer.WriteStartElement(XD.SecurityJan2004Dictionary.Prefix.Value, XD.SecurityJan2004Dictionary.KeyIdentifier, XD.SecurityJan2004Dictionary.Namespace);
                writer.WriteAttributeString(XD.SecurityJan2004Dictionary.ValueType, null, ValueTypeUri);
                KerberosTicketHashKeyIdentifierClause binaryClause = clause as KerberosTicketHashKeyIdentifierClause;
                if (this.EmitBspRequiredAttributes)
                {
                    // Emit the encodingType attribute.
                    writer.WriteAttributeString(XD.SecurityJan2004Dictionary.EncodingType, null, DefaultEncodingType);
                }
                string encoding = DefaultEncodingType;

                byte[] keyIdentifier = binaryClause.GetBuffer();
                if (encoding == EncodingTypeValueBase64Binary)
                {
                    writer.WriteBase64(keyIdentifier, 0, keyIdentifier.Length);
                }
                else if (encoding == EncodingTypeValueHexBinary)
                {
                    writer.WriteBinHex(keyIdentifier, 0, keyIdentifier.Length);
                }
                else if (encoding == EncodingTypeValueText)
                {
                    writer.WriteString(new UTF8Encoding().GetString(keyIdentifier, 0, keyIdentifier.Length));
                }
                writer.WriteEndElement();
            }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:27,代码来源:WSSecurityJan2004.cs


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