Пример #1
0
        private static ExtendedProfileTuple CreateExtendedProfileTuple(DVD profile, FileInfo fileInfo)
        {
            String rawProfileXml = DVDProfilerSerializer <DVD> .ToString(profile, Collection.DefaultEncoding);

            ExtendedProfileTuple tuple = new ExtendedProfileTuple(fileInfo, rawProfileXml);

            return(tuple);
        }
Пример #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);
            }
        }
            private static String GetCleanedProfile(String rawProfileXml)
            {
                DVD cleanedProfile = DVDProfilerSerializer <DVD> .FromString(rawProfileXml, Collection.DefaultEncoding);

                cleanedProfile.LastEditedSpecified = false;
                cleanedProfile.ProfileTimestamp    = new DateTime(0);

                String cleanedProfileXml = DVDProfilerSerializer <DVD> .ToString(cleanedProfile, Collection.DefaultEncoding);

                return(cleanedProfileXml);
            }
Пример #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);
            }
        }