本文整理汇总了C#中System.Xml.XmlNode.XMLReadSubnode方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.XMLReadSubnode方法的具体用法?C# XmlNode.XMLReadSubnode怎么用?C# XmlNode.XMLReadSubnode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlNode
的用法示例。
在下文中一共展示了XmlNode.XMLReadSubnode方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadPerson
/// <inheritdoc/>
public override void ReadPerson(XmlNode xmlActor)
{
// extract person and set basic properties
XmlNode xmlPerson = xmlActor.XMLReadSubnode("person");
base.ReadPerson(xmlPerson);
// add role
this.Role = xmlActor.XMLReadSubnode("character").XMLReadInnerText(string.Empty);
}
示例2: ReadMediaFiles
/// <inheritdoc/>
public override void ReadMediaFiles(XmlNode xMLMedia)
{
int k = 0;
// video files from Link-List
foreach (XmlNode xMLVideodatei in xMLMedia.XMLReadSubnode("links").XMLReadSubnodes("link"))
{
if (xMLVideodatei.XMLReadSubnode("urltype").XMLReadInnerText(string.Empty) == "Movie" && !xMLVideodatei.XMLReadSubnode("description").XMLReadInnerText(string.Empty).Contains("Untertitel."))
{
VideoFile videoFile = new VideoFile(this.Configuration);
k++;
videoFile.Description = xMLVideodatei.XMLReadSubnode("description").XMLReadInnerText(string.Empty);
videoFile.Description = videoFile.OverrideSpecial(this.OverrideVideoStreamData(videoFile.Description));
videoFile.FileIndex = k;
videoFile.URL = xMLVideodatei.XMLReadSubnode("url").XMLReadInnerText(string.Empty);
videoFile.Media = this;
this.MediaFiles.Add(videoFile);
}
}
// video files from Discs and override MediaStreamData
foreach (XmlNode xMLMovieDisc in xMLMedia.XMLReadSubnode("discs").XMLReadSubnodes("disc"))
{
string discTitle = this.OverrideVideoStreamData(xMLMovieDisc.XMLReadSubnode("title").XMLReadInnerText(string.Empty));
foreach (XmlNode xMLEpisode in xMLMovieDisc.XMLReadSubnode("episodes").XMLReadSubnodes("episode"))
{
VideoFile videoFile = new VideoFile(this.Configuration);
k++;
videoFile.Description = xMLEpisode.XMLReadSubnode("title").XMLReadInnerText(string.Empty);
videoFile.OverrideSpecial(discTitle);
videoFile.OverrideSpecial(this.OverrideVideoStreamData(videoFile.Description));
videoFile.URL = xMLEpisode.XMLReadSubnode("movielink").XMLReadInnerText(string.Empty);
videoFile.FileIndex = k;
videoFile.Media = this;
this.MediaFiles.Add(videoFile);
}
}
// SubTitles
foreach (VideoFile videoFile in this.MediaFiles)
{
videoFile.ReadSubTitleFile(xMLMedia);
}
}
示例3: ReadImages
/// <inheritdoc/>
public override void ReadImages(XmlNode xMLNode)
{
ImageFile image;
// Image
image = new ImageFile(this.Configuration);
image.Media = this;
image.Season = ((Episode)image.Media).actualSeason;
image.Filename = image.Media.Filename;
image.URL = xMLNode.XMLReadSubnode("largeimage").XMLReadInnerText(string.Empty);
image.ConvertFilename();
image.ImageType = Configuration.ImageType.EpisodeCover;
if (image.URL != string.Empty)
{
image.Media.Images.Add(image);
}
}
示例4: ReadMediaFiles
/// <inheritdoc/>
public override void ReadMediaFiles(XmlNode xMLMedia)
{
VideoFile videoFile = new VideoFile(this.Configuration);
videoFile.IsSpecial = this.IsSpecial;
videoFile.Description = "EpisodeVideoFile";
videoFile.URL = xMLMedia.XMLReadSubnode("movielink").XMLReadInnerText(string.Empty);
videoFile.Media = this;
videoFile.FileIndex = this.VideoIndex;
videoFile.ConvertFilename();
this.MediaFiles.Add(videoFile);
}
示例5: ReadAudioStreamData
/// <summary>
/// Reads stream data representing audio information
/// </summary>
/// <param name="xMLMedia">Part of XML-file representing stream information</param>
private void ReadAudioStreamData(XmlNode xMLMedia)
{
foreach (XmlNode xMLAudio in xMLMedia.XMLReadSubnode("audios").XMLReadSubnodes("audio"))
{
string displayname = xMLAudio.XMLReadSubnode("displayname").XMLReadInnerText(string.Empty);
AudioStream audioStreamData = new AudioStream();
audioStreamData.Codec = "AC3";
audioStreamData.Language = displayname.RightOf("[").LeftOf("]");
if (displayname.LeftOf("[").Contains("2.0") || displayname.LeftOf("[").Contains("Stereo"))
{
audioStreamData.NumberOfChannels = "2";
}
if (displayname.LeftOf("[").Contains("5.1"))
{
audioStreamData.NumberOfChannels = "6";
}
this.AudioStreams.Add(audioStreamData);
}
}
示例6: ReadVideoStreamData
/// <summary>
/// Reads stream data representing video information
/// </summary>
/// <param name="xMLMedia">Part of XML-file representing stream information</param>
private void ReadVideoStreamData(XmlNode xMLMedia)
{
Configuration.VideoAspectRatio videoAspectRatio = Configuration.VideoAspectRatio.AspectRatio169;
Configuration.VideoDefinition videoDefinition = Configuration.VideoDefinition.SD;
// VideoAspectRatio
List<XmlNode> xMLVideoAspectRatios = xMLMedia.XMLReadSubnode("ratios").XMLReadSubnodes("ratio");
if (xMLVideoAspectRatios.Count > 0)
{
XmlNode xMLVideoAspectRatio = xMLVideoAspectRatios.ElementAt(0);
if (xMLVideoAspectRatio.XMLReadSubnode("displayname").XMLReadInnerText("Widescreen (16:9)").Equals("Fullscreen (4:3)"))
{
videoAspectRatio = Configuration.VideoAspectRatio.AspectRatio43;
}
else if (xMLVideoAspectRatio.XMLReadSubnode("displayname").XMLReadInnerText("Widescreen (16:9)").Equals("Widescreen (16:9)"))
{
videoAspectRatio = Configuration.VideoAspectRatio.AspectRatio169;
}
else if (xMLVideoAspectRatio.XMLReadSubnode("displayname").XMLReadInnerText("Widescreen (16:9)").Equals("Theatrical Widescreen (21:9)"))
{
videoAspectRatio = Configuration.VideoAspectRatio.AspectRatio219;
}
}
// VideoDefinition
XmlNode xMLVideoDefinition = xMLMedia.XMLReadSubnode("condition");
if (xMLVideoDefinition.XMLReadSubnode("displayname").XMLReadInnerText("SD").Equals("SD"))
{
videoDefinition = Configuration.VideoDefinition.SD;
}
else if (xMLVideoDefinition.XMLReadSubnode("displayname").XMLReadInnerText("SD").Equals("HD"))
{
videoDefinition = Configuration.VideoDefinition.HD;
}
// Werte übertragen
this.VideoDefinition = videoDefinition;
this.VideoAspectRatio = videoAspectRatio;
}
示例7: ReadSubTitleStreamData
/// <summary>
/// Reads stream data representing subtitle information
/// </summary>
/// <param name="xMLMedia">Part of XML-file representing stream information</param>
public virtual void ReadSubTitleStreamData(XmlNode xMLMedia)
{
foreach (XmlNode xMLSubTitle in xMLMedia.XMLReadSubnode("subtitles").XMLReadSubnodes("subtitle"))
{
SubTitle subTitle = new SubTitle(this.Configuration);
subTitle.Video = this;
string displayname = xMLSubTitle.XMLReadSubnode("displayname").XMLReadInnerText(string.Empty);
subTitle.Language = displayname;
this.SubTitles.Add(subTitle);
}
}
示例8: ReadCast
/// <summary>
/// Reads cast information from MovieCollector XML-file
/// </summary>
/// <param name="xMLNode">Part of XML-file representing cast information</param>
public virtual void ReadCast(XmlNode xMLNode)
{
foreach (XmlNode xMLCast in xMLNode.XMLReadSubnode("cast").XMLReadSubnodes("star"))
{
if (xMLCast.XMLReadSubnode("roleid").XMLReadInnerText(string.Empty) == "dfActor")
{
Actor actor = this.ActorFactory(this.Configuration);
actor.ReadPerson(xMLCast);
this.Actors.Add(actor);
}
}
}
示例9: ReadCrew
/// <summary>
/// Reads crew information from MovieCollector XML-file
/// </summary>
/// <param name="xMLNode">Part of XML-file representing Crew information</param>
public void ReadCrew(XmlNode xMLNode)
{
foreach (XmlNode xMLCrewmember in xMLNode.XMLReadSubnode("crew").XMLReadSubnodes("crewmember"))
{
bool isDirector = xMLCrewmember.XMLReadSubnode("roleid").XMLReadInnerText(string.Empty) == "dfDirector";
bool isWriter = xMLCrewmember.XMLReadSubnode("roleid").XMLReadInnerText(string.Empty) == "dfWriter";
if (isDirector)
{
Director director = new Director(this.Configuration);
director.ReadPerson(xMLCrewmember.XMLReadSubnode("person"));
this.Directors.Add(director);
}
if (isWriter)
{
Writer writer = new Writer(this.Configuration);
writer.ReadPerson(xMLCrewmember.XMLReadSubnode("person"));
this.Writers.Add(writer);
}
}
}
示例10: ReadPerson
/// <summary>
/// extracts properties of person from XML-node representing a person
/// </summary>
/// <param name="xmlPerson">xml-node representing a person</param>
public virtual void ReadPerson(XmlNode xmlPerson)
{
this.Name = xmlPerson.XMLReadSubnode("displayname").XMLReadInnerText(string.Empty);
this.URL = xmlPerson.XMLReadSubnode("url").XMLReadInnerText(string.Empty);
this.Thumb = xmlPerson.XMLReadSubnode("imageurl").XMLReadInnerText(string.Empty);
}
示例11: ReadImages
/// <summary>
/// Reads images from XML-File
/// </summary>
/// <param name="xMLNode">Part of Collectors export, representing images of media</param>
public virtual void ReadImages(XmlNode xMLNode)
{
ImageFile image;
ImageFile imageFileClone = null;
// Covers / Backdrops per Season
List<List<int>> imagesPerSeason = new List<List<int>>();
List<List<ImageFile>> imageFilesPerSeason = new List<List<ImageFile>>();
// initialize ImagePerSeason-List with imageTypes
for (int i = 0; i < this.Configuration.NumberOfImageTypes; i++)
{
imagesPerSeason.Add(new List<int>());
imagesPerSeason[i].Add(0); // allSeasons
imagesPerSeason[i].Add(0); // Specials
imagesPerSeason[i].Add(0); // Season 1
imageFilesPerSeason.Add(new List<ImageFile>());
imageFilesPerSeason[i].Add(null); // allSeasons
imageFilesPerSeason[i].Add(null); // Specials
imageFilesPerSeason[i].Add(null); // Season 1
}
// Cover-Front-Image
image = new ImageFile(this.Configuration);
image.Media = this;
image.Filename = "cover";
image.URL = xMLNode.XMLReadSubnode("coverfront").XMLReadInnerText(string.Empty);
image.ConvertFilename();
image.ImageType = Configuration.ImageType.CoverFront;
if (image.URL != string.Empty)
{
image.Media.Images.Add(image);
imagesPerSeason[(int)Configuration.ImageType.CoverFront][0]++;
imageFilesPerSeason[(int)Configuration.ImageType.CoverFront][0] /* Cover */ = image;
}
// Cover-Back-Image
image = new ImageFile(this.Configuration);
image.Media = this;
image.Filename = "coverback";
image.URL = xMLNode.XMLReadSubnode("coverback").XMLReadInnerText(string.Empty);
image.ConvertFilename();
image.ImageType = Configuration.ImageType.CoverBack;
if (image.URL != string.Empty)
{
image.Media.Images.Add(image);
imagesPerSeason[(int)Configuration.ImageType.CoverBack][0]++;
imageFilesPerSeason[(int)Configuration.ImageType.CoverBack][0] /* Cover-Back */ = image;
}
// Poster-Image
image = new ImageFile(this.Configuration);
image.Media = this;
image.Filename = "poster";
image.URL = xMLNode.XMLReadSubnode("poster").XMLReadInnerText(string.Empty);
/* Estuary just displays poster instead of cover; so setting this as poster when empty */
if (image.URL == string.Empty)
{
image.URL = xMLNode.XMLReadSubnode("coverfront").XMLReadInnerText(string.Empty);
}
image.ConvertFilename();
image.ImageType = Configuration.ImageType.Poster;
if (image.URL != string.Empty)
{
image.Media.Images.Add(image);
imagesPerSeason[(int)Configuration.ImageType.Poster][0]++;
imageFilesPerSeason[(int)Configuration.ImageType.Poster][0] /* Poster */ = image;
}
// Backdrop-Image
image = new ImageFile(this.Configuration);
image.Media = this;
image.Filename = "fanart";
image.URL = xMLNode.XMLReadSubnode("backdropurl").XMLReadInnerText(string.Empty);
image.ConvertFilename();
image.ImageType = Configuration.ImageType.Backdrop;
if (image.URL != string.Empty)
{
image.Media.Images.Add(image);
imagesPerSeason[(int)Configuration.ImageType.Backdrop][0]++;
imageFilesPerSeason[(int)Configuration.ImageType.Backdrop][0] /* Backdrop */ = image;
}
// add images from Links section
int numberOfExtraBackdrop = 0;
int numberOfExtraCover = 0;
foreach (XmlNode xMLImageFile in xMLNode.XMLReadSubnode("links").XMLReadSubnodes("link"))
{
if (xMLImageFile.XMLReadSubnode("urltype").XMLReadInnerText(string.Empty) == "Image")
//.........这里部分代码省略.........
示例12: ReadStudio
/// <summary>
/// Reads studios from XML-File
/// </summary>
/// <param name="xMLNode">Part of Collectors export, representing studios of media</param>
public void ReadStudio(XmlNode xMLNode)
{
foreach (XmlNode xMLStudio in xMLNode.XMLReadSubnode("studios").XMLReadSubnodes("studio"))
{
this.Studios.Add(xMLStudio.XMLReadSubnode("displayname").XMLReadInnerText(string.Empty));
}
}
示例13: ReadGenre
/// <summary>
/// Reads genre from XML-File
/// </summary>
/// <param name="xMLNode">Part of Collectors export, representing genres of media</param>
public void ReadGenre(XmlNode xMLNode)
{
foreach (XmlNode xMLGenre in xMLNode.XMLReadSubnode("genres").XMLReadSubnodes("genre"))
{
this.Genres.Add(xMLGenre.XMLReadSubnode("displayname").XMLReadInnerText(string.Empty));
}
}
示例14: ReadSubTitleFile
/// <summary>
/// checks XML-file from MovieCollector for SubTitles linked to the Video and sets them for this VideoFile
/// </summary>
/// <param name="xMLMedia">XML-file from MovieCollector</param>
public void ReadSubTitleFile(XmlNode xMLMedia)
{
List<SubTitleFile> lstSubTitleFiles = new List<SubTitleFile>();
foreach (SubTitle subTitle in ((Video)this.Media).SubTitles)
{
foreach (XmlNode xMLSubTitleStreamFile in xMLMedia.XMLReadSubnode("links").XMLReadSubnodes("link"))
{
// check all links for subtitle in language
if ((xMLSubTitleStreamFile.XMLReadSubnode("urltype").XMLReadInnerText(string.Empty) == "Movie") && xMLSubTitleStreamFile.XMLReadSubnode("description").XMLReadInnerText(string.Empty).Contains("Untertitel." + subTitle.Language + "."))
{
// create new subtitle objects
SrtSubTitleFile srtSubTitleFile = new SrtSubTitleFile(this.Configuration);
srtSubTitleFile.Media = this.Media;
srtSubTitleFile.SubTitle = subTitle;
// name and filenames
srtSubTitleFile.Description = xMLSubTitleStreamFile.XMLReadSubnode("description").XMLReadInnerText(string.Empty);
srtSubTitleFile.URL = xMLSubTitleStreamFile.XMLReadSubnode("url").XMLReadInnerText(string.Empty);
srtSubTitleFile.ConvertFilename();
// check for fileIndex
int completeLength = srtSubTitleFile.Description.Length;
int subtitleLength = ("Untertitel." + subTitle.Language + ".").Length;
int fileIndex = 1;
if (!int.TryParse(srtSubTitleFile.Description.Substring(subtitleLength, completeLength - subtitleLength).LeftOf("."), out fileIndex))
{
fileIndex = 1;
}
// subtitle file name and type
if (srtSubTitleFile.Extension.Contains(".srt") && this.FileIndex == fileIndex)
{
srtSubTitleFile.FileIndex = fileIndex;
srtSubTitleFile.ReadFromSubTitleFile();
lstSubTitleFiles.Add(srtSubTitleFile);
}
}
}
}
this.SubTitleFiles.AddRange(lstSubTitleFiles);
}