namespace TmatrixLibrary { using iTextSharp.text.pdf; using OIDModule.Generator; using System; using System.Drawing; using System.IO; using System.Windows.Forms; public class TmatrixClass { private bool gbKeyValidate; private string gsSize; private string gsBID; private string gsPID1; private string gsPID2; private string gsExpiration; private string gsSID; private string gsOID; private int gSID; private int gOID; private int gBID; private int gPID1; private int gPID2; private int gTotalPageID; private int gCurrentPageID; private int gPageNum; private string[] gTPDFName = new string[0x100]; private string[] gTPDFVIName = new string[0x100]; private string[] gTPDFWOVIName = new string[0x100]; private string[] gTPDFBGIName = new string[0x100]; private string gPointType = ""; private string[] gsPointType = new string[4]; private string[] gsPointDPI = new string[4]; private int gCurPageIndex; private int Default_DPI = 300; private OIDPublishImageGenerator oidPIGenerator = new OIDPublishImageGenerator(); private bool IsKeyValidate() { return this.gbKeyValidate; } private bool CheckExpirationValidate(string dstr) { string[] strArray = dstr.Substring(1, dstr.Length - 1).Split(new char[] { '/' }); int num = int.Parse(strArray[0]); int num2 = int.Parse(strArray[1]); int num3 = int.Parse(strArray[2]); DateTime today = DateTime.Today; int year = today.Year; int month = today.Month; int day = today.Day; return ((year <= num) ? ((year != num) || ((month <= num2) ? ((month != num2) || (day <= num3)) : false)) : false); } private void CheckOidBuildState(OIDBeginBuildState eBeginBuildState) { switch (eBeginBuildState) { case OIDBeginBuildState.eBBState_ImageFileNotExist: MessageBox.Show("eBBState_ImageFileNotExist"); return; case OIDBeginBuildState.eBBState_FailToOpenImageFile: MessageBox.Show("eBBState_FailToOpenImageFile"); return; case OIDBeginBuildState.eBBState_Unknown: MessageBox.Show("eBBState_Unknown"); return; } } public string DecodeLicense_TmatrixKey(string KeyStr) { char[] chArray = new char[80]; char[] chArray2 = new char[80]; string str = ""; long num5 = 1L; chArray = KeyStr.ToCharArray(); int length = KeyStr.Length; long num4 = 0L; for (long 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) % ((long) 0x24); if ((num3 < 0L) || (num3 > 9)) { chArray2[(int) ((IntPtr) i)] = Convert.ToChar((long) (num3 + 0x37)); } else { chArray2[(int) ((IntPtr) i)] = Convert.ToChar((long) (num3 + 0x30)); } num5 = (num3 * num3) * i; str = str + chArray2[(int) ((IntPtr) i)].ToString(); } return str; } public string GenerateTmatrixBigAreaCode_OID4(string KeyStr, string sPath, int StartPageID, int[] PointType, bool[] bPublishImageType, int[] PointDPI, double dWidth, double dHeight) { string str = ""; str = this.TmatrixKeyCheck_OID4(KeyStr); if (str.Substring(0, 1) == "1") { return str; } if ((StartPageID < int.Parse(this.gsPID1)) || (StartPageID > int.Parse(this.gsPID2))) { return ("1Start page ID must be located between " + this.gsPID1 + " ~ " + this.gsPID2); } bool flag1 = bPublishImageType[0]; bool bGenerateVImage = bPublishImageType[1]; bool flag6 = bPublishImageType[2]; bool bGenerateImage = bPublishImageType[3]; this.gTotalPageID = StartPageID; int nPageIndex = 0; int nXStart = 0; int nYStart = 0; bool bPrintIdleCode = false; for (int i = 0; i < 4; i++) { int num24 = PointType[i]; switch (num24) { case 0: this.gsPointType[i] = "2"; break; case 1: this.gsPointType[i] = "3"; break; case 2: this.gsPointType[i] = "4"; break; default: break; } switch (PointDPI[i]) { case 0: this.gsPointDPI[i] = "D600"; break; case 1: this.gsPointDPI[i] = "D1200"; break; default: break; } } this.gCurrentPageID = this.gTotalPageID; this.gCurPageIndex = 0; string str2 = sPath + @"\BA_.pdf"; string str3 = sPath + @"\BA_VI_.pdf"; sPath = sPath + @"\BA_WOVI_.pdf"; string str4 = sPath + @"\BA_Im_.tif"; OIDBeginBuildState eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState) this.oidPIGenerator.BeginBuildPublishImageByInfo(dWidth / 10.0, dHeight / 10.0); this.CheckOidBuildState(eBeginBuildState); if ((eBeginBuildState == OIDBeginBuildState.eBBState_OK) && (bGenerateVImage || bGenerateImage)) { int num4 = this.gSID % 2; int num5 = this.gSID / 2; int num6 = this.gOID % 0x10; int num7 = this.gOID / 0x10; int num10 = this.gCurrentPageID % 0x10; int num11 = this.gCurrentPageID / 0x10; int num12 = 0; int num13 = 0; int num14 = 0; int num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; while (true) { if (!this.oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { string str5; if (bGenerateVImage) { str5 = str3; this.oidPIGenerator.BuildPublishImage(str5.ToCharArray(), bPrintIdleCode, true, true, PointDPI[1], PointType[1], 1); } if (bGenerateImage) { str5 = str4; this.gTPDFBGIName[0] = str4; this.oidPIGenerator.BuildPublishImage(str5.ToCharArray(), bPrintIdleCode, true, true, PointDPI[3], PointType[3], 0); } this.gCurPageIndex++; this.oidPIGenerator.EndBuildPublishImage(); break; } uint num22 = (uint) ((dWidth * 75.0) / 25.4); uint num23 = (uint) ((dHeight * 75.0) / 25.4); int 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 !"; default: break; } uint[] numArray3 = new uint[5]; numArray3[1] = 0x1372; numArray3[2] = 0x1372; uint[] arPointX = numArray3; uint[] numArray4 = new uint[5]; numArray4[2] = 0x1a5d; numArray4[3] = 0x1a5d; uint[] arPointY = numArray4; arPointX[1] = num22; arPointX[2] = num22; arPointY[2] = num23; arPointY[3] = num23; this.oidPIGenerator.AddObjectInfo(nPageIndex, 0xffffffffUL, arPointX, arPointY, 4, 0, 1); this.gTPDFName[nPageIndex] = str2; this.gTPDFVIName[nPageIndex] = str3; this.gTPDFBGIName[nPageIndex] = str4; nPageIndex++; this.gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; } } string str6 = this.RenameBigAreaTmatrixPDF_OID4(StartPageID, this.gsSID, this.gsOID, this.gsBID, bGenerateVImage, bGenerateImage, dWidth / 10.0, dHeight / 10.0); return ("0Generate code completely" + str6); } 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; string str = ""; str = this.TmatrixKeyCheck_OID4(KeyStr); if (str.Substring(0, 1) == "1") { return str; } if (PDFFileName == "") { return "1Please select PDF file first !"; } if ((StartPageID < int.Parse(this.gsPID1)) || (StartPageID > int.Parse(this.gsPID2))) { return ("1Start page ID must be located between " + this.gsPID1 + " ~ " + this.gsPID2); } this.gPageNum = this.GetPDFPageNumber(PDFFileName); if (((this.gPageNum + StartPageID) - 1) > int.Parse(this.gsPID2)) { return "1Not enough code page for this PDF to generate !"; } this.gTotalPageID = StartPageID; int nPageIndex = 0; int nXStart = 0; int nYStart = 0; bool bPrintIdleCode = false; bool bSplitBigImage = false; bool bMergeSplittedImages = false; bool bExportPDFImage = true; int nPublishImageDPIType = 0; this.gCurrentPageID = this.gTotalPageID; this.gCurPageIndex = 0; string str2 = PDFFileName; string str3 = str2.Substring(0, str2.Length - 4) + "_.pdf"; string str4 = str2.Substring(0, str2.Length - 4) + "_VI_.pdf"; string str5 = str2.Substring(0, str2.Length - 4) + "_WOVI_.pdf"; OIDBeginBuildState eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState) this.oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, this.Default_DPI); this.CheckOidBuildState(eBeginBuildState); if ((eBeginBuildState == OIDBeginBuildState.eBBState_OK) && (bGenerateBGWithVImage || bGenerateVImage)) { num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; while (true) { if (!this.oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { this.gPointType = (PointType != 1) ? "2" : "3"; if (bGenerateBGWithVImage) { this.oidPIGenerator.BuildPublishImage(str3.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 2); } if (bGenerateVImage) { nPublishImageDPIType = 1; this.oidPIGenerator.BuildPublishImage(str4.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, nPublishImageDPIType, PointType, 1); } this.gCurPageIndex++; this.oidPIGenerator.EndBuildPublishImage(); break; } string filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex.ToString() + ".png"; Image image = Image.FromFile(filename); uint num21 = (uint) (image.Width + 0x48); uint num22 = (uint) (image.Height + 0x48); image.Dispose(); uint[] numArray3 = new uint[5]; numArray3[1] = 0x1372; numArray3[2] = 0x1372; uint[] arPointX = numArray3; uint[] numArray4 = new uint[5]; numArray4[2] = 0x1a5d; numArray4[3] = 0x1a5d; uint[] arPointY = numArray4; arPointX[1] = num21; arPointX[2] = num21; arPointY[2] = num22; arPointY[3] = num22; this.oidPIGenerator.AddObjectInfo(nPageIndex, 0xffffffffUL, arPointX, arPointY, 4, 0, 1); if (nPageIndex == 0) { this.gTPDFName[nPageIndex] = str3; this.gTPDFVIName[nPageIndex] = str4; } else { this.gTPDFName[nPageIndex] = str3.Substring(0, str3.Length - 4) + "_" + nPageIndex.ToString() + ".pdf"; this.gTPDFVIName[nPageIndex] = str4.Substring(0, str4.Length - 4) + "_" + nPageIndex.ToString() + ".pdf"; } nPageIndex++; this.gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; } } eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState) this.oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, this.Default_DPI); this.CheckOidBuildState(eBeginBuildState); if ((eBeginBuildState == OIDBeginBuildState.eBBState_OK) && bGenerateBGWithoutVImage) { this.gTotalPageID = StartPageID; this.gCurrentPageID = this.gTotalPageID; this.gCurPageIndex = 0; nPageIndex = 0; bPrintIdleCode = false; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; while (true) { if (!this.oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { this.gPointType = (PointType != 1) ? "2" : "3"; if (bGenerateBGWithoutVImage) { this.oidPIGenerator.BuildPublishImage(str5.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, nPublishImageDPIType, PointType, 2); } this.gCurPageIndex++; this.oidPIGenerator.EndBuildPublishImage(); break; } this.gTPDFWOVIName[nPageIndex] = (nPageIndex != 0) ? (str5.Substring(0, str5.Length - 4) + "_" + nPageIndex.ToString() + ".pdf") : str5; nPageIndex++; this.gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; } } this.RenameTmatrixPDF(StartPageID, KeyStr.Substring(4, 2), bGenerateBGWithVImage, bGenerateVImage, bGenerateBGWithoutVImage); return "0Generate code completely"; } 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; string str = ""; str = this.TmatrixKeyCheck_OID4(KeyStr); if (str.Substring(0, 1) == "1") { return str; } if (PDFFileName == "") { return "1Please select PDF file first !"; } if ((StartPageID < int.Parse(this.gsPID1)) || (StartPageID > int.Parse(this.gsPID2))) { return ("1Start page ID must be located between " + this.gsPID1 + " ~ " + this.gsPID2); } this.gPageNum = this.GetPDFPageNumber(PDFFileName); if (((this.gPageNum + StartPageID) - 1) > int.Parse(this.gsPID2)) { return "1Not enough code page for this PDF to generate !"; } this.gTotalPageID = StartPageID; int nPageIndex = 0; int nXStart = 0; int nYStart = 0; bool bPrintIdleCode = false; bool bSplitBigImage = false; bool bMergeSplittedImages = false; bool bExportPDFImage = true; this.gCurrentPageID = this.gTotalPageID; this.gCurPageIndex = 0; string str2 = PDFFileName; string str3 = str2.Substring(0, str2.Length - 4) + "_.pdf"; string str4 = str2.Substring(0, str2.Length - 4) + "_VI_.pdf"; string str5 = str2.Substring(0, str2.Length - 4) + "_WOVI_.pdf"; string str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; OIDBeginBuildState eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState) this.oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, this.Default_DPI); this.CheckOidBuildState(eBeginBuildState); if ((eBeginBuildState == OIDBeginBuildState.eBBState_OK) && ((bGenerateBGWithVImage || bGenerateVImage) || bGenerateBGWithImage)) { num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; while (true) { if (!this.oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { switch (PointType) { case 0: this.gPointType = "2"; break; case 1: this.gPointType = "3"; break; case 2: this.gPointType = "4"; break; default: break; } if (bGenerateBGWithVImage) { this.oidPIGenerator.BuildPublishImage(str3.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 2); } if (bGenerateVImage) { this.oidPIGenerator.BuildPublishImage(str4.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 1); } if (bGenerateBGWithImage) { this.oidPIGenerator.BuildPublishImage(str6.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, 2, 3); } this.gCurPageIndex++; this.oidPIGenerator.EndBuildPublishImage(); break; } string filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex.ToString() + ".png"; Image image = Image.FromFile(filename); uint width = (uint) image.Width; uint height = (uint) image.Height; image.Dispose(); uint num16 = (uint) ((width * 25.4) / ((double) this.Default_DPI)); uint num17 = (uint) ((height * 25.4) / ((double) this.Default_DPI)); width += (uint) 0x48; height += (uint) 0x48; int 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 !"; default: break; } uint[] numArray3 = new uint[5]; numArray3[1] = 0x1372; numArray3[2] = 0x1372; uint[] arPointX = numArray3; uint[] numArray4 = new uint[5]; numArray4[2] = 0x1a5d; numArray4[3] = 0x1a5d; uint[] arPointY = numArray4; arPointX[1] = width; arPointX[2] = width; arPointY[2] = height; arPointY[3] = height; this.oidPIGenerator.AddObjectInfo(nPageIndex, 0xffffffffUL, arPointX, arPointY, 4, 0, 1); if (nPageIndex == 0) { this.gTPDFName[nPageIndex] = str3; this.gTPDFVIName[nPageIndex] = str4; this.gTPDFBGIName[nPageIndex] = str6; } else { this.gTPDFName[nPageIndex] = str3.Substring(0, str3.Length - 4) + "_" + nPageIndex.ToString() + ".pdf"; this.gTPDFVIName[nPageIndex] = str4.Substring(0, str4.Length - 4) + "_" + nPageIndex.ToString() + ".pdf"; this.gTPDFBGIName[nPageIndex] = str6.Substring(0, str6.Length - 4) + "_" + nPageIndex.ToString() + ".pdf"; } nPageIndex++; this.gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; } } eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState) this.oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, this.Default_DPI); this.CheckOidBuildState(eBeginBuildState); if ((eBeginBuildState == OIDBeginBuildState.eBBState_OK) && bGenerateBGWithoutVImage) { this.gTotalPageID = StartPageID; this.gCurrentPageID = this.gTotalPageID; this.gCurPageIndex = 0; nPageIndex = 0; bPrintIdleCode = false; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; while (true) { if (!this.oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { switch (PointType) { case 0: this.gPointType = "2"; break; case 1: this.gPointType = "3"; break; case 2: this.gPointType = "4"; break; default: break; } if (bGenerateBGWithoutVImage) { this.oidPIGenerator.BuildPublishImage(str5.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 2); } this.gCurPageIndex++; this.oidPIGenerator.EndBuildPublishImage(); break; } this.gTPDFWOVIName[nPageIndex] = (nPageIndex != 0) ? (str5.Substring(0, str5.Length - 4) + "_" + nPageIndex.ToString() + ".pdf") : str5; nPageIndex++; this.gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; } } this.RenameTmatrixPDF_OID4(StartPageID, this.gsSID, this.gsOID, this.gsBID, bGenerateBGWithVImage, bGenerateVImage, bGenerateBGWithoutVImage, bGenerateBGWithImage); return "0Generate code completely"; } 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; string str = ""; str = this.TmatrixKeyCheck_OID4(KeyStr); if (str.Substring(0, 1) == "1") { return str; } if (PDFFileName == "") { return "1Please select PDF file first !"; } if ((StartPageID < int.Parse(this.gsPID1)) || (StartPageID > int.Parse(this.gsPID2))) { return ("1Start page ID must be located between " + this.gsPID1 + " ~ " + this.gsPID2); } this.gPageNum = this.GetPDFPageNumber(PDFFileName); if (((this.gPageNum + StartPageID) - 1) > int.Parse(this.gsPID2)) { return "1Not enough code page for this PDF to generate !"; } bool bGenerateBGWithVImage = bPublishImageType[0]; bool bGenerateVImage = bPublishImageType[1]; bool bGenerateBGWithoutVImage = bPublishImageType[2]; bool bGenerateBGWithImage = bPublishImageType[3]; this.gTotalPageID = StartPageID; int nPageIndex = 0; int nXStart = 0; int nYStart = 0; bool bPrintIdleCode = false; bool bSplitBigImage = false; bool bMergeSplittedImages = false; bool bExportPDFImage = true; for (int i = 0; i < 4; i++) { int num26 = PointType[i]; switch (num26) { case 0: this.gsPointType[i] = "2"; break; case 1: this.gsPointType[i] = "3"; break; case 2: this.gsPointType[i] = "4"; break; default: break; } switch (PointDPI[i]) { case 0: this.gsPointDPI[i] = "D600"; break; case 1: this.gsPointDPI[i] = "D1200"; break; default: break; } } this.gCurrentPageID = this.gTotalPageID; this.gCurPageIndex = 0; string str2 = PDFFileName; string str3 = str2.Substring(0, str2.Length - 4) + "_.pdf"; string str4 = str2.Substring(0, str2.Length - 4) + "_VI_.pdf"; string str5 = str2.Substring(0, str2.Length - 4) + "_WOVI_.pdf"; string str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; OIDBeginBuildState eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState) this.oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, this.Default_DPI); this.CheckOidBuildState(eBeginBuildState); if ((eBeginBuildState == OIDBeginBuildState.eBBState_OK) && ((bGenerateBGWithVImage || bGenerateVImage) || bGenerateBGWithImage)) { num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; while (true) { if (!this.oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { if (bGenerateBGWithVImage) { this.oidPIGenerator.BuildPublishImage(str3.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[0], PointType[0], 2); } if (bGenerateVImage) { this.oidPIGenerator.BuildPublishImage(str4.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[1], PointType[1], 1); } if (bGenerateBGWithImage) { this.oidPIGenerator.BuildPublishImage(str6.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[3], PointType[3], 3); } this.gCurPageIndex++; this.oidPIGenerator.EndBuildPublishImage(); break; } string filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex.ToString() + ".png"; Image image = Image.FromFile(filename); float horizontalResolution = image.HorizontalResolution; float verticalResolution = image.VerticalResolution; uint width = (uint) image.Width; uint height = (uint) image.Height; image.Dispose(); uint num16 = (uint) ((width * 25.4) / ((double) this.Default_DPI)); uint num17 = (uint) ((height * 25.4) / ((double) this.Default_DPI)); width += (uint) 0x48; height += (uint) 0x48; int 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 !"; default: break; } uint[] numArray3 = new uint[5]; numArray3[1] = 0x1372; numArray3[2] = 0x1372; uint[] arPointX = numArray3; uint[] numArray4 = new uint[5]; numArray4[2] = 0x1a5d; numArray4[3] = 0x1a5d; uint[] arPointY = numArray4; arPointX[1] = width; arPointX[2] = width; arPointY[2] = height; arPointY[3] = height; this.oidPIGenerator.AddObjectInfo(nPageIndex, 0xffffffffUL, arPointX, arPointY, 4, 0, 1); if (nPageIndex == 0) { this.gTPDFName[nPageIndex] = str3; this.gTPDFVIName[nPageIndex] = str4; this.gTPDFBGIName[nPageIndex] = str6; } else { this.gTPDFName[nPageIndex] = str3.Substring(0, str3.Length - 4) + "_" + nPageIndex.ToString() + ".pdf"; this.gTPDFVIName[nPageIndex] = str4.Substring(0, str4.Length - 4) + "_" + nPageIndex.ToString() + ".pdf"; this.gTPDFBGIName[nPageIndex] = str6.Substring(0, str6.Length - 4) + "_" + nPageIndex.ToString() + ".pdf"; } nPageIndex++; this.gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; } } eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState) this.oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, this.Default_DPI); this.CheckOidBuildState(eBeginBuildState); if ((eBeginBuildState == OIDBeginBuildState.eBBState_OK) && bGenerateBGWithoutVImage) { this.gTotalPageID = StartPageID; this.gCurrentPageID = this.gTotalPageID; this.gCurPageIndex = 0; nPageIndex = 0; bPrintIdleCode = false; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; while (true) { if (!this.oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { if (bGenerateBGWithoutVImage) { this.oidPIGenerator.BuildPublishImage(str5.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[2], PointType[2], 2); } this.gCurPageIndex++; this.oidPIGenerator.EndBuildPublishImage(); break; } this.gTPDFWOVIName[nPageIndex] = (nPageIndex != 0) ? (str5.Substring(0, str5.Length - 4) + "_" + nPageIndex.ToString() + ".pdf") : str5; nPageIndex++; this.gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; } } this.RenameTmatrixPDF_OID4(StartPageID, this.gsSID, this.gsOID, this.gsBID, bGenerateBGWithVImage, bGenerateVImage, bGenerateBGWithoutVImage, bGenerateBGWithImage); return "0Generate code completely"; } 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; string str = ""; str = this.TmatrixKeyCheck_OID4(KeyStr); if (str.Substring(0, 1) == "1") { return str; } if (PDFFileName == "") { return "1Please select PDF file first !"; } if ((StartPageID < int.Parse(this.gsPID1)) || (StartPageID > int.Parse(this.gsPID2))) { return ("1Start page ID must be located between " + this.gsPID1 + " ~ " + this.gsPID2); } this.gPageNum = this.GetPDFPageNumber(PDFFileName); if (((this.gPageNum + StartPageID) - 1) > int.Parse(this.gsPID2)) { return "1Not enough code page for this PDF to generate !"; } this.gTotalPageID = StartPageID; int nPageIndex = 0; int nXStart = 0; int nYStart = 0; bool bPrintIdleCode = false; bool bSplitBigImage = false; bool bMergeSplittedImages = false; bool bExportPDFImage = true; int index = 0; this.gCurrentPageID = this.gTotalPageID; this.gCurPageIndex = 0; string str2 = PDFFileName; string str3 = str2.Substring(0, str2.Length - 4) + "_.pdf"; string str4 = str2.Substring(0, str2.Length - 4) + "_VI_.pdf"; string str5 = str2.Substring(0, str2.Length - 4) + "_WOVI_.pdf"; string str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; OIDBeginBuildState eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState) this.oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, this.Default_DPI); this.CheckOidBuildState(eBeginBuildState); if ((eBeginBuildState == OIDBeginBuildState.eBBState_OK) && ((bGenerateBGWithVImage || bGenerateVImage) || bGenerateBGWithImage)) { num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; while (true) { if (!this.oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { switch (PointType) { case 0: this.gPointType = "2"; break; case 1: this.gPointType = "3"; break; case 2: this.gPointType = "4"; break; default: break; } if (bGenerateBGWithVImage) { this.oidPIGenerator.BuildPublishImage(str3.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 2); } if (bGenerateVImage) { this.oidPIGenerator.BuildPublishImage(str4.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 1); } if (bGenerateBGWithImage) { this.oidPIGenerator.BuildPublishImage(str6.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 3); } this.gCurPageIndex++; this.oidPIGenerator.EndBuildPublishImage(); break; } int nZOrder = 0; int nObjectType = 0; string filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex.ToString() + ".png"; Image image = Image.FromFile(filename); uint width = (uint) image.Width; image.Dispose(); width += (uint) 0x48; uint num23 = (uint) (image.Height + 0x48); uint[] numArray3 = new uint[5]; numArray3[1] = 0x1372; numArray3[2] = 0x1372; uint[] arPointX = numArray3; uint[] numArray4 = new uint[5]; numArray4[2] = 0x1a5d; numArray4[3] = 0x1a5d; uint[] 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) { this.gTPDFName[nPageIndex] = str3; this.gTPDFVIName[nPageIndex] = str4; this.gTPDFBGIName[nPageIndex] = str6; } else { this.gTPDFName[nPageIndex] = str3.Substring(0, str3.Length - 4) + "_" + nPageIndex.ToString() + ".pdf"; this.gTPDFVIName[nPageIndex] = str4.Substring(0, str4.Length - 4) + "_" + nPageIndex.ToString() + ".pdf"; this.gTPDFBGIName[nPageIndex] = str6.Substring(0, str6.Length - 4) + "_" + nPageIndex.ToString() + ".pdf"; } nPageIndex++; this.gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: 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]; this.oidPIGenerator.AddObjectInfo(nPageIndex, 0xffffffffUL, arPointX, arPointY, 4, nZOrder, nObjectType); nZOrder++; index++; } } } eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState) this.oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, this.Default_DPI); this.CheckOidBuildState(eBeginBuildState); if ((eBeginBuildState == OIDBeginBuildState.eBBState_OK) && bGenerateBGWithoutVImage) { this.gTotalPageID = StartPageID; this.gCurrentPageID = this.gTotalPageID; this.gCurPageIndex = 0; nPageIndex = 0; bPrintIdleCode = false; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; while (true) { if (!this.oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { this.gPointType = (PointType != 1) ? "2" : "3"; if (bGenerateBGWithoutVImage) { this.oidPIGenerator.BuildPublishImage(str5.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, PointType, 2); } this.gCurPageIndex++; this.oidPIGenerator.EndBuildPublishImage(); break; } this.gTPDFWOVIName[nPageIndex] = (nPageIndex != 0) ? (str5.Substring(0, str5.Length - 4) + "_" + nPageIndex.ToString() + ".pdf") : str5; nPageIndex++; this.gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; } } this.RenameTmatrixPDF_OID4(StartPageID, this.gsSID, this.gsOID, this.gsBID, bGenerateBGWithVImage, bGenerateVImage, bGenerateBGWithoutVImage, bGenerateBGWithImage); return "0Generate code completely"; } 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; string str = ""; str = this.TmatrixKeyCheck_OID4(KeyStr); if (str.Substring(0, 1) == "1") { return str; } if (PDFFileName == "") { return "1Please select PDF file first !"; } if ((StartPageID < int.Parse(this.gsPID1)) || (StartPageID > int.Parse(this.gsPID2))) { return ("1Start page ID must be located between " + this.gsPID1 + " ~ " + this.gsPID2); } this.gPageNum = this.GetPDFPageNumber(PDFFileName); if (((this.gPageNum + StartPageID) - 1) > int.Parse(this.gsPID2)) { return "1Not enough code page for this PDF to generate !"; } this.gTotalPageID = StartPageID; int nPageIndex = 0; int nXStart = 0; int nYStart = 0; bool bPrintIdleCode = false; bool bSplitBigImage = false; bool bMergeSplittedImages = false; bool bExportPDFImage = true; int index = 0; int num20 = 0; for (index = 0; index < 4; index++) { int num25 = PointType[index]; switch (num25) { case 0: this.gsPointType[index] = "2"; break; case 1: this.gsPointType[index] = "3"; break; case 2: this.gsPointType[index] = "4"; break; default: break; } switch (PointDPI[index]) { case 0: this.gsPointDPI[index] = "D600"; break; case 1: this.gsPointDPI[index] = "D1200"; break; default: break; } } this.gCurrentPageID = this.gTotalPageID; this.gCurPageIndex = 0; string str2 = PDFFileName; string str3 = str2.Substring(0, str2.Length - 4) + "_.pdf"; string str4 = str2.Substring(0, str2.Length - 4) + "_VI_.pdf"; string str5 = str2.Substring(0, str2.Length - 4) + "_WOVI_.pdf"; string str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; OIDBeginBuildState eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState) this.oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, this.Default_DPI); this.CheckOidBuildState(eBeginBuildState); if ((eBeginBuildState == OIDBeginBuildState.eBBState_OK) && ((bGenerateBGWithVImage || bGenerateVImage) || bGenerateBGWithImage)) { num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; while (true) { if (!this.oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { if (bGenerateBGWithVImage) { this.oidPIGenerator.BuildPublishImage(str3.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[0], PointType[0], 2); } if (bGenerateVImage) { this.oidPIGenerator.BuildPublishImage(str4.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[1], PointType[1], 1); } if (bGenerateBGWithImage) { this.oidPIGenerator.BuildPublishImage(str6.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[3], PointType[3], 3); } this.gCurPageIndex++; this.oidPIGenerator.EndBuildPublishImage(); break; } int nZOrder = 0; int nObjectType = 0; string filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex.ToString() + ".png"; Image image = Image.FromFile(filename); uint width = (uint) image.Width; image.Dispose(); width += (uint) 0x48; uint num24 = (uint) (image.Height + 0x48); uint[] numArray3 = new uint[5]; numArray3[1] = 0x1372; numArray3[2] = 0x1372; uint[] arPointX = numArray3; uint[] numArray4 = new uint[5]; numArray4[2] = 0x1a5d; numArray4[3] = 0x1a5d; uint[] 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) { this.gTPDFName[nPageIndex] = str3; this.gTPDFVIName[nPageIndex] = str4; this.gTPDFBGIName[nPageIndex] = str6; } else { this.gTPDFName[nPageIndex] = str3.Substring(0, str3.Length - 4) + "_" + nPageIndex.ToString() + ".pdf"; this.gTPDFVIName[nPageIndex] = str4.Substring(0, str4.Length - 4) + "_" + nPageIndex.ToString() + ".pdf"; this.gTPDFBGIName[nPageIndex] = str6.Substring(0, str6.Length - 4) + "_" + nPageIndex.ToString() + ".pdf"; } nPageIndex++; this.gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: 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]; this.oidPIGenerator.AddObjectInfo(nPageIndex, 0xffffffffUL, arPointX, arPointY, 4, nZOrder, nObjectType); nZOrder++; num20++; } } } eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState) this.oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, this.Default_DPI); this.CheckOidBuildState(eBeginBuildState); if ((eBeginBuildState == OIDBeginBuildState.eBBState_OK) && bGenerateBGWithoutVImage) { this.gTotalPageID = StartPageID; this.gCurrentPageID = this.gTotalPageID; this.gCurPageIndex = 0; nPageIndex = 0; bPrintIdleCode = false; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; while (true) { if (!this.oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { if (bGenerateBGWithoutVImage) { this.oidPIGenerator.BuildPublishImage(str5.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, PointDPI[2], PointType[2], 2); } this.gCurPageIndex++; this.oidPIGenerator.EndBuildPublishImage(); break; } this.gTPDFWOVIName[nPageIndex] = (nPageIndex != 0) ? (str5.Substring(0, str5.Length - 4) + "_" + nPageIndex.ToString() + ".pdf") : str5; nPageIndex++; this.gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; } } this.RenameTmatrixPDF_OID4(StartPageID, this.gsSID, this.gsOID, this.gsBID, bGenerateBGWithVImage, bGenerateVImage, bGenerateBGWithoutVImage, bGenerateBGWithImage); return "0Generate code completely"; } public string GenerateTmatrixCodeForTForm(string KeyStr, string PDFFileName, int StartPageID, int PointType, bool bGenerateBGWithImage) { string str = ""; str = this.TmatrixKeyCheck_OID4(KeyStr); if (str.Substring(0, 1) == "1") { return str; } if (PDFFileName == "") { return "1Please select PDF file first !"; } if ((StartPageID < int.Parse(this.gsPID1)) || (StartPageID > int.Parse(this.gsPID2))) { return ("1Start page ID must be located between " + this.gsPID1 + " ~ " + this.gsPID2); } this.gPageNum = this.GetPDFPageNumber(PDFFileName); if (((this.gPageNum + StartPageID) - 1) > int.Parse(this.gsPID2)) { return "1Not enough code page for this PDF to generate !"; } this.gTotalPageID = (int.Parse(KeyStr.Substring(4, 2)) * 0x100) + StartPageID; int nPageIndex = 0; int nXStart = 0; int nYStart = 0; bool bPrintIdleCode = false; bool bSplitBigImage = false; bool bMergeSplittedImages = false; bool bExportPDFImage = true; this.gCurrentPageID = this.gTotalPageID; this.gCurPageIndex = 0; string 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"; string str3 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; OIDBeginBuildState eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = (OIDBeginBuildState) this.oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, this.Default_DPI); this.CheckOidBuildState(eBeginBuildState); if ((eBeginBuildState == OIDBeginBuildState.eBBState_OK) && bGenerateBGWithImage) { int num4 = this.gSID % 2; int num5 = this.gSID / 2; int num6 = this.gOID % 0x10; int num7 = this.gOID / 0x10; int num10 = this.gCurrentPageID % 0x10; int num11 = this.gCurrentPageID / 0x10; int num12 = 0; int num13 = 0; int num14 = 0; int num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; while (true) { if (!this.oidPIGenerator.SetStartPosition(nPageIndex, nXStart, nYStart)) { switch (PointType) { case 0: this.gPointType = "2"; break; case 1: this.gPointType = "3"; break; case 2: this.gPointType = "4"; break; default: break; } if (bGenerateBGWithImage) { this.oidPIGenerator.BuildPublishImage(str3.ToCharArray(), bPrintIdleCode, bSplitBigImage, bMergeSplittedImages, 1, 2, 3); } this.gCurPageIndex++; this.oidPIGenerator.EndBuildPublishImage(); break; } string filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex.ToString() + ".png"; Image image = Image.FromFile(filename); uint width = (uint) image.Width; image.Dispose(); width += (uint) 0x48; uint num22 = (uint) (image.Height + 0x48); uint[] numArray3 = new uint[5]; numArray3[1] = 0x1372; numArray3[2] = 0x1372; uint[] arPointX = numArray3; uint[] numArray4 = new uint[5]; numArray4[2] = 0x1a5d; numArray4[3] = 0x1a5d; uint[] arPointY = numArray4; arPointX[1] = width; arPointX[2] = width; arPointY[2] = num22; arPointY[3] = num22; this.oidPIGenerator.AddObjectInfo(nPageIndex, 0xffffffffUL, arPointX, arPointY, 4, 0, 1); this.gTPDFBGIName[nPageIndex] = (nPageIndex != 0) ? (str3.Substring(0, str3.Length - 4) + "_" + nPageIndex.ToString() + ".pdf") : str3; nPageIndex++; this.gCurrentPageID++; num4 = this.gSID % 2; num5 = this.gSID / 2; num6 = this.gOID % 0x10; num7 = this.gOID / 0x10; num10 = this.gCurrentPageID % 0x10; num11 = this.gCurrentPageID / 0x10; num12 = 0; num13 = 0; num14 = 0; num15 = 0; switch (this.gSID) { case 0: case 1: case 2: num12 = (this.gBID % 0x20) << 13; num13 = (this.gBID / 0x20) << 13; num14 = num10 << 9; num15 = num11 << 9; break; case 3: num12 = (this.gBID % 4) << 0x10; num13 = (this.gBID / 4) << 0x10; num14 = num10 << 12; num15 = num11 << 12; break; default: break; } nXStart = (((num4 << 0x16) + (num6 << 0x12)) + num12) + num14; nYStart = (((num5 << 0x16) + (num7 << 0x12)) + num13) + num15; } } this.RenameTmatrixPDF_OID4(StartPageID, this.gsSID, this.gsOID, this.gsBID, false, false, false, bGenerateBGWithImage); return "0Generate code completely"; } public int GetPDFPageNumber(string PDFName) { PdfReader obj = new PdfReader(PDFName); return obj.NumberOfPages; } 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; int index = 0; if (bGenerateVImage) { str2 = Path.GetDirectoryName(this.gTPDFVIName[index]) + @"\BA Vector Images"; fileName = Path.GetFileName(this.gTPDFVIName[index]); if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } str4 = str2 + @"\" + fileName; string[] strArray = new string[] { str4.Substring(0, str4.Length - 4), "0(Tmx", this.gsPointType[1], "S", SID, "O", OID, "B", BID }; strArray[9] = "P"; strArray[10] = (SP + index).ToString("000"); strArray[11] = this.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(this.gTPDFVIName[index])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[index], str); } } if (bGenerateImage) { str2 = Path.GetDirectoryName(this.gTPDFBGIName[0]) + @"\BA Images"; fileName = Path.GetFileName(this.gTPDFBGIName[0]); if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } str4 = str2 + @"\" + fileName; string[] strArray2 = new string[] { str4.Substring(0, str4.Length - 4), "0(Tmx", this.gsPointType[3], "S", SID, "O", OID, "B", BID }; strArray2[9] = "P"; strArray2[10] = (SP + index).ToString("000"); strArray2[11] = this.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(this.gTPDFBGIName[0])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFBGIName[0], str); } } return ""; } private void RenameTmatrixPDF(int SP, string BID) { for (int i = 0; i < this.gPageNum; i++) { string str; if (i == 0) { string[] strArray = new string[] { this.gTPDFName[i].Substring(0, this.gTPDFName[i].Length - 4), "0(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } string[] strArray2 = new string[] { this.gTPDFVIName[i].Substring(0, this.gTPDFVIName[i].Length - 4), "0(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray2); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } else if (i < 10) { string[] strArray3 = new string[] { this.gTPDFName[i].Substring(0, this.gTPDFName[i].Length - 6), i.ToString(), "(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray3[9] = ").pdf"; str = string.Concat(strArray3); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } string[] strArray4 = new string[] { this.gTPDFVIName[i].Substring(0, this.gTPDFVIName[i].Length - 6), i.ToString(), "(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray4[9] = ").pdf"; str = string.Concat(strArray4); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } else if (i < 100) { string[] strArray5 = new string[] { this.gTPDFName[i].Substring(0, this.gTPDFName[i].Length - 7), i.ToString(), "(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray5[9] = ").pdf"; str = string.Concat(strArray5); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } string[] strArray6 = new string[] { this.gTPDFVIName[i].Substring(0, this.gTPDFVIName[i].Length - 7), i.ToString(), "(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray6[9] = ").pdf"; str = string.Concat(strArray6); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } else { string[] strArray7 = new string[] { this.gTPDFName[i].Substring(0, this.gTPDFName[i].Length - 8), i.ToString(), "(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray7[9] = ").pdf"; str = string.Concat(strArray7); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } string[] strArray8 = new string[] { this.gTPDFVIName[i].Substring(0, this.gTPDFVIName[i].Length - 8), i.ToString(), "(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray8[9] = ").pdf"; str = string.Concat(strArray8); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } } } private void RenameTmatrixPDF(int SP, string BID, bool bGenerateBGWithVImage, bool bGenerateVImage, bool bGenerateBGWithoutVImage) { for (int i = 0; i < this.gPageNum; i++) { string str; string str2; string fileName; string str4; if (i == 0) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(this.gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(this.gTPDFName[i]); if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } str4 = str2 + @"\" + fileName; string[] strArray = new string[] { str4.Substring(0, str4.Length - 4), "0(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(this.gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray2); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(this.gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray3); if (File.Exists(this.gTPDFWOVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFWOVIName[i], str); } } } else if (i < 10) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(this.gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(this.gTPDFName[i]); if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } str4 = str2 + @"\" + fileName; string[] strArray4 = new string[] { str4.Substring(0, str4.Length - 6), i.ToString(), "(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray4[9] = ").pdf"; str = string.Concat(strArray4); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(this.gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(this.gTPDFVIName[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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray5[9] = ").pdf"; str = string.Concat(strArray5); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(this.gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(this.gTPDFWOVIName[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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray6[9] = ").pdf"; str = string.Concat(strArray6); if (File.Exists(this.gTPDFWOVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFWOVIName[i], str); } } } else if (i < 100) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(this.gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(this.gTPDFName[i]); if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } str4 = str2 + @"\" + fileName; string[] strArray7 = new string[] { str4.Substring(0, str4.Length - 7), i.ToString(), "(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray7[9] = ").pdf"; str = string.Concat(strArray7); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(this.gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(this.gTPDFVIName[i]); if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } str4 = str2 + @"\" + fileName; string[] strArray8 = new string[] { str4.Substring(0, str4.Length - 7), i.ToString(), "(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray8[9] = ").pdf"; str = string.Concat(strArray8); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(this.gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(this.gTPDFWOVIName[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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray9[9] = ").pdf"; str = string.Concat(strArray9); if (File.Exists(this.gTPDFWOVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFWOVIName[i], str); } } } else { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(this.gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(this.gTPDFName[i]); if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } str4 = str2 + @"\" + fileName; string[] strArray10 = new string[] { str4.Substring(0, str4.Length - 8), i.ToString(), "(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray10[9] = ").pdf"; str = string.Concat(strArray10); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(this.gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(this.gTPDFVIName[i]); if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } str4 = str2 + @"\" + fileName; string[] strArray11 = new string[] { str4.Substring(0, str4.Length - 8), i.ToString(), "(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray11[9] = ").pdf"; str = string.Concat(strArray11); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(this.gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(this.gTPDFWOVIName[i]); if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } str4 = str2 + @"\" + fileName; string[] strArray12 = new string[] { str4.Substring(0, str4.Length - 8), i.ToString(), "(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray12[9] = ").pdf"; str = string.Concat(strArray12); if (File.Exists(this.gTPDFWOVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFWOVIName[i], str); } } } } } private void RenameTmatrixPDF(int SP, string BID, bool bGenerateBGWithVImage, bool bGenerateVImage, bool bGenerateBGWithoutVImage, bool bGenerateBGWithImage) { for (int i = 0; i < this.gPageNum; i++) { string str; string str2; string fileName; string str4; if (i == 0) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(this.gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(this.gTPDFName[i]); if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } str4 = str2 + @"\" + fileName; string[] strArray = new string[] { str4.Substring(0, str4.Length - 4), "0(Tmx", this.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(this.gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray2); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(this.gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray3); if (File.Exists(this.gTPDFWOVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(this.gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000"), ").pdf" }; str = string.Concat(strArray4); if (File.Exists(this.gTPDFBGIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFBGIName[i], str); } } } else if (i < 10) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(this.gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray5[9] = ").pdf"; str = string.Concat(strArray5); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(this.gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray6[9] = ").pdf"; str = string.Concat(strArray6); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(this.gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray7[9] = ").pdf"; str = string.Concat(strArray7); if (File.Exists(this.gTPDFWOVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(this.gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray8[9] = ").pdf"; str = string.Concat(strArray8); if (File.Exists(this.gTPDFBGIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFBGIName[i], str); } } } else if (i < 100) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(this.gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray9[9] = ").pdf"; str = string.Concat(strArray9); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(this.gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray10[9] = ").pdf"; str = string.Concat(strArray10); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(this.gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray11[9] = ").pdf"; str = string.Concat(strArray11); if (File.Exists(this.gTPDFWOVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(this.gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray12[9] = ").pdf"; str = string.Concat(strArray12); if (File.Exists(this.gTPDFBGIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFBGIName[i], str); } } } else { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(this.gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray13[9] = ").pdf"; str = string.Concat(strArray13); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(this.gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray14[9] = ").pdf"; str = string.Concat(strArray14); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(this.gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray15[9] = ").pdf"; str = string.Concat(strArray15); if (File.Exists(this.gTPDFWOVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(this.gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(this.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.gPointType, this.gsSize, "B", BID, "P", (SP + i).ToString("000") }; strArray16[9] = ").pdf"; str = string.Concat(strArray16); if (File.Exists(this.gTPDFBGIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFBGIName[i], str); } } } } } private void RenameTmatrixPDF_OID4(int SP, string SID, string OID, string BID, bool bGenerateBGWithVImage, bool bGenerateVImage, bool bGenerateBGWithoutVImage, bool bGenerateBGWithImage) { for (int i = 0; i < this.gPageNum; i++) { string str; string str2; string fileName; string str4; if (i == 0) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(this.gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(this.gTPDFName[i]); if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } str4 = str2 + @"\" + fileName; string[] 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] = this.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] = this.gsPointDPI[0]; strArray[12] = ").pdf"; str = string.Concat(strArray); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(this.gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(this.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 }; string[] strArray2 = new string[13]; strArray2[0] = str4.Substring(0, str4.Length - 4); strArray2[1] = "0(Tmx"; strArray2[2] = this.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] = this.gsPointDPI[1]; strArray2[12] = ").pdf"; str = string.Concat(strArray2); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(this.gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(this.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 }; string[] strArray3 = new string[13]; strArray3[0] = str4.Substring(0, str4.Length - 4); strArray3[1] = "0(Tmx"; strArray3[2] = this.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] = this.gsPointDPI[2]; strArray3[12] = ").pdf"; str = string.Concat(strArray3); if (File.Exists(this.gTPDFWOVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(this.gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(this.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 }; string[] strArray4 = new string[13]; strArray4[0] = str4.Substring(0, str4.Length - 4); strArray4[1] = "0(Tmx"; strArray4[2] = this.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] = this.gsPointDPI[3]; strArray4[12] = ").pdf"; str = string.Concat(strArray4); if (File.Exists(this.gTPDFBGIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFBGIName[i], str); } } } else if (i < 10) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(this.gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(this.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" }; string[] strArray5 = new string[14]; strArray5[0] = str4.Substring(0, str4.Length - 6); strArray5[1] = i.ToString(); strArray5[2] = "0(Tmx"; strArray5[3] = this.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] = this.gsPointDPI[0]; strArray5[13] = ").pdf"; str = string.Concat(strArray5); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(this.gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(this.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" }; string[] strArray6 = new string[14]; strArray6[0] = str4.Substring(0, str4.Length - 6); strArray6[1] = i.ToString(); strArray6[2] = "0(Tmx"; strArray6[3] = this.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] = this.gsPointDPI[1]; strArray6[13] = ").pdf"; str = string.Concat(strArray6); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(this.gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(this.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" }; string[] strArray7 = new string[14]; strArray7[0] = str4.Substring(0, str4.Length - 6); strArray7[1] = i.ToString(); strArray7[2] = "0(Tmx"; strArray7[3] = this.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] = this.gsPointDPI[2]; strArray7[13] = ").pdf"; str = string.Concat(strArray7); if (File.Exists(this.gTPDFWOVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(this.gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(this.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" }; string[] strArray8 = new string[14]; strArray8[0] = str4.Substring(0, str4.Length - 6); strArray8[1] = i.ToString(); strArray8[2] = "0(Tmx"; strArray8[3] = this.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] = this.gsPointDPI[3]; strArray8[13] = ").pdf"; str = string.Concat(strArray8); if (File.Exists(this.gTPDFBGIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFBGIName[i], str); } } } else if (i < 100) { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(this.gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(this.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" }; string[] strArray9 = new string[14]; strArray9[0] = str4.Substring(0, str4.Length - 7); strArray9[1] = i.ToString(); strArray9[2] = "0(Tmx"; strArray9[3] = this.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] = this.gsPointDPI[0]; strArray9[13] = ").pdf"; str = string.Concat(strArray9); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(this.gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(this.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" }; string[] strArray10 = new string[14]; strArray10[0] = str4.Substring(0, str4.Length - 7); strArray10[1] = i.ToString(); strArray10[2] = "0(Tmx"; strArray10[3] = this.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] = this.gsPointDPI[1]; strArray10[13] = ").pdf"; str = string.Concat(strArray10); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(this.gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(this.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" }; string[] strArray11 = new string[14]; strArray11[0] = str4.Substring(0, str4.Length - 7); strArray11[1] = i.ToString(); strArray11[2] = "0(Tmx"; strArray11[3] = this.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] = this.gsPointDPI[2]; strArray11[13] = ").pdf"; str = string.Concat(strArray11); if (File.Exists(this.gTPDFWOVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(this.gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(this.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" }; string[] strArray12 = new string[14]; strArray12[0] = str4.Substring(0, str4.Length - 7); strArray12[1] = i.ToString(); strArray12[2] = "0(Tmx"; strArray12[3] = this.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] = this.gsPointDPI[3]; strArray12[13] = ").pdf"; str = string.Concat(strArray12); if (File.Exists(this.gTPDFBGIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFBGIName[i], str); } } } else { if (bGenerateBGWithVImage) { str2 = Path.GetDirectoryName(this.gTPDFName[i]) + @"\Bg with Vector Images"; fileName = Path.GetFileName(this.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" }; string[] strArray13 = new string[14]; strArray13[0] = str4.Substring(0, str4.Length - 8); strArray13[1] = i.ToString(); strArray13[2] = "0(Tmx"; strArray13[3] = this.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] = this.gsPointDPI[0]; strArray13[13] = ").pdf"; str = string.Concat(strArray13); if (File.Exists(this.gTPDFName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFName[i], str); } } if (bGenerateVImage) { str2 = Path.GetDirectoryName(this.gTPDFVIName[i]) + @"\Vector Images"; fileName = Path.GetFileName(this.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" }; string[] strArray14 = new string[14]; strArray14[0] = str4.Substring(0, str4.Length - 8); strArray14[1] = i.ToString(); strArray14[2] = "0(Tmx"; strArray14[3] = this.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] = this.gsPointDPI[1]; strArray14[13] = ").pdf"; str = string.Concat(strArray14); if (File.Exists(this.gTPDFVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFVIName[i], str); } } if (bGenerateBGWithoutVImage) { str2 = Path.GetDirectoryName(this.gTPDFWOVIName[i]) + @"\Bg without Vector Images"; fileName = Path.GetFileName(this.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" }; string[] strArray15 = new string[14]; strArray15[0] = str4.Substring(0, str4.Length - 8); strArray15[1] = i.ToString(); strArray15[2] = "0(Tmx"; strArray15[3] = this.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] = this.gsPointDPI[2]; strArray15[13] = ").pdf"; str = string.Concat(strArray15); if (File.Exists(this.gTPDFWOVIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFWOVIName[i], str); } } if (bGenerateBGWithImage) { str2 = Path.GetDirectoryName(this.gTPDFBGIName[i]) + @"\Bg with Images"; fileName = Path.GetFileName(this.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" }; string[] strArray16 = new string[14]; strArray16[0] = str4.Substring(0, str4.Length - 8); strArray16[1] = i.ToString(); strArray16[2] = "0(Tmx"; strArray16[3] = this.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] = this.gsPointDPI[3]; strArray16[13] = ").pdf"; str = string.Concat(strArray16); if (File.Exists(this.gTPDFBGIName[i])) { if (File.Exists(str)) { File.Delete(str); } File.Move(this.gTPDFBGIName[i], str); } } } } } public bool TmatrixInitialize() { return this.oidPIGenerator.Initialize(); } public string TmatrixKeyCheck(string sKey) { this.gbKeyValidate = false; string[] strArray = sKey.Split(new char[] { ';' }); if (this.DecodeLicense_TmatrixKey(strArray[0]) != strArray[1]) { return "1Key is not correct, it should be modified !"; } string[] strArray2 = strArray[0].Split(new char[] { ',' }); 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") && !this.CheckExpirationValidate(strArray2[3])) { return "1Key is expired !"; } if (strArray2[1].Substring(0, 1) == "O") { return "1Element Key has not supported yet !"; } this.gsSize = strArray2[0]; this.gsBID = strArray2[1].Substring(1, 2); this.gsPID1 = strArray2[2].Substring(1, 3); this.gsPID2 = strArray2[2].Substring(5, 3); this.gsExpiration = strArray2[3].Substring(1, strArray2[3].Length - 1); this.gTotalPageID = int.Parse(this.gsBID) * 0x100; this.gbKeyValidate = true; return "0"; } public string TmatrixKeyCheck(string sKey, int type) { this.gbKeyValidate = false; string[] strArray = sKey.Split(new char[] { ';' }); if (this.DecodeLicense_TmatrixKey(strArray[0]) != strArray[1]) { return "1Key is not correct, it should be modified !"; } string[] strArray2 = strArray[0].Split(new char[] { ',' }); if (strArray2.Length < 4) { return "1Old key file format, please use new key file !"; } if ((strArray2[3].Substring(1, 4) != "0000") && !this.CheckExpirationValidate(strArray2[3])) { return "1Key is expired !"; } if ((strArray2[1].Substring(0, 1) == "O") && (type == 0)) { return "1Element Key has not supported yet !"; } this.gsSize = strArray2[0]; this.gsBID = strArray2[1].Substring(1, 2); this.gsPID1 = strArray2[2].Substring(1, 3); this.gsPID2 = strArray2[2].Substring(5, 3); this.gsExpiration = strArray2[3].Substring(1, strArray2[3].Length - 1); this.gTotalPageID = int.Parse(this.gsBID) * 0x100; this.gbKeyValidate = true; return "0"; } public string TmatrixKeyCheck_OID4(string sKey) { this.gbKeyValidate = false; string[] strArray = sKey.Split(new char[] { ';' }); if (this.DecodeLicense_TmatrixKey(strArray[0]) != strArray[1]) { return "1Key is not correct, it should be modified !"; } string[] strArray2 = strArray[0].Split(new char[] { ',' }); if (strArray2.Length < 5) { return "1 It might be old key file format, please use OID4 key file !"; } if ((strArray2[4].Substring(1, 4) != "0000") && !this.CheckExpirationValidate(strArray2[4])) { // return "0"; //return "1Key is expired ++++++++++!"; } this.gsSID = strArray2[0].Substring(1, 1); this.gsOID = strArray2[1].Substring(1, 3); this.gsBID = strArray2[2].Substring(1, 4); this.gsPID1 = strArray2[3].Substring(1, 3); this.gsPID2 = strArray2[3].Substring(5, 3); this.gSID = int.Parse(this.gsSID); this.gOID = int.Parse(this.gsOID); this.gBID = int.Parse(this.gsBID); this.gPID1 = int.Parse(this.gsPID1); this.gPID2 = int.Parse(this.gsPID2); this.gsExpiration = strArray2[4].Substring(1, strArray2[4].Length - 1); this.gTotalPageID = int.Parse(this.gsBID) * 0x100; this.gbKeyValidate = true; return "0"; } public string TmatrixKeyCheck_OID4(string sKey, int type) { this.gbKeyValidate = false; string[] strArray = sKey.Split(new char[] { ';' }); if (this.DecodeLicense_TmatrixKey(strArray[0]) != strArray[1]) { return "1Key is not correct, it should be modified !"; } string[] strArray2 = strArray[0].Split(new char[] { ',' }); if (strArray2.Length < 5) { return "1Old key file format, please use new key file !"; } if ((strArray2[4].Substring(1, 4) != "0000") && !this.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) { this.gsSID = strArray2[0].Substring(1, 1); this.gsOID = strArray2[1].Substring(1, 3); this.gsBID = strArray2[2].Substring(1, 4); this.gsPID1 = strArray2[3].Substring(1, 3); this.gsPID2 = strArray2[3].Substring(5, 3); this.gSID = int.Parse(this.gsSID); this.gOID = int.Parse(this.gsOID); this.gBID = int.Parse(this.gsBID); this.gPID1 = int.Parse(this.gsPID1); this.gPID2 = int.Parse(this.gsPID2); this.gsExpiration = strArray2[4].Substring(1, strArray2[4].Length - 1); this.gbKeyValidate = true; } return "0"; } public void TmatrixUninitialize() { this.oidPIGenerator.Uninitialize(); } } }