Esempio n. 1
0
        public static RhsFile Deserialize(BinaryReader reader)
        {
            var file = new RhsFile();

            file.version = reader.ReadByte();

            RhsEntryType type;

            while ((type = (RhsEntryType)reader.ReadByte()) != RhsEntryType.EndOfEntry)
            {
                switch (type)
                {
                case RhsEntryType.Rhs:
                    file.rhsGuid = reader.ReadRhGuid();
                    break;

                case RhsEntryType.Internal:
                    file.internalGuid = reader.ReadRhGuid();
                    break;

                case RhsEntryType.Ogg:
                    file.oggGuid = reader.ReadRhGuid();
                    break;

                case RhsEntryType.SongTitle:
                    file.songTitle = reader.ReadShortPrefixedString();
                    break;

                case RhsEntryType.TimingData:
                    file.timingData = TimingData.Deserialize(reader);
                    break;

                case RhsEntryType.PreviewStart:
                    file.previewStart = reader.ReadSingle();
                    break;

                case RhsEntryType.PreviewLength:
                    file.previewLength = reader.ReadSingle();
                    break;

                case RhsEntryType.SongLengthOverride:
                    file.songLengthOverride = reader.ReadSingle();
                    break;

                case RhsEntryType.Png:
                    file.pngGuid = reader.ReadRhGuid();
                    break;

                case RhsEntryType.Artists:
                    file.artists.Add(Artist.Deserialize(reader));
                    break;

                default:
                    throw new Exception("Unknown song entry type: " + type);
                }
            }

            return(file);
        }
Esempio n. 2
0
        public static RhcCacheEntry Deserialize(BinaryReader reader)
        {
            var entry = new RhcCacheEntry();

            // TODO: Remove duplicate logic for parsing cache entry types
            CacheEntryType type;

            while ((type = (CacheEntryType)reader.ReadByte()) != CacheEntryType.EndOfEntry)
            {
                switch (type)
                {
                case CacheEntryType.Rhc:
                    entry.rhcGuid = reader.ReadRhGuid();
                    break;

                case CacheEntryType.Rhs:
                    entry.rhsGuid = reader.ReadRhGuid();
                    break;

                case CacheEntryType.Internal:
                    entry.internalGuid = reader.ReadRhGuid();
                    break;

                case CacheEntryType.ChartName:
                    entry.chartName = reader.ReadShortPrefixedString();
                    break;

                case CacheEntryType.PreviewStart:
                    entry.unknown1 = reader.ReadBytes(7);
                    break;

                case CacheEntryType.Artists:
                    entry.artists.Add(Artist.Deserialize(reader));
                    break;

                case CacheEntryType.PreviewLength:
                    entry.unknown2 = reader.ReadBytes(36);
                    break;

                case CacheEntryType.DisplayAuthor:
                    entry.displayAuthor = reader.ReadShortPrefixedString();
                    break;

                default:
                    throw new Exception("Unknown cache entry type: " + type);
                }
            }

            return(entry);
        }
Esempio n. 3
0
        public static RhcFile Deserialize(BinaryReader reader)
        {
            var file = new RhcFile();

            file.version = reader.ReadByte();

            RhcEntryType type;

            while ((type = (RhcEntryType)reader.ReadByte()) != RhcEntryType.EndOfEntry)
            {
                switch (type)
                {
                case RhcEntryType.Rhc:
                    file.rhcGuid = reader.ReadRhGuid();
                    break;

                case RhcEntryType.Internal:
                    file.internalGuid = reader.ReadRhGuid();
                    break;

                case RhcEntryType.Rhs:
                    file.rhsGuid = reader.ReadRhGuid();
                    break;

                case RhcEntryType.ChartName:
                    file.chartName = reader.ReadShortPrefixedString();
                    break;

                case RhcEntryType.Unknown1:
                    file.unknown1 = reader.ReadUInt16();                             // Always 0
                    break;

                case RhcEntryType.Artists:
                    file.artists.Add(Artist.Deserialize(reader));
                    break;

                case RhcEntryType.Layers:
                    file.layers = Layers.Deserialize(reader);
                    break;

                default:
                    throw new Exception("Unknown chart entry type: " + type);
                }
            }

            return(file);
        }
Esempio n. 4
0
        public static RhsCacheEntry Deserialize(BinaryReader reader)
        {
            var entry = new RhsCacheEntry();

            // TODO: Remove duplicate logic for parsing cache entry types
            CacheEntryType type;

            while ((type = (CacheEntryType)reader.ReadByte()) != CacheEntryType.EndOfEntry)
            {
                switch (type)
                {
                case CacheEntryType.Rhs:
                    entry.rhsGuid = reader.ReadRhGuid();
                    break;

                case CacheEntryType.Internal:
                    entry.internalGuid = reader.ReadRhGuid();
                    break;

                case CacheEntryType.Ogg:
                    entry.oggGuid = reader.ReadRhGuid();
                    break;

                case CacheEntryType.Png:
                    entry.pngGuid = reader.ReadRhGuid();
                    break;

                case CacheEntryType.ChartName:
                    entry.songTitle = reader.ReadShortPrefixedString();
                    break;

                case CacheEntryType.TimingData:
                    entry.timingData = TimingData.Deserialize(reader);
                    break;

                case CacheEntryType.Artists:
                    entry.artists.Add(Artist.Deserialize(reader));
                    break;

                case CacheEntryType.SongLengthOverride:
                    entry.songLengthOverride = reader.ReadSingle();
                    break;

                case CacheEntryType.PreviewStart:
                    entry.previewStart = reader.ReadSingle();
                    break;

                case CacheEntryType.PreviewLength:
                    entry.previewLength = reader.ReadSingle();
                    break;

                case CacheEntryType.DisplayArtist:
                    entry.displayArtist = reader.ReadShortPrefixedString();
                    break;

                default:
                    throw new Exception("Unknown cache entry type: " + type);
                }
            }

            return(entry);
        }