Пример #1
0
        public static Bemani1 Read(Stream source, long unitNumerator, long unitDenominator, Dictionary <int, int> ignore)
        {
            Bemani1      result     = new Bemani1();
            long         offsetBase = source.Position;
            BinaryReader reader     = new BinaryReader(source);

            int[] offset = new int[12];
            int[] length = new int[12];

            for (int i = 0; i < 12; i++)
            {
                offset[i] = reader.ReadInt32();
                length[i] = reader.ReadInt32();
            }

            for (int i = 0; i < 12; i++)
            {
                if (length[i] > 0 && offset[i] >= 0x60)
                {
                    Chart chart;
                    source.Position = offsetBase + offset[i];

                    byte[] chartData = reader.ReadBytes(length[i]);
                    using (MemoryStream mem = new MemoryStream(chartData))
                    {
                        chart          = BeatmaniaIIDXPC.Read(mem, ignore);
                        chart.TickRate = new Fraction(unitNumerator, unitDenominator);

                        // fill in the metric offsets
                        chart.CalculateMetricOffsets();
                    }

                    if (chart.Entries.Count > 0)
                    {
                        result.charts[i] = chart;
                    }
                    else
                    {
                        result.charts[i] = null;
                    }
                }
            }

            return(result);
        }
Пример #2
0
        public static Bemani1 Read(Stream source, long unitNumerator, long unitDenominator)
        {
            Bemani1 result = new Bemani1();
            long offsetBase = source.Position;
            BinaryReader reader = new BinaryReader(source);

            int[] offset = new int[12];
            int[] length = new int[12];

            for (int i = 0; i < 12; i++)
            {
                offset[i] = reader.ReadInt32();
                length[i] = reader.ReadInt32();
            }

            for (int i = 0; i < 12; i++)
            {
                if (length[i] > 0 && offset[i] >= 0x60)
                {
                    Chart chart;
                    source.Position = offsetBase + offset[i];

                    byte[] chartData = reader.ReadBytes(length[i]);
                    using (MemoryStream mem = new MemoryStream(chartData))
                    {
                        chart = BeatmaniaIIDXPC.Read(mem);
                        chart.TickRate = new Fraction(unitNumerator, unitDenominator);

                        // fill in the metric offsets
                        chart.CalculateMetricOffsets();
                    }

                    if (chart.Entries.Count > 0)
                        result.charts[i] = chart;
                    else
                        result.charts[i] = null;
                }
            }

            return result;
        }