public void AddContext(string newContext, ADAGEEventInfo info)
 {
     dirty = true;
     if (context == null)
     {
         context = new ADAGEEventInfoDictionary();
     }
     context[newContext] = info;
 }
    public void RemoveEvent(string badEvent)
    {
        if (events == null)
        {
            events = new ADAGEEventInfoDictionary();
        }

        if (events.ContainsKey(badEvent))
        {
            events.Remove(badEvent);
            dirty = true;
        }
    }
    public void RemoveContext(string badContext)
    {
        if (context == null)
        {
            context = new ADAGEEventInfoDictionary();
        }

        if (context.ContainsKey(badContext))
        {
            context.Remove(badContext);
            dirty = true;
        }
    }
    public void AddEvent(string newEvent, ADAGEEventInfo info)
    {
        dirty = true;
        if (events == null)
        {
            events = new ADAGEEventInfoDictionary();
        }

        if (!events.ContainsKey(newEvent))
        {
            events.Add(newEvent, info);
        }
        else
        {
            events[newEvent] = info;
        }
    }
    public void Unpack(byte[] data)
    {
        stream = new MemoryStream(data);
        if (transport == null)
        {
            transport = new TStreamTransport(stream, null);
        }
        else
        {
            transport.InputStream = stream;
        }

        if (protocol == null)
        {
            protocol = new TCompactProtocol(transport);
        }
        else
        {
            protocol.reset();
            protocol.Transport = transport;
        }

        protocol.ReadStructBegin();
        while (true)
        {
            fieldReader = protocol.ReadFieldBegin();
            if (fieldReader.Type == TType.Stop)
            {
                break;
            }

            switch (fieldReader.ID)
            {
            case 1:
                if (fieldReader.Type == TType.Map)
                {
                    if (context == null)
                    {
                        context = new ADAGEEventInfoDictionary();
                    }
                    else
                    {
                        context.Clear();
                    }

                    TMap _map17 = protocol.ReadMapBegin();
                    for (int _i18 = 0; _i18 < _map17.Count; ++_i18)
                    {
                        tempKey   = protocol.ReadString();
                        tempValue = new ADAGEEventInfo();
                        tempValue.Read(fieldReader, protocol);
                        context[tempKey] = tempValue;
                    }
                    protocol.ReadMapEnd();
                }
                else
                {
                    TProtocolUtil.Skip(protocol, fieldReader.Type);
                }
                break;

            case 2:
                if (fieldReader.Type == TType.Struct)
                {
                    if (events == null)
                    {
                        events = new ADAGEEventInfoDictionary();
                    }
                    else
                    {
                        events.Clear();
                    }

                    TMap _map17 = protocol.ReadMapBegin();
                    for (int _i18 = 0; _i18 < _map17.Count; ++_i18)
                    {
                        tempKey   = protocol.ReadString();
                        tempValue = new ADAGEEventInfo();
                        tempValue.Read(fieldReader, protocol);
                        events[tempKey] = tempValue;
                    }
                    protocol.ReadMapEnd();
                }
                else
                {
                    TProtocolUtil.Skip(protocol, fieldReader.Type);
                }
                break;

            default:
                TProtocolUtil.Skip(protocol, fieldReader.Type);
                break;
            }

            protocol.ReadFieldEnd();
        }
        protocol.ReadStructEnd();
    }