當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。