Example #1
0
 public QbcParser()
 {
     FretbarList = new Fretbar <int>();
 }
Example #2
0
        public QbcParser(string fileName)
        {
            var    list         = new List <string>();
            var    streamReader = File.OpenText(fileName);
            string text         = null;
            string currentLine;

            while ((currentLine = streamReader.ReadLine()) != null)
            {
                if (currentLine.StartsWith("["))
                {
                    text = currentLine.Split(new[]
                    {
                        '[',
                        ']'
                    }, StringSplitOptions.RemoveEmptyEntries)[0];
                }
                else if (!currentLine.Equals("{"))
                {
                    if (currentLine.Equals("}"))
                    {
                        string key;
                        if ((key = text) == null)
                        {
                            goto IL_8AA;
                        }
                        if (Class369.Dictionary0 == null)
                        {
                            Class369.Dictionary0 = new Dictionary <string, int>(8)
                            {
                                {
                                    "Song",
                                    0
                                },
                                {
                                    "SyncTrack",
                                    1
                                },
                                {
                                    "FretBars",
                                    2
                                },
                                {
                                    "Events",
                                    3
                                },
                                {
                                    "FaceOffP1",
                                    4
                                },
                                {
                                    "FaceOffP2",
                                    5
                                },
                                {
                                    "BossBattleP1",
                                    6
                                },
                                {
                                    "BossBattleP2",
                                    7
                                }
                            };
                        }
                        int num;
                        if (Class369.Dictionary0.TryGetValue(key, out num))
                        {
                            switch (num)
                            {
                            case 0:
                                Gh3Song0.Editable = true;
                                using (var enumerator = list.GetEnumerator())
                                {
                                    while (enumerator.MoveNext())
                                    {
                                        var current = enumerator.Current;
                                        var array   = current.Split(new[]
                                        {
                                            '\t',
                                            '='
                                        }, StringSplitOptions.RemoveEmptyEntries);
                                        if (array.Length > 1)
                                        {
                                            var    text3 = array[0].Trim().ToLower();
                                            var    text4 = array[1].Trim().Replace("\"", "");
                                            string key2;
                                            switch (key2 = text3)
                                            {
                                            case "name":
                                                Gh3Song0.Title = text4;
                                                break;

                                            case "artist":
                                                Gh3Song0.Artist = text4;
                                                break;

                                            case "year":
                                                Gh3Song0.Year = text4;
                                                break;

                                            case "player2":
                                                Gh3Song0.NotBass = !text4.ToLower().Equals("bass");
                                                break;

                                            case "artisttext":
                                                if (text4.Equals("by"))
                                                {
                                                    Gh3Song0.ArtistText = true;
                                                }
                                                else if (text4.Equals("as made famous by"))
                                                {
                                                    Gh3Song0.ArtistText = false;
                                                }
                                                else
                                                {
                                                    Gh3Song0.ArtistText = text4;
                                                }
                                                break;

                                            case "offset":
                                                Gh3Song0.InputOffset =
                                                    (Gh3Song0.GemOffset = Convert.ToInt32(
                                                         Convert.ToDouble(text4) * -1000.0));
                                                break;

                                            case "singer":
                                                Gh3Song0.Singer = text4;
                                                break;

                                            case "bassist":
                                                Gh3Song0.Bassist = text4;
                                                break;

                                            case "boss":
                                                Gh3Song0.Boss = text4;
                                                break;

                                            case "countoff":
                                                Gh3Song0.Countoff = text4;
                                                break;

                                            case "guitarvol":
                                                Gh3Song0.GuitarVol = Convert.ToSingle(text4);
                                                break;

                                            case "bandvol":
                                                Gh3Song0.BandVol = Convert.ToSingle(text4);
                                                break;

                                            case "hopo":
                                                Gh3Song0.HammerOn = Convert.ToSingle(text4);
                                                break;

                                            case "originalartist":
                                                Gh3Song0.OriginalArtist = text4.Equals("true");
                                                break;

                                            case "resolution":
                                                Int1 = Convert.ToInt32(text4);
                                                break;
                                            }
                                        }
                                    }
                                    goto IL_A3C;
                                }
                                goto IL_514;

                            case 1:
                                goto IL_514;

                            case 2:
                                goto IL_5AE;

                            case 3:
                                using (var enumerator2 = list.GetEnumerator())
                                {
                                    while (enumerator2.MoveNext())
                                    {
                                        var current2 = enumerator2.Current;
                                        var array2   = current2.Split(new[]
                                        {
                                            ' ',
                                            '\t',
                                            '='
                                        }, StringSplitOptions.RemoveEmptyEntries);
                                        string a;
                                        if ((a = array2[1]) != null && a == "S")
                                        {
                                            Class2281.Add(Convert.ToInt32(array2[0]), array2[2]);
                                        }
                                    }
                                    goto IL_A3C;
                                }
                                break;

                            case 4:
                                break;

                            case 5:
                                goto IL_72D;

                            case 6:
                                goto IL_7AC;

                            case 7:
                                goto IL_82B;

                            default:
                                goto IL_8AA;
                            }
                            using (var enumerator3 = list.GetEnumerator())
                            {
                                while (enumerator3.MoveNext())
                                {
                                    var current3 = enumerator3.Current;
                                    var array3   = current3.Split(new[]
                                    {
                                        ' ',
                                        '\t',
                                        '='
                                    }, StringSplitOptions.RemoveEmptyEntries);
                                    string a2;
                                    if ((a2 = array3[1]) != null && a2 == "F")
                                    {
                                        Class2282.Add(Convert.ToInt32(array3[0]), Convert.ToInt32(array3[2]));
                                    }
                                }
                                goto IL_A3C;
                            }
                            goto IL_72D;
IL_5AE:
                            FretbarList = new Fretbar <int>();
                            foreach (var current4 in list)
                            {
                                FretbarList.method_1(Convert.ToInt32(current4.Trim(' ', '\t', '=')));
                            }
                            Int0 = (FretbarList[1] - FretbarList[0]) / 4;
                            goto IL_A3C;
IL_514:
                            using (var enumerator5 = list.GetEnumerator())
                            {
                                while (enumerator5.MoveNext())
                                {
                                    var current5 = enumerator5.Current;
                                    var array4   = current5.Split(new[]
                                    {
                                        ' ',
                                        '\t',
                                        '='
                                    }, StringSplitOptions.RemoveEmptyEntries);
                                    string a3;
                                    if ((a3 = array4[1]) != null && a3 == "TS")
                                    {
                                        TsList.Add(Convert.ToInt32(array4[0]), new[]
                                        {
                                            Convert.ToInt32(array4[2]),
                                            Convert.ToInt32(array4[3])
                                        });
                                    }
                                }
                                goto IL_A3C;
                            }
                            goto IL_5AE;
IL_72D:
                            using (var enumerator6 = list.GetEnumerator())
                            {
                                while (enumerator6.MoveNext())
                                {
                                    var current6 = enumerator6.Current;
                                    var array5   = current6.Split(new[]
                                    {
                                        ' ',
                                        '\t',
                                        '='
                                    }, StringSplitOptions.RemoveEmptyEntries);
                                    string a4;
                                    if ((a4 = array5[1]) != null && a4 == "F")
                                    {
                                        Class2283.Add(Convert.ToInt32(array5[0]), Convert.ToInt32(array5[2]));
                                    }
                                }
                                goto IL_A3C;
                            }
IL_7AC:
                            using (var enumerator7 = list.GetEnumerator())
                            {
                                while (enumerator7.MoveNext())
                                {
                                    var current7 = enumerator7.Current;
                                    var array6   = current7.Split(new[]
                                    {
                                        ' ',
                                        '\t',
                                        '='
                                    }, StringSplitOptions.RemoveEmptyEntries);
                                    string a5;
                                    if ((a5 = array6[1]) != null && a5 == "B")
                                    {
                                        BpmList.Add(Convert.ToInt32(array6[0]), Convert.ToInt32(array6[2]));
                                    }
                                }
                                goto IL_A3C;
                            }
IL_82B:
                            using (var enumerator8 = list.GetEnumerator())
                            {
                                while (enumerator8.MoveNext())
                                {
                                    var current8 = enumerator8.Current;
                                    var array7   = current8.Split(new[]
                                    {
                                        ' ',
                                        '\t',
                                        '='
                                    }, StringSplitOptions.RemoveEmptyEntries);
                                    string a6;
                                    if ((a6 = array7[1]) != null && a6 == "B")
                                    {
                                        Class2285.Add(Convert.ToInt32(array7[0]), Convert.ToInt32(array7[2]));
                                    }
                                }
                                goto IL_A3C;
                            }
                            goto IL_8AA;
                        }
                        goto IL_8AA;
IL_A3C:
                        list.Clear();
                        continue;
IL_8AA:
                        text = text.ToLower();
                        if (!NoteList.ContainsKey(text))
                        {
                            var noteList   = new Track <int, NotesAtOffset>();
                            var spList     = new Track <int, int[]>();
                            var battleNote = new Track <int, int[]>();
                            foreach (var current9 in list)
                            {
                                var array8 = current9.Split(new[]
                                {
                                    ' ',
                                    '\t',
                                    '='
                                }, StringSplitOptions.RemoveEmptyEntries);
                                string a7;
                                if ((a7 = array8[1]) != null)
                                {
                                    if (!(a7 == "N"))
                                    {
                                        if (!(a7 == "S"))
                                        {
                                            if (a7 == "B")
                                            {
                                                battleNote.Add(Convert.ToInt32(array8[0]), new[]
                                                {
                                                    Convert.ToInt32(array8[3]),
                                                    Convert.ToInt32(array8[2])
                                                });
                                            }
                                        }
                                        else
                                        {
                                            spList.Add(Convert.ToInt32(array8[0]), new[]
                                            {
                                                Convert.ToInt32(array8[3]),
                                                Convert.ToInt32(array8[2])
                                            });
                                        }
                                    }
                                    else
                                    {
                                        noteList.Add(Convert.ToInt32(array8[0]),
                                                     new NotesAtOffset(Convert.ToInt32(array8[2]), Convert.ToInt32(array8[3])));
                                    }
                                }
                            }
                            NoteList.Add(text, noteList);
                            SpList.Add(text, spList);
                            BattleNoteList.Add(text, battleNote);
                        }
                        goto IL_A3C;
                    }
                    if (!currentLine.Equals(""))
                    {
                        list.Add(currentLine);
                    }
                }
            }
            streamReader.Close();
        }
Example #3
0
        public QbcParser(string string0, ZzGenericNode1 class3080, ZzGenericNode1 class3081, ZzGenericNode1 class3082)
        {
            string[] array =
            {
                "Easy",
                "Medium",
                "Hard",
                "Expert"
            };
            string[] array2 =
            {
                "Single",
                "Double"
            };
            ArrayPointerRootNode @class;

            for (var i = 0; i < array2.Length; i++)
            {
                var      a      = array2[i];
                string[] array3 =
                {
                    "Guitar",
                    "Rhythm"
                };
                for (var j = 0; j < array3.Length; j++)
                {
                    var text   = array3[j];
                    var array4 = array;
                    for (var k = 0; k < array4.Length; k++)
                    {
                        var text2 = array4[k];
                        var text3 =
                            (text.ToLower() + ((a == "Double") ? "coop" : "") + "_" + text2.ToLower())
                            .Replace("guitar_", "");
                        @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_song_" + text3));
                        if (@class != null && @class.method_7() is IntegerArrayNode)
                        {
                            var class2 = new Track <int, NotesAtOffset>();
                            var array5 = @class.method_7().method_7 <int>();
                            for (var l = 0; l < array5.Length; l += 3)
                            {
                                class2.Add(array5[l], new NotesAtOffset(array5[l + 2], array5[l + 1]));
                            }
                            NoteList.Add(text3, class2);
                        }
                        @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_" + text3 + "_star"));
                        if (@class != null && @class.method_7() is ListArrayNode)
                        {
                            var class3 = new Track <int, int[]>();
                            foreach (var current in @class.method_7().method_8 <IntegerArrayNode>())
                            {
                                class3.Add(current[0], new[]
                                {
                                    current[1],
                                    current[2]
                                });
                            }
                            SpList.Add(text3, class3);
                        }
                        @class = class3080.method_5(
                            new ArrayPointerRootNode(string0 + "_" + text3 + "_starbattlemode"));
                        if (@class != null && @class.method_7() is ListArrayNode)
                        {
                            var class4 = new Track <int, int[]>();
                            foreach (var current2 in @class.method_7().method_8 <IntegerArrayNode>())
                            {
                                class4.Add(current2[0], new[]
                                {
                                    current2[1],
                                    current2[2]
                                });
                            }
                            BattleNoteList.Add(text3, class4);
                        }
                    }
                }
            }
            @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_faceoffp1"));
            if (@class != null && @class.method_7() is ListArrayNode)
            {
                foreach (var current3 in @class.method_7().method_8 <IntegerArrayNode>())
                {
                    Class2282.Add(current3[0], current3[1]);
                }
            }
            @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_faceoffp2"));
            if (@class != null && @class.method_7() is ListArrayNode)
            {
                foreach (var current4 in @class.method_7().method_8 <IntegerArrayNode>())
                {
                    Class2283.Add(current4[0], current4[1]);
                }
            }
            @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_bossbattlep1"));
            if (@class != null && @class.method_7() is ListArrayNode)
            {
                foreach (var current5 in @class.method_7().method_8 <IntegerArrayNode>())
                {
                    BpmList.Add(current5[0], current5[1]);
                }
            }
            @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_bossbattlep2"));
            if (@class != null && @class.method_7() is ListArrayNode)
            {
                foreach (var current6 in @class.method_7().method_8 <IntegerArrayNode>())
                {
                    Class2285.Add(current6[0], current6[1]);
                }
            }
            @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_timesig"));
            if (@class != null && @class.method_7() is ListArrayNode)
            {
                foreach (var current7 in @class.method_7().method_8 <IntegerArrayNode>())
                {
                    TsList.Add(current7[0], new[]
                    {
                        current7[1],
                        current7[2]
                    });
                }
            }
            @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_fretbars"));
            if (@class != null && @class.method_7() is IntegerArrayNode)
            {
                FretbarList = new Fretbar <int>(@class.method_7().method_8 <int>());
                Int0        = (FretbarList[1] - FretbarList[0]) / 4;
                try
                {
                    var dictionary = new Dictionary <int, string>();
                    @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_markers"));
                    if (class3081 != null && @class != null && @class.method_7() is StructureArrayNode)
                    {
                        foreach (UnicodeRootNode class5 in class3081.Nodes)
                        {
                            dictionary.Add(class5.Int0, class5.method_7());
                        }
                        using (var enumerator9 = @class.method_7().method_8 <StructureHeaderNode>().GetEnumerator())
                        {
                            while (enumerator9.MoveNext())
                            {
                                var current8 = enumerator9.Current;
                                Class2281.Add(((IntegerStructureNode)current8[0]).method_8(),
                                              dictionary[((FileTagStructureNode)current8[1]).method_9()]);
                            }
                            goto IL_7C2;
                        }
                    }
                    if (@class != null && @class.method_7() is StructureArrayNode)
                    {
                        foreach (var current9 in @class.method_7().method_8 <StructureHeaderNode>())
                        {
                            Class2281.Add(((IntegerStructureNode)current9[0]).method_8(),
                                          ((UnicodeStructureNode)current9[1]).method_8());
                        }
                    }
IL_7C2:
                    ;
                }
                catch
                {
                }
                try
                {
                    if (class3082 != null)
                    {
                        Gh3Song0 = new Gh3Song(class3082.method_5(new StructurePointerNode(string0)));
                    }
                    return;
                }
                catch
                {
                    return;
                }
            }
            throw new Exception("Not a MID.QB!");
        }