public AccessResult <String> GetTitle(TransactionObject transactionObject , String profileId , Boolean commitTransactionImplicitly) { if (m_CurrentTransaction != transactionObject) { return(new AccessResultOfString(WrongTransaction, true)); } lock (m_TransactionLock) { try { PauseTimer(); IDVDInfo dvdInfo = GetProfileData(profileId); String title = dvdInfo.GetTitle(); CommitOrStartTimer(transactionObject, commitTransactionImplicitly); return(new AccessResultOfString(title, false)); } catch (Exception ex) { AbortTransaction(transactionObject); return(new AccessResultOfString(ex.Message, true)); } } }
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); } }
public void Paste(IDVDInfo profile, string xml) { var profileTitle = profile.GetTitle(); var profileTitleWithYear = $"{profileTitle} ({profile.GetProductionYear()})"; var castInformation = TryGetInformationFromData <CastInformation>(xml); if (castInformation != null) { var xmlTitle = castInformation.Title; if (string.Equals(profileTitle, xmlTitle, StringComparison.OrdinalIgnoreCase) || string.Equals(profileTitleWithYear, xmlTitle, StringComparison.OrdinalIgnoreCase) || MessageBox.Show(string.Format(MessageBoxTexts.PasteQuestion, "Cast", xmlTitle, profileTitle), MessageBoxTexts.PasteHeader, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.PasteCast(profile, castInformation); } } else { var crewInformation = TryGetInformationFromData <CrewInformation>(xml); if (crewInformation != null) { var xmlTitle = crewInformation.Title; if (string.Equals(profileTitle, xmlTitle, StringComparison.OrdinalIgnoreCase) || string.Equals(profileTitleWithYear, xmlTitle, StringComparison.OrdinalIgnoreCase) || MessageBox.Show(string.Format(MessageBoxTexts.PasteQuestion, "Crew", xmlTitle, profileTitle), MessageBoxTexts.PasteHeader, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.PasteCrew(profile, crewInformation); } } else { throw new PasteException(MessageBoxTexts.UnknownInformationInClipboard); } } }
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); } }