示例#1
0
        public Hot(byte[] FileData)
        {
            StreamReader Reader = new StreamReader(new MemoryStream(FileData));
            bool         EventState = false, OptionsState = false, TrackDataState = false;

            while (!Reader.EndOfStream)
            {
                string CurrentLine = Reader.ReadLine().Trim().Replace("\r\n", "");

                switch (CurrentLine)
                {
                case "[EventMappingEquate]":
                    EventState = true;
                    break;

                case "[Options]":
                    OptionsState = true;
                    break;

                case "[TrackData]":
                    TrackDataState = true;
                    break;
                }

                if (!CurrentLine.Contains("["))
                {
                    if (!CurrentLine.Contains("]"))
                    {
                        if (!CurrentLine.Contains(""))
                        {
                            //EventMappingEquate fields look like: kSndobPlay=1
                            if (EventState)
                            {
                                string[]           EventParams    = CurrentLine.Split("=".ToCharArray());
                                EventMappingEquate EMappingEquate = new EventMappingEquate();
                                EMappingEquate.Label = EventParams[0];
                                EMappingEquate.Value = int.Parse(EventParams[1]);
                            }
                            //Options fields look like: Version=1
                            else if (OptionsState)
                            {
                                string[] OptionParams = CurrentLine.Split("=".ToCharArray());

                                switch (OptionParams[0])
                                {
                                case "Version":
                                    m_Version = int.Parse(OptionParams[1]);
                                    break;

                                case "LoadPriority":
                                    m_LoadPriority = int.Parse(OptionParams[1]);
                                    break;
                                }
                            }
                            //TrackData fields look like: 0xb0f4=0x10
                            else if (TrackDataState)
                            {
                                string[]  TrackParams = CurrentLine.Split("=".ToCharArray());
                                TrackData TData       = new TrackData();
                                TData.FileID           = long.Parse(TrackParams[0]);
                                TData.SubRoutineOffset = int.Parse(TrackParams[1]);
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        public Hot(byte[] FileData)
        {
            StreamReader Reader = new StreamReader(new MemoryStream(FileData));
            bool EventState = false, OptionsState = false, TrackDataState = false;

            while (!Reader.EndOfStream)
            {
                string CurrentLine = Reader.ReadLine().Trim().Replace("\r\n", "");

                switch (CurrentLine)
                {
                    case "[EventMappingEquate]":
                        EventState = true;
                        break;
                    case "[Options]":
                        OptionsState = true;
                        break;
                    case "[TrackData]":
                        TrackDataState = true;
                        break;
                }

                if (!CurrentLine.Contains("["))
                {
                    if (!CurrentLine.Contains("]"))
                    {
                        if (!CurrentLine.Contains(""))
                        {
                            //EventMappingEquate fields look like: kSndobPlay=1
                            if (EventState)
                            {
                                string[] EventParams = CurrentLine.Split("=".ToCharArray());
                                EventMappingEquate EMappingEquate = new EventMappingEquate();
                                EMappingEquate.Label = EventParams[0];
                                EMappingEquate.Value = int.Parse(EventParams[1]);
                            }
                            //Options fields look like: Version=1
                            else if (OptionsState)
                            {
                                string[] OptionParams = CurrentLine.Split("=".ToCharArray());

                                switch (OptionParams[0])
                                {
                                    case "Version":
                                        m_Version = int.Parse(OptionParams[1]);
                                        break;
                                    case "LoadPriority":
                                        m_LoadPriority = int.Parse(OptionParams[1]);
                                        break;
                                }
                            }
                            //TrackData fields look like: 0xb0f4=0x10
                            else if (TrackDataState)
                            {
                                string[] TrackParams = CurrentLine.Split("=".ToCharArray());
                                TrackData TData = new TrackData();
                                TData.FileID = long.Parse(TrackParams[0]);
                                TData.SubRoutineOffset = int.Parse(TrackParams[1]);
                            }
                        }
                    }
                }
            }
        }