Example #1
0
 /// <summary>
 /// Formats current object's tag which is the basis for renaming functionality.
 /// </summary>
 /// <param name="format">Pattern to format object's name with</param>
 /// <param name="childFormat">Format to apply to children, if they exist</param>
 /// <remarks>
 /// childFormat allows the user to specify different formats for
 /// parent and child objects. Instead of formatting the Name attribute
 /// the tag is formatted so the user can decide on which attributes 
 /// are used in the renaming process.
 /// </remarks>
 public virtual void Format(Formatter formatter)
 {
   Formatter = formatter;
   Name = formatter.Format(FileType, Name);
 }
Example #2
0
    /// <summary>
    /// Formats current object's name with the specified formmating pattern.
    /// </summary>
    /// <param name="format">Type of format to apply</param>
    /// <param name="childFormat">Type of format to apply to children object if any exist</param>
    /// <remarks>
    /// In case the user wants to format parent and child objects differently,
    /// the childFormat parameter is provided. If not provided the children
    /// will use the parent's format. If a childformat is not specified
    /// the parent's format is used by default.
    /// </remarks>
    public override void Format(Formatter formatter)
    {
      Trace.WriteLine("Formatting album " + Name);

      // Store most recent formatter for use when renaming
      Formatter = formatter;

      foreach (File child in children)
      {
        child.Format(formatter);
      }

      // Rename folder
      Name = formatter.Format(FileType, Name);
    }