/// <summary>
 /// Converts an object into its XML representation.
 /// </summary>
 /// <param name="writer">The <see cref="T:System.Xml.XmlWriter" /> stream to which the object is serialized.</param>
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteElementString("LineAlignment", LineAlignment.ToString());
     writer.WriteElementString("Alignment", Alignment.ToString());
     writer.WriteElementString("Trimming", Trimming.ToString());
     writer.WriteElementString("Xshift", Xshift.ToString());
     writer.WriteElementString("Yshift", Yshift.ToString());
     writer.WriteElementString("Font",
                               TypeDescriptor.GetConverter(Font).ConvertTo(Font, typeof(string)).ToString());
 }
        public override JObject SaveToJsonObject(StiJsonSaveMode mode)
        {
            var jObject = base.SaveToJsonObject(mode);

            jObject.Add(new JProperty("IsGeneric", IsGeneric));
            jObject.Add(new JProperty("Alignment", Alignment.ToString()));
            jObject.Add(new JProperty("FormatFlags", FormatFlags.ToString()));
            jObject.Add(new JProperty("HotkeyPrefix", HotkeyPrefix.ToString()));
            jObject.Add(new JProperty("LineAlignment", LineAlignment.ToString()));
            jObject.Add(new JProperty("Trimming", Trimming.ToString()));

            return(jObject);
        }
Пример #3
0
        /// <summary>
        /// Utility method to serialize elements of LineAlignment enum.
        /// </summary>
        /// <param name="lineAlignment">Enum value to serialize.</param>
        /// <returns>Serialized enum value.</returns>
        private static string GetLineAlignmentValue(LineAlignment lineAlignment)
        {
            switch (lineAlignment)
            {
            case LineAlignment.Start:
                return(Constants.StartValue);

            case LineAlignment.Center:
                return(Constants.CenterValue);

            case LineAlignment.End:
                return(Constants.EndValue);

            default:
                throw new ArgumentOutOfRangeException(string.Format("Unknown cue line align value '{0}'.", lineAlignment.ToString()));
            }
        }