예제 #1
0
        private void PasteCast(IDVDInfo profile, CastInformation castInformation)
        {
            profile.ClearCast();

            for (var castIndex = 0; castIndex < (castInformation.CastList?.Length ?? 0); castIndex++)
            {
                var item = castInformation.CastList[castIndex];

                if (item is Divider divider)
                {
                    var apiDividerType = ApiConstantsToText.GetApiDividerType(divider.Type);

                    profile.AddCastDivider(divider.Caption.NotNull(), apiDividerType);
                }
                else if (item is CastMember cast)
                {
                    profile.AddCast(cast.FirstName.NotNull(), cast.MiddleName.NotNull(), cast.LastName.NotNull(), cast.BirthYear, cast.Role.NotNull(), cast.CreditedAs.NotNull(), cast.Voice, cast.Uncredited, cast.Puppeteer);
                }
                else
                {
                    throw new NotImplementedException($"Unknown crew item {item}");
                }
            }

            this.Api.SaveDVDToCollection(profile);
            this.Api.ReloadCurrentDVD();
            this.Api.UpdateProfileInListDisplay(profile.GetProfileID());
        }
예제 #2
0
        private void PasteCrew(IDVDInfo profile, CrewInformation crewInformation)
        {
            profile.ClearCrew();

            for (var crewIndex = 0; crewIndex < (crewInformation.CrewList?.Length ?? 0); crewIndex++)
            {
                var item = crewInformation.CrewList[crewIndex];

                if (item is CrewDivider divider)
                {
                    var apiDividerType = ApiConstantsToText.GetApiDividerType(divider.Type);

                    var apiCreditType = ApiConstantsToText.GetApiCreditType(divider.CreditType);

                    profile.AddCrewDivider(divider.Caption.NotNull(), apiDividerType, apiCreditType);
                }
                else if (item is CrewMember crew)
                {
                    var apiCreditType = ApiConstantsToText.GetApiCreditType(crew.CreditType);

                    var apiCreditSubtype = ApiConstantsToText.GetApiCreditSubType(crew.CreditSubtype);

                    profile.AddCrew(crew.FirstName.NotNull(), crew.MiddleName.NotNull(), crew.LastName.NotNull(), crew.BirthYear, apiCreditType, apiCreditSubtype, crew.CreditedAs.NotNull());

                    if (crew.CustomRoleSpecified)
                    {
                        profile.SetCrewCustomRoleByIndex(crewIndex, crew.CustomRole.NotNull());
                    }
                }
                else
                {
                    throw new NotImplementedException($"Unknown crew item {item}");
                }
            }

            this.Api.SaveDVDToCollection(profile);
            this.Api.ReloadCurrentDVD();
            this.Api.UpdateProfileInListDisplay(profile.GetProfileID());
        }