當前位置: 首頁>>代碼示例>>C#>>正文


C# XmlDictionaryWriter.WriteBase64方法代碼示例

本文整理匯總了C#中System.Xml.XmlDictionaryWriter.WriteBase64方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlDictionaryWriter.WriteBase64方法的具體用法?C# XmlDictionaryWriter.WriteBase64怎麽用?C# XmlDictionaryWriter.WriteBase64使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.XmlDictionaryWriter的用法示例。


在下文中一共展示了XmlDictionaryWriter.WriteBase64方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: WriteObject

 public override void WriteObject(XmlDictionaryWriter writer, object graph)
 {
     var data = EncodeObject(graph);
     writer.WriteStartElement("Data");
     writer.WriteBase64(data, 0, data.Length);
     writer.WriteEndElement();
 }
開發者ID:cg123,項目名稱:xenko,代碼行數:7,代碼來源:XenkoXmlObjectSerializer.cs

示例2: WriteHeader

        private void WriteHeader(XmlDictionaryWriter writer)
        {
            var nonce = new byte[64];
            RandomNumberGenerator.Create().GetBytes(nonce);
            string created = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.mszzzz");

            writer.WriteStartElement("wsse", "UsernameToken", null);
            writer.WriteAttributeString("wsu:Id", "UsernameToken-1");
            writer.WriteStartElement("wsse", "Username", null);
            writer.WriteString(SystemUser);
            writer.WriteEndElement();//End Username 
            writer.WriteStartElement("wsse", "Password", null);
            writer.WriteAttributeString("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest");
            writer.WriteString(ComputePasswordDigest(SystemPassword, nonce, created));
            writer.WriteEndElement();//End Password 
            writer.WriteStartElement("wsse", "Nonce", null);
            writer.WriteAttributeString("EncodingType", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary");
            writer.WriteBase64(nonce, 0, nonce.Length);
            writer.WriteEndElement();//End Nonce 
            writer.WriteStartElement("wsu", "Created", null);
            writer.WriteString(created);
            writer.WriteEndElement();//End Created
            writer.WriteEndElement();//End UsernameToken
            writer.Flush();
        }
開發者ID:Rijndaal,項目名稱:midpoint,代碼行數:25,代碼來源:WsSecurityHeaders.cs

示例3: WriteChunkCallback

 void WriteChunkCallback(XmlDictionaryWriter writer, object state)
 {
     ChunkState chunkState = (ChunkState)state;
     writer.WriteStartElement(ChunkingUtils.ChunkElement, ChunkingUtils.ChunkNs);
     writer.WriteBase64(chunkState.Buffer, 0, chunkState.Count);
     writer.WriteEndElement();
 }
開發者ID:spzenk,項目名稱:sfdocsamples,代碼行數:7,代碼來源:ChunkingWriter.cs

示例4: OnWriteBodyContents

        /// <summary>
        /// Writes the given content to output writer.
        /// </summary>
        /// <param name="writer">Output writer instance.</param>
        protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
        {
            var buffer = this.contentEncoding.GetBytes(this.content);

            writer.WriteStartElement("Binary");
            writer.WriteBase64(buffer, 0, buffer.Length);
            writer.WriteEndElement();
        }
開發者ID:baio,項目名稱:Microsoft.Data.Services.Toolkit,代碼行數:12,代碼來源:JsonBodyWriter.cs

示例5: OnWriteBodyContents

        protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
        {
            writer.WriteStartElement("Binary");

            FileStream fs = new FileStream(this.testFileName, FileMode.Open);
            byte[] tmp = new byte[fs.Length];
            fs.Read(tmp, 0, tmp.Length);
            writer.WriteBase64(tmp, 0, (int)tmp.Length);

            writer.WriteEndElement();
            fs.Close();
        }
開發者ID:tian1ll1,項目名稱:WPF_Examples,代碼行數:12,代碼來源:ByteStreamBodyWriter.cs

示例6: WriteTo

 public void WriteTo(XmlDictionaryWriter writer, string prefix, XmlDictionaryString localName, XmlDictionaryString ns, XmlDictionaryString valueTypeLocalName, XmlDictionaryString valueTypeNs)
 {
     writer.WriteStartElement(prefix, localName, ns);
     writer.WriteStartAttribute(valueTypeLocalName, valueTypeNs);
     if (valueTypeUriDictionaryString != null)
         writer.WriteString(valueTypeUriDictionaryString);
     else
         writer.WriteString(valueTypeUri);
     writer.WriteEndAttribute();
     writer.WriteStartAttribute(XD.SecurityJan2004Dictionary.EncodingType, null);
     writer.WriteString(XD.SecurityJan2004Dictionary.EncodingTypeValueBase64Binary);
     writer.WriteEndAttribute();
     writer.WriteBase64(this.negotiationData, 0, this.negotiationData.Length);
     writer.WriteEndElement();
 }
開發者ID:krytht,項目名稱:DotNetReferenceSource,代碼行數:15,代碼來源:BinaryNegotiation.cs

示例7: OnWriteBodyContents

        /// <summary>
        /// Writes the body to the stream.
        /// </summary>
        protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
        {
            if (m_isRequest)
            {
                writer.WriteStartElement("InvokeServiceRequest", Namespaces.OpcUaXsd);
            }
            else
            {
                writer.WriteStartElement("InvokeServiceResponse", Namespaces.OpcUaXsd);
            }

            if (m_data != null)
            {
                writer.WriteBase64(m_data, 0, m_data.Length);
            }

            writer.WriteEndElement();
        }
開發者ID:yuriik83,項目名稱:UA-.NET,代碼行數:21,代碼來源:InvokeServiceBodyWriter.cs

示例8: WriteValue

 public void WriteValue(XmlDictionaryWriter writer, object value)
 {
     if (_isArray)
     {
         switch (_typeCode)
         {
             case TypeCode.Byte:
                 {
                     byte[] arrayValue = (byte[])value;
                     writer.WriteBase64(arrayValue, 0, arrayValue.Length);
                 }
                 break;
             case TypeCode.Boolean:
                 {
                     bool[] arrayValue = (bool[])value;
                     writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
                 }
                 break;
             case TypeCode.DateTime:
                 {
                     DateTime[] arrayValue = (DateTime[])value;
                     writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
                 }
                 break;
             case TypeCode.Decimal:
                 {
                     decimal[] arrayValue = (decimal[])value;
                     writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
                 }
                 break;
             case TypeCode.Int32:
                 {
                     Int32[] arrayValue = (Int32[])value;
                     writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
                 }
                 break;
             case TypeCode.Int64:
                 {
                     Int64[] arrayValue = (Int64[])value;
                     writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
                 }
                 break;
             case TypeCode.Single:
                 {
                     float[] arrayValue = (float[])value;
                     writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
                 }
                 break;
             case TypeCode.Double:
                 {
                     double[] arrayValue = (double[])value;
                     writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
                 }
                 break;
             default:
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.SFxInvalidUseOfPrimitiveOperationFormatter));
         }
     }
     else
     {
         switch (_typeCode)
         {
             case TypeCode.Boolean:
                 writer.WriteValue((bool)value);
                 break;
             case TypeCode.DateTime:
                 writer.WriteValue((DateTime)value);
                 break;
             case TypeCode.Decimal:
                 writer.WriteValue((Decimal)value);
                 break;
             case TypeCode.Double:
                 writer.WriteValue((double)value);
                 break;
             case TypeCode.Int32:
                 writer.WriteValue((int)value);
                 break;
             case TypeCode.Int64:
                 writer.WriteValue((long)value);
                 break;
             case TypeCode.Single:
                 writer.WriteValue((float)value);
                 break;
             case TypeCode.String:
                 writer.WriteString((string)value);
                 break;
             default:
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.SFxInvalidUseOfPrimitiveOperationFormatter));
         }
     }
 }
開發者ID:shijiaxing,項目名稱:wcf,代碼行數:91,代碼來源:PrimitiveOperationFormatter.cs

示例9: OnWriteBodyContents

 protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
 {
     writer.WriteStartElement("Binary");
     writer.WriteBase64(this.messageBytes, 0, this.messageBytes.Length);
     writer.WriteEndElement();
 }
開發者ID:pusp,項目名稱:o2platform,代碼行數:6,代碼來源:HelpPageInvoker.cs

示例10: OnWriteBodyContents

 protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
 {
     writer.WriteStartElement(BinaryBodyReader.BinaryElementName);
     writer.WriteBase64(_data, 0, _data.Length);
     writer.WriteEndElement();
 }
開發者ID:huoxudong125,項目名稱:WcfRestContrib,代碼行數:6,代碼來源:BinaryBodyWriter.cs

示例11: OnWriteBodyContents

 protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
 {
     writer.WriteStartElement("Binary");
     byte[] buffer = JSONPSupportInspector.encoding.GetBytes(this.content);
     writer.WriteBase64(buffer, 0, buffer.Length);
     writer.WriteEndElement();
 }
開發者ID:gabla5,項目名稱:LearningProjects,代碼行數:7,代碼來源:JsonPSupportBehaviorAttribute.cs

示例12: OnWriteBodyContents

        protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
        {
            writer.WriteStartElement(StreamBodyWriter.StreamElementName);

            byte[] buffer = new byte[BufferSize];
            while (true)
            {
                int actual = this.stream.Read(buffer, 0, buffer.Length);
                if (actual == 0)
                {
                    break;
                }
                writer.WriteBase64(buffer, 0, actual);
            }

            //this.stream.Close();

            writer.WriteEndElement();
        }
開發者ID:ssickles,項目名稱:archive,代碼行數:19,代碼來源:StreamMessageHelper.cs

示例13: WriteKeyIdentifierClauseCore

            public override void WriteKeyIdentifierClauseCore(XmlDictionaryWriter writer, SecurityKeyIdentifierClause keyIdentifierClause)
            {
                EncryptedKeyIdentifierClause encryptedKeyClause = keyIdentifierClause as EncryptedKeyIdentifierClause;

                writer.WriteStartElement(XD.XmlEncryptionDictionary.Prefix.Value, XD.XmlEncryptionDictionary.EncryptedKey, NamespaceUri);

                if (encryptedKeyClause.EncryptionMethod != null)
                {
                    writer.WriteStartElement(XD.XmlEncryptionDictionary.Prefix.Value, XD.XmlEncryptionDictionary.EncryptionMethod, NamespaceUri);
                    writer.WriteAttributeString(XD.XmlEncryptionDictionary.AlgorithmAttribute, null, encryptedKeyClause.EncryptionMethod);
                    if (encryptedKeyClause.EncryptionMethod == XD.SecurityAlgorithmDictionary.RsaOaepKeyWrap.Value)
                    {
                        writer.WriteStartElement(XmlSignatureStrings.Prefix, XD.XmlSignatureDictionary.DigestMethod, XD.XmlSignatureDictionary.Namespace);
                        writer.WriteAttributeString(XD.XmlSignatureDictionary.Algorithm, null, SecurityAlgorithms.Sha1Digest);
                        writer.WriteEndElement();
                    }
                    writer.WriteEndElement();
                }

                if (encryptedKeyClause.EncryptingKeyIdentifier != null)
                {
                    this.securityTokenSerializer.WriteKeyIdentifier(writer, encryptedKeyClause.EncryptingKeyIdentifier);
                }

                writer.WriteStartElement(XD.XmlEncryptionDictionary.Prefix.Value, XD.XmlEncryptionDictionary.CipherData, NamespaceUri);
                writer.WriteStartElement(XD.XmlEncryptionDictionary.Prefix.Value, XD.XmlEncryptionDictionary.CipherValue, NamespaceUri);
                byte[] encryptedKey = encryptedKeyClause.GetEncryptedKey();
                writer.WriteBase64(encryptedKey, 0, encryptedKey.Length);
                writer.WriteEndElement();
                writer.WriteEndElement();

                if (encryptedKeyClause.CarriedKeyName != null)
                {
                    writer.WriteElementString(XD.XmlEncryptionDictionary.Prefix.Value, XD.XmlEncryptionDictionary.CarriedKeyName, NamespaceUri, encryptedKeyClause.CarriedKeyName);
                }

                writer.WriteEndElement();
            }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:38,代碼來源:XmlEncApr2001.cs

示例14: WriteTokenCore

            public override void WriteTokenCore(XmlDictionaryWriter writer, SecurityToken token)
            {
                string id;
                byte[] rawData;

                WriteBinaryCore(token, out id, out rawData);

                if (rawData == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("rawData");
                }

                writer.WriteStartElement(XD.SecurityJan2004Dictionary.Prefix.Value, ElementName, XD.SecurityJan2004Dictionary.Namespace);
                if (id != null)
                {
                    writer.WriteAttributeString(XD.UtilityDictionary.Prefix.Value, XD.UtilityDictionary.IdAttribute, XD.UtilityDictionary.Namespace, id);
                }
                if (valueTypeUris != null)
                {
                    writer.WriteAttributeString(ValueTypeAttribute, null, this.valueTypeUris[0]);
                }
                if (this.tokenSerializer.EmitBspRequiredAttributes)
                {
                    writer.WriteAttributeString(EncodingTypeAttribute, null, EncodingTypeValueBase64Binary);
                }
                writer.WriteBase64(rawData, 0, rawData.Length);
                writer.WriteEndElement(); // BinarySecurityToken
            }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:28,代碼來源:WSSecurityJan2004.cs

示例15: WriteSignatureConfirmation

 internal override void WriteSignatureConfirmation(XmlDictionaryWriter writer, string id, byte[] signature)
 {
     if (id == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("id");
     }
     if (signature == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("signature");
     }
     writer.WriteStartElement(XD.SecurityXXX2005Dictionary.Prefix.Value, XD.SecurityXXX2005Dictionary.SignatureConfirmation, XD.SecurityXXX2005Dictionary.Namespace);
     writer.WriteAttributeString(XD.UtilityDictionary.Prefix.Value, XD.UtilityDictionary.IdAttribute, XD.UtilityDictionary.Namespace, id);
     writer.WriteStartAttribute(XD.SecurityXXX2005Dictionary.ValueAttribute, null);
     writer.WriteBase64(signature, 0, signature.Length);
     writer.WriteEndAttribute();
     writer.WriteEndElement();
 }
開發者ID:weshaggard,項目名稱:wcf,代碼行數:17,代碼來源:SecurityVersion.cs


注:本文中的System.Xml.XmlDictionaryWriter.WriteBase64方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。