public static ArchivedEventContract GetAllProperties(ArchivedReleaseEventVersion version) { var data = new ArchivedEventContract(); var xmlCache = new XmlCache <ArchivedEventContract>(); var thisVersion = version.Data != null?xmlCache.Deserialize(version.Version, version.Data) : new ArchivedEventContract(); data.Category = thisVersion.Category; data.Date = thisVersion.Date; data.Description = thisVersion.Description; data.Id = thisVersion.Id; data.MainPictureMime = thisVersion.MainPictureMime; data.Series = thisVersion.Series; data.SeriesNumber = thisVersion.SeriesNumber; data.SongList = thisVersion.SongList; data.TranslatedName = thisVersion.TranslatedName; data.Venue = thisVersion.Venue; data.VenueName = thisVersion.VenueName; DoIfExists(version, ReleaseEventEditableFields.Artists, xmlCache, v => data.Artists = v.Artists); DoIfExists(version, ReleaseEventEditableFields.Names, xmlCache, v => data.Names = v.Names); DoIfExists(version, ReleaseEventEditableFields.PVs, xmlCache, v => data.PVs = v.PVs); DoIfExists(version, ReleaseEventEditableFields.WebLinks, xmlCache, v => data.WebLinks = v.WebLinks); return(data); }
public static ArchivedAlbumContract GetAllProperties(ArchivedAlbumVersion version) { var data = new ArchivedAlbumContract(); var xmlCache = new XmlCache <ArchivedAlbumContract>(); var thisVersion = xmlCache.Deserialize(version.Version, version.Data); data.DiscType = thisVersion.DiscType; data.Id = thisVersion.Id; data.MainPictureMime = thisVersion.MainPictureMime; data.TranslatedName = thisVersion.TranslatedName; DoIfExists(version, AlbumEditableFields.Artists, xmlCache, (v, doc) => SetArtists(data, v, doc)); DoIfExists(version, AlbumEditableFields.Description, xmlCache, v => { data.Description = v.Description; data.DescriptionEng = v.DescriptionEng; }); DoIfExists(version, AlbumEditableFields.Identifiers, xmlCache, v => data.Identifiers = v.Identifiers); DoIfExists(version, AlbumEditableFields.OriginalRelease, xmlCache, v => data.OriginalRelease = v.OriginalRelease); DoIfExists(version, AlbumEditableFields.Names, xmlCache, v => data.Names = v.Names); DoIfExists(version, AlbumEditableFields.Pictures, xmlCache, v => data.Pictures = v.Pictures); DoIfExists(version, AlbumEditableFields.PVs, xmlCache, v => data.PVs = v.PVs); DoIfExists(version, AlbumEditableFields.Tracks, xmlCache, v => data.Songs = v.Songs); DoIfExists(version, AlbumEditableFields.WebLinks, xmlCache, v => data.WebLinks = v.WebLinks); return(data); }
public static ArchivedArtistContract GetAllProperties(ArchivedArtistVersion version) { var data = new ArchivedArtistContract(); var xmlCache = new XmlCache <ArchivedArtistContract>(); var thisVersion = xmlCache.Deserialize(version.Version, version.Data); data.ArtistType = thisVersion.ArtistType; data.BaseVoicebank = thisVersion.BaseVoicebank; data.Groups = thisVersion.Groups; data.Id = thisVersion.Id; data.MainPictureMime = thisVersion.MainPictureMime; data.Members = thisVersion.Members; data.ReleaseDate = thisVersion.ReleaseDate; data.TranslatedName = thisVersion.TranslatedName; DoIfExists(version, ArtistEditableFields.Description, xmlCache, v => { data.Description = v.Description; data.DescriptionEng = v.DescriptionEng; }); DoIfExists(version, ArtistEditableFields.Names, xmlCache, v => data.Names = v.Names); DoIfExists(version, ArtistEditableFields.Pictures, xmlCache, v => data.Pictures = v.Pictures); DoIfExists(version, ArtistEditableFields.WebLinks, xmlCache, v => data.WebLinks = v.WebLinks); return(data); }
public static ArchivedSongContract GetAllProperties(ArchivedSongVersion version) { var data = new ArchivedSongContract(); var xmlCache = new XmlCache <ArchivedSongContract>(); var thisVersion = xmlCache.Deserialize(version.Version, version.Data); data.Id = thisVersion.Id; data.LengthSeconds = thisVersion.LengthSeconds; data.NicoId = thisVersion.NicoId; data.Notes = thisVersion.Notes; data.NotesEng = thisVersion.NotesEng; data.OriginalVersion = thisVersion.OriginalVersion; data.PublishDate = thisVersion.PublishDate; data.ReleaseEvent = thisVersion.ReleaseEvent; data.SongType = thisVersion.SongType; data.TranslatedName = thisVersion.TranslatedName; DoIfExists(version, SongEditableFields.Albums, xmlCache, v => data.Albums = v.Albums); DoIfExists(version, SongEditableFields.Artists, xmlCache, (v, doc) => SetArtists(data, v, doc)); DoIfExists(version, SongEditableFields.Lyrics, xmlCache, v => data.Lyrics = v.Lyrics); DoIfExists(version, SongEditableFields.Names, xmlCache, v => data.Names = v.Names); DoIfExists(version, SongEditableFields.PVs, xmlCache, v => data.PVs = v.PVs); DoIfExists(version, SongEditableFields.WebLinks, xmlCache, v => data.WebLinks = v.WebLinks); return(data); }
private static void DoIfExists(ArchivedAlbumVersion version, AlbumEditableFields field, XmlCache <ArchivedAlbumContract> xmlCache, Action <ArchivedAlbumContract, XDocument> func) { var versionWithField = version.GetLatestVersionWithField(field); if (versionWithField != null && versionWithField.Data != null) { var data = xmlCache.Deserialize(versionWithField.Version, versionWithField.Data); func(data, versionWithField.Data); } }
private static void DoIfExists(ArchivedAlbumVersion version, AlbumEditableFields field, XmlCache<ArchivedAlbumContract> xmlCache, Action<ArchivedAlbumContract, XDocument> func) { var versionWithField = version.GetLatestVersionWithField(field); if (versionWithField != null && versionWithField.Data != null) { var data = xmlCache.Deserialize(versionWithField.Version, versionWithField.Data); func(data, versionWithField.Data); } }
private static void DoIfExists(ArchivedVenueVersion version, VenueEditableFields field, XmlCache <ArchivedVenueContract> xmlCache, Action <ArchivedVenueContract> func) { var versionWithField = version.GetLatestVersionWithField(field); if (versionWithField?.Data != null) { var data = xmlCache.Deserialize(versionWithField.Version, versionWithField.Data); func(data); } }
public static ArchivedVenueContract GetAllProperties(ArchivedVenueVersion version) { var data = new ArchivedVenueContract(); var xmlCache = new XmlCache <ArchivedVenueContract>(); var thisVersion = version.Data != null?xmlCache.Deserialize(version.Version, version.Data) : new ArchivedVenueContract(); data.Address = thisVersion.Address; data.AddressCountryCode = thisVersion.AddressCountryCode; data.Coordinates = thisVersion.Coordinates; data.Description = thisVersion.Description; data.Id = thisVersion.Id; data.TranslatedName = thisVersion.TranslatedName; DoIfExists(version, VenueEditableFields.Names, xmlCache, v => data.Names = v.Names); DoIfExists(version, VenueEditableFields.WebLinks, xmlCache, v => data.WebLinks = v.WebLinks); return(data); }
public static ArchivedTagContract GetAllProperties(ArchivedTagVersion version) { var data = new ArchivedTagContract(); var xmlCache = new XmlCache <ArchivedTagContract>(); var thisVersion = version.Data != null?xmlCache.Deserialize(version.Version, version.Data) : new ArchivedTagContract(); data.CategoryName = thisVersion.CategoryName; data.HideFromSuggestions = thisVersion.HideFromSuggestions; data.Id = thisVersion.Id; data.TranslatedName = thisVersion.TranslatedName; DoIfExists(version, TagEditableFields.Description, xmlCache, v => { data.Description = v.Description; data.DescriptionEng = v.DescriptionEng; }); DoIfExists(version, TagEditableFields.Names, xmlCache, v => data.Names = v.Names); DoIfExists(version, TagEditableFields.Parent, xmlCache, v => data.Parent = v.Parent); DoIfExists(version, TagEditableFields.RelatedTags, xmlCache, v => data.RelatedTags = v.RelatedTags); DoIfExists(version, TagEditableFields.WebLinks, xmlCache, v => data.WebLinks = v.WebLinks); return(data); }
public static ArchivedSongContract GetAllProperties(ArchivedSongVersion version) { var data = new ArchivedSongContract(); var xmlCache = new XmlCache<ArchivedSongContract>(); var thisVersion = xmlCache.Deserialize(version.Version, version.Data); data.Id = thisVersion.Id; data.LengthSeconds = thisVersion.LengthSeconds; data.NicoId = thisVersion.NicoId; data.Notes = thisVersion.Notes; data.OriginalVersion = thisVersion.OriginalVersion; data.SongType = thisVersion.SongType; data.TranslatedName = thisVersion.TranslatedName; DoIfExists(version, SongEditableFields.Artists, xmlCache, (v, doc) => SetArtists(data, v, doc)); DoIfExists(version, SongEditableFields.Lyrics, xmlCache, v => data.Lyrics = v.Lyrics); DoIfExists(version, SongEditableFields.Names, xmlCache, v => data.Names = v.Names); DoIfExists(version, SongEditableFields.PVs, xmlCache, v => data.PVs = v.PVs); DoIfExists(version, SongEditableFields.WebLinks, xmlCache, v => data.WebLinks = v.WebLinks); return data; }
public static ArchivedArtistContract GetAllProperties(ArchivedArtistVersion version) { var data = new ArchivedArtistContract(); var xmlCache = new XmlCache<ArchivedArtistContract>(); var thisVersion = xmlCache.Deserialize(version.Version, version.Data); data.ArtistType = thisVersion.ArtistType; data.BaseVoicebank = thisVersion.BaseVoicebank; data.Groups = thisVersion.Groups; data.Id = thisVersion.Id; data.MainPictureMime = thisVersion.MainPictureMime; data.Members = thisVersion.Members; data.TranslatedName = thisVersion.TranslatedName; DoIfExists(version, ArtistEditableFields.Albums, xmlCache, v => data.Albums = v.Albums); DoIfExists(version, ArtistEditableFields.Description, xmlCache, v => data.Description = v.Description); DoIfExists(version, ArtistEditableFields.Names, xmlCache, v => data.Names = v.Names); DoIfExists(version, ArtistEditableFields.Pictures, xmlCache, v => data.Pictures = v.Pictures); DoIfExists(version, ArtistEditableFields.WebLinks, xmlCache, v => data.WebLinks = v.WebLinks); return data; }
public static ArchivedAlbumContract GetAllProperties(ArchivedAlbumVersion version) { var data = new ArchivedAlbumContract(); var xmlCache = new XmlCache<ArchivedAlbumContract>(); var thisVersion = xmlCache.Deserialize(version.Version, version.Data); data.DiscType = thisVersion.DiscType; data.Id = thisVersion.Id; data.MainPictureMime = thisVersion.MainPictureMime; data.TranslatedName = thisVersion.TranslatedName; DoIfExists(version, AlbumEditableFields.Artists, xmlCache, (v, doc) => SetArtists(data, v, doc)); DoIfExists(version, AlbumEditableFields.Description, xmlCache, v => data.Description = v.Description); DoIfExists(version, AlbumEditableFields.Identifiers, xmlCache, v => data.Identifiers = v.Identifiers); DoIfExists(version, AlbumEditableFields.OriginalRelease, xmlCache, v => data.OriginalRelease = v.OriginalRelease); DoIfExists(version, AlbumEditableFields.Names, xmlCache, v => data.Names = v.Names); DoIfExists(version, AlbumEditableFields.Pictures, xmlCache, v => data.Pictures = v.Pictures); DoIfExists(version, AlbumEditableFields.PVs, xmlCache, v => data.PVs = v.PVs); DoIfExists(version, AlbumEditableFields.Tracks, xmlCache, v => data.Songs = v.Songs); DoIfExists(version, AlbumEditableFields.WebLinks, xmlCache, v => data.WebLinks = v.WebLinks); return data; }