public PolarFunctionCloud(ITextDecoder decoder, ITextHandler textHandler) { Generator = new ImageGenerator(this); _decoder = decoder; TextHandler = textHandler; frames = new HashSet<Rectangle>(); }
/// <summary> /// Returns a PDF action result. This method renders the view to a string then /// use that string to generate a PDF file. The generated PDF file is then /// returned to the browser as binary content. The view associated with this /// action should render an XML compatible with iTextSharp xml format. /// </summary> /// <param name="model">The model to send to the view.</param> /// <returns>The resulted BinaryContentResult.</returns> protected ActionResult ViewPdf(object model) { // Create the iTextSharp document. Document doc = new Document(); // Set the document to write to memory. MemoryStream memStream = new MemoryStream(); PdfWriter writer = PdfWriter.GetInstance(doc, memStream); writer.CloseStream = false; doc.Open(); // Render the view xml to a string, then parse that string into an XML dom. string xmltext = this.RenderActionResultToString(this.View(model)); XmlDocument xmldoc = new XmlDocument(); xmldoc.InnerXml = xmltext.Trim(); // Parse the XML into the iTextSharp document. ITextHandler textHandler = new ITextHandler(doc); textHandler.Parse(xmldoc); // Close and get the resulted binary data. doc.Close(); byte[] buf = new byte[memStream.Position]; memStream.Position = 0; memStream.Read(buf, 0, buf.Length); // Send the binary data to the browser. return(new BinaryContentResult(buf, "application/pdf")); }
public Chap0702() { Console.WriteLine("Chapter 7 example 2: parsing the result of example 1"); // step 1: creation of a document-object Document document = new Document(); try { // step 2: // we create a writer that listens to the document // and directs a XML-stream to a file PdfWriter.GetInstance(document, new FileStream("Chap0702.pdf", FileMode.Create)); HtmlWriter.GetInstance(document, new FileStream("Chap0702.htm", FileMode.Create)); RtfWriter.GetInstance(document, new FileStream("Chap0702.rtf", FileMode.Create)); // step 3: we create a parser ITextHandler h = new ITextHandler(document); // step 4: we parse the document h.Parse("Chap0701.xml"); } catch (Exception e) { Console.Error.WriteLine(e.StackTrace); Console.Error.WriteLine(e.Message); } }
public void Setup() { textHandler = new TextHandlerService(); text = "Words can be like bricks - bad for your teeth."; dir = $@"{AppDomain.CurrentDomain.BaseDirectory}Tests\"; path = $"{dir}TestFile.test"; outputPath = $"{dir}OutputTestFile.test"; }
public PolarFunctionCloud(int width, int height, ITextDecoder decoder, ITextHandler textHandler) { _decoder = decoder; Size = new Size(width, height); TextHandler = textHandler; frames = new HashSet<Rectangle>(); MoreDensity = false; WordScale = 7; }
public ExampleAction( ITagCloudBuilder tagCloudBuilder, ICloudVisualizer cloudVisualizer, ITextReader textReader, ITextHandler textHandler, SpiralParams spiralParams) { this.tagCloudBuilder = tagCloudBuilder; this.cloudVisualizer = cloudVisualizer; this.textReader = textReader; this.textHandler = textHandler; this.spiralParams = spiralParams; }
public void XmlToRtf(string xmlDoc, string strFilename) { Document document = new Document(); MemoryStream ms = new MemoryStream(); Phrase headerPhrase; Phrase footerPhrase; // iTextSharp RtfWriter2 writer = RtfWriter2.GetInstance(document, ms); footerPhrase = new Phrase("", new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 8)); RtfHeaderFooter footer = new RtfHeaderFooter(footerPhrase); footer.SetAlignment("center"); writer.Footer = footer; AssemblyName an = this.GetType().Assembly.GetName(); headerPhrase = new Phrase( "Use Case Maker " + an.Version.ToString(3), new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 8)); RtfHeaderFooter header = new RtfHeaderFooter(headerPhrase); header.SetAlignment("right"); writer.Header = header; StringReader sr = new StringReader(xmlDoc); XmlTextReader reader = new XmlTextReader(sr); ITextHandler xmlHandler = new ITextHandler(document); try { xmlHandler.Parse(reader); } catch (Exception e) { ms.Close(); throw e; } finally { reader.Close(); sr.Close(); } //Write output file FileStream fs = new FileStream(strFilename, FileMode.Create); BinaryWriter bw = new BinaryWriter(fs); bw.Write(ms.ToArray()); bw.Close(); fs.Close(); ms.Close(); }
/// <summary> /// Genera el archivo PDF /// </summary> private void GenerarArchivoPDF(XDocument xml) { const string version = "1.0"; const string codificacion = "ISO-8859-1"; var xmlString = String.Format("{0}\r{1}", "<?xml version='" + version + "' encoding='" + codificacion + "' ?>", xml); var output = new MemoryStream(); var document = new Document(); //document.SetPageSize(PageSize.A4.Rotate()); //document.Open(); PdfWriter.GetInstance(document, output); var xmlHandler = new ITextHandler(document); var documentoXML = new XmlDocument(); documentoXML.LoadXml(xmlString); xmlHandler.Parse(documentoXML); if (string.IsNullOrWhiteSpace(NombreArchivo)) { NombreArchivo = "Reporte"; } var file = new SaveFileDialog { FileName = NombreArchivo, Filter = @"Archivos PDF|*.pdf", Title = @"Guardar Archivo PDF" }; var result = file.ShowDialog(); if (result == DialogResult.OK) { if (file.FileName != "") { if (File.Exists(file.FileName)) { try { var archivoPDF = new FileStream(file.FileName, FileMode.Open); archivoPDF.Close(); } catch (IOException) { throw new ExcepcionServicio(Properties.Resources.ExportarExcel_ArchivoAbierto); } } File.WriteAllBytes(file.FileName, output.ToArray()); RutaFinal = file.FileName; } } }
/// <summary> /// Ctor WmlToHtmlConverterSettings /// </summary> /// <param name="pageTitle">Page title</param> /// <param name="customImageHandler">Handler used to convert open XML images to HTML images</param> /// <param name="textHandler">Handler used to convert open XML text to HTML compatible text</param> /// <param name="symbolHandler">Handler used to convert open XML symbols to HTML compatible text</param> /// <param name="breakHandler">Handler used to convert open XML breaks to HTML equivalent</param> /// <param name="fontHandler">Handler used translate open XML fonts to HTML equivalent</param> /// <param name="fabricateCssClasses">Set to true, if CSS style should be stored in classes instead of an inline attribute on each node</param> /// <param name="generalCss">Optional CSS, default is "span { white-space: pre-wrap; }"</param> /// <param name="additionalCss">Optional CSS, default is "body { margin: 1cm auto; max-width: 20cm; padding: 0; }"</param> /// <param name="cssClassPrefix">Optional CSS class name prefix, default is "pt-"</param> public WmlToHtmlConverterSettings(string pageTitle, IImageHandler customImageHandler, ITextHandler textHandler, ISymbolHandler symbolHandler, IBreakHandler breakHandler, IFontHandler fontHandler, bool fabricateCssClasses, string generalCss = defaultgeneralCss, string additionalCss = defaultAdditionalCss, string cssClassPrefix = defaultCssClassPrefix) { AdditionalCss = additionalCss; GeneralCss = generalCss; PageTitle = pageTitle; FabricateCssClasses = fabricateCssClasses; CssClassPrefix = cssClassPrefix; ImageHandler = customImageHandler; TextHandler = textHandler; SymbolHandler = symbolHandler; BreakHandler = breakHandler; FontHandler = fontHandler; }
// public void WriteXMLToPDF(string FileName, string TextToWrite, Rectangle pageSize, bool landscape) { string filePath = HttpContext.Current.Server.MapPath("PDF"); if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } filePath += "/" + FileName + ".pdf"; Document document = new Document(); if (landscape) { document.SetPageSize(pageSize.Rotate()); } else { document.SetPageSize(pageSize); } PdfWriter.GetInstance(document, new FileStream(filePath, FileMode.Create)); document.Open(); //EtrekReports.text.html.simpleparser.HTMLWorker hw = new EtrekReports.text.html.simpleparser.HTMLWorker(document); //hw.Parse(new StringReader(TextToWrite)); //ITextHandler xmlHandler = new ITextHandler(document); //XmlDocument doc = new XmlDocument(); //doc.LoadXml(TextToWrite); // error thrown here //XDocument doc; // using (StringReader s = new StringReader(TextToWrite)) //{ // doc = XDocument.Load(s); //} ITextHandler xmlHandler = new ITextHandler(document); // step 4: we parse the document xmlHandler.Parse(TextToWrite); document.Close(); HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + filePath); HttpContext.Current.Response.ContentType = "application/pdf"; HttpContext.Current.Response.WriteFile(filePath); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.Clear(); }
/// <summary> /// Конструктор главной модели представления /// </summary> /// <param name="MainWindow">главное окно</param> /// <param name="DialogService">сервис работы с диалоговыми окнами</param> /// <param name="FileHandlerService">сервис работы с обработчиком файлов</param> /// <param name="InfoFile">сервис работы с информационным файлом</param> public MainViewModel(MainWindow MainWindow, IDialogService DialogService, ITextHandler FileHandlerService, IInfoFileService InfoFile) { this.mainWindow = MainWindow; this.dialogService = DialogService; this.textHandlerService = FileHandlerService; this.infoFileService = InfoFile; Documents = new ObservableCollection <Document>(); // Инициализация BackgroundWorker для реализации многопоточности this.Worker = new BackgroundWorker { WorkerReportsProgress = true }; this.Worker.DoWork += Worker_DoWork; this.Worker.RunWorkerCompleted += Worker_RunWorkerCompleted; // Инициализация значений по умолчанию для свойств отвечающих за параметры обработки текста MinWordLength = 5; RemovePunctuationMarks = true; }
/// <summary> /// Genera el archivo PDF /// </summary> private MemoryStream GenerarArchivoPDF(XDocument xml) { const string version = "1.0"; const string codificacion = "ISO-8859-1"; var xmlString = String.Format("{0}\r{1}", "<?xml version='" + version + "' encoding='" + codificacion + "' ?>", xml); var output = new MemoryStream(); var document = new Document(); PdfWriter.GetInstance(document, output); var xmlHandler = new ITextHandler(document); var documentoXML = new XmlDocument(); documentoXML.LoadXml(xmlString); xmlHandler.Parse(documentoXML); return(output); }
public void XmlToPdf(string xmlDoc, string strFilename) { Document document = new Document(); MemoryStream ms = new MemoryStream(); // iTextSharp PdfWriter writer = PdfWriter.GetInstance(document, ms); MyPageEvents pageEvents = new MyPageEvents(); writer.PageEvent = pageEvents; StringReader sr = new StringReader(xmlDoc); XmlTextReader reader = new XmlTextReader(sr); ITextHandler xmlHandler = new ITextHandler(document); try { xmlHandler.Parse(reader); } catch (Exception e) { ms.Close(); throw e; } finally { reader.Close(); sr.Close(); } //Write output file FileStream fs = new FileStream(strFilename, FileMode.Create); BinaryWriter bw = new BinaryWriter(fs); bw.Write(ms.ToArray()); bw.Close(); fs.Close(); ms.Close(); }
/// <summary> /// Genera el XML que se guarda en la tabla /// </summary> /// <param name="checkListCorral">contenedor donde se encuentra la información del Check List</param> /// <param name="xml">Layout del XML</param> /// <returns></returns> internal static void ArmarXML(CheckListCorralInfo checkListCorral, XDocument xml) { ArmarNodoTablaCheckList(xml, checkListCorral); ArmarNodoTablaGanado(xml, checkListCorral.ListaConceptos); ArmarNodoTablaCorral(xml, checkListCorral.ListaAcciones); var version = "1.0"; var codificacion = "ISO-8859-1"; var xmlString = String.Format("{0}\r{1}", "<?xml version='" + version + "' encoding='" + codificacion + "' ?>", xml); var output = new MemoryStream(); var document = new Document(); PdfWriter.GetInstance(document, output); var xmlHandler = new ITextHandler(document); var documentoXML = new XmlDocument(); documentoXML.LoadXml(xmlString); xmlHandler.Parse(documentoXML); checkListCorral.PDF = output.ToArray(); }
static void SolutionWithFullDI() { Console.WriteLine("Hello i need a text, i'm a software very curious"); Console.WriteLine("Please give me a text and press enter"); string textQuery = Console.ReadLine(); ITextHandler textHandler = Container.Resolve <ITextHandler>(); Console.WriteLine("Now i am going to sort your text: "); Console.WriteLine(textHandler.Sort(textQuery, DIService.ContainerService.ResolveKeyed <ITextSorter>(eSortMode.AlphabeticAsc))); Console.WriteLine(textHandler.Sort(textQuery, DIService.ContainerService.ResolveKeyed <ITextSorter>(eSortMode.AlphabeticDesc))); Console.WriteLine(textHandler.Sort(textQuery, DIService.ContainerService.ResolveKeyed <ITextSorter>(eSortMode.LenghtAsc))); Console.WriteLine("Now i am going to get some Statistics: "); TextStatistics statistics = textHandler.GetStatistics(textQuery); Console.WriteLine(statistics.GetPrintableRestuls()); Console.WriteLine("Ops, it's time to go..."); Console.ReadKey(); }
/// <summary> /// Parses a given file. /// </summary> /// <param name="document"></param> /// <param name="file"></param> public virtual void Go(IDocListener document, String file) { parser = new ITextHandler(document); parser.Parse(file); }
void textHandler_ContentsChanged(ITextHandler sender, EventArgs e) { sender.ContentsChanged -= new EventHandler<ITextHandler, EventArgs>(textHandler_ContentsChanged); _Set = null; }
void configurationFile_ContentsChanged(ITextHandler sender, EventArgs e) { _Deserialized = null; _Actions = null; _Javascript = null; _ViewComponents = null; }
protected ActionResult ViewPdff(object model) { // Create the iTextSharp document. // Rectangle r = new Rectangle(700f, 700f); Document doc = new Document(); //r.BackgroundColor = new CMYKColor(25, 90, 25, 0); //r.BackgroundColor = new Color(191, 64, 124); // Set the document to write to memory. MemoryStream memStream = new MemoryStream(); PdfWriter writer = PdfWriter.GetInstance(doc, memStream); writer.CloseStream = false; doc.Open(); string xmltext = this.RenderActionResultToString(this.View(tools)); string xmltry = this.RenderActionResultToString(this.View("choice")); XmlDocument xmldoc = new XmlDocument(); ITextHandler textHandler = new ITextHandler(doc); string imagepath = Server.MapPath("~/Content/Images"); // doc.Add(new Paragraph("Valencia Technology Club Computer Repair Branch")); doc.Add(new Paragraph("Valencia Technology Club Computer Repair Branch")); // doc.Add(new Paragraph("Valencia Technology Club Computer Repair Branch")); Image gif = Image.GetInstance(imagepath + "/VtechLogo.png"); gif.Alignment = Image.ALIGN_CENTER; doc.Add(gif); RepairCase rr = Session["NewRpCase"] as RepairCase; Customer cc = Session["customer"] as Customer; string FirstName = cc.FirstName.ToString(); string LastName = cc.LastName.ToString(); string PhoneNumber = cc.CustomerPhone; string email = cc.CustomerEmail.ToString(); string registerDate = DateTime.Now.Date.ToString(); string receptiondate = rr.ReceptionDate.ToString(); Font lightblue = new Font(Font.COURIER, 20f, Font.NORMAL, new Color(43, 145, 175)); Font georgia = FontFactory.GetFont("georgia", 15f); Font courier = new Font(Font.COURIER, 15f); georgia.Color = Color.GRAY; Chunk c1 = new Chunk("******* Final Customer Invoice *******\n", lightblue); Chunk c17 = new Chunk("\n\n"); Chunk c2 = new Chunk("First Name :", courier); Chunk c3 = new Chunk(FirstName + "\n", georgia); Chunk c4 = new Chunk("Last Name :", courier); Chunk c5 = new Chunk(LastName + "\n", georgia); Chunk c6 = new Chunk("Phone Number :", courier); Chunk c7 = new Chunk(PhoneNumber + "\n", georgia); Chunk c8 = new Chunk("Email :", courier); Chunk c9 = new Chunk(email + "\n", georgia); Chunk c10 = new Chunk("Registration Date :", courier); Chunk c11 = new Chunk(registerDate + "\n", georgia); Chunk c12 = new Chunk("Reception Date :", courier); Chunk c13 = new Chunk(receptiondate + "\n", georgia); Chunk c14 = new Chunk("\n\n"); Chunk c15 = new Chunk("*************** Tools ***************", lightblue); Chunk c16 = new Chunk("\n\n"); Phrase p12 = new Phrase(); p12.Add(c1); p12.Add(c17); p12.Add(c2); p12.Add(c3); p12.Add(c4); p12.Add(c5); p12.Add(c6); p12.Add(c7); p12.Add(c8); p12.Add(c9); p12.Add(c10); p12.Add(c11); p12.Add(c12); p12.Add(c13); p12.Add(c14); p12.Add(c15); p12.Add(c16); Paragraph p = new Paragraph(); p.Add(p12); doc.Add(p); TempData["Name"] = FirstName; TempData["email"] = email; TempData["Pname"] = LastName; TempData["Phone"] = PhoneNumber; TempData["registerDate"] = registerDate; TempData["receptiondate"] = receptiondate; Font link = FontFactory.GetFont("Arial", 12, Font.UNDERLINE, new Color(0, 0, 255)); Anchor anchor = new Anchor("https://vtech-computerrepairbranch.azurewebsites.net \n", link); Anchor anchor1 = new Anchor("http://valenciatechclub.com/ \n", link); anchor.Reference = "https://vtech-computerrepairbranch.azurewebsites.net"; anchor1.Reference = "http://valenciatechclub.com/"; PdfPTable table = new PdfPTable(4); PdfPCell cell = new PdfPCell(new Phrase("Description of the repair case : " + rr.Note)); cell.Colspan = 4; cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right table.AddCell(cell); table.AddCell("Description"); table.AddCell("type"); table.AddCell("Manufacturer"); table.AddCell("Issue"); foreach (var element in tools) { table.AddCell(element.description); table.AddCell(element.Type); table.AddCell(element.Manufacturer); table.AddCell(element.Issue); } doc.Add(table); Chunk c18 = new Chunk("\n\n"); Phrase pp = new Phrase(); pp.Add(c18); Chunk c20 = new Chunk("For more information about Valencia Technology Club : \n"); Chunk c19 = new Chunk("To follow up your repair case : \n"); Anchor anchor2 = new Anchor(" https://vtech-computerrepairbranch.azurewebsites.net/Reception/MyRepairCases \n", link); anchor2.Reference = " https://vtech-computerrepairbranch.azurewebsites.net/Reception/MyRepairCases"; pp.Add(c20); pp.Add(anchor1); pp.Add(c19); pp.Add(anchor2); Paragraph pr = new Paragraph(); pr.Add(pp); doc.Add(pr); //doc.Add(anchor); //doc.Add(anchor1); // Close your PDF doc.Close(); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=" + "FinalCustomerInvoice.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); byte[] buf = new byte[memStream.Position]; memStream.Position = 0; memStream.Read(buf, 0, buf.Length); // Send the binary data to the browser. return(new BinaryContentResult(buf, "application/pdf")); }
public InputTextController(ITextHandler service) { textHandlerServices = service; }
public FileConfigurationManager(ITextHandler configurationFile) { configurationFile.ContentsChanged += new Common.EventHandler<ITextHandler, EventArgs>(configurationFile_ContentsChanged); ConfigurationFile = configurationFile; }
/// <summary> /// Parses a given file. /// </summary> /// <param name="document"></param> /// <param name="file"></param> /// <param name="tagmap"></param> public virtual void Go(IDocListener document, String file, Hashtable tagmap) { parser = new ITextmyHandler(document, tagmap); parser.Parse(file); }
/// <summary> /// Parses a given XmlTextReader. /// </summary> /// <param name="document"></param> /// <param name="reader"></param> /// <param name="tagmap"></param> public virtual void Go(IDocListener document, XmlTextReader reader, Hashtable tagmap) { parser = new ITextmyHandler(document, tagmap); parser.Parse(reader); }
/// <summary> /// Parses a given file. /// </summary> /// <param name="document"></param> /// <param name="file"></param> /// <param name="tagmap"></param> public virtual void Go(IDocListener document, String file, String tagmap) { parser = new ITextmyHandler(document, new TagMap(tagmap)); parser.Parse(file); }
public MainWindow() { InitializeComponent(); textHandlerService = new TextHandlerService(); }
/// <summary> /// Parses a given file. /// </summary> /// <param name="document"></param> /// <param name="file"></param> public virtual void Go(IDocListener document, XmlDocument xDoc) { parser = new ITextHandler(document); parser.Parse(xDoc); }
/// <summary> /// Returns the script URLs that this script depends on /// </summary> /// <param name="javascriptClass"></param> /// <returns></returns> public IEnumerable<string> GetRequiredScriptURLs(ITextHandler javascriptClass, out string fileType) { fileType = null; List<string> toReturn = new List<string>(); toReturn.Add("/API/AJAX_serverside.js"); foreach (string line in javascriptClass.ReadLines()) { // find file type if (line.Trim().StartsWith("// FileType:")) fileType = line.Substring(12).Trim(); // Find dependant scripts else if (line.Trim().StartsWith("// Scripts:")) foreach (string script in line.Substring(11).Split(',')) toReturn.Add(script.Trim()); } return toReturn; }
public ArchimedSpiralFunctionCloud(ITextDecoder decoder, ITextHandler textHandler) : base(decoder, textHandler) { }
public ArchimedSpiralFunctionCloud(int width, int height, ITextDecoder decoder, ITextHandler textHandler) : base(width, height, decoder, textHandler) { }
/// <summary> /// Parses a given XmlTextReader. /// </summary> /// <param name="document"></param> /// <param name="reader"></param> public virtual void Go(IDocListener document, XmlTextReader reader) { parser = new ITextHandler(document); parser.Parse(reader); }
/// <summary> /// Returns all of the script IDs for the class /// </summary> /// <param name="javascriptClass">The text handler that has the class's javascript</param> /// <param name="subProcess">The process that must have the given script loaded</param> /// <returns></returns> public ScopeInfo GetScopeInfoForClass(ITextHandler javascriptClass, SubProcess subProcess) { DateTime javascriptLastModified = javascriptClass.FileContainer.LastModified; ScopeInfo toReturn = null; using (TimedLock.Lock(ScopeInfoCache)) ScopeInfoCache.TryGetValue(javascriptClass.FileContainer.FileId, out toReturn); if (null != toReturn) if (toReturn.JavascriptLastModified == javascriptLastModified) { using (TimedLock.Lock(PrecompiledScriptDataByID)) foreach (int scriptID in toReturn.ScriptsAndIDsToBuildScope) subProcess.LoadCompiled( Thread.CurrentThread.ManagedThreadId, PrecompiledScriptDataByID[scriptID], scriptID); return toReturn; } string javascript = javascriptClass.ReadAll(); string fileType = null; List<int> scriptIDsToBuildScope = new List<int>(); ISession ownerSession = FileHandlerFactoryLocator.SessionManagerHandler.CreateSession(); try { ownerSession.Login(javascriptClass.FileContainer.Owner); IWebConnection ownerWebConnection = new BlockingShellWebConnection( FileHandlerFactoryLocator.WebServer, ownerSession, javascriptClass.FileContainer.FullPath, null, null, new CookiesFromBrowser(), CallingFrom.Web, WebMethod.GET); IEnumerable<ScriptAndMD5> dependantScriptsAndMD5s = FileHandlerFactoryLocator.WebServer.WebComponentResolver.DetermineDependantScripts( GetRequiredScriptURLs(javascriptClass, out fileType), ownerWebConnection); // Load static methods that are passed into the Javascript environment as-is Dictionary<string, MethodInfo> functionsInScope = SubProcessFactory.GetFunctionsForFileType(fileType); // Load all dependant scripts foreach (ScriptAndMD5 dependantScript in dependantScriptsAndMD5s) { int scriptID = GetScriptID( dependantScript.ScriptName + "___" + ownerSession.User.Identity, dependantScript.MD5, dependantScript.Script, subProcess); scriptIDsToBuildScope.Add(scriptID); } // Construct Javascript to shell to the "base" webHandler Set<Type> webHandlerTypes = new Set<Type>(FileHandlerFactoryLocator.WebHandlerPlugins); if (null != fileType) webHandlerTypes.Add(FileHandlerFactoryLocator.WebHandlerClasses[fileType]); string baseWrapper = GetJavascriptWrapperForBase("base", webHandlerTypes); scriptIDsToBuildScope.Add( GetScriptID( javascriptClass.FileContainer.FullPath + "___" + "serversideBaseWrapper", StringParser.GenerateMD5String(baseWrapper), baseWrapper, subProcess)); // Get the ID for the actual javascript scriptIDsToBuildScope.Add( GetScriptID( javascriptClass.FileContainer.FullPath, StringParser.GenerateMD5String(javascript), javascript, subProcess)); // Add a little shunt to return information about the options scriptIDsToBuildScope.Add( GetScriptID( "____scopeshunt", "xxx", "\nif (this.options) options; else null;", subProcess)); toReturn = new ScopeInfo( javascriptLastModified, functionsInScope, scriptIDsToBuildScope); using (TimedLock.Lock(ScopeInfoCache)) ScopeInfoCache[javascriptClass.FileContainer.FileId] = toReturn; return toReturn; } finally { FileHandlerFactoryLocator.SessionManagerHandler.EndSession(ownerSession.SessionId); } }
/// <summary> /// Parses a given file. /// </summary> /// <param name="document"></param> /// <param name="file"></param> /// <param name="tagmap"></param> public virtual void Go(IDocListener document, XmlDocument xDoc, XmlDocument xTagmap) { parser = new ITextmyHandler(document, new TagMap(xTagmap)); parser.Parse(xDoc); }
void ParentScope_ContentsChanged(ITextHandler sender, EventArgs e) { _StillValid = false; // If code changed within the scope, then reset the execution environment so it'll be recreated next time its used IWebHandler webHandler; while (WebHandlersWithThisAsParent.Dequeue(out webHandler)) webHandler.ResetExecutionEnvironment(); }
/// <summary> /// Parses a given XmlTextReader. /// </summary> /// <param name="document"></param> /// <param name="reader"></param> /// <param name="tagmap"></param> public virtual void Go(IDocListener document, XmlTextReader reader, String tagmap) { parser = new ITextmyHandler(document, new TagMap(tagmap)); parser.Parse(reader); }