Exemplo n.º 1
0
 /// <summary>
 /// This method deSerializes the record from a byte array.
 /// </summary>
 /// <param name="data">The byte array containing the escher record information</param>
 /// <param name="offset">The starting offset into data</param>
 /// <param name="recordFactory">May be null since this is not a container record.</param>
 /// <returns>The number of bytes Read from the byte array.</returns>
 public override int FillFields(byte[] data, int offset, IEscherRecordFactory recordFactory)
 {
     int bytesRemaining = ReadHeader(data, offset);
     int pos = offset + 8;
     int size = 0;
     field_1_shapeIdMax = LittleEndian.GetInt(data, pos + size); size += 4;
     int field_2_numIdClusters = LittleEndian.GetInt(data, pos + size); size += 4;
     field_3_numShapesSaved = LittleEndian.GetInt(data, pos + size); size += 4;
     field_4_drawingsSaved = LittleEndian.GetInt(data, pos + size); size += 4;
     field_5_fileIdClusters = new FileIdCluster[(bytesRemaining - size) / 8];  // Can't rely on field_2_numIdClusters
     for (int i = 0; i < field_5_fileIdClusters.Length; i++)
     {
         field_5_fileIdClusters[i] = new FileIdCluster(LittleEndian.GetInt(data, pos + size), LittleEndian.GetInt(data, pos + size + 4));
         maxDgId = Math.Max(maxDgId, field_5_fileIdClusters[i].DrawingGroupId);
         size += 8;
     }
     bytesRemaining -= size;
     if (bytesRemaining != 0)
         throw new RecordFormatException("Expecting no remaining data but got " + bytesRemaining + " byte(s).");
     return 8 + size + bytesRemaining;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Adds the cluster.
 /// </summary>
 /// <param name="dgId">id of the drawing group (stored in the record options)</param>
 /// <param name="numShapedUsed">initial value of the numShapedUsed field</param>
 /// <param name="sort">if set to <c>true</c> if true then sort clusters by drawing group id.(
 /// In Excel the clusters are sorted but in PPT they are not).</param>
 public void AddCluster(int dgId, int numShapedUsed, bool sort)
 {
     ArrayList clusters = new ArrayList(field_5_fileIdClusters);
     clusters.Add(new FileIdCluster(dgId, numShapedUsed));
     clusters.Sort(new EscherDggRecordComparer());
     maxDgId = Math.Min(maxDgId, dgId);
     field_5_fileIdClusters = (FileIdCluster[])clusters.ToArray(typeof(FileIdCluster));
 }