示例#1
0
        public EVT(Stream Data)
        {
            m_Reader = new FileReader(Data, false);
            ASCIIEncoding Enc = new ASCIIEncoding();

            string[] TrackEvents = Enc.GetString(m_Reader.ReadToEnd()).Split("\r\n".ToCharArray(),
                                                                             StringSplitOptions.RemoveEmptyEntries);

            foreach (string TrckEvent in TrackEvents)
            {
                string[]   Elements = TrckEvent.Split(',');
                TrackEvent Event    = new TrackEvent();
                Event.Name      = Elements[0];
                Event.EventType = (HITEvents)Enum.ToObject(typeof(HITEvents), ParseHexString(Elements[1]));
                if (!Event.Name.Contains("bkground")) //Sigh, Maxis...
                {
                    Event.TrackID = (Elements[2].Equals("", StringComparison.InvariantCultureIgnoreCase)) ? 0 : uint.Parse(Elements[2].Replace("0x", ""), NumberStyles.HexNumber);
                }
                else
                {
                    Event.TrackID = (Elements[2].Equals("", StringComparison.InvariantCultureIgnoreCase)) ? 0 : uint.Parse(Elements[2]);
                }
                Event.Unknown  = ParseHexString(Elements[3]);
                Event.Unknown2 = ParseHexString(Elements[4]);
                Event.Unknown3 = ParseHexString(Elements[5]);
                Event.Unknown4 = ParseHexString(Elements[6]);
                Events.Add(Event);
            }

            m_Reader.Close();
        }
示例#2
0
        public EVT(Stream Data)
        {
            m_Reader = new FileReader(Data, false);
            ASCIIEncoding Enc = new ASCIIEncoding();

            string[] TrackEvents = Enc.GetString(m_Reader.ReadToEnd()).Split("\r\n".ToCharArray(),
                StringSplitOptions.RemoveEmptyEntries);

            foreach(string TrckEvent in TrackEvents)
            {
                string[] Elements = TrckEvent.Split(',');
                TrackEvent Event = new TrackEvent();
                Event.Name = Elements[0];
                Event.Event = Elements[1];
                Event.TrackID = (Elements[2].Equals("", StringComparison.InvariantCultureIgnoreCase)) ? 0 : uint.Parse(Elements[2].Replace("0x", ""), NumberStyles.HexNumber);
                Events.Add(Event);
            }

            m_Reader.Close();
        }