本文整理汇总了C#中System.Xml.XmlWriter.WriteSafeElementString方法的典型用法代码示例。如果您正苦于以下问题:C# XmlWriter.WriteSafeElementString方法的具体用法?C# XmlWriter.WriteSafeElementString怎么用?C# XmlWriter.WriteSafeElementString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlWriter
的用法示例。
在下文中一共展示了XmlWriter.WriteSafeElementString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteXml
/// <summary>
/// Writes this object into XML representation.
/// </summary>
/// <param name='writer'>The XmlWriter to write to.</param>
public override void WriteXml(XmlWriter writer)
{
base.WriteXml(writer);
// Writes <mediaid>MediaId</mediaid>
writer.WriteSafeElementString("mediaid", MediaId);
}
示例2: WriteXml
/// <summary>
/// Writes this object into XML representation.
/// </summary>
/// <param name='writer'>The XmlWriter to write to.</param>
public override void WriteXml(XmlWriter writer)
{
// Writes <mediafile></mediafile>
if (MediaFile != null)
{
writer.WriteSafeElementString("mediafile", MediaFile.AbsoluteUri);
}
// Writes <mediaid></mediaid>
writer.WriteSafeElementString("mediaid", MediaId);
// Writes <mediastatus></mediastatus>
writer.WriteSafeElementString("mediastatus", MediaStatus);
// Writes <createdate></createdate>
writer.WriteSafeElementString("createdate",
!CreateDate.Equals(DateTime.MinValue)
? CreateDate.ToString("yyyy-MM-dd HH:mm:ss",
CultureInfo.GetCultureInfo("en-US"))
: "0000-00-00 00:00:00");
// Writes <startdate></startdate>
writer.WriteSafeElementString("startdate",
!StartDate.Equals(DateTime.MinValue)
? StartDate.ToString("yyyy-MM-dd HH:mm:ss",
CultureInfo.GetCultureInfo("en-US"))
: "0000-00-00 00:00:00");
// Writes <finishdate></finishdate>
writer.WriteSafeElementString("finishdate",
!FinishDate.Equals(DateTime.MinValue)
? FinishDate.ToString("yyyy-MM-dd HH:mm:ss",
CultureInfo.GetCultureInfo("en-US"))
: "0000-00-00 00:00:00");
}
示例3: WriteXml
/// <summary>
/// Writes this object into XML representation.
/// </summary>
/// <param name='writer'>The XmlWriter to write to.</param>
public override void WriteXml(XmlWriter writer)
{
// Writes <userid></userid>
writer.WriteSafeElementString("userid", UserId);
// Writes <userkey></userkey>
writer.WriteSafeElementString("userkey", UserKey);
// Writes <action></action>
writer.WriteSafeElementString("action", Action);
// Writes <mediaid></mediaid>
writer.WriteSafeElementString("mediaid", MediaId);
// Writes <source></source>
if (Sources != null)
{
foreach (Uri uri in Sources)
{
writer.WriteSafeElementString("source", uri.AbsoluteUri);
}
}
// Writes <notify></notify>
if (Notify != null)
{
writer.WriteSafeElementString("notify", Notify.AbsoluteUri);
}
// Writes <instant></instant>
if (IsInstant)
{
writer.WriteSafeElementString("instant", "yes");
}
// Writes <format>...</format
if (Formats != null)
{
foreach (EncodingFormat f in Formats)
{
writer.WriteStartElement("format");
f.WriteXml(writer);
writer.WriteEndElement();
}
}
}
示例4: WriteXml
public override void WriteXml(XmlWriter writer)
{
// Writes <noise_reduction></noise_reduction>
if (NoiseReduction >= 0)
{
writer.WriteSafeElementString("noise_reduction", Convert.ToString(NoiseReduction));
}
// Writes <output></output>
writer.WriteSafeElementString("output", Output);
// Writes <video_codec></video_codec>
writer.WriteSafeElementString("video_codec", VideoCodec);
// Writes <audio_codec></audio_codec>
writer.WriteSafeElementString("audio_codec", AudioCodec);
// Writes <bitrate></bitrate>
if (VideoBitrate != 0)
{
writer.WriteSafeElementString("bitrate", String.Format("{0}k", VideoBitrate));
}
// Writes <audio_bitrate></audio_bitrate>
if (AudioBitrate != 0D)
{
writer.WriteSafeElementString("audio_bitrate", String.Format("{0}k", AudioBitrate));
}
// Writes <audio_sample_rate></audio_sample_rate>
if (AudioSampleRate != 0)
{
writer.WriteSafeElementString("audio_sample_rate",
String.Format("{0}", AudioSampleRate));
}
// Writes <audio_volume></audio_volume>
if (AudioVolume >= 0 && AudioVolume <= 100)
{
writer.WriteSafeElementString("audio_volume", String.Format("{0}", AudioVolume));
}
// Writes <size></size>
if (VideoFrameSize != null)
{
writer.WriteSafeElementString("size",
String.Format("{0}x{1}", VideoFrameSize.Width, VideoFrameSize.Height));
}
// Writes <fade_in></fade_in>
if (FadeIn != null)
{
writer.WriteSafeElementString("fade_in",
String.Format("{0}:{1}", FadeIn.StartTime, FadeIn.Duration));
}
// Writes <fade_out></fade_out>
if (FadeOut != null)
{
writer.WriteSafeElementString("fade_out",
String.Format("{0}:{1}", FadeOut.StartTime, FadeOut.Duration));
}
// Writes <crop_left></crop_left>
if (CropLeft % 2 == 0)
{
writer.WriteSafeElementString("crop_left", String.Format("{0}", CropLeft));
}
// Writes <crop_right></crop_right>
if (CropRight % 2 == 0)
{
writer.WriteSafeElementString("crop_right", String.Format("{0}", CropRight));
}
// Writes <crop_top></crop_top>
if (CropTop % 2 == 0)
{
writer.WriteSafeElementString("crop_top", String.Format("{0}", CropTop));
}
// Writes <crop_bottom></crop_bottom>
if (CropBottom % 2 == 0)
{
writer.WriteSafeElementString("crop_bottom", String.Format("{0}", CropBottom));
}
// Writes <keep_aspect_ratio></keep_aspect_ratio>
if (!KeepAspectRatio)
{
writer.WriteSafeElementString("keep_aspect_ratio", "no");
}
}
示例5: WriteXml
/// <summary>
/// Writes this object into XML representation.
/// </summary>
/// <remarks>
/// When overriden in derived class, call base.WriteXml(XmlWriter) to ensure that
/// all properties are correctly written to the writer.
/// </remarks>
/// <param name='writer'>The XmlWriter to write to.</param>
public override void WriteXml(XmlWriter writer)
{
// Writes <message></message>
writer.WriteSafeElementString("message", Message);
if (Errors != null)
{
int count = Errors.Count;
if (count > 0)
{
// Writes <errors>...</errors>
writer.WriteStartElement("errors");
foreach (var item in Errors)
{
// Writes <error></error>
writer.WriteSafeElementString("error", item);
}
writer.WriteEndElement();
}
}
}