void EscherSerializationListener.AfterRecordSerialize(int Offset, short recordId, int size, EscherRecord record)
 {
     if (recordId == EscherClientDataRecord.RECORD_ID || recordId == EscherTextboxRecord.RECORD_ID)
     {
         spEndingOffsets.Add(Offset);
         shapes.Add(record);
     }
 }
 /// <summary>
 /// Adds the child record.
 /// </summary>
 /// <param name="childRecord">The child record.</param>
 public void AddChildRecord(EscherRecord childRecord)
 {
     ChildRecords.Add(childRecord);
 }
 public void AfterRecordSerialize(int offset, short recordId, int size, EscherRecord record)
 {
     // do nothing
 }
 public void BeforeRecordSerialize(int offset, short recordId, EscherRecord record)
 {
     // do nothing
 }
 public bool AddEscherRecord(EscherRecord element)
 {
     escherRecords.Add(element);
     return true;
 }
        /**
 * Clone the current record, via a call to serialise
 *  it, and another to Create a new record from the
 *  bytes.
 * May only be used for classes which don't have
 *  internal counts / ids in them. For those which
 *  do, a full record-aware serialise is needed, which
 *  allocates new ids / counts as needed.
 */
        //public override Record CloneViaReserialise()
        //{
        //    // Do it via a re-serialise
        //    // It's a cheat, but it works...
        //    byte[] b = this.Serialize();
        //    using (var ms = new System.IO.MemoryStream(b))
        //    {
        //        RecordInputStream rinp = new RecordInputStream(ms);
        //        rinp.NextRecord();

        //        Record[] r = RecordFactory.CreateRecord(rinp);
        //        if (r.Length != 1)
        //        {
        //            throw new InvalidOperationException("Re-serialised a record to Clone it, but got " + r.Length + " records back!");
        //        }
        //        return r[0];
        //    }
        //}

        public void AddEscherRecord(int index, EscherRecord element)
        {
            escherRecords.Insert(index, element);
        }
 /// <summary>
 /// Adds the child record.
 /// </summary>
 /// <param name="record">The record.</param>
 public void AddChildRecord(EscherRecord record)
 {
     this.childRecords.Add(record);
 }
 public bool RemoveChildRecord(EscherRecord toBeRemoved)
 {
     return childRecords.Remove(toBeRemoved);
 }
 public void AfterRecordSerialize(int offset, short recordId, int size, EscherRecord record)
 {
     // do nothing
 }
 public void BeforeRecordSerialize(int offset, short recordId, EscherRecord record)
 {
     // do nothing
 }
Example #11
0
 /// <summary>
 /// Adds the child record.
 /// </summary>
 /// <param name="record">The record.</param>
 public void AddChildRecord(EscherRecord record)
 {
     this.childRecords.Add(record);
 }
Example #12
0
 public bool RemoveChildRecord(EscherRecord toBeRemoved)
 {
     return(childRecords.Remove(toBeRemoved));
 }
 /**
  * Associates an escher record to an OBJ record or a TXO record.
  */
 public Object AssoicateShapeToObjRecord(EscherRecord r, Record objRecord)
 {
     return shapeToObj[r]= objRecord;
 }
 void EscherSerializationListener.BeforeRecordSerialize(int Offset, short recordId, EscherRecord record)
 {
    
 }
Example #15
0
        /// <summary>
        /// Generates an escher record including the any children contained under that record.
        /// An exception is thrown if the record could not be generated.
        /// </summary>
        /// <param name="data">The byte array containing the records</param>
        /// <param name="offset">The starting offset into the byte array</param>
        /// <returns>The generated escher record</returns>
        public virtual EscherRecord CreateRecord(byte[] data, int offset)
        {
            EscherRecord.EscherRecordHeader header = EscherRecord.EscherRecordHeader.ReadHeader(data, offset);

            // Options of 0x000F means container record
            // However, EscherTextboxRecord are containers of records for the
            //  host application, not of other Escher records, so treat them
            //  differently
            if ((header.Options & (short)0x000F) == (short)0x000F &&
                header.RecordId != EscherTextboxRecord.RECORD_ID)
            {
                EscherContainerRecord r = new EscherContainerRecord();
                r.RecordId = header.RecordId;
                r.Options  = header.Options;
                return(r);
            }
            if (header.RecordId >= EscherBlipRecord.RECORD_ID_START && header.RecordId <= EscherBlipRecord.RECORD_ID_END)
            {
                EscherBlipRecord r;
                if (header.RecordId == EscherBitmapBlip.RECORD_ID_DIB ||
                    header.RecordId == EscherBitmapBlip.RECORD_ID_JPEG ||
                    header.RecordId == EscherBitmapBlip.RECORD_ID_PNG)
                {
                    r = new EscherBitmapBlip();
                }
                else if (header.RecordId == EscherMetafileBlip.RECORD_ID_EMF ||
                         header.RecordId == EscherMetafileBlip.RECORD_ID_WMF ||
                         header.RecordId == EscherMetafileBlip.RECORD_ID_PICT)
                {
                    r = new EscherMetafileBlip();
                }
                else
                {
                    r = new EscherBlipRecord();
                }
                r.RecordId = header.RecordId;
                r.Options  = header.Options;
                return(r);
            }

            //ConstructorInfo recordConstructor = (ConstructorInfo) recordsMap[header.RecordId];
            ConstructorInfo recordConstructor = null;

            if (recordsMap.ContainsKey(header.RecordId))
            {
                recordConstructor = recordsMap[header.RecordId];
            }

            EscherRecord escherRecord = null;

            if (recordConstructor == null)
            {
                return(new UnknownEscherRecord());
            }

            try
            {
                escherRecord = (EscherRecord)recordConstructor.Invoke(new object[] { });
                //escherRecord = (EscherRecord)Activator.CreateInstance(recordConstructor);
            }
            catch (Exception)
            {
                return(new UnknownEscherRecord());
            }
            escherRecord.RecordId = header.RecordId;
            escherRecord.Options  = header.Options;
            return(escherRecord);
        }
Example #16
0
 /// <summary>
 /// Adds the child record.
 /// </summary>
 /// <param name="childRecord">The child record.</param>
 public void AddChildRecord(EscherRecord childRecord)
 {
     ChildRecords.Add(childRecord);
 }