private void SongAggregateGraph(DLCPackageData info, DLCPackageType dlcType)
        {
            var dlcName = info.Name.ToLower();
            var songPartition = new SongPartition();

            // Xblock
            var xbl = new GraphItem();
            xbl.Name = dlcName;
            xbl.Canonical = String.Format(CANONICAL_XBLOCK[dlcType], dlcName);
            xbl.RelPathDirectory = xbl.Canonical;
            xbl.Tag = new List<string>();
            xbl.Tag.Add(TagValue.EmergentWorld.GetDescription());
            xbl.Tag.Add(TagValue.XWorld.GetDescription());
            xbl.UUID = IdGenerator.Guid();
            xbl.RelPathFile = String.Format("{0}.xblock", xbl.Name);
            GameXblock = xbl;

            JsonDB = new List<GraphItem>();
            if (currentPlatform.IsConsole)
                HsonDB = new List<GraphItem>();

            SongXml = new List<GraphItemLLID>();
            MusicgameSong = new List<GraphItemLLID>();
            foreach (var arrangement in info.Arrangements) {
                var name = String.Format(NAME_ARRANGEMENT, dlcName, songPartition.GetArrangementFileName(arrangement.Name, arrangement.ArrangementType).ToLower());

                // JsonDB
                var json = new GraphItem();
                json.Name = name;
                json.Canonical = currentPlatform.IsConsole ? CANONICAL_MANIFEST_CONSOLE : String.Format(CANONICAL_MANIFEST_PC, dlcName);
                json.RelPathDirectory = json.Canonical;
                json.Tag = new List<string>();
                json.Tag.Add(TagValue.Database.GetDescription());
                json.Tag.Add(TagValue.JsonDB.GetDescription());
                json.UUID = IdGenerator.Guid();
                json.RelPathFile = String.Format("{0}.json", json.Name);
                JsonDB.Add(json);

                //One file for each arrangement (Xbox360 / PS3 only)
                if (currentPlatform.IsConsole) {
                    // HsonDB
                    var hson = new GraphItem();
                    hson.Name = name;
                    hson.Canonical = CANONICAL_MANIFEST_CONSOLE;
                    hson.RelPathDirectory = hson.Canonical;
                    hson.Tag = new List<string>();
                    hson.Tag.Add(TagValue.Database.GetDescription());
                    hson.Tag.Add(TagValue.HsonDB.GetDescription());
                    hson.UUID = IdGenerator.Guid();
                    hson.RelPathFile = String.Format("{0}.hson", json.Name);
                    HsonDB.Add(hson);
                }

                // XmlSong
                var xml = new GraphItemLLID();
                xml.Name = name;
                xml.Canonical = String.Format(CANONICAL_XMLSONG, dlcName);
                xml.RelPathDirectory = xml.Canonical;
                xml.LogPathDirectory = xml.Canonical;
                xml.Tag = new List<string>();
                xml.Tag.Add(TagValue.Application.GetDescription());
                xml.Tag.Add(TagValue.XML.GetDescription());
                xml.UUID = arrangement.SongXml.UUID;
                xml.LLID = Guid.Parse(arrangement.SongXml.LLID);
                xml.RelPathFile = String.Format("{0}.xml", xml.Name);
                xml.LogPathFile = xml.RelPathFile;
                SongXml.Add(xml);

                // Musicgame
                var sng = new GraphItemLLID();
                sng.Name = name;
                sng.Canonical = String.Format(CANONICAL_GAMESONG, currentPlatform.GetPathName()[1].ToLower());
                sng.RelPathDirectory = sng.Canonical;
                sng.LogPathDirectory = sng.Canonical;
                sng.Tag = new List<string>();
                sng.Tag.Add(TagValue.Application.GetDescription());
                sng.Tag.Add(TagValue.MusicgameSong.GetDescription());
                if (currentPlatform.IsConsole)
                    sng.Tag.Add(GraphItem.GetPlatformTagDescription(currentPlatform.platform));
                sng.UUID = arrangement.SongFile.UUID;
                sng.LLID = Guid.Parse(arrangement.SongFile.LLID);
                sng.RelPathFile = String.Format("{0}.sng", sng.Name);
                sng.LogPathFile = sng.RelPathFile;
                MusicgameSong.Add(sng);
            }

            if (currentPlatform.version == GameVersion.RS2014) {
                //One file for all arrangement (PC / Mac only)
                if (!currentPlatform.IsConsole) {
                    // HsanDB
                    var hsan = new GraphItem();
                    hsan.Name = String.Format("songs_dlc_{0}", dlcName);
                    hsan.Canonical = String.Format(CANONICAL_MANIFEST_PC, dlcName);
                    hsan.RelPathDirectory = hsan.Canonical;
                    hsan.Tag = new List<string>();
                    hsan.Tag.Add(TagValue.Database.GetDescription());
                    hsan.Tag.Add(TagValue.HsanDB.GetDescription());
                    hsan.UUID = IdGenerator.Guid();
                    hsan.RelPathFile = String.Format("{0}.hsan", hsan.Name);
                    HsanDB = hsan;
                }

                // Showlight (Xml)
                var xml = new GraphItemLLID();
                xml.Name = String.Format(NAME_SHOWLIGHT, dlcName);
                xml.Canonical = String.Format(CANONICAL_XMLSONG, dlcName);
                xml.RelPathDirectory = xml.Canonical;
                xml.LogPathDirectory = xml.Canonical;
                xml.Tag = new List<string>();
                xml.Tag.Add(TagValue.Application.GetDescription());
                xml.Tag.Add(TagValue.XML.GetDescription());
                xml.UUID = IdGenerator.Guid();
                xml.LLID = Guid.Parse(IdGenerator.LLID());
                xml.RelPathFile = String.Format("{0}.xml", xml.Name);
                xml.LogPathFile = xml.RelPathFile;
                SongXml.Add(xml);
                ShowlightXml = xml;
            }

            // Image Art (DDS)
            var aArtArray = new string[] { info.AlbumArtPath };
            if (currentPlatform.version == GameVersion.RS2014)
                aArtArray = new string[] {
                    String.Format("album_{0}_256.dds", dlcName),
                    String.Format("album_{0}_128.dds", dlcName),
                    String.Format("album_{0}_64.dds", dlcName) };
            ImageArt = new List<GraphItemLLID>();
            foreach (var album in aArtArray) {
                var dds = new GraphItemLLID();
                dds.Canonical = CANONICAL_IMAGEART[dlcType];
                dds.RelPathDirectory = dds.Canonical;
                dds.LogPathDirectory = dds.Canonical;
                dds.Tag = new List<string>();
                dds.Tag.Add(TagValue.DDS.GetDescription());
                dds.Tag.Add(TagValue.Image.GetDescription());
                dds.UUID = IdGenerator.Guid();
                dds.LLID = Guid.Parse(IdGenerator.LLID());
                dds.Name = Path.GetFileNameWithoutExtension(album);
                dds.RelPathFile = Path.GetFileName(album);
                dds.LogPathFile = dds.RelPathFile;
                ImageArt.Add(dds);
            }

            // Lyrics Font Texture
            if (!String.IsNullOrEmpty(info.LyricsTex)) {
                LyricsTex = new GraphItemLLID();
                var tex = new GraphItemLLID();
                tex.Canonical = String.Format(CANONICAL_MANIFEST_PC, dlcName);
                tex.RelPathDirectory = tex.Canonical;
                tex.LogPathDirectory = tex.Canonical;
                tex.Tag = new List<string>();
                tex.Tag.Add(TagValue.DDS.GetDescription());
                tex.Tag.Add(TagValue.Image.GetDescription());
                tex.UUID = IdGenerator.Guid();
                tex.LLID = Guid.Parse(IdGenerator.LLID());
                tex.Name = String.Format("lyrics_{0}", dlcName);
                tex.RelPathFile = tex.Name;
                tex.LogPathFile = tex.RelPathFile;
                LyricsTex = tex;
            }

            // Soundbank
            Soundbank = new List<GraphItemLLID>();
            var bnk = new GraphItemLLID();
            bnk.Canonical = String.Format(CANONICAL_SOUNDBANK, currentPlatform.GetPathName()[0].ToLower());
            bnk.RelPathDirectory = bnk.Canonical;
            bnk.LogPathDirectory = LOGPATH_SOUNDBANK;
            bnk.Tag = new List<string>();
            bnk.Tag.Add(TagValue.Audio.GetDescription());
            bnk.Tag.Add(TagValue.WwiseSoundBank.GetDescription());
            bnk.Tag.Add(GraphItem.GetPlatformTagDescription(currentPlatform.platform));
            bnk.UUID = IdGenerator.Guid();
            bnk.LLID = Guid.Parse(IdGenerator.LLID());
            bnk.Name = String.Format("song_{0}", dlcName);
            bnk.RelPathFile = String.Format("{0}.bnk", bnk.Name);
            bnk.LogPathFile = bnk.RelPathFile;
            Soundbank.Add(bnk);

            if (currentPlatform.version == GameVersion.RS2014) {
                // Soundbank Preview
                var bnkPreview = new GraphItemLLID();
                bnkPreview.Canonical = String.Format(CANONICAL_SOUNDBANK, currentPlatform.GetPathName()[0].ToLower());
                bnkPreview.RelPathDirectory = bnkPreview.Canonical;
                bnkPreview.LogPathDirectory = LOGPATH_SOUNDBANK;
                bnkPreview.Tag = new List<string>();
                bnkPreview.Tag.Add(TagValue.Audio.GetDescription());
                bnkPreview.Tag.Add(TagValue.WwiseSoundBank.GetDescription());
                bnkPreview.Tag.Add(GraphItem.GetPlatformTagDescription(currentPlatform.platform));
                bnkPreview.UUID = IdGenerator.Guid();
                bnkPreview.LLID = Guid.Parse(IdGenerator.LLID());
                bnkPreview.Name = String.Format("song_{0}_preview", dlcName);
                bnkPreview.RelPathFile = String.Format("{0}.bnk", bnkPreview.Name);
                bnkPreview.LogPathFile = bnkPreview.RelPathFile;
                Soundbank.Add(bnkPreview);
            }
        }
示例#2
0
        private void SongAggregateGraph(DLCPackageData info, DLCPackageType dlcType)
        {
            var dlcName       = info.Name.ToLower();
            var songPartition = new SongPartition();

            // Xblock
            GameXblock = new List <GraphItem>();
            var xbl = new GraphItem();

            xbl.Name             = dlcName;
            xbl.Canonical        = String.Format(CANONICAL_XBLOCK[dlcType], dlcName);
            xbl.RelPathDirectory = xbl.Canonical;
            xbl.Tag = new List <string>();
            xbl.Tag.Add(TagValue.EmergentWorld.GetDescription());
            xbl.Tag.Add(TagValue.XWorld.GetDescription());
            xbl.UUID        = IdGenerator.Guid();
            xbl.RelPathFile = String.Format("{0}.xblock", xbl.Name);
            GameXblock.Add(xbl);

            JsonDB = new List <GraphItem>();
            if (currentPlatform.IsConsole)
            {
                HsonDB = new List <GraphItem>();
            }

            SongXml       = new List <GraphItemLLID>();
            MusicgameSong = new List <GraphItemLLID>();
            foreach (var arrangement in info.Arrangements)
            {
                if (arrangement.ArrangementType == Sng.ArrangementType.ShowLight)
                {
                    continue;
                }

                var name = String.Format(NAME_ARRANGEMENT, dlcName, songPartition.GetArrangementFileName(arrangement.ArrangementName, arrangement.ArrangementType).ToLower());

                // JsonDB
                var json = new GraphItem();
                json.Name             = name;
                json.Canonical        = currentPlatform.IsConsole ? CANONICAL_MANIFEST_CONSOLE : String.Format(CANONICAL_MANIFEST_PC, dlcName);
                json.RelPathDirectory = json.Canonical;
                json.Tag = new List <string>();
                json.Tag.Add(TagValue.Database.GetDescription());
                json.Tag.Add(TagValue.JsonDB.GetDescription());
                json.UUID        = IdGenerator.Guid();
                json.RelPathFile = String.Format("{0}.json", json.Name);
                JsonDB.Add(json);

                //One file for each arrangement (Xbox360 / PS3 only)
                if (currentPlatform.IsConsole)
                {
                    // HsonDB
                    var hson = new GraphItem();
                    hson.Name             = name;
                    hson.Canonical        = CANONICAL_MANIFEST_CONSOLE;
                    hson.RelPathDirectory = hson.Canonical;
                    hson.Tag = new List <string>();
                    hson.Tag.Add(TagValue.Database.GetDescription());
                    hson.Tag.Add(TagValue.HsonDB.GetDescription());
                    hson.UUID        = IdGenerator.Guid();
                    hson.RelPathFile = String.Format("{0}.hson", json.Name);
                    HsonDB.Add(hson);
                }

                // XmlSong
                var xml = new GraphItemLLID();
                xml.Name             = name;
                xml.Canonical        = String.Format(CANONICAL_XMLSONG, dlcName);
                xml.RelPathDirectory = xml.Canonical;
                xml.LogPathDirectory = xml.Canonical;
                xml.Tag = new List <string>();
                xml.Tag.Add(TagValue.Application.GetDescription());
                xml.Tag.Add(TagValue.XML.GetDescription());
                xml.UUID        = arrangement.SongXml.UUID;
                xml.LLID        = IdGenerator.LLIDGuid();
                xml.RelPathFile = String.Format("{0}.xml", xml.Name);
                xml.LogPathFile = xml.RelPathFile;
                SongXml.Add(xml);

                // Musicgame
                var sng = new GraphItemLLID();
                sng.Name             = name;
                sng.Canonical        = String.Format(CANONICAL_GAMESONG, currentPlatform.GetPathName()[1].ToLower());
                sng.RelPathDirectory = sng.Canonical;
                sng.LogPathDirectory = sng.Canonical;
                sng.Tag = new List <string>();
                sng.Tag.Add(TagValue.Application.GetDescription());
                sng.Tag.Add(TagValue.MusicgameSong.GetDescription());
                if (currentPlatform.IsConsole)
                {
                    sng.Tag.Add(GraphItem.GetPlatformTagDescription(currentPlatform.platform));
                }
                sng.UUID        = arrangement.SongFile.UUID;
                sng.LLID        = IdGenerator.LLIDGuid();
                sng.RelPathFile = String.Format("{0}.sng", sng.Name);
                sng.LogPathFile = sng.RelPathFile;
                MusicgameSong.Add(sng);
            }

            if (currentPlatform.version == GameVersion.RS2014)
            {
                //One file for all arrangement (PC / Mac only)
                if (!currentPlatform.IsConsole)
                {
                    // HsanDB
                    var hsan = new GraphItem();
                    hsan.Name             = String.Format("songs_dlc_{0}", dlcName);
                    hsan.Canonical        = String.Format(CANONICAL_MANIFEST_PC, dlcName);
                    hsan.RelPathDirectory = hsan.Canonical;
                    hsan.Tag = new List <string>();
                    hsan.Tag.Add(TagValue.Database.GetDescription());
                    hsan.Tag.Add(TagValue.HsanDB.GetDescription());
                    hsan.UUID        = IdGenerator.Guid();
                    hsan.RelPathFile = String.Format("{0}.hsan", hsan.Name);
                    HsanDB           = hsan;
                }

                // Showlight (Xml)
                var ShowlightXml = new List <GraphItemLLID>();
                var xml          = new GraphItemLLID();
                xml.Name             = String.Format(NAME_SHOWLIGHT, dlcName);
                xml.Canonical        = String.Format(CANONICAL_XMLSONG, dlcName);
                xml.RelPathDirectory = xml.Canonical;
                xml.LogPathDirectory = xml.Canonical;
                xml.Tag = new List <string>();
                xml.Tag.Add(TagValue.Application.GetDescription());
                xml.Tag.Add(TagValue.XML.GetDescription());
                xml.UUID        = IdGenerator.Guid();
                xml.LLID        = IdGenerator.LLIDGuid();
                xml.RelPathFile = String.Format("{0}.xml", xml.Name);
                xml.LogPathFile = xml.RelPathFile;
                SongXml.Add(xml); // TODO: check this
                ShowlightXml.Add(xml);
            }

            // Image Art (DDS)
            var aArtArray = new string[] { info.AlbumArtPath };

            if (currentPlatform.version == GameVersion.RS2014)
            {
                aArtArray = new string[] {
                    String.Format("album_{0}_256.dds", dlcName),
                    String.Format("album_{0}_128.dds", dlcName),
                    String.Format("album_{0}_64.dds", dlcName)
                }
            }
            ;
            ImageArt = new List <GraphItemLLID>();
            foreach (var album in aArtArray)
            {
                var dds = new GraphItemLLID();
                dds.Canonical        = CANONICAL_IMAGEART[dlcType];
                dds.RelPathDirectory = dds.Canonical;
                dds.LogPathDirectory = dds.Canonical;
                dds.Tag = new List <string>();
                dds.Tag.Add(TagValue.DDS.GetDescription());
                dds.Tag.Add(TagValue.Image.GetDescription());
                dds.UUID        = IdGenerator.Guid();
                dds.LLID        = IdGenerator.LLIDGuid();
                dds.Name        = Path.GetFileNameWithoutExtension(album);
                dds.RelPathFile = Path.GetFileName(album);
                dds.LogPathFile = dds.RelPathFile;
                ImageArt.Add(dds);
            }

            // Lyrics Font Texture
            if (!String.IsNullOrEmpty(info.LyricArtPath))
            {
                var dds = new GraphItemLLID();
                dds.Canonical        = String.Format(CANONICAL_LYRIC, dlcName);
                dds.RelPathDirectory = dds.Canonical;
                dds.LogPathDirectory = dds.Canonical;
                dds.Tag = new List <string>();
                dds.Tag.Add(TagValue.DDS.GetDescription());
                dds.Tag.Add(TagValue.Image.GetDescription());
                dds.UUID        = IdGenerator.Guid();
                dds.LLID        = IdGenerator.LLIDGuid();
                dds.Name        = String.Format("lyrics_{0}", dlcName);
                dds.RelPathFile = String.Format("{0}.dds", dds.Name); //keep extension
                dds.LogPathFile = dds.RelPathFile;
                ImageArt.Add(dds);
            }

            // Soundbank
            Soundbank = new List <GraphItemLLID>();
            var bnk = new GraphItemLLID();

            bnk.Canonical        = String.Format(CANONICAL_SOUNDBANK, currentPlatform.GetPathName()[0].ToLower());
            bnk.RelPathDirectory = bnk.Canonical;
            bnk.LogPathDirectory = LOGPATH_SOUNDBANK;
            bnk.Tag = new List <string>();
            bnk.Tag.Add(TagValue.Audio.GetDescription());
            bnk.Tag.Add(TagValue.WwiseSoundBank.GetDescription());
            bnk.Tag.Add(GraphItem.GetPlatformTagDescription(currentPlatform.platform));
            bnk.UUID        = IdGenerator.Guid();
            bnk.LLID        = IdGenerator.LLIDGuid();
            bnk.Name        = String.Format("song_{0}", dlcName);
            bnk.RelPathFile = String.Format("{0}.bnk", bnk.Name);
            bnk.LogPathFile = bnk.RelPathFile;
            Soundbank.Add(bnk);

            if (currentPlatform.version == GameVersion.RS2014)
            {
                // Soundbank Preview
                var bnkPreview = new GraphItemLLID();
                bnkPreview.Canonical        = String.Format(CANONICAL_SOUNDBANK, currentPlatform.GetPathName()[0].ToLower());
                bnkPreview.RelPathDirectory = bnkPreview.Canonical;
                bnkPreview.LogPathDirectory = LOGPATH_SOUNDBANK;
                bnkPreview.Tag = new List <string>();
                bnkPreview.Tag.Add(TagValue.Audio.GetDescription());
                bnkPreview.Tag.Add(TagValue.WwiseSoundBank.GetDescription());
                bnkPreview.Tag.Add(GraphItem.GetPlatformTagDescription(currentPlatform.platform));
                bnkPreview.UUID        = IdGenerator.Guid();
                bnkPreview.LLID        = IdGenerator.LLIDGuid();
                bnkPreview.Name        = String.Format("song_{0}_preview", dlcName);
                bnkPreview.RelPathFile = String.Format("{0}.bnk", bnkPreview.Name);
                bnkPreview.LogPathFile = bnkPreview.RelPathFile;
                Soundbank.Add(bnkPreview);
            }
        }
示例#3
0
        public string GenerateManifest(string dlcKey, IList <Arrangement> arrangements, SongInfo songInfo, Platform platform)
        {
            var manifest = Manifest;

            manifest.Entries = new Dictionary <string, Dictionary <string, Attributes> >();
            bool firstarrangset = false;

            Arrangement vocal = null;

            if (arrangements.Any <Arrangement>(a => a.ArrangementType == Sng.ArrangementType.Vocal))
            {
                vocal = arrangements.Single <Arrangement>(a => a.ArrangementType == Sng.ArrangementType.Vocal);
            }

            var manifestFunctions = new ManifestFunctions(platform.version);
            var songPartition     = new SongPartition();

            foreach (var arr in arrangements)
            {
                var isVocal   = arr.ArrangementType == Sng.ArrangementType.Vocal;
                var song      = (isVocal) ? null : Song.LoadFromFile(arr.SongXml.File);
                var attribute = new Attributes();

                attribute.AlbumArt             = String.Format("urn:llid:{0}", AggregateGraph.AlbumArt.LLID);
                attribute.AlbumName            = songInfo.Album;
                attribute.AlbumNameSort        = songInfo.AlbumSort;
                attribute.ArrangementName      = arr.ArrangementName.ToString();
                attribute.ArtistName           = songInfo.Artist;
                attribute.ArtistNameSort       = songInfo.ArtistSort;
                attribute.AssociatedTechniques = new List <string>();
                //Should be 51 for bass, 49 for vocal and guitar
                attribute.BinaryVersion = arr.ArrangementType == Sng.ArrangementType.Bass ? 51 : 49;
                attribute.BlockAsset    = String.Format("urn:emergent-world:{0}", AggregateGraph.XBlock.Name);

                if (!isVocal)
                {
                    attribute.ChordTemplates = new List <ChordTemplate>();
                }

                attribute.DISC_DLC_OTHER             = "Disc";
                attribute.DisplayName                = songInfo.SongDisplayName;
                attribute.DLCPreview                 = false;
                attribute.EffectChainMultiplayerName = String.Empty;
                // NOTE: attribute.EffectChainName = tone.Key
                // attribute.EffectChainName = isVocal ? "" : (arr.ToneBase == null ? throw new DataException("<ERROR> " + arr.ArrangementName + " ToneBase/ToneKey is null ...") : arr.ToneBase);

                if (isVocal)
                {
                    attribute.EffectChainName = "";
                }
                else
                {
                    if (arr.ToneBase == null)
                    {
                        throw new DataException("<ERROR> " + arr.ArrangementName + " ToneBase/ToneKey is null ...");
                    }
                    else // ToneBase w/ space <=> tone.Name w/ space <=> tone.Key w/o space
                    {
                        attribute.EffectChainName = arr.ToneBase.GetValidKey(isTone: true);
                    }
                }
                attribute.EventFirstTimeSortOrder = 9999;
                attribute.ExclusiveBuild          = new List <object>();
                attribute.FirstArrangementInSong  = false;
                attribute.ForceUseXML             = true;
                attribute.Genre      = "PLACEHOLDER Genre";
                attribute.InputEvent = isVocal ? "Play_Tone_Standard_Mic" : "Play_Tone_";
                attribute.IsDemoSong = false;
                attribute.IsDLC      = true;

                if (!isVocal)
                {
                    attribute.LastConversionDateTime = song.LastConversionDateTime;
                }

                // TODO: improve this
                int masterId = isVocal ? 1 : arr.MasterId;
                attribute.MasterID_PS3     = masterId;
                attribute.MasterID_Xbox360 = masterId;

                if (!isVocal)
                {
                    attribute.MaxPhraseDifficulty = manifestFunctions.GetMaxDifficulty(song);
                }

                attribute.PersistentID     = arr.Id.ToString().Replace("-", "").ToUpper();
                attribute.PhraseIterations = new List <PhraseIteration>();
                attribute.Phrases          = new List <Phrase>();
                attribute.PluckedType      = arr.PluckedType == Sng.PluckedType.Picked ? "Picked" : "Not Picked"; // TODO: FIXME

                if (isVocal)
                {
                    attribute.RelativeDifficulty        = 0;
                    attribute.RepresentativeArrangement = false;
                }
                else
                {
                    attribute.RelativeDifficulty        = song.Levels.Length; //TODO: FIXME
                    attribute.RepresentativeArrangement = true;
                }

                attribute.Score_MaxNotes = 0;
                attribute.Score_PNV      = 0;
                attribute.Sections       = new List <Section>();
                attribute.Shipping       = true;
                attribute.SongAsset      = String.Format("urn:llid:{0}", arr.SongFile.LLID);

                if (!isVocal)
                {
                    attribute.SongDifficulty = (float)song.PhraseIterations.Average(it => song.Phrases[it.PhraseId].MaxDifficulty);
                }

                attribute.SongEvent    = String.Format("Play_{0}", dlcKey);
                attribute.SongKey      = dlcKey;
                attribute.SongLength   = 0;
                attribute.SongName     = songInfo.SongDisplayName;
                attribute.SongNameSort = songInfo.SongDisplayNameSort;

                if (!isVocal)
                {
                    attribute.SongPartition = songPartition.GetSongPartition(arr.ArrangementName, arr.ArrangementType);
                    attribute.SongLength    = (float)Math.Round((decimal)song.SongLength, 3, MidpointRounding.AwayFromZero); //rounded
                }

                attribute.SongXml  = String.Format("urn:llid:{0}", arr.SongXml.LLID);
                attribute.SongYear = songInfo.SongYear;

                if (isVocal)
                {
                    attribute.TargetScore     = 0;
                    attribute.ToneUnlockScore = 0;
                }
                else
                {
                    attribute.TargetScore     = 100000;
                    attribute.ToneUnlockScore = 70000;
                }

                attribute.TwoHandTapping = false;
                attribute.UnlockKey      = "";
                attribute.Tuning         = arr.Tuning;
                attribute.VocalsAssetId  = arr.ArrangementType == Sng.ArrangementType.Vocal ? "" : (vocal != null) ? String.Format("{0}|GRSong_{1}", vocal.Id, vocal.ArrangementName) : "";

                if (!firstarrangset && arr == arrangements.First())
                {
                    firstarrangset = true;
                    attribute.FirstArrangementInSong = true;
                }

                manifestFunctions.GenerateDynamicVisualDensity(attribute, song, arr, GameVersion.RS2012);

                if (!isVocal)
                {
                    #region Include Associated Techniques

                    attribute.PowerChords = song.HasPowerChords();
                    if (attribute.PowerChords)
                    {
                        AssociateTechniques(arr, attribute, "PowerChords");
                    }
                    attribute.BarChords = song.HasBarChords();
                    if (attribute.BarChords)
                    {
                        AssociateTechniques(arr, attribute, "BarChords");
                    }
                    attribute.OpenChords = song.HasOpenChords();
                    if (attribute.OpenChords)
                    {
                        AssociateTechniques(arr, attribute, "ChordIntro");
                    }
                    attribute.DoubleStops = song.HasDoubleStops();
                    if (attribute.DoubleStops)
                    {
                        AssociateTechniques(arr, attribute, "DoubleStops");
                    }
                    attribute.Sustain = song.HasSustain();
                    if (attribute.Sustain)
                    {
                        AssociateTechniques(arr, attribute, "Sustain");
                    }
                    attribute.Bends = song.HasBends();
                    if (attribute.Bends)
                    {
                        AssociateTechniques(arr, attribute, "Bends");
                    }
                    attribute.Slides = song.HasSlides();
                    if (attribute.Slides)
                    {
                        AssociateTechniques(arr, attribute, "Slides");
                    }
                    attribute.Tremolo = song.HasTremolo();
                    if (attribute.Tremolo)
                    {
                        AssociateTechniques(arr, attribute, "Tremolo");
                    }
                    attribute.SlapAndPop = song.HasSlapAndPop();
                    if (attribute.SlapAndPop)
                    {
                        AssociateTechniques(arr, attribute, "Slap");
                    }
                    attribute.Harmonics = song.HasHarmonics();
                    if (song.HasHarmonics())
                    {
                        AssociateTechniques(arr, attribute, "Harmonics");
                    }
                    attribute.PalmMutes = song.HasPalmMutes();
                    if (attribute.Harmonics)
                    {
                        AssociateTechniques(arr, attribute, "PalmMutes");
                    }
                    attribute.HOPOs = song.HasHOPOs();
                    if (attribute.HOPOs)
                    {
                        AssociateTechniques(arr, attribute, "HOPOs");
                    }
                    attribute.FretHandMutes = song.HasFretHandMutes();
                    if (attribute.FretHandMutes)
                    {
                        AssociateTechniques(arr, attribute, "FretHandMutes");
                    }
                    attribute.DropDPowerChords = song.HasDropDPowerChords();
                    if (attribute.DropDPowerChords)
                    {
                        AssociateTechniques(arr, attribute, "DropDPowerChords");
                    }
                    attribute.Prebends = song.HasPrebends();
                    if (attribute.Prebends)
                    {
                        AssociateTechniques(arr, attribute, "Prebends");
                    }
                    attribute.Vibrato = song.HasVibrato();
                    if (attribute.Vibrato)
                    {
                        AssociateTechniques(arr, attribute, "Vibrato");
                    }

                    //Bass exclusive
                    attribute.TwoFingerPlucking = song.HasTwoFingerPlucking();
                    if (attribute.TwoFingerPlucking)
                    {
                        AssociateTechniques(arr, attribute, "Plucking");
                    }
                    attribute.FifthsAndOctaves = song.HasFifthsAndOctaves();
                    if (attribute.FifthsAndOctaves)
                    {
                        AssociateTechniques(arr, attribute, "Octave");
                    }
                    attribute.Syncopation = song.HasSyncopation();
                    if (attribute.Syncopation)
                    {
                        AssociateTechniques(arr, attribute, "Syncopation");
                    }

                    #endregion

                    manifestFunctions.GenerateChordTemplateData(attribute, song);
                    manifestFunctions.GeneratePhraseData(attribute, song);
                    manifestFunctions.GenerateSectionData(attribute, song);
                    manifestFunctions.GeneratePhraseIterationsData(attribute, song, platform.version);
                }

                var attrDict = new Dictionary <string, Attributes> {
                    { "Attributes", attribute }
                };
                manifest.Entries.Add(attribute.PersistentID, attrDict);
            }

            manifest.ModelName        = "GRSong_Asset";
            manifest.IterationVersion = 2;

            var jsonManifest = JsonConvert.SerializeObject(manifest, Formatting.Indented);
            return(jsonManifest);
        }
        public static GameXblock <Entity2014> Generate2014(DLCPackageData info, Platform platform, DLCPackageType dlcType = DLCPackageType.Song)
        {
            var game = new GameXblock <Entity2014>();

            game.EntitySet = new List <Entity2014>();

            var dlcName       = info.Name.ToLower();
            var songPartition = new SongPartition();

            switch (dlcType)
            {
            case DLCPackageType.Song:
                foreach (var arrangement in info.Arrangements)
                {
                    if (arrangement.ArrangementType == ArrangementType.ShowLight)
                    {
                        continue;
                    }

                    var entity = new Entity2014();
                    var arrangementFileName = songPartition.GetArrangementFileName(arrangement.Name, arrangement.ArrangementType);

                    entity.Id         = arrangement.Id.ToLowerId();
                    entity.ModelName  = "RSEnumerable_Song";
                    entity.Name       = String.Format("{0}_{1}", info.Name, arrangementFileName);
                    entity.Iterations = 0;

                    entity.Properties = new List <Property2014>();
                    if (platform.IsConsole)
                    {
                        entity.Properties.Add(new Property2014()
                        {
                            Name = "Header", Set = new Set()
                            {
                                Value = String.Format(URN_TEMPLATE, TagValue.Database.GetDescription(), TagValue.HsonDB.GetDescription(), String.Format(AggregateGraph2014.AggregateGraph2014.NAME_ARRANGEMENT, dlcName, arrangementFileName.ToLower()))
                            }
                        });
                    }
                    else
                    {
                        entity.Properties.Add(new Property2014()
                        {
                            Name = "Header", Set = new Set()
                            {
                                Value = String.Format(URN_TEMPLATE, TagValue.Database.GetDescription(), TagValue.HsanDB.GetDescription(), String.Format("songs_dlc_{0}", dlcName))
                            }
                        });
                    }
                    entity.Properties.Add(new Property2014()
                    {
                        Name = "Manifest", Set = new Set()
                        {
                            Value = String.Format(URN_TEMPLATE, TagValue.Database.GetDescription(), TagValue.JsonDB.GetDescription(), String.Format(AggregateGraph2014.AggregateGraph2014.NAME_ARRANGEMENT, dlcName, arrangementFileName.ToLower()))
                        }
                    });
                    entity.Properties.Add(new Property2014()
                    {
                        Name = "SngAsset", Set = new Set()
                        {
                            Value = String.Format(URN_TEMPLATE, TagValue.Application.GetDescription(), TagValue.MusicgameSong.GetDescription(), String.Format(AggregateGraph2014.AggregateGraph2014.NAME_ARRANGEMENT, dlcName, arrangementFileName.ToLower()))
                        }
                    });
                    entity.Properties.Add(new Property2014()
                    {
                        Name = "AlbumArtSmall", Set = new Set()
                        {
                            Value = String.Format(URN_TEMPLATE, TagValue.Image.GetDescription(), TagValue.DDS.GetDescription(), String.Format("album_{0}_64", dlcName))
                        }
                    });
                    entity.Properties.Add(new Property2014()
                    {
                        Name = "AlbumArtMedium", Set = new Set()
                        {
                            Value = String.Format(URN_TEMPLATE, TagValue.Image.GetDescription(), TagValue.DDS.GetDescription(), String.Format("album_{0}_128", dlcName))
                        }
                    });
                    entity.Properties.Add(new Property2014()
                    {
                        Name = "AlbumArtLarge", Set = new Set()
                        {
                            Value = String.Format(URN_TEMPLATE, TagValue.Image.GetDescription(), TagValue.DDS.GetDescription(), String.Format("album_{0}_256", dlcName))
                        }
                    });
                    if (arrangement.ArrangementType == ArrangementType.Vocal && arrangement.CustomFont)     // One per song
                    {
                        entity.Properties.Add(new Property2014()
                        {
                            Name = "LyricArt", Set = new Set()
                            {
                                Value = String.Format(URN_TEMPLATE, TagValue.Image.GetDescription(), TagValue.DDS.GetDescription(), String.Format("lyrics_{0}", dlcName))
                            }
                        });
                    }
                    else
                    {
                        entity.Properties.Add(new Property2014()
                        {
                            Name = "LyricArt", Set = new Set()
                            {
                                Value = ""
                            }
                        });
                    }
                    entity.Properties.Add(new Property2014()
                    {
                        Name = "ShowLightsXMLAsset", Set = new Set()
                        {
                            Value = String.Format(URN_TEMPLATE, TagValue.Application.GetDescription(), TagValue.XML.GetDescription(), String.Format(AggregateGraph2014.AggregateGraph2014.NAME_SHOWLIGHT, dlcName))
                        }
                    });
                    entity.Properties.Add(new Property2014()
                    {
                        Name = "SoundBank", Set = new Set()
                        {
                            Value = String.Format(URN_TEMPLATE, TagValue.Audio.GetDescription(), TagValue.WwiseSoundBank.GetDescription(), String.Format("song_{0}", dlcName))
                        }
                    });
                    entity.Properties.Add(new Property2014()
                    {
                        Name = "PreviewSoundBank", Set = new Set()
                        {
                            Value = String.Format(URN_TEMPLATE, TagValue.Audio.GetDescription(), TagValue.WwiseSoundBank.GetDescription(), String.Format("song_{0}_preview", dlcName))
                        }
                    });

                    game.EntitySet.Add(entity);
                }
                break;

            case DLCPackageType.Lesson:
                throw new NotImplementedException("Lesson package type not implemented yet :(");

            case DLCPackageType.Inlay:
                dlcName = info.Inlay.DLCSixName;
                var inlayEntity = new Entity2014();

                inlayEntity.Id         = info.Inlay.Id.ToLowerId();
                inlayEntity.ModelName  = "RSEnumerable_Guitars";
                inlayEntity.Name       = info.Name;
                inlayEntity.Iterations = 0;

                inlayEntity.Properties = new List <Property2014>();
                if (platform.IsConsole)
                {
                    inlayEntity.Properties.Add(new Property2014()
                    {
                        Name = "Header", Set = new Set()
                        {
                            Value = String.Format(URN_TEMPLATE, TagValue.Database.GetDescription(), TagValue.HsonDB.GetDescription(), String.Format("dlc_{0}", dlcName))
                        }
                    });
                }
                else
                {
                    inlayEntity.Properties.Add(new Property2014()
                    {
                        Name = "Header", Set = new Set()
                        {
                            Value = String.Format(URN_TEMPLATE, TagValue.Database.GetDescription(), TagValue.HsanDB.GetDescription(), String.Format("dlc_{0}", dlcName))
                        }
                    });
                }
                inlayEntity.Properties.Add(new Property2014()
                {
                    Name = "Manifest", Set = new Set()
                    {
                        Value = String.Format(URN_TEMPLATE, TagValue.Database.GetDescription(), TagValue.JsonDB.GetDescription(), String.Format("dlc_guitar_{0}", dlcName))
                    }
                });
                inlayEntity.Properties.Add(new Property2014()
                {
                    Name = "PreviewArt", Set = new Set()
                    {
                        Value = String.Format(URN_TEMPLATE, TagValue.Image.GetDescription(), TagValue.DDS.GetDescription(), String.Format("reward_inlay_{0}", dlcName))
                    }
                });
                //
                inlayEntity.Properties.Add(new Property2014()
                {
                    Name = "DecorativeInlays", Set = new Set()
                    {
                        Value = String.Format(URN_TEMPLATE, TagValue.Application.GetDescription(), TagValue.GamebryoSceneGraph.GetDescription(), dlcName)
                    }
                });
                game.EntitySet.Add(inlayEntity);
                break;
            }

            return(game);
        }
        public string GenerateManifest(string dlcName, IList<Arrangement> arrangements, SongInfo songInfo, Platform platform)
        {
            var manifest = Manifest;
            manifest.Entries = new Dictionary<string, Dictionary<string, Attributes>>();
            bool firstarrangset = false;

            Arrangement vocal = null;
            if (arrangements.Any<Arrangement>(a => a.ArrangementType == Sng.ArrangementType.Vocal))
                vocal = arrangements.Single<Arrangement>(a => a.ArrangementType == Sng.ArrangementType.Vocal);

            var manifestFunctions = new ManifestFunctions(platform.version);
            var songPartition = new SongPartition();

            foreach (var x in arrangements)
            {
                var isVocal = x.ArrangementType == Sng.ArrangementType.Vocal;
                var song = (isVocal) ? null : Song.LoadFromFile(x.SongXml.File);

                var attribute = new Attributes();
                attribute.AlbumArt = String.Format("urn:llid:{0}", AggregateGraph.AlbumArt.LLID);
                attribute.AlbumNameSort = attribute.AlbumName = songInfo.Album;
                attribute.ArrangementName = x.Name.ToString();
                attribute.ArtistName = songInfo.Artist;
                attribute.ArtistNameSort = songInfo.ArtistSort;
                attribute.AssociatedTechniques = new List<string>();
                //Should be 51 for bass, 49 for vocal and guitar
                attribute.BinaryVersion = x.ArrangementType == Sng.ArrangementType.Bass ? 51 : 49;
                attribute.BlockAsset = String.Format("urn:emergent-world:{0}", AggregateGraph.XBlock.Name);
                attribute.ChordTemplates = null;
                attribute.DISC_DLC_OTHER = "Disc";
                attribute.DisplayName = songInfo.SongDisplayName;
                attribute.DLCPreview = false;
                attribute.EffectChainMultiplayerName = string.Empty;
                attribute.EffectChainName = isVocal ? "" : (dlcName + "_" + x.ToneBase == null ? "Default" : x.ToneBase.Replace(' ', '_'));
                attribute.EventFirstTimeSortOrder = 9999;
                attribute.ExclusiveBuild = new List<object>();
                attribute.FirstArrangementInSong = false;
                if (isVocal && !firstarrangset)
                {
                    firstarrangset = true;
                    attribute.FirstArrangementInSong = true;
                }
                attribute.ForceUseXML = true;
                attribute.Tag = "PLACEHOLDER Tag";
                attribute.InputEvent = isVocal ? "Play_Tone_Standard_Mic" : "Play_Tone_";
                attribute.IsDemoSong = false;
                attribute.IsDLC = true;
                attribute.LastConversionDateTime = "";
                int masterId = isVocal ? 1 : x.MasterId;
                attribute.MasterID_PS3 = masterId;
                attribute.MasterID_Xbox360 = masterId;
                attribute.MaxPhraseDifficulty = 0;
                attribute.PersistentID = x.Id.ToString().Replace("-", "").ToUpper();
                attribute.PhraseIterations = new List<PhraseIteration>();
                attribute.Phrases = new List<Phrase>();
                attribute.PluckedType = x.PluckedType == Sng.PluckedType.Picked ? "Picked" : "Not Picked";
                attribute.RelativeDifficulty = isVocal ? 0 : song.Levels.Count();
                attribute.RepresentativeArrangement = false;
                attribute.Score_MaxNotes = 0;
                attribute.Score_PNV = 0;
                attribute.Sections = new List<Section>();
                attribute.Shipping = true;
                attribute.SongAsset = String.Format("urn:llid:{0}", x.SongFile.LLID);
                attribute.SongEvent = String.Format("Play_{0}", dlcName);
                attribute.SongKey = dlcName;
                attribute.SongLength = 0;
                attribute.SongName = songInfo.SongDisplayName;
                attribute.SongNameSort = songInfo.SongDisplayNameSort;
                attribute.SongXml = String.Format("urn:llid:{0}", x.SongXml.LLID);
                attribute.SongYear = songInfo.SongYear;
                attribute.TargetScore = 0;
                attribute.ToneUnlockScore = 0;
                attribute.TwoHandTapping = false;
                attribute.UnlockKey = "";
                attribute.Tuning = x.Tuning;
                attribute.VocalsAssetId = x.ArrangementType == Sng.ArrangementType.Vocal ? "" : (vocal != null) ? String.Format("{0}|GRSong_{1}", vocal.Id, vocal.Name) : "";
                attribute.ChordTemplates = new List<ChordTemplate>();
                manifestFunctions.GenerateDynamicVisualDensity(attribute, song, x);

                if (!isVocal)
                {
                    #region "Associated Techniques"

                    attribute.PowerChords = song.HasPowerChords();
                    if (song.HasPowerChords()) AssociateTechniques(x, attribute, "PowerChords");
                    attribute.BarChords = song.HasBarChords();
                    if (song.HasBarChords()) AssociateTechniques(x, attribute, "BarChords");
                    attribute.OpenChords = song.HasOpenChords();
                    if (song.HasOpenChords()) AssociateTechniques(x, attribute, "ChordIntro");
                    attribute.DoubleStops = song.HasDoubleStops();
                    if (song.HasDoubleStops()) AssociateTechniques(x, attribute, "DoubleStops");
                    attribute.Sustain = song.HasSustain();
                    if (song.HasSustain()) AssociateTechniques(x, attribute, "Sustain");
                    attribute.Bends = song.HasBends();
                    if (song.HasBends()) AssociateTechniques(x, attribute, "Bends");
                    attribute.Slides = song.HasSlides();
                    if (song.HasSlides()) AssociateTechniques(x, attribute, "Slides");
                    attribute.Tremolo = song.HasTremolo();
                    if (song.HasTremolo()) AssociateTechniques(x, attribute, "Tremolo");
                    attribute.SlapAndPop = song.HasSlapAndPop();
                    if (song.HasSlapAndPop()) AssociateTechniques(x, attribute, "Slap");
                    attribute.Harmonics = song.HasHarmonics();
                    if (song.HasHarmonics()) AssociateTechniques(x, attribute, "Harmonics");
                    attribute.PalmMutes = song.HasPalmMutes();
                    if (song.HasPalmMutes()) AssociateTechniques(x, attribute, "PalmMutes");
                    attribute.HOPOs = song.HasHOPOs();
                    if (song.HasHOPOs()) AssociateTechniques(x, attribute, "HOPOs");
                    attribute.FretHandMutes = song.HasFretHandMutes();
                    if (song.HasFretHandMutes()) AssociateTechniques(x, attribute, "FretHandMutes");
                    attribute.DropDPowerChords = song.HasDropDPowerChords();
                    if (song.HasDropDPowerChords()) AssociateTechniques(x, attribute, "DropDPowerChords");
                    attribute.Prebends = song.HasPrebends();
                    if (song.HasPrebends()) AssociateTechniques(x, attribute, "Prebends");
                    attribute.Vibrato = song.HasVibrato();
                    if (song.HasVibrato()) AssociateTechniques(x, attribute, "Vibrato");

                    //Bass exclusive
                    attribute.TwoFingerPlucking = song.HasTwoFingerPlucking();
                    if (song.HasTwoFingerPlucking()) AssociateTechniques(x, attribute, "Plucking");
                    attribute.FifthsAndOctaves = song.HasFifthsAndOctaves();
                    if (song.HasFifthsAndOctaves()) AssociateTechniques(x, attribute, "Octave");
                    attribute.Syncopation = song.HasSyncopation();
                    if (song.HasSyncopation()) AssociateTechniques(x, attribute, "Syncopation");

                    #endregion

                    attribute.AverageTempo = songInfo.AverageTempo;
                    attribute.RepresentativeArrangement = true;
                    attribute.SongPartition = songPartition.GetSongPartition(x.Name, x.ArrangementType);
                    attribute.SongLength = (float)Math.Round((decimal)song.SongLength, 3, MidpointRounding.AwayFromZero); //rounded
                    attribute.LastConversionDateTime = song.LastConversionDateTime;
                    attribute.TargetScore = 100000;
                    attribute.ToneUnlockScore = 70000;
                    attribute.SongDifficulty = (float)song.PhraseIterations.Average(it => song.Phrases[it.PhraseId].MaxDifficulty);
                    manifestFunctions.GenerateChordTemplateData(attribute, song);
                    manifestFunctions.GeneratePhraseData(attribute, song);
                    manifestFunctions.GenerateSectionData(attribute, song);
                    manifestFunctions.GeneratePhraseIterationsData(attribute, song, platform.version);
                }
                var attrDict = new Dictionary<string, Attributes> { { "Attributes", attribute } };
                manifest.Entries.Add(attribute.PersistentID, attrDict);
            }
            manifest.ModelName = "GRSong_Asset";
            manifest.IterationVersion = 2;
            return JsonConvert.SerializeObject(manifest, Formatting.Indented);
        }