Beispiel #1
0
 /// <summary>
 ///   Creates a new instance of the <see cref="Component"/> class from the specified
 ///   IANA <see cref="Name"/> with no default <see cref="Properties"/>.
 /// </summary>
 /// <param name="ianaName">
 ///   The IANA assigned <see cref="Name"/>.
 /// </param>
 /// <returns>
 ///   A new instance of the <see cref="Component"/> class that implements the
 ///   <paramref name="ianaName"/>.
 /// </returns>
 /// <exception cref="CalendarException">
 ///   <paramref name="ianaName"/> is not known nor experimental.
 /// </exception>
 /// <remarks>
 ///   <para>
 ///   <b>Create</b> is designed to be used by <see cref="IcsReader"/>.
 ///   </para>
 /// </remarks>
 public static Component Create(string ianaName)
 {
     var component = new Component(ianaName);
     component.Properties.Clear();
     return component;
 }
Beispiel #2
0
 /// <summary>
 ///   Writes the <see cref="Component"/>.
 /// </summary>
 /// <param name="component">
 ///   A <see cref="Component"/> to write.
 /// </param>
 /// <remarks>
 ///   A component has the form:
 ///   <code>
 ///     BEGIN:<see cref="Component.Name"/> CRLF
 ///     (<see cref="Component.Properties"/> CRLF)* 
 ///     (<see cref="Component.Components"/> CRLF)*
 ///     END:<see cref="Component.Name"/> CRLF
 ///   </code>
 ///   A property is a <see cref="ContentLine"/> with the form: 
 ///   <code>
 ///     <see cref="ContentLine.Name"/> 
 ///       (";" <see cref="ContentLine.Parameters">parameter</see>)*
 ///       ":" <see cref="ContentLine.Value"/> 
 ///       CRLF
 ///   </code>
 ///   <para>
 ///   A long line will be split between any two characters by inserting a CRLF
 ///   immediately followed by a single linear white-space character (i.e., SPACE).
 ///   </para>
 /// </remarks>
 public void Write(Component component)
 {
     WriteBeginComponent(component.Name);
     foreach (var property in component.Properties.OrderBy(p => p.Name))
         Write(property);
     foreach (var subcomponent in component.Components.OrderBy(c => c.Name))
         Write(subcomponent);
     WriteEndComponent();
 }