// *********************************************************************** // Assembly : GeneratorCode // Author : 黄昕 // Created : 02-14-2019 // // Last Modified By : 黄昕 // Last Modified On : 02-19-2019 // *********************************************************************** // // Copyright © 2019 // // // *********************************************************************** using iTextSharp.text.pdf; using OIDModule.Generator; using System; using System.Collections.Generic; using System.Drawing; using System.IO; namespace TmatrixLibrary { /// /// Class TmatrixClass. /// public class TmatrixClass { /// /// The default dpi /// private readonly int Default_DPI = 300; /// /// The gs point dpi /// private readonly string[] gsPointDPI = new string[4]; /// /// The gs point type /// private readonly string[] gsPointType = new string[4]; /// /// The g tpdfbgi name /// private readonly string[] gTPDFBGIName = new string[0x100]; /// /// The g TPDF name /// private readonly string[] gTPDFName = new string[0x100]; /// /// The g tpdfvi name /// private readonly string[] gTPDFVIName = new string[0x100]; /// /// The g tpdfwovi name /// private readonly string[] gTPDFWOVIName = new string[0x100]; /// /// The oid pi generator /// private readonly OIDPublishImageGenerator oidPIGenerator = new OIDPublishImageGenerator(); /// /// The g bid /// private int gBID; /// /// The gb key validate /// private bool gbKeyValidate; /// /// The g current page index /// private int gCurPageIndex; /// /// The g current page identifier /// private int gCurrentPageID; /// /// The g oid /// private int gOID; /// /// The g page number /// private int gPageNum; /// /// The g pi d1 /// private int gPID1; /// /// The g pi d2 /// private int gPID2; /// /// The g point type /// private string gPointType = ""; /// /// The gs bid /// private string gsBID; /// /// The gs expiration /// private string gsExpiration; /// /// The g sid /// private int gSID; /// /// The gs oid /// private string gsOID; /// /// The gs pi d1 /// private string gsPID1; /// /// The gs pi d2 /// private string gsPID2; /// /// The gs sid /// private string gsSID; /// /// The gs size /// private string gsSize; /// /// The g step /// private int gStep; /// /// The g total page identifier /// private int gTotalPageID; /// /// Delegate ProgressChangedEvent /// /// The step. public delegate void ProgressChangedEvent(int step); /// /// Occurs when [progress change]. /// public event ProgressChangedEvent ProgressChange; /// /// Decodes the license tmatrix key. /// /// The key string. /// System.String. public string DecodeLicense_TmatrixKey(string KeyStr) { var chArray = new char[80]; var chArray2 = new char[80]; var str = ""; var num5 = 1L; chArray = KeyStr.ToCharArray(); var length = KeyStr.Length; var num4 = 0L; for (var i = 0L; i < length; i += 1L) { long num3 = Convert.ToByte(chArray[(int)(IntPtr)i]); if (i > 1L) num4 = Convert.ToByte(chArray[(int)(IntPtr)(length + 1 - i)]); num3 = ((num3 * 2L + num5 * 2L + num4) * (i + num5) + num5 * i - 12) % 0x24; if (num3 < 0L || num3 > 9) chArray2[(int)(IntPtr)i] = Convert.ToChar(num3 + 0x37); else chArray2[(int)(IntPtr)i] = Convert.ToChar(num3 + 0x30); num5 = num3 * num3 * i; str = str + chArray2[(int)(IntPtr)i]; } return str; } /// /// Generates the tmatrix big area code oi d4. /// /// The key string. /// The s path. /// The start page identifier. /// Type of the point. /// Type of the b publish image. /// The point dpi. /// Width of the d. /// Height of the d. /// System.String. public string GenerateTmatrixBigAreaCode_OID4(string KeyStr, string sPath, int StartPageID, int[] PointType, bool[] bPublishImageType, int[] PointDPI, double dWidth, double dHeight) { var str = ""; str = TmatrixKeyCheck_OID4(KeyStr); if (str.Substring(0, 1) == "1") return str; if (StartPageID < int.Parse(gsPID1) || StartPageID > int.Parse(gsPID2)) return "1Start page ID must be located between " + gsPID1 + " ~ " + gsPID2; var flag1 = bPublishImageType[0]; var bGenerateVImage = bPublishImageType[1]; var flag6 = bPublishImageType[2]; var bGenerateImage = bPublishImageType[3]; gTotalPageID = StartPageID; var nPageIndex = 0; var nXStart = 0; var nYStart = 0; var bPrintIdleCode = false; for (var i = 0; i < 4; i++) { var num24 = PointType[i]; switch (num24) { case 0: gsPointType[i] = "2"; break; case 1: gsPointType[i] = "3"; break; case 2: gsPointType[i] = "4"; break; } switch (PointDPI[i]) { case 0: gsPointDPI[i] = "D600"; break; case 1: gsPointDPI[i] = "D1200"; break; } } gCurrentPageID = gTotalPageID; gCurPageIndex = 0; var str2 = sPath + @"\BA_.pdf"; var str3 = sPath + @"\BA_VI_.pdf"; sPath = sPath + @"\BA_WOVI_.pdf"; var str4 = sPath + @"\BA_Im_.tif"; var eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImageByInfo(dWidth / 10.0, dHeight / 10.0); CheckOidBuildState(eBeginBuildState); if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && (bGenerateVImage || bGenerateImage)) { var num4 = this.gSID % 2; var num5 = this.gSID / 2; var num6 = gOID % 0x10; var num7 = gOID / 0x10; var num10 = gCurrentPageID % 0x10; var num11 = gCurrentPageID / 0x10; var num12 = 0; var num13 = 0; var num14 = 0; var num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; while (true) { if (!oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { string str5; if (bGenerateVImage) { str5 = str3; oidPIGenerator.BuildPublishImage(str5.ToCharArray(), bPrintIdleCode, true, true, PointDPI[1], PointType[1], 1); } if (bGenerateImage) { str5 = str4; gTPDFBGIName[0] = str4; oidPIGenerator.BuildPublishImage(str5.ToCharArray(), bPrintIdleCode, true, true, PointDPI[3], PointType[3], 0); } gCurPageIndex++; oidPIGenerator.EndBuildPublishImage(); break; } var num22 = (uint)(dWidth * 75.0 / 25.4); var num23 = (uint)(dHeight * 75.0 / 25.4); var gSID = this.gSID; switch (gSID) { case 0: case 1: case 2: if (dWidth <= 780.0 && dHeight <= 780.0) break; return "1PDF page size's width or height > 780mm !"; case 3: if (dWidth <= 6242.0 && dHeight <= 6242.0) break; return "1PDF page size's width or height > 6242mm !"; } var numArray3 = new uint[5]; numArray3[1] = 0x1372; numArray3[2] = 0x1372; var arPointX = numArray3; var numArray4 = new uint[5]; numArray4[2] = 0x1a5d; numArray4[3] = 0x1a5d; var arPointY = numArray4; arPointX[1] = num22; arPointX[2] = num22; arPointY[2] = num23; arPointY[3] = num23; oidPIGenerator.AddObjectInfo(nPageIndex, 0xffffffffUL, arPointX, arPointY, 4, 0, 1); gTPDFName[nPageIndex] = str2; gTPDFVIName[nPageIndex] = str3; gTPDFBGIName[nPageIndex] = str4; nPageIndex++; gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; } } var str6 = RenameBigAreaTmatrixPDF_OID4(StartPageID, gsSID, gsOID, gsBID, bGenerateVImage, bGenerateImage, dWidth / 10.0, dHeight / 10.0); return "0Generate code completely" + str6; } /// /// Generates the tmatrix code. /// /// The key string. /// Name of the PDF file. /// The start page identifier. /// Type of the point. /// if set to true [b generate bg with v image]. /// if set to true [b generate v image]. /// if set to true [b generate bg without v image]. /// System.String. public string GenerateTmatrixCode(string KeyStr, string PDFFileName, int StartPageID, int PointType, bool bGenerateBGWithVImage, bool bGenerateVImage, bool bGenerateBGWithoutVImage) { int num4; int num5; int num6; int num7; int num10; int num11; int num12; int num13; int num14; int num15; var str = ""; str = TmatrixKeyCheck_OID4(KeyStr); if (str.Substring(0, 1) == "1") return str; if (PDFFileName == "") return "1Please select PDF file first !"; if (StartPageID < int.Parse(gsPID1) || StartPageID > int.Parse(gsPID2)) return "1Start page ID must be located between " + gsPID1 + " ~ " + gsPID2; gPageNum = GetPDFPageNumber(PDFFileName); if (gPageNum + StartPageID - 1 > int.Parse(gsPID2)) return "1Not enough code page for this PDF to generate !"; gTotalPageID = StartPageID; var nPageIndex = 0; var nXStart = 0; var nYStart = 0; var bPrintIdleCode = false; var bSplitBigImage = false; var bMergeSplittedImages = false; var bExportPDFImage = true; var nPublishImageDPIType = 0; gCurrentPageID = gTotalPageID; gCurPageIndex = 0; var str2 = PDFFileName; var str3 = str2.Substring(0, str2.Length - 4) + "_.pdf"; var str4 = str2.Substring(0, str2.Length - 4) + "_VI_.pdf"; var str5 = str2.Substring(0, str2.Length - 4) + "_WOVI_.pdf"; var eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, Default_DPI); CheckOidBuildState(eBeginBuildState); if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && (bGenerateBGWithVImage || bGenerateVImage)) { num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; while (true) { if (!oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { gPointType = PointType != 1 ? "2" : "3"; if (bGenerateBGWithVImage) oidPIGenerator.BuildPublishImage(str3.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 2); if (bGenerateVImage) { nPublishImageDPIType = 1; oidPIGenerator.BuildPublishImage(str4.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, nPublishImageDPIType, PointType, 1); } gCurPageIndex++; oidPIGenerator.EndBuildPublishImage(); break; } var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png"; var image = Image.FromFile(filename); var num21 = (uint)(image.Width + 0x48); var num22 = (uint)(image.Height + 0x48); image.Dispose(); var numArray3 = new uint[5]; numArray3[1] = 0x1372; numArray3[2] = 0x1372; var arPointX = numArray3; var numArray4 = new uint[5]; numArray4[2] = 0x1a5d; numArray4[3] = 0x1a5d; var arPointY = numArray4; arPointX[1] = num21; arPointX[2] = num21; arPointY[2] = num22; arPointY[3] = num22; oidPIGenerator.AddObjectInfo(nPageIndex, 0xffffffffUL, arPointX, arPointY, 4, 0, 1); if (nPageIndex == 0) { gTPDFName[nPageIndex] = str3; gTPDFVIName[nPageIndex] = str4; } else { gTPDFName[nPageIndex] = str3.Substring(0, str3.Length - 4) + "_" + nPageIndex + ".pdf"; gTPDFVIName[nPageIndex] = str4.Substring(0, str4.Length - 4) + "_" + nPageIndex + ".pdf"; } nPageIndex++; gCurrentPageID++; num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; } } eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, Default_DPI); CheckOidBuildState(eBeginBuildState); if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && bGenerateBGWithoutVImage) { gTotalPageID = StartPageID; gCurrentPageID = gTotalPageID; gCurPageIndex = 0; nPageIndex = 0; bPrintIdleCode = false; num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; while (true) { if (!oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { gPointType = PointType != 1 ? "2" : "3"; if (bGenerateBGWithoutVImage) oidPIGenerator.BuildPublishImage(str5.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, nPublishImageDPIType, PointType, 2); gCurPageIndex++; oidPIGenerator.EndBuildPublishImage(); break; } gTPDFWOVIName[nPageIndex] = nPageIndex != 0 ? str5.Substring(0, str5.Length - 4) + "_" + nPageIndex + ".pdf" : str5; nPageIndex++; gCurrentPageID++; num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; } } RenameTmatrixPDF(StartPageID, KeyStr.Substring(4, 2), bGenerateBGWithVImage, bGenerateVImage, bGenerateBGWithoutVImage); return "0Generate code completely"; } /// /// Generates the tmatrix code. /// /// The key string. /// Name of the PDF file. /// The start page identifier. /// Type of the point. /// if set to true [b generate bg with v image]. /// if set to true [b generate v image]. /// if set to true [b generate bg without v image]. /// if set to true [b generate bg with image]. /// System.String. public string GenerateTmatrixCode(string KeyStr, string PDFFileName, int StartPageID, int PointType, bool bGenerateBGWithVImage, bool bGenerateVImage, bool bGenerateBGWithoutVImage, bool bGenerateBGWithImage) { int num4; int num5; int num6; int num7; int num10; int num11; int num12; int num13; int num14; int num15; var str = ""; str = TmatrixKeyCheck_OID4(KeyStr); if (str.Substring(0, 1) == "1") return str; if (PDFFileName == "") return "1Please select PDF file first !"; if (StartPageID < int.Parse(gsPID1) || StartPageID > int.Parse(gsPID2)) return "1Start page ID must be located between " + gsPID1 + " ~ " + gsPID2; gPageNum = GetPDFPageNumber(PDFFileName); if (gPageNum + StartPageID - 1 > int.Parse(gsPID2)) return "1Not enough code page for this PDF to generate !"; gTotalPageID = StartPageID; var nPageIndex = 0; var nXStart = 0; var nYStart = 0; var bPrintIdleCode = false; var bSplitBigImage = false; var bMergeSplittedImages = false; var bExportPDFImage = true; gCurrentPageID = gTotalPageID; gCurPageIndex = 0; var str2 = PDFFileName; var str3 = str2.Substring(0, str2.Length - 4) + "_.pdf"; var str4 = str2.Substring(0, str2.Length - 4) + "_VI_.pdf"; var str5 = str2.Substring(0, str2.Length - 4) + "_WOVI_.pdf"; var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; var eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, Default_DPI); CheckOidBuildState(eBeginBuildState); if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && (bGenerateBGWithVImage || bGenerateVImage || bGenerateBGWithImage)) { num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; while (true) { if (!oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { switch (PointType) { case 0: gPointType = "2"; break; case 1: gPointType = "3"; break; case 2: gPointType = "4"; break; } if (bGenerateBGWithVImage) oidPIGenerator.BuildPublishImage(str3.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 2); if (bGenerateVImage) oidPIGenerator.BuildPublishImage(str4.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 1); if (bGenerateBGWithImage) oidPIGenerator.BuildPublishImage(str6.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, 2, 3); gCurPageIndex++; oidPIGenerator.EndBuildPublishImage(); break; } var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png"; var image = Image.FromFile(filename); var width = (uint)image.Width; var height = (uint)image.Height; image.Dispose(); var num16 = (uint)(width * 25.4 / Default_DPI); var num17 = (uint)(height * 25.4 / Default_DPI); width += 0x48; height += 0x48; var gSID = this.gSID; switch (gSID) { case 0: case 1: case 2: if (num16 <= 780 && num17 <= 780) break; return "1PDF page size's width or height > 780mm !"; case 3: if (num16 <= 0x1862 && num17 <= 0x1862) break; return "1PDF page size's width or height > 6242mm !"; } var numArray3 = new uint[5]; numArray3[1] = 0x1372; numArray3[2] = 0x1372; var arPointX = numArray3; var numArray4 = new uint[5]; numArray4[2] = 0x1a5d; numArray4[3] = 0x1a5d; var arPointY = numArray4; arPointX[1] = width; arPointX[2] = width; arPointY[2] = height; arPointY[3] = height; oidPIGenerator.AddObjectInfo(nPageIndex, 0xffffffffUL, arPointX, arPointY, 4, 0, 1); if (nPageIndex == 0) { gTPDFName[nPageIndex] = str3; gTPDFVIName[nPageIndex] = str4; gTPDFBGIName[nPageIndex] = str6; } else { gTPDFName[nPageIndex] = str3.Substring(0, str3.Length - 4) + "_" + nPageIndex + ".pdf"; gTPDFVIName[nPageIndex] = str4.Substring(0, str4.Length - 4) + "_" + nPageIndex + ".pdf"; gTPDFBGIName[nPageIndex] = str6.Substring(0, str6.Length - 4) + "_" + nPageIndex + ".pdf"; } nPageIndex++; gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; } } eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, Default_DPI); CheckOidBuildState(eBeginBuildState); if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && bGenerateBGWithoutVImage) { gTotalPageID = StartPageID; gCurrentPageID = gTotalPageID; gCurPageIndex = 0; nPageIndex = 0; bPrintIdleCode = false; num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; while (true) { if (!oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { switch (PointType) { case 0: gPointType = "2"; break; case 1: gPointType = "3"; break; case 2: gPointType = "4"; break; } if (bGenerateBGWithoutVImage) oidPIGenerator.BuildPublishImage(str5.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 2); gCurPageIndex++; oidPIGenerator.EndBuildPublishImage(); break; } gTPDFWOVIName[nPageIndex] = nPageIndex != 0 ? str5.Substring(0, str5.Length - 4) + "_" + nPageIndex + ".pdf" : str5; nPageIndex++; gCurrentPageID++; num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; } } RenameTmatrixPDF_OID4(StartPageID, gsSID, gsOID, gsBID, bGenerateBGWithVImage, bGenerateVImage, bGenerateBGWithoutVImage, bGenerateBGWithImage); return "0Generate code completely"; } /// /// Generates the tmatrix code oi d4. /// /// The key string. /// Name of the PDF file. /// The start page identifier. /// Type of the point. /// Type of the b publish image. /// The point dpi. /// System.String. public string GenerateTmatrixCode_OID4(string KeyStr, string PDFFileName, int StartPageID, int[] PointType, bool[] bPublishImageType, int[] PointDPI) { int num4; int num5; int num6; int num7; int num10; int num11; int num12; int num13; int num14; int num15; var str = ""; var imgFile = new List(); SetProgress(0); str = TmatrixKeyCheck_OID4(KeyStr); if (str.Substring(0, 1) != "0") return str; if (PDFFileName == "") return "4Please select PDF file first !"; if (StartPageID < int.Parse(gsPID1) || StartPageID > int.Parse(gsPID2)) return "5Start page ID must be located between " + gsPID1 + " ~ " + gsPID2; gPageNum = GetPDFPageNumber(PDFFileName); if (gPageNum + StartPageID - 1 > int.Parse(gsPID2)) return "6Not enough code page for this PDF to generate !"; SetProgress(1); var bGenerateBGWithVImage = bPublishImageType[0]; var bGenerateVImage = bPublishImageType[1]; var bGenerateBGWithoutVImage = bPublishImageType[2]; var bGenerateBGWithImage = bPublishImageType[3]; gTotalPageID = StartPageID; var nPageIndex = 0; var nXStart = 0; var nYStart = 0; var bPrintIdleCode = false; var bSplitBigImage = false; var bMergeSplittedImages = false; var bExportPDFImage = true; for (var i = 0; i < 4; i++) { var num26 = PointType[i]; switch (num26) { case 0: gsPointType[i] = "2"; break; case 1: gsPointType[i] = "3"; break; case 2: gsPointType[i] = "4"; break; } switch (PointDPI[i]) { case 0: gsPointDPI[i] = "D600"; break; case 1: gsPointDPI[i] = "D1200"; break; } } gCurrentPageID = gTotalPageID; gCurPageIndex = 0; var str2 = PDFFileName; var str3 = str2.Substring(0, str2.Length - 4) + "_.pdf"; var str4 = str2.Substring(0, str2.Length - 4) + "_VI_.pdf"; var str5 = str2.Substring(0, str2.Length - 4) + "_WOVI_.pdf"; var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; var eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, Default_DPI); CheckOidBuildState(eBeginBuildState); SetProgress(10); if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && (bGenerateBGWithVImage || bGenerateVImage || bGenerateBGWithImage)) { num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; while (true) { var perCent = 10 + nPageIndex * 30 / gPageNum; SetProgress(perCent); if (!oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { SetProgress(40); if (bGenerateBGWithVImage) oidPIGenerator.BuildPublishImage(str3.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[0], PointType[0], 2); if (bGenerateVImage) oidPIGenerator.BuildPublishImage(str4.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[1], PointType[1], 1); if (bGenerateBGWithImage) oidPIGenerator.BuildPublishImage(str6.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[3], PointType[3], 3); gCurPageIndex++; oidPIGenerator.EndBuildPublishImage(); SetProgress(80); break; } var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png"; var image = Image.FromFile(filename); imgFile.Add(filename); var horizontalResolution = image.HorizontalResolution; var verticalResolution = image.VerticalResolution; var width = (uint)image.Width; var height = (uint)image.Height; image.Dispose(); var num16 = (uint)(width * 25.4 / Default_DPI); var num17 = (uint)(height * 25.4 / Default_DPI); width += 0x48; height += 0x48; var gSID = this.gSID; switch (gSID) { case 0: case 1: case 2: if (num16 <= 780 && num17 <= 780) break; return "7PDF page size's width or height > 780mm !"; case 3: if (num16 <= 0x1862 && num17 <= 0x1862) break; return "8PDF page size's width or height > 6242mm !"; } var numArray3 = new uint[5]; numArray3[1] = 0x1372; numArray3[2] = 0x1372; var arPointX = numArray3; var numArray4 = new uint[5]; numArray4[2] = 0x1a5d; numArray4[3] = 0x1a5d; var arPointY = numArray4; arPointX[1] = width; arPointX[2] = width; arPointY[2] = height; arPointY[3] = height; oidPIGenerator.AddObjectInfo(nPageIndex, 0xffffffffUL, arPointX, arPointY, 4, 0, 1); if (nPageIndex == 0) { gTPDFName[nPageIndex] = str3; gTPDFVIName[nPageIndex] = str4; gTPDFBGIName[nPageIndex] = str6; } else { gTPDFName[nPageIndex] = str3.Substring(0, str3.Length - 4) + "_" + nPageIndex + ".pdf"; gTPDFVIName[nPageIndex] = str4.Substring(0, str4.Length - 4) + "_" + nPageIndex + ".pdf"; gTPDFBGIName[nPageIndex] = str6.Substring(0, str6.Length - 4) + "_" + nPageIndex + ".pdf"; } nPageIndex++; gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; } } eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, Default_DPI); CheckOidBuildState(eBeginBuildState); if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && bGenerateBGWithoutVImage) { gTotalPageID = StartPageID; gCurrentPageID = gTotalPageID; gCurPageIndex = 0; nPageIndex = 0; bPrintIdleCode = false; num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; while (true) { if (!oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { if (bGenerateBGWithoutVImage) oidPIGenerator.BuildPublishImage(str5.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[2], PointType[2], 2); gCurPageIndex++; oidPIGenerator.EndBuildPublishImage(); break; } gTPDFWOVIName[nPageIndex] = nPageIndex != 0 ? str5.Substring(0, str5.Length - 4) + "_" + nPageIndex + ".pdf" : str5; nPageIndex++; gCurrentPageID++; num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; } } SetProgress(90); RenameTmatrixPDF_OID4(StartPageID, gsSID, gsOID, gsBID, bGenerateBGWithVImage, bGenerateVImage, bGenerateBGWithoutVImage, bGenerateBGWithImage); foreach (var file in imgFile) if (File.Exists(file)) File.Delete(file); SetProgress(99); return "0Generate code completely"; } /// /// Generates the tmatrix code by area. /// /// The key string. /// Name of the PDF file. /// The start page identifier. /// Type of the point. /// if set to true [b generate bg with v image]. /// if set to true [b generate v image]. /// if set to true [b generate bg without v image]. /// if set to true [b generate bg with image]. /// The tx. /// The ty. /// The tw. /// The th. /// System.String. public string GenerateTmatrixCodeByArea(string KeyStr, string PDFFileName, int StartPageID, int PointType, bool bGenerateBGWithVImage, bool bGenerateVImage, bool bGenerateBGWithoutVImage, bool bGenerateBGWithImage, uint[][] Tx, uint[][] Ty, uint[][] Tw, uint[][] Th) { int num4; int num5; int num6; int num7; int num10; int num11; int num12; int num13; int num14; int num15; var str = ""; str = TmatrixKeyCheck_OID4(KeyStr); if (str.Substring(0, 1) == "1") return str; if (PDFFileName == "") return "1Please select PDF file first !"; if (StartPageID < int.Parse(gsPID1) || StartPageID > int.Parse(gsPID2)) return "1Start page ID must be located between " + gsPID1 + " ~ " + gsPID2; gPageNum = GetPDFPageNumber(PDFFileName); if (gPageNum + StartPageID - 1 > int.Parse(gsPID2)) return "1Not enough code page for this PDF to generate !"; gTotalPageID = StartPageID; var nPageIndex = 0; var nXStart = 0; var nYStart = 0; var bPrintIdleCode = false; var bSplitBigImage = false; var bMergeSplittedImages = false; var bExportPDFImage = true; var index = 0; gCurrentPageID = gTotalPageID; gCurPageIndex = 0; var str2 = PDFFileName; var str3 = str2.Substring(0, str2.Length - 4) + "_.pdf"; var str4 = str2.Substring(0, str2.Length - 4) + "_VI_.pdf"; var str5 = str2.Substring(0, str2.Length - 4) + "_WOVI_.pdf"; var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; var eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, Default_DPI); CheckOidBuildState(eBeginBuildState); if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && (bGenerateBGWithVImage || bGenerateVImage || bGenerateBGWithImage)) { num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; while (true) { if (!oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { switch (PointType) { case 0: gPointType = "2"; break; case 1: gPointType = "3"; break; case 2: gPointType = "4"; break; } if (bGenerateBGWithVImage) oidPIGenerator.BuildPublishImage(str3.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 2); if (bGenerateVImage) oidPIGenerator.BuildPublishImage(str4.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 1); if (bGenerateBGWithImage) oidPIGenerator.BuildPublishImage(str6.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 3); gCurPageIndex++; oidPIGenerator.EndBuildPublishImage(); break; } var nZOrder = 0; var nObjectType = 0; var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png"; var image = Image.FromFile(filename); var width = (uint)image.Width; image.Dispose(); width += 0x48; var num23 = (uint)(image.Height + 0x48); var numArray3 = new uint[5]; numArray3[1] = 0x1372; numArray3[2] = 0x1372; var arPointX = numArray3; var numArray4 = new uint[5]; numArray4[2] = 0x1a5d; numArray4[3] = 0x1a5d; var arPointY = numArray4; arPointX[1] = width; arPointX[2] = width; arPointY[2] = num23; arPointY[3] = num23; nZOrder = 0; nObjectType = 1; index = 0; while (true) { if (Tw[nPageIndex][index] == 0 && Th[nPageIndex][index] == 0) { if (nPageIndex == 0) { gTPDFName[nPageIndex] = str3; gTPDFVIName[nPageIndex] = str4; gTPDFBGIName[nPageIndex] = str6; } else { gTPDFName[nPageIndex] = str3.Substring(0, str3.Length - 4) + "_" + nPageIndex + ".pdf"; gTPDFVIName[nPageIndex] = str4.Substring(0, str4.Length - 4) + "_" + nPageIndex + ".pdf"; gTPDFBGIName[nPageIndex] = str6.Substring(0, str6.Length - 4) + "_" + nPageIndex + ".pdf"; } nPageIndex++; gCurrentPageID++; num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; break; } arPointX[0] = Tx[nPageIndex][index]; arPointY[0] = Ty[nPageIndex][index]; arPointX[1] = Tx[nPageIndex][index] + Tw[nPageIndex][index]; arPointY[1] = Ty[nPageIndex][index]; arPointX[2] = Tx[nPageIndex][index] + Tw[nPageIndex][index]; arPointY[2] = Ty[nPageIndex][index] + Th[nPageIndex][index]; arPointX[3] = Tx[nPageIndex][index]; arPointY[3] = Ty[nPageIndex][index] + Th[nPageIndex][index]; oidPIGenerator.AddObjectInfo(nPageIndex, 0xffffffffUL, arPointX, arPointY, 4, nZOrder, nObjectType); nZOrder++; index++; } } } eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, Default_DPI); CheckOidBuildState(eBeginBuildState); if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && bGenerateBGWithoutVImage) { gTotalPageID = StartPageID; gCurrentPageID = gTotalPageID; gCurPageIndex = 0; nPageIndex = 0; bPrintIdleCode = false; num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; while (true) { if (!oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { gPointType = PointType != 1 ? "2" : "3"; if (bGenerateBGWithoutVImage) oidPIGenerator.BuildPublishImage(str5.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 2); gCurPageIndex++; oidPIGenerator.EndBuildPublishImage(); break; } gTPDFWOVIName[nPageIndex] = nPageIndex != 0 ? str5.Substring(0, str5.Length - 4) + "_" + nPageIndex + ".pdf" : str5; nPageIndex++; gCurrentPageID++; num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; } } RenameTmatrixPDF_OID4(StartPageID, gsSID, gsOID, gsBID, bGenerateBGWithVImage, bGenerateVImage, bGenerateBGWithoutVImage, bGenerateBGWithImage); return "0Generate code completely"; } /// /// Generates the tmatrix code by area oi d4. /// /// The key string. /// Name of the PDF file. /// The start page identifier. /// Type of the point. /// The point dpi. /// if set to true [b generate bg with v image]. /// if set to true [b generate v image]. /// if set to true [b generate bg without v image]. /// if set to true [b generate bg with image]. /// The tx. /// The ty. /// The tw. /// The th. /// System.String. public string GenerateTmatrixCodeByArea_OID4(string KeyStr, string PDFFileName, int StartPageID, int[] PointType, int[] PointDPI, bool bGenerateBGWithVImage, bool bGenerateVImage, bool bGenerateBGWithoutVImage, bool bGenerateBGWithImage, uint[][] Tx, uint[][] Ty, uint[][] Tw, uint[][] Th) { int num4; int num5; int num6; int num7; int num10; int num11; int num12; int num13; int num14; int num15; var str = ""; str = TmatrixKeyCheck_OID4(KeyStr); if (str.Substring(0, 1) == "1") return str; if (PDFFileName == "") return "1Please select PDF file first !"; if (StartPageID < int.Parse(gsPID1) || StartPageID > int.Parse(gsPID2)) return "1Start page ID must be located between " + gsPID1 + " ~ " + gsPID2; gPageNum = GetPDFPageNumber(PDFFileName); if (gPageNum + StartPageID - 1 > int.Parse(gsPID2)) return "1Not enough code page for this PDF to generate !"; gTotalPageID = StartPageID; var nPageIndex = 0; var nXStart = 0; var nYStart = 0; var bPrintIdleCode = false; var bSplitBigImage = false; var bMergeSplittedImages = false; var bExportPDFImage = true; var index = 0; var num20 = 0; for (index = 0; index < 4; index++) { var num25 = PointType[index]; switch (num25) { case 0: gsPointType[index] = "2"; break; case 1: gsPointType[index] = "3"; break; case 2: gsPointType[index] = "4"; break; } switch (PointDPI[index]) { case 0: gsPointDPI[index] = "D600"; break; case 1: gsPointDPI[index] = "D1200"; break; } } gCurrentPageID = gTotalPageID; gCurPageIndex = 0; var str2 = PDFFileName; var str3 = str2.Substring(0, str2.Length - 4) + "_.pdf"; var str4 = str2.Substring(0, str2.Length - 4) + "_VI_.pdf"; var str5 = str2.Substring(0, str2.Length - 4) + "_WOVI_.pdf"; var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; var eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, Default_DPI); CheckOidBuildState(eBeginBuildState); if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && (bGenerateBGWithVImage || bGenerateVImage || bGenerateBGWithImage)) { num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; while (true) { if (!oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { if (bGenerateBGWithVImage) oidPIGenerator.BuildPublishImage(str3.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[0], PointType[0], 2); if (bGenerateVImage) oidPIGenerator.BuildPublishImage(str4.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[1], PointType[1], 1); if (bGenerateBGWithImage) oidPIGenerator.BuildPublishImage(str6.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[3], PointType[3], 3); gCurPageIndex++; oidPIGenerator.EndBuildPublishImage(); break; } var nZOrder = 0; var nObjectType = 0; var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png"; var image = Image.FromFile(filename); var width = (uint)image.Width; image.Dispose(); width += 0x48; var num24 = (uint)(image.Height + 0x48); var numArray3 = new uint[5]; numArray3[1] = 0x1372; numArray3[2] = 0x1372; var arPointX = numArray3; var numArray4 = new uint[5]; numArray4[2] = 0x1a5d; numArray4[3] = 0x1a5d; var arPointY = numArray4; arPointX[1] = width; arPointX[2] = width; arPointY[2] = num24; arPointY[3] = num24; nZOrder = 0; nObjectType = 1; num20 = 0; while (true) { if (Tw[nPageIndex][num20] == 0 && Th[nPageIndex][num20] == 0) { if (nPageIndex == 0) { gTPDFName[nPageIndex] = str3; gTPDFVIName[nPageIndex] = str4; gTPDFBGIName[nPageIndex] = str6; } else { gTPDFName[nPageIndex] = str3.Substring(0, str3.Length - 4) + "_" + nPageIndex + ".pdf"; gTPDFVIName[nPageIndex] = str4.Substring(0, str4.Length - 4) + "_" + nPageIndex + ".pdf"; gTPDFBGIName[nPageIndex] = str6.Substring(0, str6.Length - 4) + "_" + nPageIndex + ".pdf"; } nPageIndex++; gCurrentPageID++; num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; break; } arPointX[0] = Tx[nPageIndex][num20]; arPointY[0] = Ty[nPageIndex][num20]; arPointX[1] = Tx[nPageIndex][num20] + Tw[nPageIndex][num20]; arPointY[1] = Ty[nPageIndex][num20]; arPointX[2] = Tx[nPageIndex][num20] + Tw[nPageIndex][num20]; arPointY[2] = Ty[nPageIndex][num20] + Th[nPageIndex][num20]; arPointX[3] = Tx[nPageIndex][num20]; arPointY[3] = Ty[nPageIndex][num20] + Th[nPageIndex][num20]; oidPIGenerator.AddObjectInfo(nPageIndex, 0xffffffffUL, arPointX, arPointY, 4, nZOrder, nObjectType); nZOrder++; num20++; } } } eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, Default_DPI); CheckOidBuildState(eBeginBuildState); if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && bGenerateBGWithoutVImage) { gTotalPageID = StartPageID; gCurrentPageID = gTotalPageID; gCurPageIndex = 0; nPageIndex = 0; bPrintIdleCode = false; num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; while (true) { if (!oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { if (bGenerateBGWithoutVImage) oidPIGenerator.BuildPublishImage(str5.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[2], PointType[2], 2); gCurPageIndex++; oidPIGenerator.EndBuildPublishImage(); break; } gTPDFWOVIName[nPageIndex] = nPageIndex != 0 ? str5.Substring(0, str5.Length - 4) + "_" + nPageIndex + ".pdf" : str5; nPageIndex++; gCurrentPageID++; num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; } } RenameTmatrixPDF_OID4(StartPageID, gsSID, gsOID, gsBID, bGenerateBGWithVImage, bGenerateVImage, bGenerateBGWithoutVImage, bGenerateBGWithImage); return "0Generate code completely"; } /// /// Generates the tmatrix code for t form. /// /// The key string. /// Name of the PDF file. /// The start page identifier. /// Type of the point. /// if set to true [b generate bg with image]. /// System.String. public string GenerateTmatrixCodeForTForm(string KeyStr, string PDFFileName, int StartPageID, int PointType, bool bGenerateBGWithImage) { var str = ""; str = TmatrixKeyCheck_OID4(KeyStr); if (str.Substring(0, 1) == "1") return str; if (PDFFileName == "") return "1Please select PDF file first !"; if (StartPageID < int.Parse(gsPID1) || StartPageID > int.Parse(gsPID2)) return "1Start page ID must be located between " + gsPID1 + " ~ " + gsPID2; gPageNum = GetPDFPageNumber(PDFFileName); if (gPageNum + StartPageID - 1 > int.Parse(gsPID2)) return "1Not enough code page for this PDF to generate !"; gTotalPageID = int.Parse(KeyStr.Substring(4, 2)) * 0x100 + StartPageID; var nPageIndex = 0; var nXStart = 0; var nYStart = 0; var bPrintIdleCode = false; var bSplitBigImage = false; var bMergeSplittedImages = false; var bExportPDFImage = true; gCurrentPageID = gTotalPageID; gCurPageIndex = 0; var str2 = PDFFileName; str2 = str2.Substring(0, str2.Length - 4) + "_.pdf"; str2 = str2.Substring(0, str2.Length - 4) + "_VI_.pdf"; str2 = str2.Substring(0, str2.Length - 4) + "_WOVI_.pdf"; var str3 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; var eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, Default_DPI); CheckOidBuildState(eBeginBuildState); if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && bGenerateBGWithImage) { var num4 = gSID % 2; var num5 = gSID / 2; var num6 = gOID % 0x10; var num7 = gOID / 0x10; var num10 = gCurrentPageID % 0x10; var num11 = gCurrentPageID / 0x10; var num12 = 0; var num13 = 0; var num14 = 0; var num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; while (true) { if (!oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { switch (PointType) { case 0: gPointType = "2"; break; case 1: gPointType = "3"; break; case 2: gPointType = "4"; break; } if (bGenerateBGWithImage) oidPIGenerator.BuildPublishImage(str3.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, 2, 3); gCurPageIndex++; oidPIGenerator.EndBuildPublishImage(); break; } var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png"; var image = Image.FromFile(filename); var width = (uint)image.Width; image.Dispose(); width += 0x48; var num22 = (uint)(image.Height + 0x48); var numArray3 = new uint[5]; numArray3[1] = 0x1372; numArray3[2] = 0x1372; var arPointX = numArray3; var numArray4 = new uint[5]; numArray4[2] = 0x1a5d; numArray4[3] = 0x1a5d; var arPointY = numArray4; arPointX[1] = width; arPointX[2] = width; arPointY[2] = num22; arPointY[3] = num22; oidPIGenerator.AddObjectInfo(nPageIndex, 0xffffffffUL, arPointX, arPointY, 4, 0, 1); gTPDFBGIName[nPageIndex] = nPageIndex != 0 ? str3.Substring(0, str3.Length - 4) + "_" + nPageIndex + ".pdf" : str3; nPageIndex++; gCurrentPageID++; num4 = gSID % 2; num5 = gSID / 2; num6 = gOID % 0x10; num7 = gOID / 0x10; num10 = gCurrentPageID % 0x10; num11 = gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (gSID) { case 0: case 1: case 2: num12 = (gBID % 0x20) << 13; num13 = (gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (gBID % 4) << 0x10; num13 = (gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; } nXStart = (num4 << 0x16) + (num6 << 0x12) + num12 + num14; nYStart = (num5 << 0x16) + (num7 << 0x12) + num13 + num15; } } RenameTmatrixPDF_OID4(StartPageID, gsSID, gsOID, gsBID, false, false, false, bGenerateBGWithImage); return "0Generate code completely"; } /// /// Gets the PDF page number. /// /// Name of the PDF. /// System.Int32. public int GetPDFPageNumber(string PDFName) { var obj = new PdfReader(PDFName); return obj.NumberOfPages; } /// /// Gets the progerss. /// /// System.Int32. public int GetProgerss() { return gStep; } /// /// Called when [progress percent]. /// /// The MSG. /// System.String. public string OnProgressPercent(string msg) { return msg; } /// /// Sets the progress. /// /// The step. public void SetProgress(int step) { if (gStep != step) { gStep = step; OnProgressChanged(gStep); } } /// /// Tmatrixes the initialize. /// /// true if XXXX, false otherwise. public bool TmatrixInitialize() { return oidPIGenerator.Initialize(); } /// /// Tmatrixes the key check. /// /// The s key. /// System.String. public string TmatrixKeyCheck(string sKey) { gbKeyValidate = false; var strArray = sKey.Split(';'); if (DecodeLicense_TmatrixKey(strArray[0]) != strArray[1]) return "1Key is not correct, it should be modified !"; var strArray2 = strArray[0].Split(','); if (strArray2.Length < 4) return "1 It might be Old key file format, please use new key file !"; if (strArray2[3].Substring(1, 4) != "0000" && !CheckExpirationValidate(strArray2[3])) return "1Key is expired !"; if (strArray2[1].Substring(0, 1) == "O") return "1Element Key has not supported yet !"; gsSize = strArray2[0]; gsBID = strArray2[1].Substring(1, 2); gsPID1 = strArray2[2].Substring(1, 3); gsPID2 = strArray2[2].Substring(5, 3); gsExpiration = strArray2[3].Substring(1, strArray2[3].Length - 1); gTotalPageID = int.Parse(gsBID) * 0x100; gbKeyValidate = true; return "0"; } /// /// Tmatrixes the key check. /// /// The s key. /// The type. /// System.String. public string TmatrixKeyCheck(string sKey, int type) { gbKeyValidate = false; var strArray = sKey.Split(';'); if (DecodeLicense_TmatrixKey(strArray[0]) != strArray[1]) return "1Key is not correct, it should be modified !"; var strArray2 = strArray[0].Split(','); if (strArray2.Length < 4) return "1Old key file format, please use new key file !"; if (strArray2[3].Substring(1, 4) != "0000" && !CheckExpirationValidate(strArray2[3])) return "1Key is expired !"; if (strArray2[1].Substring(0, 1) == "O" && type == 0) return "1Element Key has not supported yet !"; gsSize = strArray2[0]; gsBID = strArray2[1].Substring(1, 2); gsPID1 = strArray2[2].Substring(1, 3); gsPID2 = strArray2[2].Substring(5, 3); gsExpiration = strArray2[3].Substring(1, strArray2[3].Length - 1); gTotalPageID = int.Parse(gsBID) * 0x100; gbKeyValidate = true; return "0"; } /// /// Tmatrixes the key check oi d4. /// /// The s key. /// System.String. public string TmatrixKeyCheck_OID4(string sKey) { gbKeyValidate = false; var strArray = sKey.Split(';'); if (DecodeLicense_TmatrixKey(strArray[0]) != strArray[1]) return "1Key is not correct, it should be modified !"; var strArray2 = strArray[0].Split(','); if (strArray2.Length < 5) return "2It might be old key file format, please use OID4 key file !"; if (strArray2[4].Substring(1, 4) != "0000" && !CheckExpirationValidate(strArray2[4])) { //return "3Key is expired!"; } gsSID = strArray2[0].Substring(1, 1); gsOID = strArray2[1].Substring(1, 3); gsBID = strArray2[2].Substring(1, 4); gsPID1 = strArray2[3].Substring(1, 3); gsPID2 = strArray2[3].Substring(5, 3); gSID = int.Parse(gsSID); gOID = int.Parse(gsOID); gBID = int.Parse(gsBID); gPID1 = int.Parse(gsPID1); gPID2 = int.Parse(gsPID2); gsExpiration = strArray2[4].Substring(1, strArray2[4].Length - 1); gTotalPageID = int.Parse(gsBID) * 0x100; gbKeyValidate = true; return "0"; } /// /// Tmatrixes the key check oi d4. /// /// The s key. /// The type. /// System.String. public string TmatrixKeyCheck_OID4(string sKey, int type) { gbKeyValidate = false; var strArray = sKey.Split(';'); if (DecodeLicense_TmatrixKey(strArray[0]) != strArray[1]) return "1Key is not correct, it should be modified !"; var strArray2 = strArray[0].Split(','); if (strArray2.Length < 5) return "1Old key file format, please use new key file !"; if (strArray2[4].Substring(1, 4) != "0000" && !CheckExpirationValidate(strArray2[4])) return "1Key is expired !"; if (strArray2[1].Substring(0, 1) == "O" && type == 0) return "1Element Key has not supported yet !"; if (type != 0x63) { gsSID = strArray2[0].Substring(1, 1); gsOID = strArray2[1].Substring(1, 3); gsBID = strArray2[2].Substring(1, 4); gsPID1 = strArray2[3].Substring(1, 3); gsPID2 = strArray2[3].Substring(5, 3); gSID = int.Parse(gsSID); gOID = int.Parse(gsOID); gBID = int.Parse(gsBID); gPID1 = int.Parse(gsPID1); gPID2 = int.Parse(gsPID2); gsExpiration = strArray2[4].Substring(1, strArray2[4].Length - 1); gbKeyValidate = true; } return "0"; } /// /// Tmatrixes the uninitialize. /// public void TmatrixUninitialize() { oidPIGenerator.Uninitialize(); } /// /// Called when [progress changed]. /// /// The step. protected virtual void OnProgressChanged(int step) { if (ProgressChange != null) ProgressChange(step); else ProgressChange(-1); } /// /// Checks the expiration validate. /// /// The DSTR. /// true if XXXX, false otherwise. private bool CheckExpirationValidate(string dstr) { var strArray = dstr.Substring(1, dstr.Length - 1).Split('/'); var num = int.Parse(strArray[0]); var num2 = int.Parse(strArray[1]); var num3 = int.Parse(strArray[2]); var today = DateTime.Today; var year = today.Year; var month = today.Month; var day = today.Day; return year <= num ? year != num || (month <= num2 ? month != num2 || day <= num3 : false) : false; } /// /// Checks the state of the oid build. /// /// State of the e begin build. /// System.String. private string CheckOidBuildState(OIDBeginBuildState eBeginBuildState) { switch (eBeginBuildState) { case OIDBeginBuildState.eBBState_ImageFileNotExist: //MessageBox.Show(); return "eBBState_ImageFileNotExist"; case OIDBeginBuildState.eBBState_FailToOpenImageFile: //MessageBox.Show("eBBState_FailToOpenImageFile"); return "eBBState_FailToOpenImageFile"; case OIDBeginBuildState.eBBState_Unknown: //MessageBox.Show("eBBState_Unknown"); return "eBBState_Unknown"; } return ""; } /// /// Determines whether [is key validate]. /// /// true if [is key validate]; otherwise, false. private bool IsKeyValidate() { return gbKeyValidate; } /// /// Renames the big area tmatrix PDF oi d4. /// /// The sp. /// The sid. /// The oid. /// The bid. /// if set to true [b generate v image]. /// if set to true [b generate image]. /// The w. /// The h. /// System.String. private string RenameBigAreaTmatrixPDF_OID4(int SP, string SID, string OID, string BID, bool bGenerateVImage, bool bGenerateImage, double w, double h) { string str; string str2; string fileName; string str4; var index = 0; if (bGenerateVImage) { str2 = Path.GetDirectoryName(gTPDFVIName[index]) + @"\BA Vector Images"; fileName = Path.GetFileName(gTPDFVIName[index]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray = { str4.Substring(0, str4.Length - 4), "0(Tmx", gsPointType[1], "S", SID, "O", OID, "B", BID }; strArray[9] = "P"; strArray[10] = (SP + index).ToString("000"); strArray[11] = gsPointDPI[1]; strArray[12] = "W"; strArray[13] = w.ToString(); strArray[14] = "H"; strArray[15] = h.ToString(); strArray[0x10] = ").pdf"; str = string.Concat(strArray); if (File.Exists(gTPDFVIName[index])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[index], str); } } if (bGenerateImage) { str2 = Path.GetDirectoryName(gTPDFBGIName[0]) + @"\BA Images"; fileName = Path.GetFileName(gTPDFBGIName[0]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray2 = { str4.Substring(0, str4.Length - 4), "0(Tmx", gsPointType[3], "S", SID, "O", OID, "B", BID }; strArray2[9] = "P"; strArray2[10] = (SP + index).ToString("000"); strArray2[11] = gsPointDPI[3]; strArray2[12] = "W"; strArray2[13] = w.ToString(); strArray2[14] = "H"; strArray2[15] = h.ToString(); strArray2[0x10] = ").tif"; str = string.Concat(strArray2); if (File.Exists(gTPDFBGIName[0])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFBGIName[0], str); } } return ""; } /// /// Renames the tmatrix PDF. /// /// The sp. /// The bid. private void RenameTmatrixPDF(int SP, string BID) { for (var i = 0; i < gPageNum; i++) { string str; if (i == 0) { string[] strArray = { gTPDFName[i].Substring(0, gTPDFName[i].Length - 4), "0(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } string[] strArray2 = { gTPDFVIName[i].Substring(0, gTPDFVIName[i].Length - 4), "0(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray2); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } else if (i < 10) { string[] strArray3 = { gTPDFName[i].Substring(0, gTPDFName[i].Length - 6), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray3[9] = ").pdf"; str = string.Concat(strArray3); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } string[] strArray4 = { gTPDFVIName[i].Substring(0, gTPDFVIName[i].Length - 6), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray4[9] = ").pdf"; str = string.Concat(strArray4); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } else if (i < 100) { string[] strArray5 = { gTPDFName[i].Substring(0, gTPDFName[i].Length - 7), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray5[9] = ").pdf"; str = string.Concat(strArray5); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } string[] strArray6 = { gTPDFVIName[i].Substring(0, gTPDFVIName[i].Length - 7), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray6[9] = ").pdf"; str = string.Concat(strArray6); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } else { string[] strArray7 = { gTPDFName[i].Substring(0, gTPDFName[i].Length - 8), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray7[9] = ").pdf"; str = string.Concat(strArray7); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } string[] strArray8 = { gTPDFVIName[i].Substring(0, gTPDFVIName[i].Length - 8), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray8[9] = ").pdf"; str = string.Concat(strArray8); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } } } /// /// Renames the tmatrix PDF. /// /// The sp. /// The bid. /// if set to true [b generate bg with v image]. /// if set to true [b generate v image]. /// if set to true [b generate bg without v image]. private void RenameTmatrixPDF(int SP, string BID, bool bGenerateBGWithVImage, bool bGenerateVImage, bool bGenerateBGWithoutVImage) { for (var i = 0; i < gPageNum; i++) { string str; string str2; string fileName; string str4; if (i == 0) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(gTPDFName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray = { str4.Substring(0, str4.Length - 4), "0(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(gTPDFVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray2 = { str4.Substring(0, str4.Length - 4), "0(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray2); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(gTPDFWOVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray3 = { str4.Substring(0, str4.Length - 4), "0(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray3); if (File.Exists(gTPDFWOVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFWOVIName[i], str); } } } else if (i < 10) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(gTPDFName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray4 = { str4.Substring(0, str4.Length - 6), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray4[9] = ").pdf"; str = string.Concat(strArray4); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(gTPDFVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray5 = { str4.Substring(0, str4.Length - 6), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray5[9] = ").pdf"; str = string.Concat(strArray5); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(gTPDFWOVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray6 = { str4.Substring(0, str4.Length - 6), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray6[9] = ").pdf"; str = string.Concat(strArray6); if (File.Exists(gTPDFWOVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFWOVIName[i], str); } } } else if (i < 100) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(gTPDFName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray7 = { str4.Substring(0, str4.Length - 7), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray7[9] = ").pdf"; str = string.Concat(strArray7); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(gTPDFVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray8 = { str4.Substring(0, str4.Length - 7), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray8[9] = ").pdf"; str = string.Concat(strArray8); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(gTPDFWOVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray9 = { str4.Substring(0, str4.Length - 7), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray9[9] = ").pdf"; str = string.Concat(strArray9); if (File.Exists(gTPDFWOVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFWOVIName[i], str); } } } else { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(gTPDFName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray10 = { str4.Substring(0, str4.Length - 8), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray10[9] = ").pdf"; str = string.Concat(strArray10); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(gTPDFVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray11 = { str4.Substring(0, str4.Length - 8), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray11[9] = ").pdf"; str = string.Concat(strArray11); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(gTPDFWOVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray12 = { str4.Substring(0, str4.Length - 8), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray12[9] = ").pdf"; str = string.Concat(strArray12); if (File.Exists(gTPDFWOVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFWOVIName[i], str); } } } } } /// /// Renames the tmatrix PDF. /// /// The sp. /// The bid. /// if set to true [b generate bg with v image]. /// if set to true [b generate v image]. /// if set to true [b generate bg without v image]. /// if set to true [b generate bg with image]. private void RenameTmatrixPDF(int SP, string BID, bool bGenerateBGWithVImage, bool bGenerateVImage, bool bGenerateBGWithoutVImage, bool bGenerateBGWithImage) { for (var i = 0; i < gPageNum; i++) { string str; string str2; string fileName; string str4; if (i == 0) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(gTPDFName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray = { str4.Substring(0, str4.Length - 4), "0(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(gTPDFVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray2 = { str4.Substring(0, str4.Length - 4), "0(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray2); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(gTPDFWOVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray3 = { str4.Substring(0, str4.Length - 4), "0(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray3); if (File.Exists(gTPDFWOVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(gTPDFBGIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray4 = { str4.Substring(0, str4.Length - 4), "0(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray4); if (File.Exists(gTPDFBGIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFBGIName[i], str); } } } else if (i < 10) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(gTPDFName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray5 = { str4.Substring(0, str4.Length - 6), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray5[9] = ").pdf"; str = string.Concat(strArray5); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(gTPDFVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray6 = { str4.Substring(0, str4.Length - 6), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray6[9] = ").pdf"; str = string.Concat(strArray6); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(gTPDFWOVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray7 = { str4.Substring(0, str4.Length - 6), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray7[9] = ").pdf"; str = string.Concat(strArray7); if (File.Exists(gTPDFWOVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(gTPDFBGIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray8 = { str4.Substring(0, str4.Length - 6), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray8[9] = ").pdf"; str = string.Concat(strArray8); if (File.Exists(gTPDFBGIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFBGIName[i], str); } } } else if (i < 100) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(gTPDFName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray9 = { str4.Substring(0, str4.Length - 7), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray9[9] = ").pdf"; str = string.Concat(strArray9); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(gTPDFVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray10 = { str4.Substring(0, str4.Length - 7), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray10[9] = ").pdf"; str = string.Concat(strArray10); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(gTPDFWOVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray11 = { str4.Substring(0, str4.Length - 7), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray11[9] = ").pdf"; str = string.Concat(strArray11); if (File.Exists(gTPDFWOVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(gTPDFBGIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray12 = { str4.Substring(0, str4.Length - 7), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray12[9] = ").pdf"; str = string.Concat(strArray12); if (File.Exists(gTPDFBGIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFBGIName[i], str); } } } else { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(gTPDFName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray13 = { str4.Substring(0, str4.Length - 8), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray13[9] = ").pdf"; str = string.Concat(strArray13); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(gTPDFVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray14 = { str4.Substring(0, str4.Length - 8), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray14[9] = ").pdf"; str = string.Concat(strArray14); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(gTPDFWOVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray15 = { str4.Substring(0, str4.Length - 8), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray15[9] = ").pdf"; str = string.Concat(strArray15); if (File.Exists(gTPDFWOVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(gTPDFBGIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; string[] strArray16 = { str4.Substring(0, str4.Length - 8), i.ToString(), "(Tmx", gPointType, gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray16[9] = ").pdf"; str = string.Concat(strArray16); if (File.Exists(gTPDFBGIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFBGIName[i], str); } } } } } /// /// Renames the tmatrix PDF oi d4. /// /// The sp. /// The sid. /// The oid. /// The bid. /// if set to true [b generate bg with v image]. /// if set to true [b generate v image]. /// if set to true [b generate bg without v image]. /// if set to true [b generate bg with image]. private void RenameTmatrixPDF_OID4(int SP, string SID, string OID, string BID, bool bGenerateBGWithVImage, bool bGenerateVImage, bool bGenerateBGWithoutVImage, bool bGenerateBGWithImage) { for (var i = 0; i < gPageNum; i++) { string str; string str2; string fileName; string str4; if (i == 0) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(gTPDFName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; var strArray = new string[13]; //string[] strArray = new string[] { str4.Substring(0, str4.Length - 4), "0(Tmx", this.gsPointType[0], "S", SID, "O", OID, "B", BID }; strArray[0] = str4.Substring(0, str4.Length - 4); strArray[1] = "0(Tmx"; strArray[2] = gsPointType[0]; strArray[3] = "S"; strArray[4] = SID; strArray[5] = "0"; strArray[6] = OID; strArray[7] = "B"; strArray[8] = "BID"; strArray[9] = "P"; strArray[10] = (SP + i).ToString("000"); strArray[11] = gsPointDPI[0]; strArray[12] = ").pdf"; str = string.Concat(strArray); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(gTPDFVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray2 = new string[] { str4.Substring(0, str4.Length - 4), "0(Tmx", this.gsPointType[1], "S", SID, "O", OID, "B", BID }; var strArray2 = new string[13]; strArray2[0] = str4.Substring(0, str4.Length - 4); strArray2[1] = "0(Tmx"; strArray2[2] = gsPointType[1]; strArray2[3] = "S"; strArray2[4] = SID; strArray2[5] = "0"; strArray2[6] = OID; strArray2[7] = "B"; strArray2[8] = "BID"; strArray2[9] = "P"; strArray2[10] = (SP + i).ToString("000"); strArray2[11] = gsPointDPI[1]; strArray2[12] = ").pdf"; str = string.Concat(strArray2); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(gTPDFWOVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray3 = new string[] { str4.Substring(0, str4.Length - 4), "0(Tmx", this.gsPointType[2], "S", SID, "O", OID, "B", BID }; var strArray3 = new string[13]; strArray3[0] = str4.Substring(0, str4.Length - 4); strArray3[1] = "0(Tmx"; strArray3[2] = gsPointType[2]; strArray3[3] = "S"; strArray3[4] = SID; strArray3[5] = "0"; strArray3[6] = OID; strArray3[7] = "B"; strArray3[8] = "BID"; strArray3[9] = "P"; strArray3[10] = (SP + i).ToString("000"); strArray3[11] = gsPointDPI[2]; strArray3[12] = ").pdf"; str = string.Concat(strArray3); if (File.Exists(gTPDFWOVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(gTPDFBGIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray4 = new string[] { str4.Substring(0, str4.Length - 4), "0(Tmx", this.gsPointType[3], "S", SID, "O", OID, "B", BID }; var strArray4 = new string[13]; strArray4[0] = str4.Substring(0, str4.Length - 4); strArray4[1] = "0(Tmx"; strArray4[2] = gsPointType[3]; strArray4[3] = "S"; strArray4[4] = SID; strArray4[5] = "0"; strArray4[6] = OID; strArray4[7] = "B"; strArray4[8] = "BID"; strArray4[9] = "P"; strArray4[10] = (SP + i).ToString("000"); strArray4[11] = gsPointDPI[3]; strArray4[12] = ").pdf"; str = string.Concat(strArray4); if (File.Exists(gTPDFBGIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFBGIName[i], str); } } } else if (i < 10) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(gTPDFName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray5 = new string[] { str4.Substring(0, str4.Length - 6), i.ToString(), "(Tmx", this.gsPointType[0], "S", SID, "O", OID, "B" }; var strArray5 = new string[14]; strArray5[0] = str4.Substring(0, str4.Length - 6); strArray5[1] = i.ToString(); strArray5[2] = "0(Tmx"; strArray5[3] = gsPointType[0]; strArray5[4] = "S"; strArray5[5] = SID; strArray5[6] = "0"; strArray5[7] = OID; strArray5[8] = "B"; strArray5[9] = BID; strArray5[10] = "P"; strArray5[11] = (SP + i).ToString("000"); strArray5[12] = gsPointDPI[0]; strArray5[13] = ").pdf"; str = string.Concat(strArray5); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(gTPDFVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray6 = new string[] { str4.Substring(0, str4.Length - 6), i.ToString(), "(Tmx", this.gsPointType[1], "S", SID, "O", OID, "B" }; var strArray6 = new string[14]; strArray6[0] = str4.Substring(0, str4.Length - 6); strArray6[1] = i.ToString(); strArray6[2] = "0(Tmx"; strArray6[3] = gsPointType[1]; strArray6[4] = "S"; strArray6[5] = SID; strArray6[6] = "0"; strArray6[7] = OID; strArray6[8] = "B"; strArray6[9] = BID; strArray6[10] = "P"; strArray6[11] = (SP + i).ToString("000"); strArray6[12] = gsPointDPI[1]; strArray6[13] = ").pdf"; str = string.Concat(strArray6); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(gTPDFWOVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray7 = new string[] { str4.Substring(0, str4.Length - 6), i.ToString(), "(Tmx", this.gsPointType[2], "S", SID, "O", OID, "B" }; var strArray7 = new string[14]; strArray7[0] = str4.Substring(0, str4.Length - 6); strArray7[1] = i.ToString(); strArray7[2] = "0(Tmx"; strArray7[3] = gsPointType[2]; strArray7[4] = "S"; strArray7[5] = SID; strArray7[6] = "0"; strArray7[7] = OID; strArray7[8] = "B"; strArray7[9] = BID; strArray7[10] = "P"; strArray7[11] = (SP + i).ToString("000"); strArray7[12] = gsPointDPI[2]; strArray7[13] = ").pdf"; str = string.Concat(strArray7); if (File.Exists(gTPDFWOVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(gTPDFBGIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray8 = new string[] { str4.Substring(0, str4.Length - 6), i.ToString(), "(Tmx", this.gsPointType[3], "S", SID, "O", OID, "B" }; var strArray8 = new string[14]; strArray8[0] = str4.Substring(0, str4.Length - 6); strArray8[1] = i.ToString(); strArray8[2] = "0(Tmx"; strArray8[3] = gsPointType[3]; strArray8[4] = "S"; strArray8[5] = SID; strArray8[6] = "0"; strArray8[7] = OID; strArray8[8] = "B"; strArray8[9] = BID; strArray8[10] = "P"; strArray8[11] = (SP + i).ToString("000"); strArray8[12] = gsPointDPI[3]; strArray8[13] = ").pdf"; str = string.Concat(strArray8); if (File.Exists(gTPDFBGIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFBGIName[i], str); } } } else if (i < 100) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(gTPDFName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray9 = new string[] { str4.Substring(0, str4.Length - 7), i.ToString(), "(Tmx", this.gsPointType[0], "S", SID, "O", OID, "B" }; var strArray9 = new string[14]; strArray9[0] = str4.Substring(0, str4.Length - 7); strArray9[1] = i.ToString(); strArray9[2] = "0(Tmx"; strArray9[3] = gsPointType[0]; strArray9[4] = "S"; strArray9[5] = SID; strArray9[6] = "0"; strArray9[7] = OID; strArray9[8] = "B"; strArray9[9] = BID; strArray9[10] = "P"; strArray9[11] = (SP + i).ToString("000"); strArray9[12] = gsPointDPI[0]; strArray9[13] = ").pdf"; str = string.Concat(strArray9); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(gTPDFVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray10 = new string[] { str4.Substring(0, str4.Length - 7), i.ToString(), "(Tmx", this.gsPointType[1], "S", SID, "O", OID, "B" }; var strArray10 = new string[14]; strArray10[0] = str4.Substring(0, str4.Length - 7); strArray10[1] = i.ToString(); strArray10[2] = "0(Tmx"; strArray10[3] = gsPointType[1]; strArray10[4] = "S"; strArray10[5] = SID; strArray10[6] = "0"; strArray10[7] = OID; strArray10[8] = "B"; strArray10[9] = BID; strArray10[10] = "P"; strArray10[11] = (SP + i).ToString("000"); strArray10[12] = gsPointDPI[1]; strArray10[13] = ").pdf"; str = string.Concat(strArray10); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(gTPDFWOVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray11 = new string[] { str4.Substring(0, str4.Length - 7), i.ToString(), "(Tmx", this.gsPointType[2], "S", SID, "O", OID, "B" }; var strArray11 = new string[14]; strArray11[0] = str4.Substring(0, str4.Length - 7); strArray11[1] = i.ToString(); strArray11[2] = "0(Tmx"; strArray11[3] = gsPointType[2]; strArray11[4] = "S"; strArray11[5] = SID; strArray11[6] = "0"; strArray11[7] = OID; strArray11[8] = "B"; strArray11[9] = BID; strArray11[10] = "P"; strArray11[11] = (SP + i).ToString("000"); strArray11[12] = gsPointDPI[2]; strArray11[13] = ").pdf"; str = string.Concat(strArray11); if (File.Exists(gTPDFWOVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(gTPDFBGIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray12 = new string[] { str4.Substring(0, str4.Length - 7), i.ToString(), "(Tmx", this.gsPointType[3], "S", SID, "O", OID, "B" }; var strArray12 = new string[14]; strArray12[0] = str4.Substring(0, str4.Length - 7); strArray12[1] = i.ToString(); strArray12[2] = "0(Tmx"; strArray12[3] = gsPointType[3]; strArray12[4] = "S"; strArray12[5] = SID; strArray12[6] = "0"; strArray12[7] = OID; strArray12[8] = "B"; strArray12[9] = BID; strArray12[10] = "P"; strArray12[11] = (SP + i).ToString("000"); strArray12[12] = gsPointDPI[3]; strArray12[13] = ").pdf"; str = string.Concat(strArray12); if (File.Exists(gTPDFBGIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFBGIName[i], str); } } } else { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(gTPDFName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray13 = new string[] { str4.Substring(0, str4.Length - 8), i.ToString(), "(Tmx", this.gsPointType[0], "S", SID, "O", OID, "B" }; var strArray13 = new string[14]; strArray13[0] = str4.Substring(0, str4.Length - 8); strArray13[1] = i.ToString(); strArray13[2] = "0(Tmx"; strArray13[3] = gsPointType[0]; strArray13[4] = "S"; strArray13[5] = SID; strArray13[6] = "0"; strArray13[7] = OID; strArray13[8] = "B"; strArray13[9] = BID; strArray13[10] = "P"; strArray13[11] = (SP + i).ToString("000"); strArray13[12] = gsPointDPI[0]; strArray13[13] = ").pdf"; str = string.Concat(strArray13); if (File.Exists(gTPDFName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(gTPDFVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray14 = new string[] { str4.Substring(0, str4.Length - 8), i.ToString(), "(Tmx", this.gsPointType[1], "S", SID, "O", OID, "B" }; var strArray14 = new string[14]; strArray14[0] = str4.Substring(0, str4.Length - 8); strArray14[1] = i.ToString(); strArray14[2] = "0(Tmx"; strArray14[3] = gsPointType[1]; strArray14[4] = "S"; strArray14[5] = SID; strArray14[6] = "0"; strArray14[7] = OID; strArray14[8] = "B"; strArray14[9] = BID; strArray14[10] = "P"; strArray14[11] = (SP + i).ToString("000"); strArray14[12] = gsPointDPI[1]; strArray14[13] = ").pdf"; str = string.Concat(strArray14); if (File.Exists(gTPDFVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(gTPDFWOVIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray15 = new string[] { str4.Substring(0, str4.Length - 8), i.ToString(), "(Tmx", this.gsPointType[2], "S", SID, "O", OID, "B" }; var strArray15 = new string[14]; strArray15[0] = str4.Substring(0, str4.Length - 8); strArray15[1] = i.ToString(); strArray15[2] = "0(Tmx"; strArray15[3] = gsPointType[2]; strArray15[4] = "S"; strArray15[5] = SID; strArray15[6] = "0"; strArray15[7] = OID; strArray15[8] = "B"; strArray15[9] = BID; strArray15[10] = "P"; strArray15[11] = (SP + i).ToString("000"); strArray15[12] = gsPointDPI[2]; strArray15[13] = ").pdf"; str = string.Concat(strArray15); if (File.Exists(gTPDFWOVIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(gTPDFBGIName[i]); if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); str4 = str2 + @"\" + fileName; //string[] strArray16 = new string[] { str4.Substring(0, str4.Length - 8), i.ToString(), "(Tmx", this.gsPointType[3], "S", SID, "O", OID, "B" }; var strArray16 = new string[14]; strArray16[0] = str4.Substring(0, str4.Length - 8); strArray16[1] = i.ToString(); strArray16[2] = "0(Tmx"; strArray16[3] = gsPointType[3]; strArray16[4] = "S"; strArray16[5] = SID; strArray16[6] = "0"; strArray16[7] = OID; strArray16[8] = "B"; strArray16[9] = BID; strArray16[10] = "P"; strArray16[11] = (SP + i).ToString("000"); strArray16[12] = gsPointDPI[3]; strArray16[13] = ").pdf"; str = string.Concat(strArray16); if (File.Exists(gTPDFBGIName[i])) { if (File.Exists(str)) File.Delete(str); File.Move(gTPDFBGIName[i], str); } } } } } } }