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


C# AMFWriter.WriteData方法代碼示例

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


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

示例1: WriteData

		public void WriteData(AMFWriter writer, object data) {
			if (data is INullable) {
				if ((data as INullable).IsNull) {
					writer.WriteNull();
					return;
				}
			}
			if (data is SqlByte) {
				writer.WriteData(ObjectEncoding.AMF0, ((SqlByte)data).Value);
				return;
			}
			if (data is SqlInt16) {
				writer.WriteData(ObjectEncoding.AMF0, ((SqlInt16)data).Value);
				return;
			}
			if (data is SqlInt32) {
				writer.WriteData(ObjectEncoding.AMF0, ((SqlInt32)data).Value);
				return;
			}
			if (data is SqlInt64) {
				writer.WriteData(ObjectEncoding.AMF0, ((SqlInt64)data).Value);
				return;
			}
			if (data is SqlSingle) {
				writer.WriteData(ObjectEncoding.AMF0, ((SqlSingle)data).Value);
				return;
			}
			if (data is SqlDouble) {
				writer.WriteData(ObjectEncoding.AMF0, ((SqlDouble)data).Value);
				return;
			}
			if (data is SqlDecimal) {
				writer.WriteData(ObjectEncoding.AMF0, ((SqlDecimal)data).Value);
				return;
			}
			if (data is SqlMoney) {
				writer.WriteData(ObjectEncoding.AMF0, ((SqlMoney)data).Value);
				return;
			}
			if (data is SqlDateTime) {
				writer.WriteData(ObjectEncoding.AMF0, ((SqlDateTime)data).Value);
				return;
			}
			if (data is SqlString) {
				writer.WriteString(((SqlString)data).Value);
				return;
			}
			if (data is SqlGuid) {
				writer.WriteData(ObjectEncoding.AMF0, ((SqlGuid)data).Value.ToString("D"));
				return;
			}
			if (data is SqlBoolean) {
				writer.WriteBoolean(((SqlBoolean)data).Value);
				return;
			}
			string msg = string.Format("Could not find serializer for type {0}", data.GetType().FullName);
			if (_log.IsErrorEnabled)
				_log.Error(msg);
			throw new FluorineException(msg);
		}
開發者ID:GodLesZ,項目名稱:svn-dump,代碼行數:60,代碼來源:AMF0SqlTypesWriter.cs

示例2: Serialize

        /// <summary>
        /// Writes the object to the specified output stream.
        /// </summary>
        /// <param name="writer">Writer to write to.</param>
        public void Serialize(AMFWriter writer)
        {
#if !(NET_1_1)
            Dictionary<string, object> persistentAttributes = new Dictionary<string, object>();
#else
            Hashtable persistentAttributes = new Hashtable();
#endif
            foreach (string attribute in this.GetAttributeNames())
            {
                if (attribute.StartsWith(Constants.TransientPrefix))
                    continue;
                persistentAttributes.Add(attribute, this[attribute]);
            }
            writer.WriteData(ObjectEncoding.AMF0, persistentAttributes);
        }
開發者ID:apakian,項目名稱:fluorinefx,代碼行數:19,代碼來源:PersistableAttributeStore.cs

示例3: InjectMetaCue

		/// <summary>
		/// Injects metadata (Cue Points) into a tag.
		/// </summary>
		/// <param name="meta">Metadata.</param>
		/// <param name="tag">Tag.</param>
		/// <returns></returns>
		private ITag InjectMetaCue(MetaCue meta, ITag tag) {
			MemoryStream ms = new MemoryStream();
			AMFWriter writer = new AMFWriter(ms);
			writer.WriteData(ObjectEncoding.AMF0, "onCuePoint");
			writer.WriteData(ObjectEncoding.AMF0, meta);
			byte[] buffer = ms.ToArray();
			return new Tag(IOConstants.TYPE_METADATA, GetTimeInMilliseconds(meta), buffer.Length, buffer, tag.PreviousTagSize);
		}
開發者ID:GodLesZ,項目名稱:svn-dump,代碼行數:14,代碼來源:MetaService.cs

示例4: InjectMetaData

		/// <summary>
		/// Injects metadata (other than Cue points) into a tag.
		/// </summary>
		/// <param name="meta">Metadata.</param>
		/// <param name="tag">Tag.</param>
		/// <returns></returns>
		private ITag InjectMetaData(MetaData meta, ITag tag) {
			MemoryStream ms = new MemoryStream();
			AMFWriter writer = new AMFWriter(ms);
			writer.WriteData(ObjectEncoding.AMF0, "onMetaData");
			writer.WriteData(ObjectEncoding.AMF0, meta);
			byte[] buffer = ms.ToArray();
			return new Tag(IOConstants.TYPE_METADATA, 0, buffer.Length, buffer, tag.PreviousTagSize);
		}
開發者ID:GodLesZ,項目名稱:svn-dump,代碼行數:14,代碼來源:MetaService.cs

示例5: WriteData

 public void WriteData(AMFWriter writer, object data)
 {
     writer.WriteData(ObjectEncoding.AMF0, (data as CacheableObject).Object);
 }
開發者ID:mstaessen,項目名稱:fluorinefx,代碼行數:4,代碼來源:AMF0CacheResultWriter.cs

示例6: Serialize

        public void Serialize(AMFWriter writer)
		{
            writer.WriteString(this.Name);
            writer.WriteString(this.Path);
            writer.WriteData(ObjectEncoding.AMF0, _attributes);
		}
開發者ID:Nicholi,項目名稱:fluorinefx-mod,代碼行數:6,代碼來源:SharedObject.cs

示例7: WriteBodyData

 /// <summary>
 /// This method supports the Fluorine infrastructure and is not intended to be used directly from your code.
 /// </summary>
 protected virtual void WriteBodyData(ObjectEncoding objectEncoding, AMFWriter writer)
 {
     object content = this.Content;
     writer.WriteData(objectEncoding, content);
 }
開發者ID:ByteSempai,項目名稱:Ubiquitous,代碼行數:8,代碼來源:AMFBody.cs

示例8: WriteBodyData

		protected override void WriteBodyData(ObjectEncoding objectEncoding, AMFWriter writer)
		{
			writer.WriteData(objectEncoding, this.Content);
		}
開發者ID:ByteSempai,項目名稱:Ubiquitous,代碼行數:4,代碼來源:CachedBody.cs


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