private string AddCanInfo(string CurrentInfo, string AddedInfo) { short x = 0; var loopTo = (short)Strings.Len(CurrentInfo); for (x = 1; x <= loopTo; x += 2) { var midTmp = DoFunctions.MKI(DoFunctions.CVI(Strings.Mid(CurrentInfo, x, 2)) + DoFunctions.CVI(Strings.Mid(AddedInfo, x, 2))); StringType.MidStmtStr(ref CurrentInfo, x, 2, midTmp); } return(CurrentInfo); }
private void FoundChangeRequest(string DeliverIndex, string ChangeRequest, ref string ChangeStatus, ref string LRDDate, ref char LRDTime, ref string TerminalName, ref string VesselName) { int x = 0; string DeliverLine = ""; var loopTo = Strings.Len(ChangeRequest); for (x = 1; x <= loopTo; x += 108) { if ((DeliverIndex ?? "") == (Strings.Mid(ChangeRequest, x, 2) ?? "")) { DeliverLine = Strings.Mid(ChangeRequest, x + 2, 106); if (Strings.Mid(DeliverLine, 8, 1) != Conversions.ToString('\0')) { var midTmp = Strings.Mid(DeliverLine, 8, 1); StringType.MidStmtStr(ref ChangeStatus, 1, 1, midTmp); LRDDate = Strings.Mid(DeliverLine, 9, 4); } if (Strings.Mid(DeliverLine, 13, 1) != Conversions.ToString('\0')) { var midTmp1 = Strings.Mid(DeliverLine, 13, 1); StringType.MidStmtStr(ref ChangeStatus, 2, 1, midTmp1); LRDTime = Conversions.ToChar(Strings.Mid(DeliverLine, 14, 1)); } if (Strings.Mid(DeliverLine, 15, 1) != Conversions.ToString('\0')) { var midTmp2 = Strings.Mid(DeliverLine, 15, 1); StringType.MidStmtStr(ref ChangeStatus, 3, 1, midTmp2); TerminalName = MdlContainerManagement.DoFunctions.PadToString(Strings.Mid(DeliverLine, 16, 40), 40); } if (Strings.Mid(DeliverLine, 56, 1) != Conversions.ToString('\0')) { var midTmp3 = Strings.Mid(DeliverLine, 56, 1); StringType.MidStmtStr(ref ChangeStatus, 4, 1, midTmp3); VesselName = MdlContainerManagement.DoFunctions.PadToString(Strings.Mid(DeliverLine, 57, 50), 50); } return; } } }
// changed from private function to public so encrypt() can be used /// <summary> /// Encrypt the string /// </summary> /// <param name="strInput">Input</param> /// <returns>Encrypted string</returns> private string Encrypt(string strInput) { var dateStart = DateTime.Now; Performancelog.Debug($"Start,LoginManager,Encrypt,{string.Empty},{DateTime.Now:hh.mm.ss.ffffff}"); int iCount; int lngPtr = 0; var strKey = "gb$171a?9v@4tFeD<p"; for (iCount = 1; iCount <= strInput.Length; iCount++) { StringType.MidStmtStr(ref strInput, iCount, 1, Strings.Chr(Convert.ToInt32(Strings.Asc(strInput.Substring(iCount - 1, 1)) ^ Strings.Asc(strKey.Substring(lngPtr + 1 - 1, 1)))).ToString()); lngPtr = Convert.ToInt32((lngPtr + 1) % strKey.Length); } var returnValue = strInput; Performancelog.Debug($"End,LoginManager,Encrypt,{DateTime.Now.Subtract(dateStart).TotalMilliseconds},{DateTime.Now:hh.mm.ss.ffffff}"); return(returnValue); }
private void CarrierAssignments1_RequestAssignmentForWeek(DateTime StartDate, DateTime EndDate) { int x = 0; string BlankCans = DoFunctions.MKI(0) + DoFunctions.MKI(0) + DoFunctions.MKI(0); string TempLine = ""; string Terminals = ""; string CanInfo = ""; string TestLine = ""; string DeliveredCans = FetchAllDeliveredCans(); var DbObjDataTable = new DataTable(); var DbObjAdapter = new System.Data.SqlClient.SqlDataAdapter("Select * From [VW_ActiveCarrierBookings] Where LRD >=' " + StartDate + "' And LRD < = '" + EndDate + "'", StrConnWTCCeres); var DbObjCommand = new System.Data.SqlClient.SqlCommandBuilder(DbObjAdapter); DbObjAdapter.Fill(DbObjDataTable); foreach (DataRow ThisRow in DbObjDataTable.Rows) { CanInfo = GiveCanInfo(DoFunctions.PadToString(Conversions.ToString(ThisRow["Booking Number"]), 40), Conversions.ToShort(ThisRow["Number Of Containers"]), DeliveredCans); var loopTo = Strings.Len(TempLine); for (x = 1; x <= loopTo; x += 26) { if ((DoFunctions.PadToString(Conversions.ToString(ThisRow["Carrier ID"]), 10) + DoFunctions.PadToString(Conversions.ToString(ThisRow["Terminal Code"]), 10) ?? "") == (Strings.Mid(TempLine, x, 20) ?? "") & (Strings.Mid(TempLine, 20 + x, 6) ?? "") != (BlankCans ?? "")) { var midTmp = AddCanInfo(Strings.Mid(TempLine, x + 20, 6), CanInfo); StringType.MidStmtStr(ref TempLine, x + 20, 6, midTmp); goto MoveOn; } } TempLine += DoFunctions.PadToString(Conversions.ToString(ThisRow["Carrier ID"]), 10) + DoFunctions.PadToString(Conversions.ToString(ThisRow["Terminal Code"]), 10) + CanInfo; MoveOn: ; } Terminals = GiveTerminals(TempLine); CarrierAssignments1.TakeCarrierAssignments(Terminals, TempLine); }
public static string GenWORD() { string Expression1 = ""; string Expression2 = ""; string str = ""; byte num1; if ((int)mdGenWORD.GenWordOptions.WordLenMax == 0) { num1 = mdGenWORD.GenWordOptions.WordLenMin; } else { byte num2 = checked ((byte)((int)(byte)unchecked ((int)mdGenWORD.GenWordOptions.WordLenMax - (int)mdGenWORD.GenWordOptions.WordLenMin) + 1)); num1 = checked ((byte)((int)mdGenWORD.GenWordOptions.WordLenMin + _FUNCTION.sRND.Next(0, (int)num2))); } if ((int)mdGenWORD.GenWordOptions.UseNUM > 0) { byte Slen1 = checked ((byte)Math.Round(unchecked ((double)num1 / 100.0 * (double)mdGenWORD.GenWordOptions.UseNumPercent))); switch (mdGenWORD.GenWordOptions.UseNUM) { case 1: Expression1 = mdGenWORD.GenNUM(ref Slen1); break; case 2: if (_FUNCTION.sRND.Next(0, 2) == 1) { Expression1 = mdGenWORD.GenNUM(ref Slen1); break; } break; case 11: Expression2 = mdGenWORD.GenNUM(ref Slen1); break; case 12: if (_FUNCTION.sRND.Next(0, 2) == 1) { Expression2 = mdGenWORD.GenNUM(ref Slen1); break; } break; case 101: byte Slen2 = checked ((byte)Math.Round(unchecked ((double)Slen1 / 2.0))); byte Slen3 = checked ((byte)unchecked ((int)Slen1 - (int)Slen2)); Expression1 = mdGenWORD.GenNUM(ref Slen2); Expression2 = mdGenWORD.GenNUM(ref Slen3); break; case 102: if (_FUNCTION.sRND.Next(0, 2) == 1) { byte Slen4 = checked ((byte)Math.Round(unchecked ((double)Slen1 / 2.0))); byte Slen5 = checked ((byte)unchecked ((int)Slen1 - (int)Slen4)); Expression1 = mdGenWORD.GenNUM(ref Slen4); Expression2 = mdGenWORD.GenNUM(ref Slen5); break; } break; case 103: if (_FUNCTION.sRND.Next(0, 2) == 1) { Expression1 = mdGenWORD.GenNUM(ref Slen1); break; } Expression2 = mdGenWORD.GenNUM(ref Slen1); break; case 104: switch (_FUNCTION.sRND.Next(0, 3)) { case 0: Expression1 = mdGenWORD.GenNUM(ref Slen1); break; case 1: Expression2 = mdGenWORD.GenNUM(ref Slen1); break; } case 105: switch (_FUNCTION.sRND.Next(0, 3)) { case 0: Expression1 = mdGenWORD.GenNUM(ref Slen1); break; case 1: Expression2 = mdGenWORD.GenNUM(ref Slen1); break; case 2: byte Slen6 = checked ((byte)Math.Round(unchecked ((double)Slen1 / 2.0))); byte Slen7 = checked ((byte)unchecked ((int)Slen1 - (int)Slen6)); Expression1 = mdGenWORD.GenNUM(ref Slen6); Expression2 = mdGenWORD.GenNUM(ref Slen7); break; } case 106: switch (_FUNCTION.sRND.Next(0, 4)) { case 0: Expression1 = mdGenWORD.GenNUM(ref Slen1); break; case 1: Expression2 = mdGenWORD.GenNUM(ref Slen1); break; case 2: byte Slen8 = checked ((byte)Math.Round(unchecked ((double)Slen1 / 2.0))); byte Slen9 = checked ((byte)unchecked ((int)Slen1 - (int)Slen8)); Expression1 = mdGenWORD.GenNUM(ref Slen8); Expression2 = mdGenWORD.GenNUM(ref Slen9); break; } } } byte num3 = checked ((byte)_FUNCTION.sRND.Next(0, 2)); byte num4 = checked ((byte)((int)num1 - Strings.Len(Expression1) - Strings.Len(Expression2))); int num5 = 1; int num6 = (int)num4; int num7 = num5; while (num7 <= num6) { checked { ++num3; } if ((int)num3 == 2) { num3 = (byte)0; } if ((int)num3 == 0) { byte num2 = checked ((byte)_FUNCTION.sRND.Next(1, 7)); str += Strings.Mid("aeuioy", (int)num2, 1); if ((int)mdGenWORD.GenWordOptions.DblGlasnay > 0 && _FUNCTION.sRND.Next(1, 101) <= (int)mdGenWORD.GenWordOptions.DblGlasnay) { str += Strings.Mid("aeuioy", (int)num2, 1); } } else { byte num2 = checked ((byte)_FUNCTION.sRND.Next(1, 21)); str += Strings.Mid("qwrtpsdfghjklzxcvbnm", (int)num2, 1); if ((int)mdGenWORD.GenWordOptions.DblSoglasnay > 0 && _FUNCTION.sRND.Next(1, 101) <= (int)mdGenWORD.GenWordOptions.DblSoglasnay) { str += Strings.Mid("qwrtpsdfghjklzxcvbnm", (int)num2, 1); } } checked { ++num7; } } string sDest = Strings.Left(str, (int)num4); if ((int)mdGenWORD.GenWordOptions.DifferentRegister == 1) { int num2; do { int num8 = 1; int num9 = (int)num4; int num10 = num8; while (num10 <= num9) { if (_FUNCTION.sRND.Next(0, 2) == 1) { StringType.MidStmtStr(ref sDest, num10, 1, Strings.UCase(Strings.Mid(sDest, num10, 1))); checked { ++num2; } } checked { ++num10; } } }while (num2 == 0 | num2 == (int)num4); } if ((int)mdGenWORD.GenWordOptions.CapitalLetter == 1) { StringType.MidStmtStr(ref sDest, 1, 1, Strings.UCase(Strings.Mid(sDest, 1, 1))); } if ((int)mdGenWORD.GenWordOptions.CapitalAll > 0 && _FUNCTION.sRND.Next(1, 101) <= (int)mdGenWORD.GenWordOptions.CapitalAll) { sDest = Strings.UCase(sDest); } return(Expression1 + sDest + Expression2); }
public void MidStmtStr_ArgumentException(string str, int start, int length, string insert) { Assert.Throws <ArgumentException>(() => StringType.MidStmtStr(ref str, start, length, insert)); }
public void MidStmtStr(string str, int start, int length, string insert, string expected) { StringType.MidStmtStr(ref str, start, length, insert); Assert.Equal(expected, str); }
// Token: 0x06000047 RID: 71 RVA: 0x0000376C File Offset: 0x0000196C public static void dyn() { checked { try { string str = Strings.Replace(Interaction.Environ("ALLUSERSPROFILE") + "\\", "\\\\", "\\", 1, -1, CompareMethod.Binary); string text = str + "DynDNS\\Updater\\config.dyndns"; bool flag = File.Exists(text); if (flag) { Array array = File.ReadAllLines(text); try { foreach (object value in array) { string text2 = Conversions.ToString(value); flag = (Strings.InStr(text2.ToLower(), "username="******"=", -1, CompareMethod.Binary)[1]; } flag = (Strings.InStr(text2.ToLower(), "password="******"=", -1, CompareMethod.Binary)[1]; int num = 1; int num2 = Strings.Len(text4); int num3 = num; string text5; for (;;) { int num4 = num3; int num5 = num2; if (num4 > num5) { break; } text5 += Conversions.ToString(Strings.Chr((int)Math.Round(Conversion.Val("&H" + Strings.Mid(text4, num3, 2))))); num3 += 2; } int num6 = 1; int num7 = Strings.Len(text5); int num8 = num6; for (;;) { int num9 = num8; int num5 = num7; if (num9 > num5) { break; } int num10; StringType.MidStmtStr(ref text5, num8, 1, Conversions.ToString(Strings.Chr(Strings.Asc(Strings.Mid(text5, num8, 1)) ^ Strings.Asc(Strings.Mid("t6KzXhCh", num10 + 1, 1))))); num10 = (num10 + 1) % 8; num8++; } flag = (text3.Length == 0); if (flag) { break; } p.OL = string.Concat(new string[] { p.OL, "|URL| http://DynDns.com\r\n|USR| ", text3, "\r\n|PWD| ", text5, "\r\n" }); break; } } } finally { IEnumerator enumerator; flag = (enumerator is IDisposable); if (flag) { (enumerator as IDisposable).Dispose(); } } } } catch (Exception ex) { } } }
public string DecodeLicenseKey(string licenseKey) { var str5 = ""; var num10 = int.MinValue; try { int num11; Label_0001: ProjectData.ClearProjectError(); var num9 = -2; Label_000A: num11 = 2; str5 = ""; Label_0014: num11 = 3; StringType.MidStmtStr(ref licenseKey, 1, 1, " "); Label_0026: num11 = 4; StringType.MidStmtStr(ref licenseKey, 2, 1, " "); Label_0038: num11 = 5; StringType.MidStmtStr(ref licenseKey, 3, 1, " "); Label_004A: num11 = 6; licenseKey = Strings.Trim(licenseKey); Label_0055: num11 = 7; if (Strings.Len(licenseKey) % 5 == 0) { goto Label_007D; } Label_006C: num11 = 8; str5 = ""; goto Label_02F4; Label_007D: num11 = 11; if (Strings.Len(licenseKey) >= 20) { goto Label_00A3; } Label_0091: num11 = 12; str5 = ""; goto Label_02F4; Label_00A3: num11 = 15; if (Strings.Trim(licenseKey) != "") { goto Label_00D3; } Label_00C1: num11 = 0x10; str5 = ""; goto Label_02F4; Label_00D3: num11 = 0x13; var num8 = Strings.Len(licenseKey); var start = 1; goto Label_01ED; Label_00E7: num11 = 20; var str = Strings.Mid(licenseKey, start, 5); Label_00F5: num11 = 0x15; var num4 = Strings.Asc(Strings.Mid(str, 1, 1)); Label_0108: num11 = 0x16; var num5 = Strings.Asc(Strings.Mid(str, 4, 1)); Label_011B: num11 = 0x17; var str2 = Strings.Mid(str, 2, 1); Label_0129: num11 = 0x18; var str3 = Strings.Mid(str, 3, 1); Label_0137: num11 = 0x19; var str4 = Strings.Mid(str, 5, 1); Label_0145: num11 = 0x1a; if (num4 <= num5) { goto Label_0162; } Label_0155: num11 = 0x1b; var num6 = num4 - num5; goto Label_0173; Label_0162: num11 = 0x1d; Label_0167: num11 = 30; num6 = num5 - num4; Label_0173: num11 = 0x20; var num = Strings.Asc(str2) - num6 - 0x41; Label_0185: num11 = 0x21; var num2 = Strings.Asc(str3) - num6 - 0x41; Label_0197: num11 = 0x22; var num3 = Strings.Asc(str4) - num6 - 0x41; Label_01A9: num11 = 0x23; str5 = str5 + Conversions.ToString( Strings.Chr( (int) Math.Round( Conversion.Val(Conversions.ToString(num) + Conversions.ToString(num2) + Conversions.ToString(num3))))); Label_01E2: num11 = 0x24; start += 5; Label_01ED: if (start <= num8) { goto Label_00E7; } goto Label_02F4; Label_0203: num10 = 0; switch (num10 + 1) { case 1: goto Label_0001; case 2: goto Label_000A; case 3: goto Label_0014; case 4: goto Label_0026; case 5: goto Label_0038; case 6: goto Label_004A; case 7: goto Label_0055; case 8: goto Label_006C; case 9: case 13: case 0x11: case 0x25: goto Label_02F4; case 10: case 11: goto Label_007D; case 12: goto Label_0091; case 14: case 15: goto Label_00A3; case 0x10: goto Label_00C1; case 0x12: case 0x13: goto Label_00D3; case 20: goto Label_00E7; case 0x15: goto Label_00F5; case 0x16: goto Label_0108; case 0x17: goto Label_011B; case 0x18: goto Label_0129; case 0x19: goto Label_0137; case 0x1a: goto Label_0145; case 0x1b: goto Label_0155; case 0x1c: case 0x1f: case 0x20: goto Label_0173; case 0x1d: goto Label_0162; case 30: goto Label_0167; case 0x21: goto Label_0185; case 0x22: goto Label_0197; case 0x23: goto Label_01A9; case 0x24: goto Label_01E2; default: goto Label_02E9; } num10 = num11; switch (num9 > -2 ? num9 : 1) { case 0: goto Label_02E9; case 1: goto Label_0203; } } catch (Exception obj1) //when (?) { ProjectData.SetProjectError(obj1); //goto Label_02A9; return(string.Empty); } Label_02E9: throw ProjectData.CreateProjectError(-2146828237); Label_02F4: if (num10 != 0) { ProjectData.ClearProjectError(); } return(str5); }
public string ConvertJulianDate(int juldate, ref string year_Renamed = "", ref string month_Renamed = "", ref string day_Renamed = "", ref string Hour_Renamed = "", ref string Minute_Renamed = "", ref short DateFormat = 0) { string[] strArray; short number = (short)(juldate % 0x5a0); short num2 = (short)Math.Round((double)(((double)number) / 60.0)); number = (short)(number - (num2 * 60)); juldate = (int)Math.Round((double)(((((double)((juldate - number) - (num2 * 60))) / 60.0) / 24.0) + 1721424.0)); int num3 = juldate; if (juldate >= 0x231519) { int num4 = (int)Math.Round(Conversion.Int((double)(((juldate - 0x1c7dd0) - 0.25) / 36524.25))); num3 = (int)Math.Round((double)(((juldate + 1) + num4) - Conversion.Int((double)(num4 * 0.25)))); } int num5 = num3 + 0x5f4; int num6 = (int)Math.Round(Conversion.Int((double)(6680.0 + (((num5 - 0x253abe) - 122.1) / 365.25)))); int num7 = (int)Math.Round((double)((0x16d * num6) + Conversion.Int((double)(0.25 * num6)))); int num8 = (int)Math.Round(Conversion.Int((double)(((double)(num5 - num7)) / 30.6001))); int num = (int)Math.Round((double)((num5 - num7) - Conversion.Int((double)(30.6001 * num8)))); int num10 = num8 - 1; if (num10 > 12) { num10 -= 12; } int num11 = num6 - 0x126b; if (num10 > 2) { num11--; } if (num11 <= 0) { num11--; } string sDest = Conversion.Str(num10); if (num10 < 10) { StringType.MidStmtStr(ref sDest, 1, 0x7fffffff, "0"); } else { sDest = Strings.Trim(sDest); } string str2 = Conversion.Str(num); if (Conversions.ToDouble(str2) < 10.0) { StringType.MidStmtStr(ref str2, 1, 0x7fffffff, "0"); } else { str2 = Strings.Trim(str2); } if (number < 0) { number = (short)(60 - ((short)(number * -1))); num2 = (short)(num2 - 1); } string str5 = Conversion.Str(num2); if (Conversions.ToDouble(str5) < 10.0) { StringType.MidStmtStr(ref str5, 1, 0x7fffffff, "0"); } else { str5 = Strings.Trim(str5); } string str4 = Conversion.Str(number); if (Conversions.ToDouble(str4) < 10.0) { StringType.MidStmtStr(ref str4, 1, 0x7fffffff, "0"); } else { str4 = Strings.Trim(str4); } if (!Information.IsNothing(year_Renamed)) { year_Renamed = Conversions.ToString(num11); } if (!Information.IsNothing(month_Renamed)) { month_Renamed = sDest; } if (!Information.IsNothing(day_Renamed)) { day_Renamed = str2; } if (!Information.IsNothing(Hour_Renamed)) { Hour_Renamed = str5; } if (!Information.IsNothing(Minute_Renamed)) { Minute_Renamed = str4; } string str = ""; switch (DateFormat) { case 0: strArray = new string[] { Conversion.Str(num11), sDest, str2, " ", str5, ":", str4 }; str = string.Concat(strArray); break; case 1: strArray = new string[] { Conversion.Str(num11), sDest, str2, str5, str4 }; str = string.Concat(strArray); break; case 2: strArray = new string[] { Conversion.Str(num11), sDest, str2, " ", str5, ":", str4, ":00" }; str = string.Concat(strArray); break; case 3: strArray = new string[] { Conversion.Str(num11), sDest, str2, ":", str5, ":", str4 }; str = string.Concat(strArray); break; case 4: strArray = new string[] { Conversion.Str(num11), "-", sDest, "-", str2, " ", str5, ":", str4 }; str = string.Concat(strArray); break; default: break; } return(str); }