/// <summary> /// Retrieves the response-functions answer to the browser in a usable format. /// </summary> /// <param name="sessionData">the current sessionData</param> /// <returns>the responded message</returns> protected string GetResponse(SessionData sessionData) { string param = ""; if (sessionData is HttpSessionData) { param = sessionData.GetHttpHeadValue("value"); } if (param == null) { param = ""; } var entries = _func(sessionData, param).ToArray(); string ret = ""; for (int i = 0; i < entries.Length; i++) { ret += new HLink(entries[i].Item1, entries[i].Item2) { DescriptionTags = "onmousedown='" + new JScript(JSValue.CurrentBrowserURL.Set((JSStringValue)entries[i].Item2), JSElement.GetByID(ContainerID).Hide) + "'" }; if (i + 1 < entries.Length) { ret += new HNewLine(); } } return(ret); }
public void addHyperLinkData(HLink hlink) { HyperlinkData hld = new HyperlinkData(); hld.colFirst = hlink.colFirst; hld.colLast = hlink.colLast; hld.rwFirst = hlink.rwFirst; hld.rwLast = hlink.rwLast; hld.absolute = hlink.hlstmfIsAbsolute; hld.url = hlink.monikerString; hld.location = hlink.location; hld.display = hlink.displayName; this.HyperLinkList.Add(hld); }
static IHtmlControl JumpElement(string urlWithoutPageIndex, int pageIndex, bool isSelected, bool isFirst) { IHtmlControl jumpItem = null; if (!isSelected) { jumpItem = new HLink(JumpPageUrl(urlWithoutPageIndex, pageIndex), (pageIndex + 1).ToString()); } else { jumpItem = new HLabel(pageIndex + 1).FontBold(); } HPanel jumpElement = new HPanel( !isFirst ? new HLabel(" | ").MarginLeft(5).MarginRight(5) : null, jumpItem ).InlineBlock(); //if (!isFirst) // jumpElement.BorderLeft("1px solid #000"); return(jumpElement); }
/// <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()); //} }
/// <inheritdoc /> public override HElement GetContents(SessionData sessionData, string requestedAction, WalkableQueue <Tuple <ID, string> > positionQueue) { if (positionQueue.AtEnd()) { HElement list = new HList(HList.EListType.UnorderedList, (from s in _subNodes select GetLink(s.Value.Name, s.Key, positionQueue, positionQueue.Position, null)).ToArray()) { Class = "subnodes" }; if (((HList)list).IsEmpty()) { list = new HItalic("This DebugNode includes no Subnodes.") { Class = "subnodes" } } ; else { list = new HHeadline("Subnodes of this DebugNode", 3) { Class = "subnodes" } } +list; return(new HHeadline(Name) + new HLine() { Class = "start" } +(_description == null ? new HText(_description) : (HElement) new HString()) + new HContainer(GetElements(sessionData)) + new HLine() { Class = "subnodes" } +list); } else { HLink navlink = GetLink(this); navlink.Class = "nav"; HInlineContainer name = new HInlineContainer() { Elements = { navlink } }; DebugResponseNode node = null; positionQueue.Pop(); if (_subNodes) { node = _subNodes[positionQueue.Peek().Item1]; } if (ReferenceEquals(node, null)) { HElement list = new HList(HList.EListType.UnorderedList, (from s in _subNodes select GetLink(s.Value.Name, s.Value.URL)).ToArray()) { Class = "subnodes" }; if (((HList)list).IsEmpty()) { list = new HItalic("This DebugNode includes no Subnodes.") { Class = "subnodes" } } ; else { list = new HHeadline("Subnodes of this DebugNode", 3) { Class = "subnodes" } } +list; return(name + new HHeadline(Name) + new HLine() { Class = "start" } +new HText($"The ID '{positionQueue.Peek().Item1.Value}' is not a child of this {nameof(DebugContainerResponseNode)}.") { Class = "invalid" } +new HLine() { Class = "subnodes" } +list); } else { return(name + node.GetContents(sessionData, positionQueue.Peek().Item2, positionQueue)); } } }