public IDictionary Deserialize()

in Source/Tx.Windows/EtwTdh/EtwTdhEventInfo.cs [42:109]


        public IDictionary<string, object> Deserialize(ref EtwNativeEvent e)
        {
            Dictionary<string, object> instance = new Dictionary<string, object>(_template)
            {
                { "EventId", e.Id },
                { "Version", e.Version },
                { "TimeCreated", e.TimeStamp.UtcDateTime },

                { "ProcessId", e.ProcessId },
                { "ThreadId", e.ThreadId },
                { "ActivityId", e.ActivityId }
            };

            Dictionary<string, object> eventData = new Dictionary<string, object>();
            List<object> values = new List<object>();
            foreach (var p in _properties)
            {
                uint len = p.Length;
                if (p.LengthPropertyName != null)
                {
                    try
                    {
                        string num = Convert.ToString(eventData[p.LengthPropertyName]);
                        if (num.StartsWith("0x", StringComparison.CurrentCultureIgnoreCase))
                        {
                            num = num.Substring(2);
                            len = uint.Parse(num, System.Globalization.NumberStyles.HexNumber);
                        }
                        else
                        {
                            len = Convert.ToUInt32(num);
                        }
                    }
                    catch (Exception ex)
                    {
                        ex.Data["ProviderGuid"] = e.ProviderId;
                        throw;
                    }
                }

                try
                {
                    object value = GetValue(p.Type, len, ref e);
                    value = FormatValue(p, value);
                    value = EtwTdhPostFormat.ApplyFormatting(e.ProviderId, e.Id, p.Name, value);
                    eventData.Add(p.Name, value);
                    values.Add(value);
                }
                catch (Exception)
                {
                    eventData.Add(p.Name, "Exception on retrieving value");
                }
            }

            instance.Add("EventData", eventData);

            if (_formatString == null)
            {
                instance.Add("Message", null);
            }
            else
            {
                string message = string.Format(_formatString, values.ToArray());
                instance.Add("Message", message);
            }

            return instance;
        }