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


C# EventReader类代码示例

本文整理汇总了C#中EventReader的典型用法代码示例。如果您正苦于以下问题:C# EventReader类的具体用法?C# EventReader怎么用?C# EventReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: YamlDocument

		/// <summary>
		/// Initializes a new instance of the <see cref="YamlDocument"/> class.
		/// </summary>
		/// <param name="events">The events.</param>
		internal YamlDocument(EventReader events)
		{
			DocumentLoadingState state = new DocumentLoadingState();

			events.Expect<DocumentStart>();

			while (!events.Accept<DocumentEnd>())
			{
				Debug.Assert(RootNode == null);
				RootNode = YamlNode.ParseNode(events, state);

				if (RootNode is YamlAliasNode)
				{
					throw new YamlException();
				}
			}

			state.ResolveAliases();

#if DEBUG
			foreach (var node in AllNodes)
			{
				if (node is YamlAliasNode)
				{
					throw new InvalidOperationException("Error in alias resolution.");
				}
			}
#endif

			events.Expect<DocumentEnd>();
		}
开发者ID:Cyberbanan,项目名称:Projeny,代码行数:35,代码来源:YamlDocument.cs

示例2: PopulateHeal

 protected void PopulateHeal( EventReader reader )
 {
     amount = reader.ReadInt32();
     overkill = reader.ReadInt32();
     absorbed = reader.ReadInt32();
     critical = reader.ReadString() != null;
 }
开发者ID:ZixThree,项目名称:WowLogAnalyzer,代码行数:7,代码来源:CombatLogEventHeal.cs

示例3: DeserializeScript

 protected virtual Script DeserializeScript(ReloadedScriptEntry reloadedScript)
 {
     var eventReader = new EventReader(new MemoryParser(reloadedScript.YamlEvents));
     var scriptCollection = (ScriptCollection)YamlSerializer.Deserialize(eventReader, null, typeof(ScriptCollection), log != null ? new SerializerContextSettings { Logger = new YamlForwardLogger(log) } : null);
     var script = scriptCollection.Count == 1 ? scriptCollection[0] : null;
     return script;
 }
开发者ID:releed,项目名称:paradox,代码行数:7,代码来源:AssemblyReloader.cs

示例4: InternalPopulate

 protected override void InternalPopulate( EventReader reader )
 {
     base.InternalPopulate(reader);
     enchant = reader.ReadString();
     itemId = reader.ReadInt32();
     itemName = reader.ReadString();
 }
开发者ID:ZixThree,项目名称:WowLogAnalyzer,代码行数:7,代码来源:EnchantApplied.cs

示例5: DeserializeValue

        public object DeserializeValue(EventReader reader, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
        {
            var nodeEvent = reader.Peek<NodeEvent>();

            var nodeType = GetTypeFromEvent(nodeEvent, expectedType);

            try
            {
                foreach (var deserializer in deserializers)
                {
                    object value;
                    if (deserializer.Deserialize(reader, nodeType, (r, t) => nestedObjectDeserializer.DeserializeValue(r, t, state, nestedObjectDeserializer), out value))
                    {
                        return value;
                    }
                }
            }
            catch (YamlException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new YamlException(nodeEvent.Start, nodeEvent.End, "Exception during deserialization", ex);
            }

            throw new YamlException(
                nodeEvent.Start,
                nodeEvent.End,
                string.Format(
                    "No node deserializer was able to deserialize the node into type {0}",
                    expectedType.AssemblyQualifiedName
                )
            );
        }
开发者ID:t4world,项目名称:AssetGraph,代码行数:35,代码来源:NodeValueDeserializer.cs

示例6: nestedObjectDeserializer

		bool INodeDeserializer.Deserialize(EventReader reader, Type expectedType, Func<EventReader, Type, object> nestedObjectDeserializer, out object value)
		{
			if (!typeof(IList).IsAssignableFrom(expectedType))
			{
				value = false;
				return false;
			}

			reader.Expect<SequenceStart>();

			var list = (IList)_objectFactory.Create(expectedType);
			while (!reader.Accept<SequenceEnd>())
			{
				var item = nestedObjectDeserializer(reader, typeof(object));
				var promise = item as IValuePromise;
				if (promise == null)
				{
					list.Add(item);
				}
				else
				{
					var index = list.Count;
					list.Add(null);
					promise.ValueAvailable += v => list[index] = v;
				}
			}
			value = list;

			reader.Expect<SequenceEnd>();

			return true;
		}
开发者ID:ChelseaLing,项目名称:AssetGraph,代码行数:32,代码来源:NonGenericListNodeDeserializer.cs

示例7: YamlScalarNode

		/// <summary>
		/// Initializes a new instance of the <see cref="YamlScalarNode"/> class.
		/// </summary>
		/// <param name="events">The events.</param>
		/// <param name="state">The state.</param>
		internal YamlScalarNode(EventReader events, DocumentLoadingState state)
		{
			Scalar scalar = events.Expect<Scalar>();
			Load(scalar, state);
			Value = scalar.Value;
			Style = scalar.Style;
		}
开发者ID:modulexcite,项目名称:SharpYaml,代码行数:12,代码来源:YamlScalarNode.cs

示例8: Start

 // Use this for initialization
 void Start () {
     var input = new StringReader(Document);
     
     var deserializer = new Deserializer();
     
     var reader = new EventReader(new Parser(input));
     
     // Consume the stream start event "manually"
     reader.Expect<StreamStart>();
     
     var output = new StringBuilder();
     while(reader.Accept<DocumentStart>())
     {
         // Deserialize the document
         var doc = deserializer.Deserialize<List<string>>(reader);
     
         output.AppendLine("## Document");
         foreach(var item in doc)
         {
             output.AppendLine(item);
         }
     }    
     Debug.Log(output);
     
 }
开发者ID:Phrohdoh,项目名称:Projeny,代码行数:26,代码来源:Deserializing_multiple_documents.cs

示例9: ParseNode

		/// <summary>
		/// Parses the node represented by the next event in <paramref name="events" />.
		/// </summary>
		/// <param name="events">The events.</param>
		/// <param name="state">The state.</param>
		/// <returns>Returns the node that has been parsed.</returns>
		static internal YamlNode ParseNode(EventReader events, DocumentLoadingState state)
		{
			if (events.Accept<Scalar>())
			{
				return new YamlScalarNode(events, state);
			}

			if (events.Accept<SequenceStart>())
			{
				return new YamlSequenceNode(events, state);
			}

			if (events.Accept<MappingStart>())
			{
				return new YamlMappingNode(events, state);
			}

			if (events.Accept<AnchorAlias>())
			{
				AnchorAlias alias = events.Expect<AnchorAlias>();
				return state.GetNode(alias.Value, false, alias.Start, alias.End) ?? new YamlAliasNode(alias.Value);
			}

			throw new ArgumentException("The current event is of an unsupported type.", "events");
		}
开发者ID:Cyberbanan,项目名称:Projeny,代码行数:31,代码来源:YamlNode.cs

示例10: PopulateAuraEvent

 protected void PopulateAuraEvent( EventReader reader )
 {
     auraKind = reader.ReadEnum<CombatLogAuraKind>();
     if( reader.HasNextValue ) {
         // Note: seems to be used for absorb effects.
         amount = reader.ReadInt32();
     }
 }
开发者ID:ZixThree,项目名称:WowLogAnalyzer,代码行数:8,代码来源:CombatLogEventAura.cs

示例11: InternalPopulate

 protected override void InternalPopulate( EventReader reader )
 {
     base.InternalPopulate(reader);
     spell = reader.ReadSpell();
     PopulateAuraEvent(reader);
     if( reader.HasNextValue ) {
         unknown1 = reader.ReadString();
         unknown2 = reader.ReadString();
     }
 }
开发者ID:ZixThree,项目名称:WowLogAnalyzer,代码行数:10,代码来源:SpellAuraApplied.cs

示例12:

		bool INodeDeserializer.Deserialize(EventReader reader, Type expectedType, Func<EventReader, Type, object> nestedObjectDeserializer, out object value)
		{
			var converter = converters.FirstOrDefault(c => c.Accepts(expectedType));
			if (converter == null)
			{
				value = null;
				return false;
			}

			value = converter.ReadYaml(reader.Parser, expectedType);
			return true;
		}
开发者ID:ChelseaLing,项目名称:AssetGraph,代码行数:12,代码来源:TypeConverterNodeDeserializer.cs

示例13: PopulateDamageEvent

 protected void PopulateDamageEvent( EventReader reader )
 {
     amount = reader.ReadInt32();
     overkill = reader.ReadInt32();
     damageSchool = (CombatLogSpellSchool)reader.ReadUInt32();
     resisted = reader.ReadInt32();
     blocked = reader.ReadInt32();
     absorbed = reader.ReadInt32();
     critical = reader.ReadString() != null;
     glancing = reader.ReadString() != null;
     crushing = reader.ReadString() != null;
 }
开发者ID:ZixThree,项目名称:WowLogAnalyzer,代码行数:12,代码来源:CombatLogEventDamage.cs

示例14: NodeIsNull

		bool INodeDeserializer.Deserialize(EventReader reader, Type expectedType, Func<EventReader, Type, object> nestedObjectDeserializer, out object value)
		{
			value = null;
			var evt = reader.Peek<NodeEvent>();
			var isNull = evt != null
				&& NodeIsNull(evt);

			if (isNull)
			{
				reader.SkipThisAndNestedEvents();
			}
			return isNull;
		}
开发者ID:Cyberbanan,项目名称:Projeny,代码行数:13,代码来源:NullNodeDeserializer.cs

示例15: Deserialize

 public bool Deserialize(EventReader reader, Type expectedType,
     Func<EventReader, Type, object> nestedObjectDeserializer,
     out object value)
 {
     if (_nodeDeserializer.Deserialize(reader, expectedType,
         nestedObjectDeserializer, out value))
     {
         if (((Data)value).Name == null) 
         {
             Debug.Log("ValidatingNodeDeserializer found that 'Name' was missing or null");
         }
         return true;
     }
     return false;
 }
开发者ID:Phrohdoh,项目名称:Projeny,代码行数:15,代码来源:Validating_during_deserialization.cs


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