示例#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 CopyCast(IDVDInfo profile)
        {
            var castCount = profile.GetCastCount();

            var castList = new List <object>(castCount);

            for (var castIndex = 0; castIndex < castCount; castIndex++)
            {
                profile.GetCastByIndex(castIndex, out var firstName, out var middleName, out var lastName, out var birthYear, out var role, out var creditedAs, out var voice, out var uncredited, out var puppeteer);

                if (firstName != null)
                {
                    castList.Add(new CastMember()
                    {
                        FirstName  = firstName.NotNull(),
                        MiddleName = middleName.NotNull(),
                        LastName   = lastName.NotNull(),
                        BirthYear  = birthYear,
                        Role       = role.NotNull(),
                        CreditedAs = creditedAs.NotNull(),
                        Voice      = voice,
                        Uncredited = uncredited,
                        Puppeteer  = puppeteer,
                    });
                }
                else
                {
                    profile.GetCastDividerByIndex(castIndex, out var caption, out var apiDividerType);

                    var dividerType = ApiConstantsToText.GetDividerType(apiDividerType);

                    castList.Add(new Divider()
                    {
                        Caption = caption.NotNull(),
                        Type    = dividerType,
                    });
                }
            }

            var castInformation = new CastInformation()
            {
                Title    = profile.GetTitle().NotNull(),
                CastList = castList.ToArray(),
            };

            var xml = DVDProfilerSerializer <CastInformation> .ToString(castInformation, CastInformation.DefaultEncoding);

            try
            {
                Clipboard.SetDataObject(xml, true, 4, 250);
            }
            catch (Exception ex) //clipboard in use
            {
                MessageBox.Show(ex.Message, MessageBoxTexts.CriticalErrorHeader, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
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());
        }
示例#4
0
        private void CopyCrew(IDVDInfo profile)
        {
            var crewCount = profile.GetCrewCount();

            var crewList = new List <object>(crewCount);

            for (var crewIndex = 0; crewIndex < crewCount; crewIndex++)
            {
                profile.GetCrewByIndex(crewIndex, out var firstName, out var middleName, out var lastName, out var birthYear, out var apiCreditType, out var apiCreditSubtype, out var creditedAs);

                if (firstName != null)
                {
                    var customRole = profile.GetCrewCustomRoleByIndex(crewIndex);

                    var creditType = ApiConstantsToText.GetCreditType(apiCreditType);

                    var creditSubtype = ApiConstantsToText.GetCreditSubType(apiCreditType, apiCreditSubtype);

                    crewList.Add(new CrewMember()
                    {
                        FirstName           = firstName.NotNull(),
                        MiddleName          = middleName.NotNull(),
                        LastName            = lastName.NotNull(),
                        BirthYear           = birthYear,
                        CreditType          = creditType,
                        CreditSubtype       = creditSubtype,
                        CustomRole          = customRole,
                        CustomRoleSpecified = !string.IsNullOrWhiteSpace(customRole),
                        CreditedAs          = creditedAs.NotNull(),
                    });
                }
                else
                {
                    profile.GetCrewDividerByIndex(crewIndex, out var caption, out var apiDividerType, out apiCreditType);

                    var dividerType = ApiConstantsToText.GetDividerType(apiDividerType);

                    var creditType = ApiConstantsToText.GetCreditType(apiCreditType);

                    crewList.Add(new CrewDivider()
                    {
                        Caption    = caption.NotNull(),
                        Type       = dividerType,
                        CreditType = creditType,
                    });
                }
            }

            var crewInformation = new CrewInformation()
            {
                Title    = profile.GetTitle().NotNull(),
                CrewList = crewList.ToArray(),
            };

            var xml = DVDProfilerSerializer <CrewInformation> .ToString(crewInformation, CrewInformation.DefaultEncoding);

            try
            {
                Clipboard.SetDataObject(xml, true, 4, 250);
            }
            catch (Exception ex) //clipboard in use
            {
                MessageBox.Show(ex.Message, MessageBoxTexts.CriticalErrorHeader, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }