static void Main(string[] args) { Parser parser_test = new Parser(); List <Test> testList_test = new List <Test>(); Test test = new Test(); try { // provide the path for XML request. string path = "../../TestRequest.xml"; System.IO.FileStream xml = new System.IO.FileStream(path, System.IO.FileMode.Open); parser_test.parseRequest(xml.ToString()); foreach (Test test1 in testList_test) { test1.show(); } } catch (Exception ex) { Console.Write("\n\n {0}", ex.Message); } }
/// <summary> Returns a string of information about the object, more than 1 line /// long. The information string includes information from the underlying /// RandomAccessIO (its toString() method is called in turn). /// /// </summary> /// <returns> A string of information about the object. /// /// </returns> public override System.String ToString() { //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" return("ImgReaderPGX: WxH = " + w + "x" + h + ", Component = 0" + ", Bit-depth = " + bitDepth + ", signed = " + isSigned + "\nUnderlying RandomAccessIO:\n" + in_Renamed.ToString()); }
private int curAvail; // redundant for speed: (bufSizes[curBufIndex] - curBuf.position()) public MultiMMapIndexInput(System.IO.FileStream raf, int maxBufSize) { this.length = raf.Length; this.maxBufSize = maxBufSize; if (maxBufSize <= 0) { throw new System.ArgumentException("Non positive maxBufSize: " + maxBufSize); } if ((length / maxBufSize) > System.Int32.MaxValue) { throw new System.ArgumentException("RandomAccessFile too big for maximum buffer size: " + raf.ToString()); } int nrBuffers = (int)(length / maxBufSize); if ((nrBuffers * maxBufSize) < length) { nrBuffers++; } this.buffers = new System.IO.MemoryStream[nrBuffers]; // {{Aroush-1.9}} this.bufSizes = new int[nrBuffers]; long bufferStart = 0; System.IO.FileStream rafc = raf; for (int bufNr = 0; bufNr < nrBuffers; bufNr++) { byte[] data = new byte[rafc.Length]; raf.Read(data, 0, (int)rafc.Length); int bufSize = (length > (bufferStart + maxBufSize)) ? maxBufSize : (int)(length - bufferStart); this.buffers[bufNr] = new System.IO.MemoryStream(data); // rafc.map(MapMode.READ_ONLY, bufferStart, bufSize); // {{Aroush-1.9}} this.bufSizes[bufNr] = bufSize; bufferStart += bufSize; } Seek(0L); }
public MultiMMapIndexInput(MMapDirectory enclosingInstance, System.IO.FileStream raf, int maxBufSize) { InitBlock(enclosingInstance); this.length = raf.Length; this.maxBufSize = maxBufSize; if (maxBufSize <= 0) { throw new System.ArgumentException("Non positive maxBufSize: " + maxBufSize); } if ((length / maxBufSize) > int.MaxValue) { throw new System.ArgumentException("RandomAccessFile too big for maximum buffer size: " + raf.ToString()); } int nrBuffers = (int)(length / maxBufSize); if (((long)nrBuffers * maxBufSize) < length) { nrBuffers++; } this.buffers = new System.IO.MemoryStream[nrBuffers]; this.bufSizes = new int[nrBuffers]; long bufferStart = 0; System.IO.FileStream rafc = raf; for (int bufNr = 0; bufNr < nrBuffers; bufNr++) { byte[] data = new byte[rafc.Length]; raf.Read(data, 0, (int)rafc.Length); int bufSize = (length > (bufferStart + maxBufSize))?maxBufSize:(int)(length - bufferStart); this.buffers[bufNr] = new System.IO.MemoryStream(data); this.bufSizes[bufNr] = bufSize; bufferStart += bufSize; } Seek(0L); }
/// <summary> Returns a string of information about the object, more than 1 line /// long. The information string includes information from the underlying /// RandomAccessFile (its toString() method is called in turn). /// /// </summary> /// <returns> A string of information about the object. /// /// </returns> public override System.String ToString() { //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" return("ImgWriterPGM: WxH = " + w + "x" + h + ", Component=" + c + "\nUnderlying RandomAccessFile:\n" + out_Renamed.ToString()); }
private static string GenerateReport() { string path = ConfigurationManager.AppSettings["ReportPathOnServer"] + "Daily Activity" + DateTime.Now.ToShortDateString().Replace("/", "_") + ".pdf"; System.IO.File.WriteAllText(@"C:\Users\Public\TestFolder\WriteText.txt", " 1 " + path); Document doc = new Document(iTextSharp.text.PageSize.A4); System.IO.FileStream file = new System.IO.FileStream(path, System.IO.FileMode.OpenOrCreate); System.IO.File.WriteAllText(@"C:\Users\Public\TestFolder\WriteText.txt", " 1 " + file.ToString()); PdfWriter writer = PdfWriter.GetInstance(doc, file); doc.Open(); PdfPTable tab = new PdfPTable(5); PdfPCell cell = new PdfPCell(new Phrase("Header")); cell = ImageCell("~/images/logo.png", 30f, PdfPCell.ALIGN_LEFT); cell.Colspan = 5; cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right //Style cell.BorderColor = new BaseColor(System.Drawing.Color.Black); cell.Border = Rectangle.BOTTOM_BORDER; // | Rectangle.TOP_BORDER; cell.BorderWidthBottom = 1f; cell.PaddingBottom = 30f; tab.AddCell(cell); cell = new PdfPCell(new Phrase("DAILY ACTIVITY REPORT(" + DateTime.Now.ToShortDateString() + ")", new Font(Font.FontFamily.COURIER, 12F, 1, BaseColor.RED))); cell.Colspan = 5; cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right //Style // cell.BorderColor = new BaseColor(System.Drawing.Color.Black); cell.Border = Rectangle.BOTTOM_BORDER; // | Rectangle.TOP_BORDER; cell.BorderWidthBottom = 1f; cell.PaddingTop = 18f; cell.PaddingBottom = 18f; tab.AddCell(cell); //add header cells here tab.AddCell("Date & Time"); tab.AddCell("Username"); // tab.AddCell("Activity"); tab.AddCell("Message"); tab.AddCell("IP"); tab.AddCell("URL"); PdfPCell cellBottom = new PdfPCell(); cellBottom.Colspan = 5; cellBottom.HorizontalAlignment = 1; //Style cellBottom.BorderColor = new BaseColor(System.Drawing.Color.Black); cellBottom.Border = Rectangle.BOTTOM_BORDER; cellBottom.BorderWidthBottom = 1f; cellBottom.PaddingBottom = 5f; tab.AddCell(cellBottom); // put up the data now List <tblActivityLog> lst = new ActivityLogBL().GetTodayLogs(); foreach (var item in lst) { tab.AddCell(item.ActivityDate.ToShortDateString()); tab.AddCell(item.UserName); // tab.AddCell(item.Activity); tab.AddCell(item.Message); tab.AddCell(item.IP); tab.AddCell(item.URL); } doc.Add(tab); doc.Close(); file.Close(); return(path); }
private static string GenerateReport() { string path = ConfigurationManager.AppSettings["ReportPathOnServer"] + "Daily Activity" + DateTime.Now.ToShortDateString().Replace("/", "_") + ".pdf"; System.IO.File.WriteAllText(@"C:\Users\Public\TestFolder\WriteText.txt", " 1 " + path); Document doc = new Document(iTextSharp.text.PageSize.A4); System.IO.FileStream file = new System.IO.FileStream(path, System.IO.FileMode.OpenOrCreate); System.IO.File.WriteAllText(@"C:\Users\Public\TestFolder\WriteText.txt"," 1 " + file.ToString()); PdfWriter writer = PdfWriter.GetInstance(doc, file); doc.Open(); PdfPTable tab = new PdfPTable(5); PdfPCell cell = new PdfPCell(new Phrase("Header")); cell = ImageCell("~/images/logo.png", 30f, PdfPCell.ALIGN_LEFT); cell.Colspan = 5; cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right //Style cell.BorderColor = new BaseColor(System.Drawing.Color.Black); cell.Border = Rectangle.BOTTOM_BORDER; // | Rectangle.TOP_BORDER; cell.BorderWidthBottom = 1f; cell.PaddingBottom = 30f; tab.AddCell(cell); cell = new PdfPCell(new Phrase("DAILY ACTIVITY REPORT(" + DateTime.Now.ToShortDateString() + ")", new Font(Font.FontFamily.COURIER, 12F,1,BaseColor.RED))); cell.Colspan = 5; cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right //Style // cell.BorderColor = new BaseColor(System.Drawing.Color.Black); cell.Border = Rectangle.BOTTOM_BORDER; // | Rectangle.TOP_BORDER; cell.BorderWidthBottom = 1f; cell.PaddingTop = 18f; cell.PaddingBottom = 18f; tab.AddCell(cell); //add header cells here tab.AddCell("Date & Time"); tab.AddCell("Username"); // tab.AddCell("Activity"); tab.AddCell("Message"); tab.AddCell("IP"); tab.AddCell("URL"); PdfPCell cellBottom = new PdfPCell(); cellBottom.Colspan = 5; cellBottom.HorizontalAlignment = 1; //Style cellBottom.BorderColor = new BaseColor(System.Drawing.Color.Black); cellBottom.Border = Rectangle.BOTTOM_BORDER; cellBottom.BorderWidthBottom = 1f; cellBottom.PaddingBottom = 5f; tab.AddCell(cellBottom); // put up the data now List<tblActivityLog> lst = new ActivityLogBL().GetTodayLogs(); foreach (var item in lst) { tab.AddCell(item.ActivityDate.ToShortDateString()); tab.AddCell(item.UserName); // tab.AddCell(item.Activity); tab.AddCell(item.Message); tab.AddCell(item.IP); tab.AddCell(item.URL); } doc.Add(tab); doc.Close(); file.Close(); return path; }