/// <summary>
        /// Initializes a new instance of the <see cref="SummaryInformation"/> class.
        /// </summary>
        /// <param name="ps">A property Set which should be Created from a summary
        /// information stream.</param>
        public SummaryInformation(PropertySet ps): base(ps)
        {

            if (!IsSummaryInformation)
                throw new UnexpectedPropertySetTypeException("Not a "
                        + GetType().Name);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="MutablePropertySet"/> class.
 /// All nested elements, i.e.<c>Section</c>s and <c>Property</c> instances, will be their
 /// mutable counterparts in the new <c>MutablePropertySet</c>.
 /// </summary>
 /// <param name="ps">The property Set To copy</param>
 public MutablePropertySet(PropertySet ps)
 {
     byteOrder = ps.ByteOrder;
     format = ps.Format;
     osVersion = ps.OSVersion;
     ClassID=ps.ClassID;
     ClearSections();
     if (sections == null)
         sections = new ArrayList();
     for (IEnumerator i = ps.Sections.GetEnumerator(); i.MoveNext(); )
     {
         MutableSection s = new MutableSection((Section)(i.Current));
         AddSection(s);
     }
 }
 /// <summary>
 /// Creates the most specific {@link PropertySet} from an {@link
 /// InputStream}. This is preferrably a {@link
 /// DocumentSummaryInformation} or a {@link SummaryInformation}. If
 /// the specified {@link InputStream} does not contain a property
 /// Set stream, an exception is thrown and the {@link InputStream}
 /// is repositioned at its beginning.
 /// </summary>
 /// <param name="stream">Contains the property set stream's data.</param>
 /// <returns>The Created {@link PropertySet}.</returns>
 public static PropertySet Create(Stream stream)
 {
     PropertySet ps = new PropertySet(stream);
     try
     {
         if (ps.IsSummaryInformation)
             return new SummaryInformation(ps);
         else if (ps.IsDocumentSummaryInformation)
             return new DocumentSummaryInformation(ps);
         else
             return ps;
     }
     catch (UnexpectedPropertySetTypeException)
     {
         /* This exception will never be throws because we alReady checked
          * explicitly for this case above. */
         throw;
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SpecialPropertySet"/> class.
 /// </summary>
 /// <param name="ps">The property Set To be encapsulated by the <c>SpecialPropertySet</c></param>
 public SpecialPropertySet(PropertySet ps)
 {
     delegate1 = new MutablePropertySet(ps);
 }
Beispiel #5
0
 /// <summary>
 /// Writes out a given ProperySet
 /// </summary>
 /// <param name="name">the (POIFS Level) name of the property to Write.</param>
 /// <param name="Set">the PropertySet to Write out.</param>
 /// <param name="outFS">the POIFSFileSystem to Write the property into.</param>
 protected void WritePropertySet(String name, PropertySet Set, POIFSFileSystem outFS)
 {
     try
     {
         MutablePropertySet mSet = new MutablePropertySet(Set);
         using (MemoryStream bOut = new MemoryStream())
         {
             mSet.Write(bOut);
             byte[] data = bOut.ToArray();
             using (MemoryStream bIn = new MemoryStream(data))
             {
                 outFS.CreateDocument(bIn, name);
             }
             //logger.Log(POILogger.INFO, "Wrote property Set " + name + " of size " + data.Length);
         }
     }
     catch (WritingNotSupportedException)
     {
         Console.Error.WriteLine("Couldn't Write property Set with name " + name + " as not supported by HPSF yet");
     }
 }