Ejemplo n.º 1
0
        public ChartParser LoadMidi()
        {
            var name = "";

            name = name + new FileInfo(_fileLocation).Name + ":\n";
            try
            {
                _midiReader = MidiReader.smethod_0(_fileLocation);
            }
            catch (Exception)
            {
                throw new IOException(name + "Unknown Error: Could not parse MIDI sequence.");
            }
            foreach (var current in _midiReader.GetMidiLineList())
            {
                if (current.method_2().Equals("PART GUITAR"))
                {
                    _isPartGuitar = true;
                }
                else if (current.method_2().Equals("EVENTS"))
                {
                    _isEvents = true;
                }
            }
            if (_midiReader.GetMidiLineList().Count == 1 && !_isPartGuitar)
            {
                _midiReader.GetMidiLineList()[0].method_3("PART GUITAR");
                _isPartGuitar = true;
            }
            if (!_isPartGuitar)
            {
                throw new IOException(name + "PART GUITAR not found. No chart created.");
            }
            var chartParser = new ChartParser();

            _bpmInterpreter     = chartParser.BpmInterpreter;
            _sectionInterpreter = chartParser.SectionInterpreter;
            chartParser.DifficultyWithNotes.Add("EasySingle", _easySingle);
            chartParser.DifficultyWithNotes.Add("MediumSingle", _mediumSingle);
            chartParser.DifficultyWithNotes.Add("HardSingle", _hardSingle);
            chartParser.DifficultyWithNotes.Add("ExpertSingle", _expertSingle);
            chartParser.DifficultyWithNotes.Add("EasyDoubleGuitar", _easyDoubleGuitar);
            chartParser.DifficultyWithNotes.Add("MediumDoubleGuitar", _mediumDoubleGuitar);
            chartParser.DifficultyWithNotes.Add("HardDoubleGuitar", _hardDoubleGuitar);
            chartParser.DifficultyWithNotes.Add("ExpertDoubleGuitar", _expertDoubleGuitar);
            chartParser.DifficultyWithNotes.Add("EasyDoubleBass", _easyDoubleBass);
            chartParser.DifficultyWithNotes.Add("MediumDoubleBass", _mediumDoubleBass);
            chartParser.DifficultyWithNotes.Add("HardDoubleBass", _hardDoubleBass);
            chartParser.DifficultyWithNotes.Add("ExpertDoubleBass", _expertDoubleBass);
            chartParser.InstrumentList.Add("EasyDrums", _easyDrums);
            chartParser.InstrumentList.Add("MediumDrums", _mediumDrums);
            chartParser.InstrumentList.Add("HardDrums", _hardDrums);
            chartParser.InstrumentList.Add("ExpertDrums", _expertDrums);
            chartParser.InstrumentList.Add("EasyKeyboard", _easyKeyboard);
            chartParser.InstrumentList.Add("MediumKeyboard", _mediumKeyboard);
            chartParser.InstrumentList.Add("HardKeyboard", _hardKeyboard);
            chartParser.InstrumentList.Add("ExpertKeyboard", _expertKeyboard);
            chartParser.Constant480 = 480;
            _resolution             = 480.0 / _midiReader.method_0();
            object obj = name;

            name = string.Concat(obj, "NumTracks = ", _midiReader.GetMidiLineList().Count, "\n");
            method_1(_midiReader.GetMidiLineList()[0]);
            foreach (var midiLine in _midiReader.GetMidiLineList())
            {
                if (midiLine.method_2().Equals("PART GUITAR"))
                {
                    GetNotes(midiLine, 0);
                }
                else if (midiLine.method_2().Equals("T1 GEMS"))
                {
                    GetNotes(midiLine, 0);
                }
                else if (midiLine.method_2().Equals("PART GUITAR COOP"))
                {
                    GetNotes(midiLine, 1);
                }
                else if (midiLine.method_2().Equals("PART RHYTHM"))
                {
                    _notBass = true;
                    GetNotes(midiLine, 3);
                }
                else if (midiLine.method_2().Equals("PART BASS"))
                {
                    GetNotes(midiLine, 3);
                }
                else if (midiLine.method_2().Equals("EVENTS"))
                {
                    GetNotes(midiLine, 4);
                }
                else if (midiLine.method_2().Equals("BAND DRUMS"))
                {
                    GetNotes(midiLine, 5);
                }
                else if (midiLine.method_2().Equals("BAND KEYS"))
                {
                    GetNotes(midiLine, 7);
                }
                else
                {
                    name = name + "Track (" + midiLine.method_2() + ") ignored.\n";
                }
            }
            chartParser.Gh3SongInfo.Title   = _songTitle;
            chartParser.Gh3SongInfo.NotBass = _notBass;
            name += "Conversion Complete!";
            Console.WriteLine(name);
            chartParser.RemoveEmptyParts();
            return(chartParser);
        }