override public void Apply(RegularContainer slide) { TraceLogger.DebugInternal("TitleMasterMapping.Apply"); // Start the document _writer.WriteStartDocument(); _writer.WriteStartElement("p", "sldLayout", OpenXmlNamespaces.PresentationML); _writer.WriteAttributeString("showMasterSp", "0"); _writer.WriteAttributeString("type", "title"); _writer.WriteAttributeString("preserve", "1"); // Force declaration of these namespaces at document start _writer.WriteAttributeString("xmlns", "a", null, OpenXmlNamespaces.DrawingML); // Force declaration of these namespaces at document start _writer.WriteAttributeString("xmlns", "r", null, OpenXmlNamespaces.Relationships); _writer.WriteStartElement("p", "cSld", OpenXmlNamespaces.PresentationML); _writer.WriteStartElement("p", "spTree", OpenXmlNamespaces.PresentationML); ShapeTreeMapping stm = new ShapeTreeMapping(_ctx, _writer); stm.parentSlideMapping = this; stm.Apply(slide.FirstChildWithType <PPDrawing>()); _writer.WriteEndElement(); _writer.WriteEndElement(); // End the document _writer.WriteEndElement(); _writer.WriteEndDocument(); _writer.Flush(); }
override public void Apply(RegularContainer pmaster) { Slide master = (Slide)pmaster; TraceLogger.DebugInternal("MasterMapping.Apply"); UInt32 masterId = master.PersistAtom.SlideId; _ctx.RegisterMasterMapping(masterId, this); this.Master = master; this.MasterId = master.PersistAtom.SlideId; this.LayoutManager = _ctx.GetOrCreateLayoutManagerByMasterId(this.MasterId); // Add PPT2007 roundtrip slide layouts List <RoundTripContentMasterInfo12> rtSlideLayouts = this.Master.AllChildrenWithType <RoundTripContentMasterInfo12>(); foreach (RoundTripContentMasterInfo12 slideLayout in rtSlideLayouts) { SlideLayoutPart layoutPart = this.LayoutManager.AddLayoutPartWithInstanceId(slideLayout.Instance); XmlNode e = slideLayout.XmlDocumentElement; XmlNamespaceManager nsm = new XmlNamespaceManager(new NameTable()); nsm.AddNamespace("a", OpenXmlNamespaces.DrawingML); //for the moment remove blips that reference pictures foreach (XmlNode bublip in e.SelectNodes("//a:buBlip", nsm)) { bublip.ParentNode.RemoveChild(bublip); } Tools.Utils.replaceOutdatedNamespaces(ref e); e.WriteTo(layoutPart.XmlWriter); layoutPart.XmlWriter.Flush(); } }
public static ShapeType GetShapeType(UInt32 typeCode) { ShapeType result; Type cls; if (TypeToShapeClassMapping.TryGetValue(typeCode, out cls)) { ConstructorInfo constructor = cls.GetConstructor(new Type[] {}); if (constructor == null) { throw new Exception(String.Format( "Internal error: Could not find a matching constructor for class {0}", cls)); } try { result = (ShapeType)constructor.Invoke(new object[] {}); } catch (TargetInvocationException e) { TraceLogger.DebugInternal(e.InnerException.ToString()); throw e.InnerException; } } else { result = null; } return(result); }
public static Record ReadRecord(BinaryReader reader) { try { UInt16 verAndInstance = reader.ReadUInt16(); uint version = verAndInstance & 0x000FU; // first 4 bit of field verAndInstance uint instance = (verAndInstance & 0xFFF0U) >> 4; // last 12 bit of field verAndInstance UInt16 typeCode = reader.ReadUInt16(); UInt32 size = reader.ReadUInt32(); bool isContainer = (version == 0xF); Record result; Type cls; if (TypeToRecordClassMapping.TryGetValue(typeCode, out cls)) { ConstructorInfo constructor = cls.GetConstructor(new Type[] { typeof(BinaryReader), typeof(uint), typeof(uint), typeof(uint), typeof(uint) }); if (constructor == null) { throw new Exception(String.Format( "Internal error: Could not find a matching constructor for class {0}", cls)); } //TraceLogger.DebugInternal("Going to read record of type {0} ({1})", cls, typeCode); try { result = (Record)constructor.Invoke(new object[] { reader, size, typeCode, version, instance }); //TraceLogger.DebugInternal("Here it is: {0}", result); } catch (TargetInvocationException e) { TraceLogger.DebugInternal(e.InnerException.ToString()); throw e.InnerException; } } else { //TraceLogger.DebugInternal("Going to read record of type UnknownRecord ({1})", cls, typeCode); result = new UnknownRecord(reader, size, typeCode, version, instance); } return(result); } catch (OutOfMemoryException e) { throw new InvalidRecordException("Invalid record", e); } }
override public void AfterParentSet() { ClientTextbox textbox = this.ParentRecord as ClientTextbox; if (textbox == null) { TraceLogger.DebugInternal("Record of type StyleTextPropAtom doesn't have parent of type ClientTextbox: {0}", this); return; } // TODO: FindSiblingByType? TextAtom textAtom = textbox.FirstChildWithType <TextAtom>(); /* This can legitimately happen... */ if (textAtom == null) { this.Reader.Read(new char[this.BodySize], 0, (int)this.BodySize); return; } // TODO: Length in bytes? UTF-16 characters? Full width unicode characters? //TraceLogger.DebugInternal("New text style for text: {0}", Utils.StringInspect(textAtom.Text)); uint seenLength = 0; while (seenLength < textAtom.Text.Length + 1) { long pos = this.Reader.BaseStream.Position; uint length = this.Reader.ReadUInt32(); ParagraphRun run = new ParagraphRun(this.Reader, false); run.Length = length; this.PRuns.Add(run); /*TraceLogger.DebugInternal("Read paragraph run. Before pos = {0}, after pos = {1} of {2}: {3}", * pos, this.Reader.BaseStream.Position, this.Reader.BaseStream.Length, * run);*/ seenLength += length; } //TraceLogger.DebugInternal(); seenLength = 0; while (seenLength < textAtom.Text.Length + 1) { uint length = this.Reader.ReadUInt32(); CharacterRun run = new CharacterRun(this.Reader); run.Length = length; this.CRuns.Add(run); seenLength += length; } }
public void VerifyReadToEnd() { long streamPos = this.Reader.BaseStream.Position; long streamLen = this.Reader.BaseStream.Length; if (streamPos != streamLen) { TraceLogger.DebugInternal("Record {3} didn't read to end: (stream position: {1} of {2})\n{0}", this, streamPos, streamLen, this.GetIdentifier()); } }
override public void Apply(RegularContainer pmaster) { var master = (Note)pmaster; TraceLogger.DebugInternal("NotesMasterMapping.Apply"); uint masterId = 0; // master.PersistAtom.SlideId; this._ctx.RegisterNotesMasterMapping(masterId, this); this.Master = master; this.MasterId = 0; // master.PersistAtom.SlideId; }
override public void Apply(RegularContainer pmaster) { Handout master = (Handout)pmaster; TraceLogger.DebugInternal("HandoutMasterMapping.Apply"); UInt32 masterId = 0; // master.PersistAtom.SlideId; _ctx.RegisterHandoutMasterMapping(masterId, this); this.Master = master; this.MasterId = 0; // master.PersistAtom.SlideId; }
override public void Apply(RegularContainer note) { this.Note = (Note)note; TraceLogger.DebugInternal("NoteMapping.Apply"); // Associate slide with slide layout var notesAtom = note.FirstChildWithType <NotesAtom>(); //Add relationship to slide this.targetPart.ReferencePart(this.SlideMapping.targetPart); this.SlideMapping.targetPart.ReferencePart(this.targetPart); //Add relationship to notes master // Start the document this._writer.WriteStartDocument(); this._writer.WriteStartElement("p", "notes", OpenXmlNamespaces.PresentationML); // Force declaration of these namespaces at document start this._writer.WriteAttributeString("xmlns", "a", null, OpenXmlNamespaces.DrawingML); // Force declaration of these namespaces at document start this._writer.WriteAttributeString("xmlns", "r", null, OpenXmlNamespaces.Relationships); // TODO: Write slide data of master slide this._writer.WriteStartElement("p", "cSld", OpenXmlNamespaces.PresentationML); //TODO: write background properties (p:bg) this._writer.WriteStartElement("p", "spTree", OpenXmlNamespaces.PresentationML); var stm = new ShapeTreeMapping(this._ctx, this._writer); stm.parentSlideMapping = this; stm.Apply(note.FirstChildWithType <PPDrawing>()); checkHeaderFooter(stm); this._writer.WriteEndElement(); //spTree this._writer.WriteEndElement(); //cSld // TODO: Write clrMapOvr // End the document this._writer.WriteEndElement(); //sld this._writer.WriteEndDocument(); this._writer.Flush(); }
public TextMasterStyleAtom(BinaryReader _reader, uint size, uint typeCode, uint version, uint instance) : base(_reader, size, typeCode, version, instance) { this.Bytes = this.Reader.ReadBytes((int)this.BodySize); this.Reader.BaseStream.Position = 0; this.IndentLevelCount = this.Reader.ReadUInt16(); for (int i = 0; i < this.IndentLevelCount; i++) { long pos = this.Reader.BaseStream.Position; if ((this.Instance >= 5)) // & (this.Instance < this.IndentLevelCount)) { ushort level = this.Reader.ReadUInt16(); } this.PRuns.Add(new ParagraphRun(this.Reader, true)); TraceLogger.DebugInternal("Read paragraph run. Before pos = {0}, after pos = {1} of {2}: {3}", pos, this.Reader.BaseStream.Position, this.Reader.BaseStream.Length, this.PRuns[i].ToString()); pos = this.Reader.BaseStream.Position; this.CRuns.Add(new CharacterRun(this.Reader)); TraceLogger.DebugInternal("Read character run. Before pos = {0}, after pos = {1} of {2}: {3}", pos, this.Reader.BaseStream.Position, this.Reader.BaseStream.Length, this.CRuns[i].ToString()); } //// XXX: I'm not sure why but in some cases there is trailing garbage -- flgr if (this.Reader.BaseStream.Position != this.Reader.BaseStream.Length) { this.Reader.BaseStream.Position = this.Reader.BaseStream.Length; } }
/// <summary> /// This static method is used to convert the ptgStack to the infixnotation /// This method changes every Ptg***N** PtgRecord from a shared formula /// </summary> /// <param name="stack"></param> /// <param name="xlsContext"></param> /// <param name="rw">Row from the shared formula</param> /// <param name="col">Column from the shared formula</param> /// <returns></returns> public static string mapFormula(Stack <AbstractPtg> stack, ExcelContext xlsContext, int rw, int col) { var resultStack = new Stack <string>(); try { var opStack = new Stack <AbstractPtg>(stack); if (opStack.Count == 0) { throw new Exception(); } while (opStack.Count != 0) { var ptg = opStack.Pop(); if (ptg is PtgInt || ptg is PtgNum || ptg is PtgBool || ptg is PtgMissArg || ptg is PtgErr) { resultStack.Push(ptg.getData()); } else if (ptg is PtgRef) { var ptgref = (PtgRef)ptg; int realCol = ptgref.col; int realRw = ptgref.rw + 1; if (ptgref.colRelative) { realCol += col; } if (ptgref.rwRelative) { realRw += rw; } resultStack.Push(ExcelHelperClass.intToABCString(realCol, (realRw).ToString(), ptgref.colRelative, ptgref.rwRelative)); } else if (ptg is PtgRefN) { var ptgrefn = (PtgRefN)ptg; int realCol = (int)ptgrefn.col; int realRw; if (ptgrefn.colRelative) { realCol += col; } if (realCol >= 0xFF) { realCol -= 0x0100; } if (ptgrefn.rwRelative) { realRw = (short)ptgrefn.rw + 1; realRw += rw; } else { realRw = ptgrefn.rw + 1; } resultStack.Push(ExcelHelperClass.intToABCString(realCol, (realRw).ToString(), ptgrefn.colRelative, ptgrefn.rwRelative)); } else if (ptg is PtgUplus || ptg is PtgUminus) { string buffer = ""; if (ptg.PopSize() > resultStack.Count) { throw new ExtractorException(ExtractorException.PARSEDFORMULAEXCEPTION); } buffer = ptg.getData() + resultStack.Pop(); resultStack.Push(buffer); } else if (ptg is PtgParen) { string buffer = ""; if (ptg.PopSize() > resultStack.Count) { throw new ExtractorException(ExtractorException.PARSEDFORMULAEXCEPTION); } buffer = "(" + resultStack.Pop() + ")"; resultStack.Push(buffer); } else if (ptg is PtgPercent) { string buffer = ""; if (ptg.PopSize() > resultStack.Count) { throw new ExtractorException(ExtractorException.PARSEDFORMULAEXCEPTION); } buffer = resultStack.Pop() + ptg.getData(); resultStack.Push(buffer); } else if (ptg is PtgAdd || ptg is PtgDiv || ptg is PtgMul || ptg is PtgSub || ptg is PtgPower || ptg is PtgGt || ptg is PtgGe || ptg is PtgLt || ptg is PtgLe || ptg is PtgEq || ptg is PtgNe || ptg is PtgConcat || ptg is PtgUnion || ptg is PtgIsect ) { string buffer = ""; if (ptg.PopSize() > resultStack.Count) { throw new ExtractorException(ExtractorException.PARSEDFORMULAEXCEPTION); } buffer = ptg.getData() + resultStack.Pop(); buffer = resultStack.Pop() + buffer; resultStack.Push(buffer); } else if (ptg is PtgStr) { resultStack.Push("\"" + ptg.getData() + "\""); } else if (ptg is PtgArea) { string buffer = ""; var ptgarea = (PtgArea)ptg; buffer = ExcelHelperClass.intToABCString((int)ptgarea.colFirst, (ptgarea.rwFirst + 1).ToString(), ptgarea.colFirstRelative, ptgarea.rwFirstRelative); buffer = buffer + ":" + ExcelHelperClass.intToABCString((int)ptgarea.colLast, (ptgarea.rwLast + 1).ToString(), ptgarea.colLastRelative, ptgarea.rwLastRelative); resultStack.Push(buffer); } else if (ptg is PtgAreaN) { string buffer = ""; var ptgarean = (PtgAreaN)ptg; int realRwFirst; int realRwLast; int realColFirst = (int)ptgarean.colFirst; int realColLast = (int)ptgarean.colLast; if (ptgarean.colFirstRelative) { realColFirst += col; } if (realColFirst >= 0xFF) { realColFirst -= 0x0100; } if (ptgarean.colLastRelative) { realColLast += col; } if (realColLast >= 0xFF) { realColLast -= 0x0100; } if (ptgarean.rwFirstRelative) { realRwFirst = (short)ptgarean.rwFirst + 1; realRwFirst += rw; } else { realRwFirst = ptgarean.rwFirst + 1; } if (ptgarean.rwLastRelative) { realRwLast = (short)ptgarean.rwLast + 1; realRwLast += rw; } else { realRwLast = ptgarean.rwLast + 1; } buffer = ExcelHelperClass.intToABCString(realColFirst, (realRwFirst).ToString(), ptgarean.colFirstRelative, ptgarean.rwFirstRelative); buffer = buffer + ":" + ExcelHelperClass.intToABCString(realColLast, (realRwLast).ToString(), ptgarean.colLastRelative, ptgarean.rwLastRelative); resultStack.Push(buffer); } else if (ptg is PtgAttrSum) { string buffer = ""; var ptgref = (PtgAttrSum)ptg; buffer = ptg.getData() + "(" + resultStack.Pop() + ")"; resultStack.Push(buffer); } else if (ptg is PtgAttrIf || ptg is PtgAttrGoto || ptg is PtgAttrSemi || ptg is PtgAttrChoose || ptg is PtgAttrSpace) { } else if (ptg is PtgExp) { var ptgexp = (PtgExp)ptg; var newptgstack = ((WorkSheetData)xlsContext.CurrentSheet).getArrayData(ptgexp.rw, ptgexp.col); resultStack.Push(FormulaInfixMapping.mapFormula(newptgstack, xlsContext)); ((WorkSheetData)xlsContext.CurrentSheet).setFormulaUsesArray(ptgexp.rw, ptgexp.col); } else if (ptg is PtgRef3d) { try { var ptgr3d = (PtgRef3d)ptg; string refstring = ExcelHelperClass.EscapeFormulaString(xlsContext.XlsDoc.WorkBookData.getIXTIString(ptgr3d.ixti)); string cellref = ExcelHelperClass.intToABCString((int)ptgr3d.col, (ptgr3d.rw + 1).ToString(), ptgr3d.colRelative, ptgr3d.rwRelative); resultStack.Push("'" + refstring + "'" + "!" + cellref); } catch (Exception) { resultStack.Push("#REF!"); } } else if (ptg is PtgArea3d) { try { var ptga3d = (PtgArea3d)ptg; string refstring = ExcelHelperClass.EscapeFormulaString(xlsContext.XlsDoc.WorkBookData.getIXTIString(ptga3d.ixti)); string buffer = ""; buffer = ExcelHelperClass.intToABCString((int)ptga3d.colFirst, (ptga3d.rwFirst + 1).ToString(), ptga3d.colFirstRelative, ptga3d.rwFirstRelative); buffer = buffer + ":" + ExcelHelperClass.intToABCString((int)ptga3d.colLast, (ptga3d.rwLast + 1).ToString(), ptga3d.colLastRelative, ptga3d.rwLastRelative); resultStack.Push("'" + refstring + "'!" + buffer); } catch (Exception) { resultStack.Push("#REF!"); } } else if (ptg is PtgNameX) { var ptgnx = (PtgNameX)ptg; string opstring = xlsContext.XlsDoc.WorkBookData.getExternNameByRef(ptgnx.ixti, ptgnx.nameindex); resultStack.Push(opstring); } else if (ptg is PtgName) { var ptgn = (PtgName)ptg; string opstring = xlsContext.XlsDoc.WorkBookData.getDefinedNameByRef(ptgn.nameindex); resultStack.Push(opstring); } else if (ptg is PtgRefErr) { var ptgreferr = (PtgRefErr)ptg; resultStack.Push(ptgreferr.getData()); } else if (ptg is PtgRefErr3d) { try { var ptgreferr3d = (PtgRefErr3d)ptg; string refstring = ExcelHelperClass.EscapeFormulaString(xlsContext.XlsDoc.WorkBookData.getIXTIString(ptgreferr3d.ixti)); resultStack.Push("'" + refstring + "'" + "!" + ptgreferr3d.getData()); } catch (Exception) { resultStack.Push("#REF!"); } } else if (ptg is PtgAreaErr3d) { try { var ptgareaerr3d = (PtgAreaErr3d)ptg; string refstring = ExcelHelperClass.EscapeFormulaString(xlsContext.XlsDoc.WorkBookData.getIXTIString(ptgareaerr3d.ixti)); resultStack.Push("'" + refstring + "'" + "!" + ptgareaerr3d.getData()); } catch (Exception) { resultStack.Push("#REF!"); } } else if (ptg is PtgFunc) { var ptgf = (PtgFunc)ptg; var value = (FtabValues)ptgf.tab; string buffer = value.ToString(); buffer.Replace("_", "."); // no param if (value == FtabValues.NA || value == FtabValues.PI || value == FtabValues.TRUE || value == FtabValues.FALSE || value == FtabValues.RAND || value == FtabValues.NOW || value == FtabValues.TODAY ) { buffer += "()"; } // One param else if (value == FtabValues.ISNA || value == FtabValues.ISERROR || value == FtabValues.SIN || value == FtabValues.COS || value == FtabValues.TAN || value == FtabValues.ATAN || value == FtabValues.SQRT || value == FtabValues.EXP || value == FtabValues.LN || value == FtabValues.LOG10 || value == FtabValues.ABS || value == FtabValues.INT || value == FtabValues.SIGN || value == FtabValues.LEN || value == FtabValues.VALUE || value == FtabValues.NOT || value == FtabValues.DAY || value == FtabValues.MONTH || value == FtabValues.YEAR || value == FtabValues.HOUR || value == FtabValues.MINUTE || value == FtabValues.SECOND || value == FtabValues.AREAS || value == FtabValues.ROWS || value == FtabValues.COLUMNS || value == FtabValues.TRANSPOSE || value == FtabValues.TYPE || value == FtabValues.ASIN || value == FtabValues.ACOS || value == FtabValues.ISREF || value == FtabValues.CHAR || value == FtabValues.LOWER || value == FtabValues.UPPER || value == FtabValues.PROPER || value == FtabValues.TRIM || value == FtabValues.CODE || value == FtabValues.ISERR || value == FtabValues.ISTEXT || value == FtabValues.ISNUMBER || value == FtabValues.ISBLANK || value == FtabValues.T || value == FtabValues.N || value == FtabValues.DATEVALUE || value == FtabValues.TIMEVALUE || value == FtabValues.CLEAN || value == FtabValues.MDETERM || value == FtabValues.MINVERSE || value == FtabValues.FACT || value == FtabValues.ISNONTEXT || value == FtabValues.ISLOGICAL || value == FtabValues.LENB || value == FtabValues.DBCS || value == FtabValues.SINH || value == FtabValues.COSH || value == FtabValues.TANH || value == FtabValues.ASINH || value == FtabValues.ACOSH || value == FtabValues.ATANH || value == FtabValues.INFO || value == FtabValues.ERROR_TYPE || value == FtabValues.GAMMALN || value == FtabValues.EVEN || value == FtabValues.FISHER || value == FtabValues.FISHERINV || value == FtabValues.NORMSDIST || value == FtabValues.NORMSINV || value == FtabValues.ODD || value == FtabValues.RADIANS || value == FtabValues.DEGREES || value == FtabValues.COUNTBLANK || value == FtabValues.DATESTRING || value == FtabValues.PHONETIC ) { buffer += "(" + resultStack.Pop() + ")"; } // two params else if (value == FtabValues.ROUND || value == FtabValues.REPT || value == FtabValues.MOD || value == FtabValues.TEXT || value == FtabValues.ATAN2 || value == FtabValues.EXACT || value == FtabValues.MMULT || value == FtabValues.ROUNDUP || value == FtabValues.ROUNDDOWN || value == FtabValues.FREQUENCY || value == FtabValues.CHIDIST || value == FtabValues.CHIINV || value == FtabValues.COMBIN || value == FtabValues.FLOOR || value == FtabValues.CEILING || value == FtabValues.PERMUT || value == FtabValues.SUMXMY2 || value == FtabValues.SUMX2MY2 || value == FtabValues.SUMX2PY2 || value == FtabValues.CHITEST || value == FtabValues.CORREL || value == FtabValues.COVAR || value == FtabValues.FTEST || value == FtabValues.INTERCEPT || value == FtabValues.PEARSON || value == FtabValues.RSQ || value == FtabValues.STEYX || value == FtabValues.SLOPE || value == FtabValues.LARGE || value == FtabValues.SMALL || value == FtabValues.QUARTILE || value == FtabValues.PERCENTILE || value == FtabValues.TRIMMEAN || value == FtabValues.TINV || value == FtabValues.POWER || value == FtabValues.COUNTIF || value == FtabValues.NUMBERSTRING ) { buffer += "("; string buffer2 = resultStack.Pop(); buffer2 = resultStack.Pop() + "," + buffer2; buffer += buffer2 + ")"; } // Three params else if (value == FtabValues.MID || value == FtabValues.DCOUNT || value == FtabValues.DSUM || value == FtabValues.DAVERAGE || value == FtabValues.DMIN || value == FtabValues.DMAX || value == FtabValues.DSTDEV || value == FtabValues.DVAR || value == FtabValues.MIRR || value == FtabValues.DATE || value == FtabValues.TIME || value == FtabValues.SLN || value == FtabValues.DPRODUCT || value == FtabValues.DSTDEVP || value == FtabValues.DVARP || value == FtabValues.DCOUNTA || value == FtabValues.MIDB || value == FtabValues.DGET || value == FtabValues.CONFIDENCE || value == FtabValues.CRITBINOM || value == FtabValues.EXPONDIST || value == FtabValues.FDIST || value == FtabValues.FINV || value == FtabValues.GAMMAINV || value == FtabValues.LOGNORMDIST || value == FtabValues.LOGINV || value == FtabValues.NEGBINOMDIST || value == FtabValues.NORMINV || value == FtabValues.STANDARDIZE || value == FtabValues.POISSON || value == FtabValues.TDIST || value == FtabValues.FORECAST ) { buffer += "("; string buffer2 = resultStack.Pop(); buffer2 = resultStack.Pop() + "," + buffer2; buffer2 = resultStack.Pop() + "," + buffer2; buffer += buffer2 + ")"; } // four params else if (value == FtabValues.REPLACE || value == FtabValues.SYD || value == FtabValues.REPLACEB || value == FtabValues.BINOMDIST || value == FtabValues.GAMMADIST || value == FtabValues.HYPGEOMDIST || value == FtabValues.NORMDIST || value == FtabValues.WEIBULL || value == FtabValues.TTEST || value == FtabValues.ISPMT ) { buffer += "("; string buffer2 = resultStack.Pop(); buffer2 = resultStack.Pop() + "," + buffer2; buffer2 = resultStack.Pop() + "," + buffer2; buffer2 = resultStack.Pop() + "," + buffer2; buffer += buffer2 + ")"; } if ((int)value != 0xff) { } resultStack.Push(buffer); } else if (ptg is PtgFuncVar) { var ptgfv = (PtgFuncVar)ptg; // is Ftab or Cetab if (!ptgfv.fCelFunc) { var value = (FtabValues)ptgfv.tab; string buffer = value.ToString(); buffer.Replace("_", "."); // 1 to x parameter if (value == FtabValues.COUNT || value == FtabValues.IF || value == FtabValues.ISNA || value == FtabValues.ISERROR || value == FtabValues.AVERAGE || value == FtabValues.MAX || value == FtabValues.MIN || value == FtabValues.SUM || value == FtabValues.ROW || value == FtabValues.COLUMN || value == FtabValues.NPV || value == FtabValues.STDEV || value == FtabValues.DOLLAR || value == FtabValues.FIXED || value == FtabValues.SIN || value == FtabValues.COS || value == FtabValues.LOOKUP || value == FtabValues.INDEX || value == FtabValues.AND || value == FtabValues.OR || value == FtabValues.VAR || value == FtabValues.LINEST || value == FtabValues.TREND || value == FtabValues.LOGEST || value == FtabValues.GROWTH || value == FtabValues.PV || value == FtabValues.FV || value == FtabValues.NPER || value == FtabValues.PMT || value == FtabValues.RATE || value == FtabValues.IRR || value == FtabValues.MATCH || value == FtabValues.WEEKDAY || value == FtabValues.OFFSET || value == FtabValues.ARGUMENT || value == FtabValues.SEARCH || value == FtabValues.CHOOSE || value == FtabValues.HLOOKUP || value == FtabValues.VLOOKUP || value == FtabValues.LOG || value == FtabValues.LEFT || value == FtabValues.RIGHT || value == FtabValues.SUBSTITUTE || value == FtabValues.FIND || value == FtabValues.CELL || value == FtabValues.DDB || value == FtabValues.INDIRECT || value == FtabValues.IPMT || value == FtabValues.PPMT || value == FtabValues.COUNTA || value == FtabValues.PRODUCT || value == FtabValues.STDEVP || value == FtabValues.VARP || value == FtabValues.TRUNC || value == FtabValues.USDOLLAR || value == FtabValues.FINDB || value == FtabValues.SEARCHB || value == FtabValues.LEFTB || value == FtabValues.RIGHTB || value == FtabValues.RANK || value == FtabValues.ADDRESS || value == FtabValues.DAYS360 || value == FtabValues.VDB || value == FtabValues.MEDIAN || value == FtabValues.PRODUCT || value == FtabValues.DB || value == FtabValues.AVEDEV || value == FtabValues.BETADIST || value == FtabValues.BETAINV || value == FtabValues.PROB || value == FtabValues.DEVSQ || value == FtabValues.GEOMEAN || value == FtabValues.HARMEAN || value == FtabValues.SUMSQ || value == FtabValues.KURT || value == FtabValues.SKEW || value == FtabValues.ZTEST || value == FtabValues.PERCENTRANK || value == FtabValues.MODE || value == FtabValues.CONCATENATE || value == FtabValues.SUBTOTAL || value == FtabValues.SUMIF || value == FtabValues.ROMAN || value == FtabValues.GETPIVOTDATA || value == FtabValues.HYPERLINK || value == FtabValues.AVERAGEA || value == FtabValues.MAXA || value == FtabValues.MINA || value == FtabValues.STDEVPA || value == FtabValues.VARPA || value == FtabValues.STDEVA || value == FtabValues.VARA ) { buffer += "("; string buffer2 = resultStack.Pop(); for (int i = 1; i < ptgfv.cparams; i++) { buffer2 = resultStack.Pop() + "," + buffer2; } buffer += buffer2 + ")"; resultStack.Push(buffer); } else if ((int)value == 0xFF) { buffer = "("; string buffer2 = resultStack.Pop(); for (int i = 1; i < ptgfv.cparams - 1; i++) { buffer2 = resultStack.Pop() + "," + buffer2; } buffer += buffer2 + ")"; // take the additional Operator from the Operandstack buffer = resultStack.Pop() + buffer; resultStack.Push(buffer); } } } else if (ptg is PtgMemFunc) { string value; value = FormulaInfixMapping.mapFormula(((PtgMemFunc)ptg).ptgStack, xlsContext); resultStack.Push(value); } } } catch (Exception ex) { TraceLogger.DebugInternal(ex.Message.ToString()); resultStack.Push(""); } if (resultStack.Count == 0) { resultStack.Push(""); } return(resultStack.Pop()); }
/// <summary> /// Extracting the data from the stream /// </summary> public override void extractData() { BiffHeader bh, latestbiff; BOF firstBOF = null; //try //{ while (this.StreamReader.BaseStream.Position < this.StreamReader.BaseStream.Length) { bh.id = (RecordType)this.StreamReader.ReadUInt16(); bh.length = this.StreamReader.ReadUInt16(); // TraceLogger.DebugInternal("BIFF {0}\t{1}\t", bh.id, bh.length); Console.WriteLine("WORKSHEET-BIFF {0}\t{1}\t", bh.id, bh.length); switch (bh.id) { case RecordType.EOF: { this.StreamReader.BaseStream.Seek(0, SeekOrigin.End); } break; case RecordType.BOF: { var bof = new BOF(this.StreamReader, bh.id, bh.length); switch (bof.docType) { case BOF.DocumentType.WorkbookGlobals: case BOF.DocumentType.Worksheet: firstBOF = bof; break; case BOF.DocumentType.Chart: // parse chart break; default: this.readUnknownFile(); break; } } break; case RecordType.LabelSst: { var labelsst = new LabelSst(this.StreamReader, bh.id, bh.length); this.bsd.addLabelSST(labelsst); } break; case RecordType.MulRk: { var mulrk = new MulRk(this.StreamReader, bh.id, bh.length); this.bsd.addMULRK(mulrk); } break; case RecordType.Number: { var number = new Number(this.StreamReader, bh.id, bh.length); this.bsd.addNUMBER(number); } break; case RecordType.RK: { var rk = new RK(this.StreamReader, bh.id, bh.length); this.bsd.addRK(rk); } break; case RecordType.MergeCells: { var mergecells = new MergeCells(this.StreamReader, bh.id, bh.length); this.bsd.MERGECELLSData = mergecells; } break; case RecordType.Blank: { var blankcell = new Blank(this.StreamReader, bh.id, bh.length); this.bsd.addBLANK(blankcell); } break; case RecordType.MulBlank: { var mulblank = new MulBlank(this.StreamReader, bh.id, bh.length); this.bsd.addMULBLANK(mulblank); } break; case RecordType.Formula: { var formula = new Formula(this.StreamReader, bh.id, bh.length); this.bsd.addFORMULA(formula); TraceLogger.DebugInternal(formula.ToString()); } break; case RecordType.Array: { var array = new ARRAY(this.StreamReader, bh.id, bh.length); this.bsd.addARRAY(array); } break; case RecordType.ShrFmla: { var shrfmla = new ShrFmla(this.StreamReader, bh.id, bh.length); this.bsd.addSharedFormula(shrfmla); } break; case RecordType.String: { var formulaString = new STRING(this.StreamReader, bh.id, bh.length); this.bsd.addFormulaString(formulaString.value); } break; case RecordType.Row: { var row = new Row(this.StreamReader, bh.id, bh.length); this.bsd.addRowData(row); } break; case RecordType.ColInfo: { var colinfo = new ColInfo(this.StreamReader, bh.id, bh.length); this.bsd.addColData(colinfo); } break; case RecordType.DefColWidth: { var defcolwidth = new DefColWidth(this.StreamReader, bh.id, bh.length); this.bsd.addDefaultColWidth(defcolwidth.cchdefColWidth); } break; case RecordType.DefaultRowHeight: { var defrowheigth = new DefaultRowHeight(this.StreamReader, bh.id, bh.length); this.bsd.addDefaultRowData(defrowheigth); } break; case RecordType.LeftMargin: { var leftm = new LeftMargin(this.StreamReader, bh.id, bh.length); this.bsd.leftMargin = leftm.value; } break; case RecordType.RightMargin: { var rightm = new RightMargin(this.StreamReader, bh.id, bh.length); this.bsd.rightMargin = rightm.value; } break; case RecordType.TopMargin: { var topm = new TopMargin(this.StreamReader, bh.id, bh.length); this.bsd.topMargin = topm.value; } break; case RecordType.BottomMargin: { var bottomm = new BottomMargin(this.StreamReader, bh.id, bh.length); this.bsd.bottomMargin = bottomm.value; } break; case RecordType.Setup: { var setup = new Setup(this.StreamReader, bh.id, bh.length); this.bsd.addSetupData(setup); } break; case RecordType.HLink: { long oldStreamPos = this.StreamReader.BaseStream.Position; try { var hlink = new HLink(this.StreamReader, bh.id, bh.length); this.bsd.addHyperLinkData(hlink); } catch (Exception ex) { this.StreamReader.BaseStream.Seek(oldStreamPos, System.IO.SeekOrigin.Begin); this.StreamReader.BaseStream.Seek(bh.length, System.IO.SeekOrigin.Current); TraceLogger.Debug("Link parse error"); TraceLogger.Error(ex.StackTrace); } } break; case RecordType.MsoDrawing: { // Record header has already been read. Reset position to record beginning. this.StreamReader.BaseStream.Position -= 2 * sizeof(ushort); this.bsd.ObjectsSequence = new ObjectsSequence(this.StreamReader); } break; default: { // this else statement is used to read BiffRecords which aren't implemented var buffer = new byte[bh.length]; buffer = this.StreamReader.ReadBytes(bh.length); } break; } latestbiff = bh; } //} //catch (Exception ex) //{ // TraceLogger.Error(ex.Message); // TraceLogger.Error(ex.StackTrace); // TraceLogger.Debug(ex.ToString()); //} }
/// <summary> /// Add a xf biff record to the internal data list /// </summary> /// <param name="xf"></param> public void addXFDataValue(XF xf) { XFData xfdata = new XFData(); xfdata.fStyle = xf.fStyle; xfdata.ifmt = xf.ifmt; xfdata.ixfParent = xf.ixfParent; if (xf.fWrap != 0) { xfdata.wrapText = true; xfdata.hasAlignment = true; } if (xf.alc != 0xFF) { xfdata.hasAlignment = true; xfdata.horizontalAlignment = xf.alc; } if (xf.alcV != 0x02) { xfdata.hasAlignment = true; } xfdata.verticalAlignment = xf.alcV; if (xf.fJustLast != 0) { xfdata.hasAlignment = true; xfdata.justifyLastLine = true; } if (xf.fShrinkToFit != 0) { xfdata.hasAlignment = true; xfdata.shrinkToFit = true; } if (xf.trot != 0) { xfdata.hasAlignment = true; xfdata.textRotation = xf.trot; } if (xf.cIndent != 0) { xfdata.hasAlignment = true; xfdata.indent = xf.cIndent; } if (xf.iReadOrder != 0) { xfdata.hasAlignment = true; xfdata.readingOrder = xf.iReadOrder; } // the first three fontids are zero based // beginning with four the fontids are one based if (xf.ifnt > 4) { xfdata.fontId = xf.ifnt - 1; } else { xfdata.fontId = xf.ifnt; } if (xf.fStyle == 1) { this.xfCellStyleDataList.Add(xfdata); } else { this.xfCellDataList.Add(xfdata); } int countxf = this.XFCellDataList.Count + this.xfCellStyleDataList.Count; FillData fd = new FillData((StyleEnum)xf.fls, xf.icvFore, xf.icvBack); int fillDataId = this.addFillDataValue(fd); TraceLogger.DebugInternal(fd.ToString() + " -- Number XF " + countxf.ToString() + " -- Number FillData: " + this.fillDataList.Count); xfdata.fillId = fillDataId; // add border data BorderData borderData = new BorderData(); // diagonal value borderData.diagonalValue = (ushort)xf.grbitDiag; // create and add borderparts BorderPartData top = new BorderPartData((ushort)xf.dgTop, xf.icvTop); borderData.top = top; BorderPartData bottom = new BorderPartData((ushort)xf.dgBottom, xf.icvBottom); borderData.bottom = bottom; BorderPartData left = new BorderPartData((ushort)xf.dgLeft, xf.icvLeft); borderData.left = left; BorderPartData right = new BorderPartData((ushort)xf.dgRight, xf.icvRight); borderData.right = right; BorderPartData diagonal = new BorderPartData((ushort)xf.dgDiag, xf.icvDiag); borderData.diagonal = diagonal; int borderId = this.addBorderDataValue(borderData); xfdata.borderId = borderId; }
override public void Apply(RegularContainer slide) { this.Slide = (Slide)slide; TraceLogger.DebugInternal("SlideMapping.Apply"); // Associate slide with slide layout var slideAtom = slide.FirstChildWithType <SlideAtom>(); uint mainMasterId = GetMainMasterId(slideAtom); var layoutManager = this._ctx.GetOrCreateLayoutManagerByMasterId(mainMasterId); SlideLayoutPart layoutPart = null; var masterInfo = slide.FirstChildWithType <RoundTripContentMasterId12>(); // PPT2007 OOXML-Layout if (masterInfo != null) { layoutPart = layoutManager.GetLayoutPartByInstanceId(masterInfo.ContentMasterInstanceId); } // Pre-PPT2007 Title master layout else if (mainMasterId != slideAtom.MasterId) { layoutPart = layoutManager.GetOrCreateLayoutPartForTitleMasterId(slideAtom.MasterId); } // Pre-PPT2007 SSlideLayoutAtom primitive SlideLayoutType layout else { var m = (MainMaster)this._ctx.Ppt.FindMasterRecordById(slideAtom.MasterId); if (m.Layouts.Count == 1 && slideAtom.Layout.Geom == SlideLayoutType.Blank) { foreach (string layout in m.Layouts.Values) { string output = Tools.Utils.replaceOutdatedNamespaces(layout); layoutPart = layoutManager.GetOrCreateLayoutPartByCode(output); } } else { layoutPart = layoutManager.GetOrCreateLayoutPartByLayoutType(slideAtom.Layout.Geom, slideAtom.Layout.PlaceholderTypes); } } this.targetPart.ReferencePart(layoutPart); // Start the document this._writer.WriteStartDocument(); this._writer.WriteStartElement("p", "sld", OpenXmlNamespaces.PresentationML); // Force declaration of these namespaces at document start this._writer.WriteAttributeString("xmlns", "a", null, OpenXmlNamespaces.DrawingML); // Force declaration of these namespaces at document start this._writer.WriteAttributeString("xmlns", "r", null, OpenXmlNamespaces.Relationships); if (Tools.Utils.BitmaskToBool(slideAtom.Flags, 0x1 << 0) == false) { this._writer.WriteAttributeString("showMasterSp", "0"); } // TODO: Write slide data of master slide this._writer.WriteStartElement("p", "cSld", OpenXmlNamespaces.PresentationML); var sc = slide.FirstChildWithType <PPDrawing>().FirstChildWithType <DrawingContainer>().FirstChildWithType <ShapeContainer>(); if (sc != null) { var sh = sc.FirstChildWithType <Shape>(); var so = sc.FirstChildWithType <ShapeOptions>(); if (so.OptionsByID.ContainsKey(ShapeOptions.PropertyId.FillStyleBooleanProperties)) { bool ignore = false; if (sc.AllChildrenWithType <ShapeOptions>().Count > 1) { var so2 = sc.AllChildrenWithType <ShapeOptions>()[1]; if (so2.OptionsByID.ContainsKey(ShapeOptions.PropertyId.FillStyleBooleanProperties)) { var p2 = new FillStyleBooleanProperties(so2.OptionsByID[ShapeOptions.PropertyId.FillStyleBooleanProperties].op); if (!p2.fUsefFilled || !p2.fFilled) { ignore = true; } } } var sa = slide.FirstChildWithType <SlideAtom>(); if (Tools.Utils.BitmaskToBool(sa.Flags, 0x1 << 2)) { ignore = true; //this means the slide gets its background from the master } if (!ignore) { this._writer.WriteStartElement("p", "bg", OpenXmlNamespaces.PresentationML); this._writer.WriteStartElement("p", "bgPr", OpenXmlNamespaces.PresentationML); var p = new FillStyleBooleanProperties(so.OptionsByID[ShapeOptions.PropertyId.FillStyleBooleanProperties].op); if (p.fUsefFilled & p.fFilled) // so.OptionsByID.ContainsKey(ShapeOptions.PropertyId.fillType)) { new FillMapping(this._ctx, this._writer, this).Apply(so); } this._writer.WriteElementString("a", "effectLst", OpenXmlNamespaces.DrawingML, ""); this._writer.WriteEndElement(); //p:bgPr this._writer.WriteEndElement(); //p:bg } } } this._writer.WriteStartElement("p", "spTree", OpenXmlNamespaces.PresentationML); this.shapeTreeMapping = new ShapeTreeMapping(this._ctx, this._writer); this.shapeTreeMapping.parentSlideMapping = this; this.shapeTreeMapping.Apply(slide.FirstChildWithType <PPDrawing>()); checkHeaderFooter(this.shapeTreeMapping); this._writer.WriteEndElement(); //spTree this._writer.WriteEndElement(); //cSld // TODO: Write clrMapOvr if (slide.FirstChildWithType <SlideShowSlideInfoAtom>() != null) { new SlideTransitionMapping(this._ctx, this._writer).Apply(slide.FirstChildWithType <SlideShowSlideInfoAtom>()); } if (slide.FirstChildWithType <ProgTags>() != null) { if (slide.FirstChildWithType <ProgTags>().FirstChildWithType <ProgBinaryTag>() != null) { if (slide.FirstChildWithType <ProgTags>().FirstChildWithType <ProgBinaryTag>().FirstChildWithType <ProgBinaryTagDataBlob>() != null) { new AnimationMapping(this._ctx, this._writer).Apply(slide.FirstChildWithType <ProgTags>().FirstChildWithType <ProgBinaryTag>().FirstChildWithType <ProgBinaryTagDataBlob>(), this, this.shapeTreeMapping.animinfos, this.shapeTreeMapping); } } } // End the document this._writer.WriteEndElement(); //sld this._writer.WriteEndDocument(); this._writer.Flush(); }
/// <summary> /// Extracts the data from the stream /// </summary> public override void extractData() { BiffHeader bh; //try //{ while (this.StreamReader.BaseStream.Position < this.StreamReader.BaseStream.Length) { bh.id = (RecordType)this.StreamReader.ReadUInt16(); bh.length = this.StreamReader.ReadUInt16(); // Debugging output TraceLogger.DebugInternal("BIFF {0}\t{1}\t", bh.id, bh.length); switch (bh.id) { case RecordType.BoundSheet8: { // Extracts the Boundsheet data BoundSheet8 bs = new BoundSheet8(this.StreamReader, bh.id, bh.length); TraceLogger.DebugInternal(bs.ToString()); SheetData sheetData = null; switch (bs.dt) { case BoundSheet8.SheetType.Worksheet: sheetData = new WorkSheetData(); this.oldOffset = this.StreamReader.BaseStream.Position; this.StreamReader.BaseStream.Seek(bs.lbPlyPos, SeekOrigin.Begin); WorksheetExtractor se = new WorksheetExtractor(this.StreamReader, sheetData as WorkSheetData); this.StreamReader.BaseStream.Seek(oldOffset, SeekOrigin.Begin); break; case BoundSheet8.SheetType.Chartsheet: ChartSheetData chartSheetData = new ChartSheetData(); this.oldOffset = this.StreamReader.BaseStream.Position; this.StreamReader.BaseStream.Seek(bs.lbPlyPos, SeekOrigin.Begin); chartSheetData.ChartSheetSequence = new ChartSheetSequence(this.StreamReader); this.StreamReader.BaseStream.Seek(oldOffset, SeekOrigin.Begin); sheetData = chartSheetData; break; default: TraceLogger.Info("Unsupported sheet type: {0}", bs.dt); break; } if (sheetData != null) { // add general sheet info sheetData.boundsheetRecord = bs; this.workBookData.addBoundSheetData(sheetData); } } break; case RecordType.Template: { this.workBookData.Template = true; } break; case RecordType.SST: { /* reads the shared string table biff record and following continue records * creates an array of bytes and then puts that into a memory stream * this all is used to create a longer biffrecord then 8224 bytes. If theres a string * beginning in the SST that is then longer then the 8224 bytes, it continues in the * CONTINUE BiffRecord, so the parser has to read over the SST border. * The problem here is, that the parser has to overread the continue biff record header */ //SST sst; //UInt16 length = bh.length; //// save the old offset from this record begin //this.oldOffset = this.StreamReader.BaseStream.Position; //// create a list of bytearrays to store the following continue records //// List<byte[]> byteArrayList = new List<byte[]>(); //byte[] buffer = new byte[length]; //LinkedList<VirtualStreamReader> vsrList = new LinkedList<VirtualStreamReader>(); //buffer = this.StreamReader.ReadBytes((int)length); //// byteArrayList.Add(buffer); //// create a new memory stream and a new virtualstreamreader //MemoryStream bufferstream = new MemoryStream(buffer); //VirtualStreamReader binreader = new VirtualStreamReader(bufferstream); //BiffHeader bh2; //bh2.id = (RecordType)this.StreamReader.ReadUInt16(); //while (bh2.id == RecordType.Continue) //{ // bh2.length = (UInt16)(this.StreamReader.ReadUInt16()); // buffer = new byte[bh2.length]; // // create a buffer with the bytes from the records and put that array into the // // list // buffer = this.StreamReader.ReadBytes((int)bh2.length); // // byteArrayList.Add(buffer); // // create for each continue record a new streamreader !! // MemoryStream contbufferstream = new MemoryStream(buffer); // VirtualStreamReader contreader = new VirtualStreamReader(contbufferstream); // vsrList.AddLast(contreader); // // take next Biffrecord ID // bh2.id = (RecordType)this.StreamReader.ReadUInt16(); //} //// set the old position of the stream //this.StreamReader.BaseStream.Position = this.oldOffset; SST sst = new SST(this.StreamReader, bh.id, bh.length); //this.StreamReader.BaseStream.Position = this.oldOffset + bh.length; this.workBookData.SstData = sst; } break; case RecordType.EOF: { // Reads the end of the internal file !!! this.StreamReader.BaseStream.Seek(0, SeekOrigin.End); } break; case RecordType.ExternSheet: { ExternSheet extsheet = new ExternSheet(this.StreamReader, bh.id, bh.length); this.externSheets.Add(extsheet); this.workBookData.addExternSheetData(extsheet); } break; case RecordType.SupBook: { SupBook supbook = new SupBook(this.StreamReader, bh.id, bh.length); this.supBooks.Add(supbook); this.workBookData.addSupBookData(supbook); } break; case RecordType.XCT: { XCT xct = new XCT(this.StreamReader, bh.id, bh.length); this.XCTList.Add(xct); this.workBookData.addXCT(xct); } break; case RecordType.CRN: { CRN crn = new CRN(this.StreamReader, bh.id, bh.length); this.CRNList.Add(crn); this.workBookData.addCRN(crn); } break; case RecordType.ExternName: { ExternName externname = new ExternName(this.StreamReader, bh.id, bh.length); this.workBookData.addEXTERNNAME(externname); } break; case RecordType.Format: { Format format = new Format(this.StreamReader, bh.id, bh.length); this.workBookData.styleData.addFormatValue(format); } break; case RecordType.XF: { XF xf = new XF(this.StreamReader, bh.id, bh.length); this.workBookData.styleData.addXFDataValue(xf); } break; case RecordType.Style: { Style style = new Style(this.StreamReader, bh.id, bh.length); this.workBookData.styleData.addStyleValue(style); } break; case RecordType.Font: { Font font = new Font(this.StreamReader, bh.id, bh.length); this.workBookData.styleData.addFontData(font); } break; case RecordType.NAME: case RecordType.Lbl: { Lbl name = new Lbl(this.StreamReader, bh.id, bh.length); this.workBookData.addDefinedName(name); } break; case RecordType.BOF: { this.workBookData.BOF = new BOF(this.StreamReader, bh.id, bh.length); } break; case RecordType.CodeName: { this.workBookData.CodeName = new CodeName(this.StreamReader, bh.id, bh.length); } break; case RecordType.FilePass: { throw new ExtractorException(ExtractorException.FILEENCRYPTED); } break; case RecordType.Palette: { Palette palette = new Palette(this.StreamReader, bh.id, bh.length); workBookData.styleData.setColorList(palette.rgbColorList); } break; default: { // this else statement is used to read BiffRecords which aren't implemented byte[] buffer = new byte[bh.length]; buffer = this.StreamReader.ReadBytes(bh.length); TraceLogger.Debug("Unknown record found. ID {0}", bh.id); } break; } } //} //catch (Exception ex) //{ // TraceLogger.Error(ex.Message); // TraceLogger.Debug(ex.ToString()); //} }