Example #1
0
        public AttributesHeader2014(string arrangementFileName, Arrangement arrangement, DLCPackageData info, Platform platform)
        {
            IsVocal     = arrangement.ArrangementType == Sng.ArrangementType.Vocal;
            SongContent = (IsVocal) ? null : Song2014.LoadFromFile(arrangement.SongXml.File);
            var dlcName = info.Name.ToLower();

            var albumUrn = String.Format(URN_TEMPLATE, TagValue.Image.GetDescription(), TagValue.DDS.GetDescription(), String.Format("album_{0}", dlcName));
            var jsonUrn  = String.Format(URN_TEMPLATE, TagValue.Database.GetDescription(), TagValue.JsonDB.GetDescription(), String.Format("{0}_{1}", dlcName, arrangementFileName));

            //FILL ATTRIBUTES
            this.AlbumArt              = albumUrn;
            ArrangementName            = arrangement.Name.ToString();
            DLC                        = true;
            DLCKey                     = info.Name;
            LeaderboardChallengeRating = 0;
            ManifestUrn                = jsonUrn;
            MasterID_RDV               = arrangement.MasterId;
            PersistentID               = arrangement.Id.ToString().Replace("-", "").ToUpper();
            Shipping                   = true;
            SKU                        = "RS2";
            SongKey                    = info.Name;

            if (!IsVocal)
            {
                AlbumName      = AlbumNameSort = info.SongInfo.Album;
                ArtistName     = info.SongInfo.Artist;
                CentOffset     = arrangement.TuningPitch != 0 ? TuningFrequency.Frequency2Cents(arrangement.TuningPitch) : 0.0;
                ArtistNameSort = info.SongInfo.ArtistSort;
                CapoFret       = (arrangement.Sng2014.Metadata.CapoFretId == 0xFF) ? CapoFret = 0 : Convert.ToDecimal(arrangement.Sng2014.Metadata.CapoFretId);
                DNA_Chords     = arrangement.Sng2014.DNACount[(int)DNAId.Chord];
                DNA_Riffs      = arrangement.Sng2014.DNACount[(int)DNAId.Riff];
                DNA_Solo       = arrangement.Sng2014.DNACount[(int)DNAId.Solo];
                NotesEasy      = arrangement.Sng2014.NoteCount[0];
                NotesMedium    = arrangement.Sng2014.NoteCount[1];
                NotesHard      = arrangement.Sng2014.NoteCount[2];
                EasyMastery    = NotesEasy / NotesHard;
                MediumMastery  = NotesMedium / NotesHard;
                Representative = Convert.ToInt32(!arrangement.BonusArr);
                RouteMask      = (int)arrangement.RouteMask;

                // TODO this is not quite it but much closer
                SongDiffEasy   = SongContent.SongLength / NotesEasy;
                SongDiffMed    = SongContent.SongLength / NotesMedium;
                SongDiffHard   = SongContent.SongLength / NotesHard;
                SongDifficulty = SongDiffHard;

                SongLength   = (double?)Math.Round(SongContent.SongLength, 3, MidpointRounding.AwayFromZero);
                SongName     = info.SongInfo.SongDisplayName;
                SongNameSort = info.SongInfo.SongDisplayNameSort;
                SongYear     = info.SongInfo.SongYear;

                var tunDef = TuningDefinitionRepository.Instance().Select(arrangement.Tuning, platform.version);
                Tuning = tunDef.Tuning;
            }
        }
Example #2
0
        private void UpdateCentOffset()
        {
            var value = frequencyTB.Text;

            if (!String.IsNullOrEmpty(value))
            {
                double freq    = 440;
                var    isValid = Double.TryParse(value, out freq);
                if (isValid && freq > 0)
                {
                    string noteName;
                    TuningFrequency.Frequency2Note(freq, out noteName);
                    centOffsetDisplay.Text = String.Format("{0:0.00}", TuningFrequency.Frequency2Cents(freq));
                    noteDisplay.Text       = noteName;
                }
            }
        }
        public AttributesHeader2014(string arrangementFileName, Arrangement arrangement, DLCPackageData info, Platform platform)
        {
            if (arrangement.ArrangementType == ArrangementType.ShowLight)
            {
                return;
            }

            IsVocal  = arrangement.ArrangementType == ArrangementType.Vocal;
            song2014 = (IsVocal) ? null : Song2014.LoadFromFile(arrangement.SongXml.File);
            var dlcName = info.Name.ToLower();

            var albumUrn = String.Format(URN_TEMPLATE, TagValue.Image.GetDescription(), TagValue.DDS.GetDescription(), String.Format("album_{0}", dlcName));
            var jsonUrn  = String.Format(URN_TEMPLATE, TagValue.Database.GetDescription(), TagValue.JsonDB.GetDescription(), String.Format("{0}_{1}", dlcName, arrangementFileName));

            //FILL ATTRIBUTES
            this.AlbumArt              = albumUrn;
            JapaneseVocal             |= arrangement.ArrangementName == Sng.ArrangementName.JVocals;
            ArrangementName            = IsVocal ? Sng.ArrangementName.Vocals.ToString() : arrangement.ArrangementName.ToString(); //HACK: weird vocals stuff
            DLCKey                     = info.Name;                                                                                // in RS2 DLCKey = SongKey, in RS1 they are different
            SongKey                    = info.Name;
            LeaderboardChallengeRating = 0;
            ManifestUrn                = jsonUrn;
            MasterID_RDV               = arrangement.MasterId; // must be unique else in-game hang occures
            PersistentID               = arrangement.Id.ToString().Replace("-", "").ToUpper();
            Shipping                   = true;                 // false = hides the arrangement in-game

            // DLC property controls whether album artwork marker is shown in-game setlist, but
            // has side effect that 'Alternate Arrangements' are locked for newer player profiles
            DLC = true; // false = requires UPlay to unlock

            // TODO: monitor this change
            if (info.ToolkitInfo == null || info.ToolkitInfo.PackageAuthor == "Ubisoft")
            {
                SKU = "RS2"; // shows purple marker w/ "DLC" text overlay
            }
            else
            {
                SKU = ""; // hides album artwork marker in-game setlist
            }
            // this SKU and DLCKey combination shows black marker w/ "RS1" text overlay on album artwork in-game setlist
            // SKU = "RS1";
            // DLCKey = "RS1CompatibilityDisc";

            if (IsVocal)
            {
                return;
            }

            // added better AlbumNameSort feature
            AlbumName      = info.SongInfo.Album;
            AlbumNameSort  = info.SongInfo.AlbumSort;
            ArtistName     = info.SongInfo.Artist;
            CentOffset     = (!arrangement.TuningPitch.Equals(0)) ? TuningFrequency.Frequency2Cents(arrangement.TuningPitch) : 0.0;
            ArtistNameSort = info.SongInfo.ArtistSort;
            BassPick       = arrangement.ArrangementType == ArrangementType.Bass ? (int)arrangement.PluckedType : 0;
            CapoFret       = (arrangement.Sng2014.Metadata.CapoFretId == 0xFF) ? CapoFret = 0 : Convert.ToDecimal(arrangement.Sng2014.Metadata.CapoFretId);
            DNA_Chords     = arrangement.Sng2014.DNACount[(int)DNAId.Chord];
            DNA_Riffs      = arrangement.Sng2014.DNACount[(int)DNAId.Riff];
            DNA_Solo       = arrangement.Sng2014.DNACount[(int)DNAId.Solo];
            NotesEasy      = arrangement.Sng2014.NoteCount[0];
            NotesMedium    = arrangement.Sng2014.NoteCount[1];
            NotesHard      = arrangement.Sng2014.NoteCount[2];
            EasyMastery    = Math.Round((double)(NotesEasy / NotesHard), 9);
            MediumMastery  = Math.Round((double)(NotesMedium / NotesHard), 9);
            Metronome      = arrangement.Metronome == Sng.Metronome.None ? null : (int?)arrangement.Metronome;
            // TODO: monitor this change
            // Representative = Convert.ToInt32(!arrangement.BonusArr);
            Representative = arrangement.ArrangementPropeties.Represent;
            RouteMask      = (int)arrangement.RouteMask;

            ManifestFunctions.GetSongDifficulty(this, song2014);

            SongLength         = Math.Round(song2014.SongLength, 3, MidpointRounding.AwayFromZero);
            SongName           = info.SongInfo.SongDisplayName;
            SongNameSort       = info.SongInfo.SongDisplayNameSort;
            JapaneseSongName   = string.IsNullOrEmpty(info.SongInfo.JapaneseSongName) ? null : info.SongInfo.JapaneseSongName;
            JapaneseArtistName = string.IsNullOrEmpty(info.SongInfo.JapaneseArtistName) ? null : info.SongInfo.JapaneseArtistName;
            SongYear           = info.SongInfo.SongYear;

            //Detect tuning
            var tuning = TuningDefinitionRepository.Instance.Detect(song2014.Tuning, platform.version, arrangement.ArrangementType == ArrangementType.Bass);

            Tuning = tuning.Tuning; //can we just use SongContent.Tuning
        }
Example #4
0
        public AttributesHeader2014(string arrangementFileName, Arrangement arrangement, DLCPackageData info, Platform platform)
        {
            if (arrangement.ArrangementType == ArrangementType.ShowLight)
            {
                return;
            }

            IsVocal     = arrangement.ArrangementType == Sng.ArrangementType.Vocal;
            SongContent = (IsVocal) ? null : Song2014.LoadFromFile(arrangement.SongXml.File);
            var dlcName = info.Name.ToLower();

            var albumUrn = String.Format(URN_TEMPLATE, TagValue.Image.GetDescription(), TagValue.DDS.GetDescription(), String.Format("album_{0}", dlcName));
            var jsonUrn  = String.Format(URN_TEMPLATE, TagValue.Database.GetDescription(), TagValue.JsonDB.GetDescription(), String.Format("{0}_{1}", dlcName, arrangementFileName));

            //FILL ATTRIBUTES
            this.AlbumArt              = albumUrn;
            JapaneseVocal             |= arrangement.Name == Sng.ArrangementName.JVocals;
            ArrangementName            = IsVocal ? Sng.ArrangementName.Vocals.ToString() : arrangement.Name.ToString(); //HACK: weird vocals stuff
            DLC                        = true;
            DLCKey                     = info.Name;
            LeaderboardChallengeRating = 0;
            ManifestUrn                = jsonUrn;
            MasterID_RDV               = arrangement.MasterId;
            PersistentID               = arrangement.Id.ToString().Replace("-", "").ToUpper();
            Shipping                   = true;
            SKU                        = "RS2";
            SongKey                    = info.Name;

            if (!IsVocal)
            {
                AlbumName      = AlbumNameSort = info.SongInfo.Album;
                ArtistName     = info.SongInfo.Artist;
                CentOffset     = (!arrangement.TuningPitch.Equals(0)) ? TuningFrequency.Frequency2Cents(arrangement.TuningPitch) : 0.0;
                ArtistNameSort = info.SongInfo.ArtistSort;
                CapoFret       = (arrangement.Sng2014.Metadata.CapoFretId == 0xFF) ? CapoFret = 0 : Convert.ToDecimal(arrangement.Sng2014.Metadata.CapoFretId);
                DNA_Chords     = arrangement.Sng2014.DNACount[(int)DNAId.Chord];
                DNA_Riffs      = arrangement.Sng2014.DNACount[(int)DNAId.Riff];
                DNA_Solo       = arrangement.Sng2014.DNACount[(int)DNAId.Solo];
                NotesEasy      = arrangement.Sng2014.NoteCount[0];
                NotesMedium    = arrangement.Sng2014.NoteCount[1];
                NotesHard      = arrangement.Sng2014.NoteCount[2];
                EasyMastery    = NotesEasy / NotesHard;
                MediumMastery  = NotesMedium / NotesHard;
                Metronome      = (int?)arrangement.Metronome;
                Representative = Convert.ToInt32(!arrangement.BonusArr);
                RouteMask      = (int)arrangement.RouteMask;

                // TODO use ManifestFunctions.GetSongDifficulty() method (fix generation alghorythm)
                SongDiffEasy   = SongContent.SongLength / NotesEasy;
                SongDiffMed    = SongContent.SongLength / NotesMedium;
                SongDiffHard   = SongContent.SongLength / NotesHard;
                SongDifficulty = SongDiffHard;

                SongLength   = (double?)Math.Round(SongContent.SongLength, 3, MidpointRounding.AwayFromZero);
                SongName     = info.SongInfo.SongDisplayName;
                SongNameSort = info.SongInfo.SongDisplayNameSort;
                SongYear     = info.SongInfo.SongYear;

                //Detect tuning
                var tuning = TuningDefinitionRepository.Instance().SelectAny(SongContent.Tuning, platform.version);
                if (tuning == null)
                {
                    tuning        = new TuningDefinition();
                    tuning.Tuning = SongContent.Tuning;
                    tuning.Name   = tuning.UIName = arrangement.Tuning;
                    if (String.IsNullOrEmpty(tuning.Name))
                    {
                        tuning.Name = tuning.UIName = tuning.NameFromStrings(arrangement.TuningStrings, arrangement.ArrangementType == ArrangementType.Bass);
                    }
                    tuning.Custom      = true;
                    tuning.GameVersion = GameVersion.RS2014;
                    TuningDefinitionRepository.Instance().Add(tuning, true);
                }
                Tuning = tuning.Tuning;
            }
        }
Example #5
0
        public AttributesHeader2014(string arrangementFileName, Arrangement arrangement, DLCPackageData info, Platform platform)
        {
            if (arrangement.ArrangementType == ArrangementType.ShowLight)
            {
                return;
            }

            IsVocal  = arrangement.ArrangementType == ArrangementType.Vocal;
            song2014 = (IsVocal) ? null : Song2014.LoadFromFile(arrangement.SongXml.File);
            var dlcName = info.Name.ToLower();

            var albumUrn = String.Format(URN_TEMPLATE, TagValue.Image.GetDescription(), TagValue.DDS.GetDescription(), String.Format("album_{0}", dlcName));
            var jsonUrn  = String.Format(URN_TEMPLATE, TagValue.Database.GetDescription(), TagValue.JsonDB.GetDescription(), String.Format("{0}_{1}", dlcName, arrangementFileName));

            //FILL ATTRIBUTES
            this.AlbumArt              = albumUrn;
            JapaneseVocal             |= arrangement.ArrangementName == Sng.ArrangementName.JVocals;
            ArrangementName            = IsVocal ? Sng.ArrangementName.Vocals.ToString() : arrangement.ArrangementName.ToString(); //HACK: weird vocals stuff
            DLC                        = true;
            DLCKey                     = info.Name;
            LeaderboardChallengeRating = 0;
            ManifestUrn                = jsonUrn;
            MasterID_RDV               = arrangement.MasterId;
            PersistentID               = arrangement.Id.ToString().Replace("-", "").ToUpper();
            Shipping                   = true;
            SKU                        = "RS2";
            SongKey                    = info.Name; // proof same same

            if (IsVocal)
            {
                return;
            }
            // added better AlbumNameSort feature
            AlbumName      = info.SongInfo.Album;
            AlbumNameSort  = info.SongInfo.AlbumSort;
            ArtistName     = info.SongInfo.Artist;
            CentOffset     = (!arrangement.TuningPitch.Equals(0)) ? TuningFrequency.Frequency2Cents(arrangement.TuningPitch) : 0.0;
            ArtistNameSort = info.SongInfo.ArtistSort;
            BassPick       = arrangement.ArrangementType == ArrangementType.Bass ? (int)arrangement.PluckedType : 0;
            CapoFret       = (arrangement.Sng2014.Metadata.CapoFretId == 0xFF) ? CapoFret = 0 : Convert.ToDecimal(arrangement.Sng2014.Metadata.CapoFretId);
            DNA_Chords     = arrangement.Sng2014.DNACount[(int)DNAId.Chord];
            DNA_Riffs      = arrangement.Sng2014.DNACount[(int)DNAId.Riff];
            DNA_Solo       = arrangement.Sng2014.DNACount[(int)DNAId.Solo];
            NotesEasy      = arrangement.Sng2014.NoteCount[0];
            NotesMedium    = arrangement.Sng2014.NoteCount[1];
            NotesHard      = arrangement.Sng2014.NoteCount[2];
            EasyMastery    = Math.Round((double)(NotesEasy / NotesHard), 9);
            MediumMastery  = Math.Round((double)(NotesMedium / NotesHard), 9);
            Metronome      = arrangement.Metronome == Sng.Metronome.None ? null : (int?)arrangement.Metronome;
            // TODO: check for bug here
            // if there is an equivalent bonus arrangement then Representative is set to "1" otherwise "0"
            Representative = Convert.ToInt32(!arrangement.BonusArr);
            RouteMask      = (int)arrangement.RouteMask;

            ManifestFunctions.GetSongDifficulty(this, song2014);

            SongLength         = Math.Round(song2014.SongLength, 3, MidpointRounding.AwayFromZero);
            SongName           = info.SongInfo.SongDisplayName;
            SongNameSort       = info.SongInfo.SongDisplayNameSort;
            JapaneseSongName   = string.IsNullOrEmpty(info.SongInfo.JapaneseSongName) ? null : info.SongInfo.JapaneseSongName;
            JapaneseArtistName = string.IsNullOrEmpty(info.SongInfo.JapaneseArtistName) ? null : info.SongInfo.JapaneseArtistName;
            SongYear           = info.SongInfo.SongYear;

            //Detect tuning
            var tuning = TuningDefinitionRepository.Instance.Detect(song2014.Tuning, platform.version, arrangement.ArrangementType == ArrangementType.Bass);

            Tuning = tuning.Tuning; //can we just use SongContent.Tuning
        }