public void ApplyData(string text)
    {
        PieChart pie = PieObject.GetComponent <PieChart>();

        if (Format == DocumentFormat.JSON)
        {
            mParser = new JsonParser(text);
        }
        else
        {
            mParser = new XMLParser(text);
        }

        LoadCategoryVisualStyle(pie);
        if (mCategoryVisualStyle.Length == 0)
        {
            Debug.LogWarning("no visual styles defeind for BarDataFiller, aborting");
            return;
        }

        if (DataStructure == DataType.ValueArray)
        {
            LoadValueArray();
        }
        else
        {
            LoadObjectforEachElement();
        }
    }
示例#2
0
 public BpmInterpreter(string[] string0)
 {
     for (var i = 0; i < string0.Length; i++)
     {
         var text  = string0[i];
         var array = text.Split(new[]
         {
             ' ',
             '\t',
             '='
         }, StringSplitOptions.RemoveEmptyEntries);
         var    num  = ChartParser.GetNoteFromResolution(array[0]);
         var    num2 = Convert.ToInt32(array[2]);
         string a;
         if ((a = array[1]) != null)
         {
             if (!(a == "TS"))
             {
                 if (a == "B" && (BpmList.Count == 0 || BpmList[num] != num2))
                 {
                     BpmList.Add(num, num2);
                 }
             }
             else if (TsList.Count == 0 || TsList[num] != num2)
             {
                 TsList.Add(num, num2);
             }
         }
     }
     if (!TsList.ContainsKey(0))
     {
         TsList.Add(0, 4);
     }
 }
示例#3
0
 public BPMInterpreter(string[] string_0)
 {
     for (int i = 0; i < string_0.Length; i++)
     {
         string   text  = string_0[i];
         string[] array = text.Split(new char[]
         {
             ' ',
             '\t',
             '='
         }, StringSplitOptions.RemoveEmptyEntries);
         int    num  = ChartParser.getNoteFromResolution(array[0]);
         int    num2 = Convert.ToInt32(array[2]);
         string a;
         if ((a = array[1]) != null)
         {
             if (!(a == "TS"))
             {
                 if (a == "B" && (this.bpmList.Count == 0 || this.bpmList[num] != num2))
                 {
                     this.bpmList.Add(num, num2);
                 }
             }
             else if (this.TSList.Count == 0 || this.TSList[num] != num2)
             {
                 this.TSList.Add(num, num2);
             }
         }
     }
     if (!this.TSList.ContainsKey(0))
     {
         this.TSList.Add(0, 4);
     }
 }
示例#4
0
    public void ApplyData(string text)
    {
        GraphChartBase graph = GraphObject.GetComponent <GraphChartBase>();

        if (Format == DocumentFormat.JSON)
        {
            mParser = new JsonParser(text);
        }
        else
        {
            mParser = new XMLParser(text);
        }

        LoadCategoryVisualStyle(graph);
        EnsureCreateDataTypes();
        if (mCategoryVisualStyle.Length == 0)
        {
            Debug.LogWarning("no visual styles defeind for GraphDataFiller, aborting");
            return;
        }

        if (mCategoryVisualStyle.Length < Categories.Length)
        {
            Debug.LogWarning("not enough visual styles in GraphDataFiller");
        }


        graph.DataSource.StartBatch();
        for (int i = 0; i < Categories.Length; i++)
        {
            var cat = Categories[i];
            if (cat.Enabled == false)
            {
                continue;
            }
            int    visualIndex = Math.Min(i, mCategoryVisualStyle.Length - 1);
            object visualStyle = mCategoryVisualStyle[visualIndex];

            if (graph.DataSource.HasCategory(cat.Name))
            {
                graph.DataSource.RemoveCategory(cat.Name);
            }
            graph.DataSource.AddCategory(cat.Name, null, 0, new MaterialTiling(), null, false, null, 0);
            graph.DataSource.RestoreCategory(cat.Name, visualStyle); // set the visual style of the category to the one in the prefab
            var loader = mLoaders[cat.DataType];                     // find the loader based on the data type
            loader(cat);                                             // load the category data
        }
        graph.DataSource.EndBatch();
    }
    public void ApplyData(string text)
    {
        BarChart bar = BarObject.GetComponent <BarChart>();

        if (Format == DocumentFormat.JSON)
        {
            mParser = new JsonParser(text);
        }
        else
        {
            mParser = new XMLParser(text);
        }

        LoadCategoryVisualStyle(bar);
        EnsureCreateDataTypes();
        if (mCategoryVisualStyle.Length == 0)
        {
            Debug.LogWarning("no visual styles defeind for BarDataFiller, aborting");
            return;
        }

        if (mCategoryVisualStyle.Length < Categories.Length)
        {
            Debug.LogWarning("not enough visual styles in BarDataFiller");
        }


        for (int i = 0; i < Categories.Length; i++)
        {
            var cat = Categories[i];
            if (cat.Enabled == false)
            {
                continue;
            }
            int    visualIndex = Math.Min(i, mCategoryVisualStyle.Length - 1);
            object visualStyle = mCategoryVisualStyle[visualIndex];

            if (bar.DataSource.HasCategory(cat.Name))
            {
                bar.DataSource.RemoveCategory(cat.Name);
            }
            bar.DataSource.AddCategory(cat.Name, (Material)null);
            bar.DataSource.RestoreCategory(cat.Name, visualStyle); // set the visual style of the category to the one in the prefab
            var loader = mLoaders[cat.DataType];                   // find the loader based on the data type
            loader(cat);                                           // load the category data
        }
    }
示例#6
0
        public static QBCParser LoadMidiSong(string fileName, bool forceRB3)
        {
            QBCParser qbc  = null;
            Song      song = null;

            try {
                song = MidReader.ReadMidi(fileName);
                String      chartFile   = ChartWriter.writeChart(song, "", false, forceRB3).ToString();
                ChartParser chartParser = new ChartParser(chartFile, false);
                qbc = chartParser.ConvertToQBC();
            }
            catch (Exception e)
            {
                MessageBox.Show("Error using the new MIDI importer.\nReverting to original GHTCP method. \n\n" + e.ToString(), "MIDI Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                qbc = new MIDIParser(fileName).LoadMidi().ConvertToQBC();
            }
            return(qbc);
        }
示例#7
0
 public InstrumentType(string[] string0) : this()
 {
     if (string0.Length != 0)
     {
         for (var i = 0; i < string0.Length; i++)
         {
             var text  = string0[i];
             var array = text.Split(new[]
             {
                 ' ',
                 '\t',
                 '=',
                 '"',
                 'E'
             }, StringSplitOptions.RemoveEmptyEntries);
             method_5(ChartParser.GetNoteFromResolution(array[0]), array[1]);
         }
     }
 }
示例#8
0
 public InstrumentType(string[] string_0) : this()
 {
     if (string_0.Length != 0)
     {
         for (int i = 0; i < string_0.Length; i++)
         {
             string   text  = string_0[i];
             string[] array = text.Split(new char[]
             {
                 ' ',
                 '\t',
                 '=',
                 '"',
                 'E'
             }, StringSplitOptions.RemoveEmptyEntries);
             this.method_5(ChartParser.getNoteFromResolution(array[0]), array[1]);
         }
     }
 }
示例#9
0
 public SectionInterpreter(string[] string_0)
 {
     for (int i = 0; i < string_0.Length; i++)
     {
         string   text  = string_0[i];
         string[] array = text.Split(new char[]
         {
             '=',
             '"'
         }, 3, StringSplitOptions.RemoveEmptyEntries);
         if (array.Length == 3 && !(array[1].Trim() != "E"))
         {
             array[2] = array[2].TrimEnd(new char[]
             {
                 ' ',
                 '\t'
             });
             if (array[2].EndsWith("\""))
             {
                 array[2] = array[2].Substring(0, array[2].Length - 1);
             }
             int num = ChartParser.getNoteFromResolution(array[0].Trim());
             if (array[2].StartsWith("section "))
             {
                 this.sectionList.Add(num, CultureInfo.CurrentCulture.TextInfo.ToTitleCase(array[2].Substring("section ".Length).Replace('_', ' ')));
             }
             else if (this.otherList.ContainsKey(num))
             {
                 this.otherList[num].Add(array[2]);
             }
             else
             {
                 this.otherList.Add(num, new List <string>());
                 this.otherList[num].Add(array[2]);
             }
         }
     }
 }
示例#10
0
        public ChartParser method_2(Gh3Song gh3Song1)
        {
            var @class = new ChartParser(Gh3Song0);

            @class.Constant480 = Int1;
            if (gh3Song1 != null)
            {
                @class.Gh3SongInfo.vmethod_0(gh3Song1);
            }
            _class2286 = new Track <int, int>();
            if (FretbarList != null)
            {
                var value = FretbarList[0];
                FretbarList[0] = 0;
                var num = 0;
                for (var i = 1; i < FretbarList.Count; i++)
                {
                    var num2 = FretbarList[i] - FretbarList[i - 1];
                    var num3 = Convert.ToInt32(60000000.0 / num2);
                    if (num3 != num)
                    {
                        @class.BpmInterpreter.BpmList.Add((i - 1) * Int1, num3);
                        num = num3;
                    }
                    _class2286.Add(FretbarList[i - 1], num2);
                }
                FretbarList[0] = value;
                @class.SectionInterpreter.OtherList.Add(method_0(FretbarList[FretbarList.Count - 1]), new List <string>(
                                                            new[]
                {
                    "end"
                }));
                foreach (var current in Class2281.Keys)
                {
                    @class.SectionInterpreter.SectionList.Add(method_0(current), Class2281[current]);
                }
                foreach (var current2 in TsList.Keys)
                {
                    @class.BpmInterpreter.TsList.Add(method_0(current2), TsList[current2][0]);
                }
                var class2 = new Track <int, int>();
                var class3 = new Track <int, int>();
                foreach (var current3 in Class2282.Keys)
                {
                    var num4 = method_0(current3);
                    var num5 = method_0(current3 + Class2282[current3] - Int0) - num4;
                    class2.Add(num4, (num5 <= Int1 / 4) ? 0 : num5);
                }
                foreach (var current4 in Class2283.Keys)
                {
                    var num4 = method_0(current4);
                    var num5 = method_0(current4 + Class2283[current4] - Int0) - num4;
                    class3.Add(num4, (num5 <= Int1 / 4) ? 0 : num5);
                }
                var class4 = new Track <int, int>();
                var class5 = new Track <int, int>();
                foreach (var current5 in BpmList.Keys)
                {
                    var num4 = method_0(current5);
                    var num5 = method_0(current5 + BpmList[current5] - Int0) - num4;
                    class4.Add(num4, (num5 <= Int1 / 4) ? 0 : num5);
                }
                foreach (var current6 in Class2285.Keys)
                {
                    var num4 = method_0(current6);
                    var num5 = method_0(current6 + Class2285[current6] - Int0) - num4;
                    class5.Add(num4, (num5 <= Int1 / 4) ? 0 : num5);
                }
                string[] array =
                {
                    "Easy",
                    "Medium",
                    "Hard",
                    "Expert"
                };
                string[] array2 =
                {
                    "Single",
                    "Double"
                };
                for (var j = 0; j < array2.Length; j++)
                {
                    var      text   = array2[j];
                    string[] array3 =
                    {
                        "Guitar",
                        "Rhythm"
                    };
                    for (var k = 0; k < array3.Length; k++)
                    {
                        var text2  = array3[k];
                        var array4 = array;
                        for (var l = 0; l < array4.Length; l++)
                        {
                            var text3 = array4[l];
                            var key   = (text2.ToLower() + ((text == "Double") ? "coop" : "") + "_" + text3.ToLower())
                                        .Replace("guitar_", "");
                            if (NoteList.ContainsKey(key))
                            {
                                var class6 = new NoteEventInterpreter();
                                var class7 = NoteList[key];
                                foreach (var current7 in class7.Keys)
                                {
                                    var num4 = method_0(current7);
                                    var num5 = method_0(current7 + class7[current7].SustainLength - Int0) - num4;
                                    class6.NoteList.Add(num4,
                                                        new NotesAtOffset(class7[current7].NoteValues, (num5 <= Int1 / 4) ? 0 : num5));
                                }
                                class6.AlwaysTrue = false;
                                if (SpList.ContainsKey(key))
                                {
                                    var class8 = SpList[key];
                                    foreach (var current8 in class8.Keys)
                                    {
                                        var num4 = method_0(current8);
                                        var num5 = method_0(current8 + class8[current8][0] - Int0) - num4;
                                        class6.Class2281.Add(num4, (num5 <= Int1 / 4) ? 0 : num5);
                                    }
                                }
                                if (BattleNoteList.ContainsKey(key))
                                {
                                    var class9 = SpList[key];
                                    foreach (var current9 in class9.Keys)
                                    {
                                        var num4 = method_0(current9);
                                        var num5 = method_0(current9 + class9[current9][0] - Int0) - num4;
                                        class6.Class2284.Add(num4, (num5 <= Int1 / 4) ? 0 : num5);
                                    }
                                }
                                class6.Class2282 = class2;
                                class6.Class2283 = class3;
                                class6.Class2285 = class4;
                                class6.Class2286 = class5;
                                @class.DifficultyWithNotes.Add(text3 + text + text2, class6);
                            }
                        }
                    }
                }
                _class2286.Clear();
                _class2286 = null;
                return(@class);
            }
            return(null);
        }
示例#11
0
        public NoteEventInterpreter(string[] stringImported, int constant480)
        {
            if (!(AlwaysTrue = (stringImported.Length == 0))) //If string is empty
            {
                //Cycles through the string array imported (All notes/SP)
                for (var i = 0; i < stringImported.Length; i++)
                {
                    var currentString = stringImported[i];

                    /*
                     * Indexes:
                     * 0=Offset
                     * 1=Event Type
                     * 2=Note Value
                     * 3=Sustain Length
                     */
                    var notesEventsArray = currentString.Split(new[]
                    {
                        ' ',
                        '\t',
                        '='
                    }, StringSplitOptions.RemoveEmptyEntries);
                    var    offset = ChartParser.GetNoteFromResolution(notesEventsArray[0]);
                    string eventType;
                    if ((eventType = notesEventsArray[1]) != null)
                    {
                        if (!(eventType == "N"))
                        {
                            if (!(eventType == "S"))
                            {
                                if (eventType == "E")
                                {
                                    //Interprets Events
                                    if (EventList.ContainsKey(offset))
                                    {
                                        _currentEventLine = notesEventsArray[2];
                                        for (var j = 3; j < notesEventsArray.Length; j++)
                                        {
                                            _currentEventLine = _currentEventLine + " " + notesEventsArray[j];
                                        }
                                        EventList[offset].Add(_currentEventLine);
                                    }
                                    else
                                    {
                                        _currentEventLine = notesEventsArray[2];
                                        for (var k = 3; k < notesEventsArray.Length; k++)
                                        {
                                            _currentEventLine = _currentEventLine + " " + notesEventsArray[k];
                                        }
                                        EventList.Add(offset, new List <string>());
                                        EventList[offset].Add(_currentEventLine);
                                    }
                                }
                            }
                            //Interprets Starpower
                            else
                            {
                                switch (Convert.ToInt32(notesEventsArray[2]))
                                {
                                case 0:
                                    if (!Class2282.ContainsKey(offset))
                                    {
                                        Class2282.Add(offset,
                                                      ChartParser.GetNoteFromResolution(notesEventsArray[3]));
                                    }
                                    break;

                                case 1:
                                    if (!Class2283.ContainsKey(offset))
                                    {
                                        Class2283.Add(offset,
                                                      ChartParser.GetNoteFromResolution(notesEventsArray[3]));
                                    }
                                    break;

                                case 2:
                                    if (!Class2281.ContainsKey(offset))
                                    {
                                        Class2281.Add(offset,
                                                      ChartParser.GetNoteFromResolution(notesEventsArray[3]));
                                    }
                                    break;

                                case 3:
                                    if (!Class2284.ContainsKey(offset))
                                    {
                                        Class2284.Add(offset,
                                                      ChartParser.GetNoteFromResolution(notesEventsArray[3]));
                                    }
                                    break;

                                case 4:
                                    if (!Class2285.ContainsKey(offset))
                                    {
                                        Class2285.Add(offset,
                                                      ChartParser.GetNoteFromResolution(notesEventsArray[3]));
                                    }
                                    break;

                                case 5:
                                    if (!Class2286.ContainsKey(offset))
                                    {
                                        Class2286.Add(offset,
                                                      ChartParser.GetNoteFromResolution(notesEventsArray[3]));
                                    }
                                    break;
                                }
                            }
                        }
                        //Interprets Notes

                        /*
                         * Indexes:
                         * 0=Offset
                         * 1=Event Type
                         * 2=Note Value
                         * 3=Sustain Length
                         */
                        else
                        {
                            var notes         = new bool[32];
                            var sustainLength = ChartParser.GetNoteFromResolution(notesEventsArray[3]);
                            if (sustainLength <= constant480 / 4)
                            {
                                sustainLength = 0;
                            }
                            if (!NoteList.ContainsKey(offset))
                            {
                                NoteList.Add(offset, new NotesAtOffset(notes, sustainLength));
                            }
                            else
                            {
                                var currentSustainLength = NoteList[offset].SustainLength;
                                //Updates sustain length
                                if (currentSustainLength < sustainLength)
                                {
                                    NoteList[offset].SustainLength = sustainLength;
                                }
                            }
                            var note = Convert.ToInt32(notesEventsArray[2]);
                            NoteList[offset].NoteValues[note] = true;
                        }
                    }
                }
            }
        }
示例#12
0
        public ChartParser LoadMidi()
        {
            string name = "";

            name = name + new FileInfo(this.fileLocation).Name + ":\n";
            try
            {
                this.midiReader = MIDIReader.smethod_0(this.fileLocation);
            }
            catch (Exception)
            {
                throw new IOException(name + "Unknown Error: Could not parse MIDI sequence.");
            }
            foreach (MIDILine current in this.midiReader.getMidiLineList())
            {
                if (current.method_2().Equals("PART GUITAR"))
                {
                    this.isPartGuitar = true;
                }
                else if (current.method_2().Equals("EVENTS"))
                {
                    this.isEvents = true;
                }
            }
            if (this.midiReader.getMidiLineList().Count == 1 && !this.isPartGuitar)
            {
                this.midiReader.getMidiLineList()[0].method_3("PART GUITAR");
                this.isPartGuitar = true;
            }
            if (!this.isPartGuitar)
            {
                throw new IOException(name + "PART GUITAR not found. No chart created.");
            }
            ChartParser chartParser = new ChartParser();

            this.bpmInterpreter     = chartParser.bpmInterpreter;
            this.sectionInterpreter = chartParser.sectionInterpreter;
            chartParser.difficultyWithNotes.Add("EasySingle", this.easySingle);
            chartParser.difficultyWithNotes.Add("MediumSingle", this.mediumSingle);
            chartParser.difficultyWithNotes.Add("HardSingle", this.hardSingle);
            chartParser.difficultyWithNotes.Add("ExpertSingle", this.expertSingle);
            chartParser.difficultyWithNotes.Add("EasyDoubleGuitar", this.easyDoubleGuitar);
            chartParser.difficultyWithNotes.Add("MediumDoubleGuitar", this.mediumDoubleGuitar);
            chartParser.difficultyWithNotes.Add("HardDoubleGuitar", this.hardDoubleGuitar);
            chartParser.difficultyWithNotes.Add("ExpertDoubleGuitar", this.expertDoubleGuitar);
            chartParser.difficultyWithNotes.Add("EasyDoubleBass", this.easyDoubleBass);
            chartParser.difficultyWithNotes.Add("MediumDoubleBass", this.mediumDoubleBass);
            chartParser.difficultyWithNotes.Add("HardDoubleBass", this.hardDoubleBass);
            chartParser.difficultyWithNotes.Add("ExpertDoubleBass", this.expertDoubleBass);
            chartParser.instrumentList.Add("EasyDrums", this.easyDrums);
            chartParser.instrumentList.Add("MediumDrums", this.mediumDrums);
            chartParser.instrumentList.Add("HardDrums", this.hardDrums);
            chartParser.instrumentList.Add("ExpertDrums", this.expertDrums);
            chartParser.instrumentList.Add("EasyKeyboard", this.easyKeyboard);
            chartParser.instrumentList.Add("MediumKeyboard", this.mediumKeyboard);
            chartParser.instrumentList.Add("HardKeyboard", this.hardKeyboard);
            chartParser.instrumentList.Add("ExpertKeyboard", this.expertKeyboard);
            chartParser.constant480 = 480;
            this.resolution         = 480.0 / (double)this.midiReader.method_0();
            object obj = name;

            name = string.Concat(new object[]
            {
                obj,
                "NumTracks = ",
                this.midiReader.getMidiLineList().Count,
                "\n"
            });
            this.method_1(this.midiReader.getMidiLineList()[0]);
            foreach (MIDILine midiLine in this.midiReader.getMidiLineList())
            {
                if (midiLine.method_2().Equals("PART GUITAR"))
                {
                    this.getNotes(midiLine, 0);
                }
                else if (midiLine.method_2().Equals("T1 GEMS"))
                {
                    this.getNotes(midiLine, 0);
                }
                else if (midiLine.method_2().Equals("PART GUITAR COOP"))
                {
                    this.getNotes(midiLine, 1);
                }
                else if (midiLine.method_2().Equals("PART RHYTHM"))
                {
                    this.notBass = true;
                    this.getNotes(midiLine, 3);
                }
                else if (midiLine.method_2().Equals("PART BASS"))
                {
                    this.getNotes(midiLine, 3);
                }
                else if (midiLine.method_2().Equals("EVENTS"))
                {
                    this.getNotes(midiLine, 4);
                }
                else if (midiLine.method_2().Equals("BAND DRUMS"))
                {
                    this.getNotes(midiLine, 5);
                }
                else if (midiLine.method_2().Equals("BAND KEYS"))
                {
                    this.getNotes(midiLine, 7);
                }
                else
                {
                    name = name + "Track (" + midiLine.method_2() + ") ignored.\n";
                }
            }
            chartParser.gh3SongInfo.title    = this.songTitle;
            chartParser.gh3SongInfo.not_bass = this.notBass;
            name += "Conversion Complete!";
            Console.WriteLine(name);
            chartParser.removeEmptyParts();
            return(chartParser);
        }
示例#13
0
        public NoteEventInterpreter(string[] stringImported, int constant480)
        {
            if (!(this.alwaysTrue = (stringImported.Length == 0)))            //If string is empty
            {
                //Cycles through the string array imported (All notes/SP)
                for (int i = 0; i < stringImported.Length; i++)
                {
                    string currentString = stringImported[i];

                    /*
                     * Indexes:
                     * 0=Offset
                     * 1=Event Type
                     * 2=Note Value
                     * 3=Sustain Length
                     */
                    string[] NotesEventsArray = currentString.Split(new char[]
                    {
                        ' ',
                        '\t',
                        '='
                    }, StringSplitOptions.RemoveEmptyEntries);
                    int    offset = ChartParser.getNoteFromResolution(NotesEventsArray[0]);
                    string eventType;
                    if ((eventType = NotesEventsArray[1]) != null)
                    {
                        if (!(eventType == "N"))
                        {
                            if (!(eventType == "S"))
                            {
                                if (eventType == "E")
                                {
                                    //Interprets Events
                                    if (this.eventList.ContainsKey(offset))
                                    {
                                        this.currentEventLine = NotesEventsArray[2];
                                        for (int j = 3; j < NotesEventsArray.Length; j++)
                                        {
                                            this.currentEventLine = this.currentEventLine + " " + NotesEventsArray[j];
                                        }
                                        this.eventList[offset].Add(this.currentEventLine);
                                    }
                                    else
                                    {
                                        this.currentEventLine = NotesEventsArray[2];
                                        for (int k = 3; k < NotesEventsArray.Length; k++)
                                        {
                                            this.currentEventLine = this.currentEventLine + " " + NotesEventsArray[k];
                                        }
                                        this.eventList.Add(offset, new List <string>());
                                        this.eventList[offset].Add(this.currentEventLine);
                                    }
                                }
                            }
                            //Interprets Starpower
                            else
                            {
                                switch (Convert.ToInt32(NotesEventsArray[2]))
                                {
                                case 0:
                                    if (!this.class228_2.ContainsKey(offset))
                                    {
                                        this.class228_2.Add(offset, ChartParser.getNoteFromResolution(NotesEventsArray[3]));
                                    }
                                    break;

                                case 1:
                                    if (!this.class228_3.ContainsKey(offset))
                                    {
                                        this.class228_3.Add(offset, ChartParser.getNoteFromResolution(NotesEventsArray[3]));
                                    }
                                    break;

                                case 2:
                                    if (!this.class228_1.ContainsKey(offset))
                                    {
                                        this.class228_1.Add(offset, ChartParser.getNoteFromResolution(NotesEventsArray[3]));
                                    }
                                    break;

                                case 3:
                                    if (!this.class228_4.ContainsKey(offset))
                                    {
                                        this.class228_4.Add(offset, ChartParser.getNoteFromResolution(NotesEventsArray[3]));
                                    }
                                    break;

                                case 4:
                                    if (!this.class228_5.ContainsKey(offset))
                                    {
                                        this.class228_5.Add(offset, ChartParser.getNoteFromResolution(NotesEventsArray[3]));
                                    }
                                    break;

                                case 5:
                                    if (!this.class228_6.ContainsKey(offset))
                                    {
                                        this.class228_6.Add(offset, ChartParser.getNoteFromResolution(NotesEventsArray[3]));
                                    }
                                    break;
                                }
                            }
                        }
                        //Interprets Notes

                        /*
                         * Indexes:
                         * 0=Offset
                         * 1=Event Type
                         * 2=Note Value
                         * 3=Sustain Length
                         */
                        else
                        {
                            bool[] notes         = new bool[32];
                            int    sustainLength = ChartParser.getNoteFromResolution(NotesEventsArray[3]);
                            if (sustainLength <= constant480 / 4)
                            {
                                sustainLength = 0;
                            }
                            if (!this.noteList.ContainsKey(offset))
                            {
                                this.noteList.Add(offset, new NotesAtOffset(notes, sustainLength));
                            }
                            else
                            {
                                int currentSustainLength = this.noteList[offset].sustainLength;
                                //Updates sustain length
                                if (currentSustainLength < sustainLength)
                                {
                                    this.noteList[offset].sustainLength = sustainLength;
                                }
                            }
                            int note = Convert.ToInt32(NotesEventsArray[2]);
                            this.noteList[offset].noteValues[note] = true;
                        }
                    }
                }
            }
        }
示例#14
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);
        }