Advertisement
Guest User

MEXDeMakE - Program.cs

a guest
Oct 26th, 2014
1,185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 98.74 KB | None | 0 0
  1. /* Mott's Enterprise XML Decision-Making Engine (MEXDeMakE)
  2.  * Copyright (C) 2013 mott555
  3.  *
  4.  * This program is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU General Public License
  6.  * as published by the Free Software Foundation; either version 2
  7.  * of the License, or (at your option) any later version.
  8.  *
  9.  * This program is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  * GNU General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program; if not, write to the Free Software
  16.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  17.  * */
  18.  
  19. using System;
  20. using System.Collections.Generic;
  21. using System.Linq;
  22. using System.Text;
  23. using System.Net;
  24. using System.IO;
  25. using System.Reflection;
  26. using System.Net.Sockets;
  27. using System.Threading;
  28. using System.Diagnostics;
  29.  
  30. namespace Mott.OMGWTF2
  31. {
  32.     class Program
  33.     {
  34.         static void Main(string[] args)
  35.         {
  36.             Console.BackgroundColor = ConsoleColor.Green;
  37.             Console.ForegroundColor = ConsoleColor.Black;
  38.             Console.Title = (string)MyMethod("i18n", "Mott's Enterprise XML Decision-Making Engine (MEXDeMakE)", "english");
  39.             Console.WriteLine((string)MyMethod("i18n", "Welcome to Mott's Enterprise XML Decision-Making Engine (MEXDeMakE).", "english"));
  40.             Console.WriteLine((string)MyMethod("i18n", "Copyright © 2013 mott555", "english"));
  41.             Console.WriteLine();
  42.             Console.BackgroundColor = ConsoleColor.Black;
  43.             Console.ForegroundColor = ConsoleColor.Green;
  44.             Console.Write((string)MyMethod("i18n", "Performing hardware check...", "english"));
  45.             // Sanity checks on hardware. Run multiple times to make sure.
  46.             bool hardwarePass = false;
  47.             for (int i = 0; i < 10; i++)
  48.             {
  49.                 hardwarePass = (bool)MyMethod(HARDWARE_TEST, 1);
  50.                 if (hardwarePass == false)
  51.                 {
  52.                     Console.WriteLine((string)MyMethod("i18n", "Hardware failure.", "english"));
  53.                     return;
  54.                 }
  55.             }
  56.             if (hardwarePass)
  57.                 Console.WriteLine((string)MyMethod("i18n", "Pass.", "english"));
  58.  
  59.             // Get config.
  60.             string config = null;
  61.             List<string> decisions = null;
  62.             List<string> tags = null;
  63.             int workFactor = 1;
  64.             int serverPort = 0;
  65.             string server = null;
  66.             string lang = null;
  67.             for (int i = 0; i < 10; i++)
  68.             {
  69.                 switch (i)
  70.                 {
  71.                     case 0:
  72.                         Console.Write((string)MyMethod("i18n", "Loading EnterpriseConfig.xml...", "english"));
  73.                         config = (string)MyMethod(intGetConfig);
  74.                         Console.WriteLine((string)MyMethod("i18n", "Complete.", "english"));
  75.                         break;
  76.                     case 1:
  77.                         Console.Write((string)MyMethod("i18n", "Loading decision values...", "english"));
  78.                         decisions = (List<string>)MyMethod(getDecisionValues, config);
  79.                         Console.WriteLine((string)MyMethod("i18n", "Complete.", "english"));
  80.                         break;
  81.                     case 2:
  82.                         Console.Write((string)MyMethod("i18n", "Loading entropy data set...", "english"));
  83.                         tags = (List<string>)MyMethod(getTags);
  84.                         Console.WriteLine((string)MyMethod("i18n", "Complete.", "english"));
  85.                         break;
  86.                     case 3:
  87.                         Console.Write((string)MyMethod("i18n", "Configuring work factor...", "english"));
  88.                         workFactor = (int)MyMethod(getWorkFactor, config);
  89.                         Console.WriteLine((string)MyMethod("i18n", "Complete.", "english"));
  90.                         break;
  91.                     case 4:
  92.                         serverPort = (int)MyMethod("getPort", config);
  93.                         break;
  94.                     case 5:
  95.                         Console.Write((string)MyMethod("i18n", "Launching server...", "english"));
  96.                         MyMethod("launchServer", serverPort);
  97.                         Console.WriteLine((string)MyMethod("i18n", "Complete.", "english"));
  98.                         break;
  99.                     case 6:
  100.                         server = (string)MyMethod("getServer", config);
  101.                         break;
  102.                     case 7:
  103.                         TcpClient tcp = new TcpClient();
  104.                         tcp.Connect(server, serverPort);
  105.                         NetworkStream nets = tcp.GetStream();
  106.                         myReader = new StreamReader(nets);
  107.                         myWriter = new StreamWriter(nets);
  108.                         break;
  109.                     case 9:
  110.                         lang = (string)MyMethod("getLang", config);
  111.                         break;
  112.                     default: break;
  113.                 }
  114.             }
  115.  
  116.             Console.WriteLine((string)MyMethod("i18n", "Initializing menu...Complete.", "english"));
  117.  
  118.             Console.WriteLine();
  119.             MyMethod(menu, tags, decisions, workFactor, lang);
  120.         }
  121.  
  122.         // Easy fix for typoes.
  123.         const bool fasle = false;
  124.  
  125.         // Method control constants.
  126.         const int getTags = 1;
  127.         const int getDecisionValues = 2;
  128.         const int intGetConfig = 14;
  129.         const int getWorkFactor = 88;
  130.         const int HARDWARE_TEST = 6;
  131.         const int growArray = 9;
  132.         const int INT_GET_TAG_PAGE = 890;
  133.         const int doShutdown = 888;
  134.         const string generateRandomNo = "gen";
  135.         const int menu = 567; // Opens the menu.
  136.         const int pausAndCool = 789;
  137.         static int sleepThenClose = 999999;
  138.         static string getShutdownThread = "shutdownThread";
  139.         static string getShutdownThreadStart = "sts";
  140.  
  141.         // Other usful constants.
  142.         static string strLiLength = "3";
  143.         const string notUsed = "zzzzz";
  144.         const string tagPage = "http://forums.thedailywtf.com/tags/default.aspx";
  145.         const int INT_TWENTY_SEVEN = 27;
  146.         static DateTime ProgramStart = DateTime.Now;
  147.  
  148.         /// <summary>
  149.         /// Main method, does most of the app's processing.
  150.         ///
  151.         /// Easily extensible. Just add to the switch statement.
  152.         /// </summary>
  153.         /// <param name="args">Method arguments.</param>
  154.         /// <returns>Varies, depends on what was in args. Just read the code,
  155.         /// code is the best documentation.</returns>
  156.         static object MyMethod(params object[] args)
  157.         {
  158.             try
  159.             {
  160.                 switch ((int)args[0])
  161.                 {
  162.                     case 1: // get tags from tdwtf
  163.                         for (int i = 0; i < 1; i++)
  164.                         {
  165.                             WebClient wc = new WebClient();
  166.                             string tagLoc = (string)MyMethod(INT_GET_TAG_PAGE);
  167.                             string data = wc.DownloadString(tagLoc as string);
  168.  
  169.  
  170.                             bool tagCouldFound = false;
  171.                             int position = 0;
  172.                             while (!tagCouldFound)
  173.                             {
  174.                                 string substring = data.Substring(position, INT_TWENTY_SEVEN).ToLower();
  175.                                 if (substring == "<ul class=\"commontagcloud\">")
  176.                                     tagCouldFound = true;
  177.                                 position = incrementIntegr(position);
  178.                             }
  179.                             List<string> tags = new List<string>();
  180.  
  181.                             try
  182.                             {
  183.                                 bool liFoudn = false;
  184.                                 bool aFound = fasle;
  185.                                 bool endOfAFoudn = false;
  186.                                 bool boolEndOfTags = false;
  187.  
  188.                                 while (!boolEndOfTags)
  189.                                 {
  190.                                     liFoudn = false;
  191.                                     aFound = fasle;
  192.                                     endOfAFoudn = false;
  193.                                     while (!liFoudn || liFoudn == false)
  194.                                     {
  195.                                         string substring = data.Substring(position, int.Parse(strLiLength));
  196.                                         if (substring == "<li")
  197.                                             liFoudn = true;
  198.                                         position = incrementIntegr(position);
  199.                                     }
  200.                                     // Loop while a tag is not found.
  201.                                     while (!aFound)
  202.                                     {
  203.                                         string substring1 = data.Substring(position, int.Parse(2.ToString()));
  204.                                         if (substring1 == "<a")
  205.                                             aFound = true;
  206.                                         position = incrementIntegr(position);
  207.                                     }
  208.                                     // Another loop.
  209.                                     while (!endOfAFoudn)
  210.                                     {
  211.                                         string substring2 = data.Substring(position, 1);
  212.                                         if (substring2 == ">")
  213.                                             endOfAFoudn = true;
  214.                                         position = incrementIntegr(position);
  215.                                     }
  216.                                     string tag = "";
  217.  
  218.                                     bool end = fasle;
  219.                                     while (!end)
  220.                                     {
  221.                                         char character = data[position];
  222.                                         if (character == '<')
  223.                                             end = !end;
  224.                                         else
  225.                                         {
  226.                                             {
  227.                                                 tag += character;
  228.                                             }
  229.                                         }
  230.                                         position = incrementIntegr(position);
  231.                                     }
  232.                                     tags.Add(tag);
  233.                                     if (data.Substring(position).ToString().StartsWith("</ul>"))
  234.                                         boolEndOfTags = true;
  235.                                 }
  236.                                 return tags;
  237.                             }
  238.                             catch
  239.                             {
  240.                                 return tags;
  241.                             }
  242.                         }
  243.                         break;
  244.                     case 22:
  245.                         GC.Collect();
  246.                         break;
  247.                     case 14:
  248.                         string fileName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
  249.                         int lastSlash = fileName.LastIndexOf('\\');
  250.                         fileName = fileName.Substring(0, lastSlash);
  251.                         fileName = fileName + "\\EnterpriseConfig.xml";
  252.                         StreamReader read = new StreamReader(fileName);
  253.                         string file = "";
  254.                         try
  255.                         {
  256.                             // Can handle files up to 1000 lines
  257.                             for (int anInt = 0; anInt < 1000; anInt++)
  258.                             {
  259.                                 file += read.ReadLine();
  260.                             }
  261.                         }
  262.                         catch { }
  263.                        
  264.                         return file;
  265.                         break;
  266.                     case 789:
  267.                         System.Threading.Thread.Sleep(10000);
  268.                         break;
  269.                     case 9:
  270.                         object[] arr = (object[])args[1];
  271.                         object[] arr2 = new object[arr.Length + 1];
  272.                         for (int i = 0; i < arr.Length; i = incrementIntegr(i))
  273.                         {
  274.                             object myItem = arr[i];
  275.                             arr2[i] = myItem;
  276.                         }
  277.                         return arr2;
  278.                         break;
  279.                     case 567:
  280.                         {                            
  281.                             List<string> tagList = (List<string>)args[1];
  282.                             List<string> decisionList = (List<string>)args[2];
  283.                             int workFactor = (int)args[3];
  284.                             string lang = (string)args[4];
  285.  
  286.                             StringBuilder strings = new StringBuilder();
  287.                             strings.Append((string)MyMethod("i18n", "Please select from these menu items.\n", lang));
  288.                             strings.Append((string)MyMethod("i18n", " 1: Generate Decision\n", lang));
  289.                             strings.Append((string)MyMethod("i18n", " 2: Exit\n", lang));
  290.                             strings.Append((string)MyMethod("i18n", " 3: Show decision values\n", lang));
  291.                             strings.Append((string)MyMethod("i18n", " 4: Show entropy data set\n", lang));
  292.                             strings.Append((string)MyMethod("i18n", " 5: Edit enterprise configuration\n", lang));
  293.                             strings.Append((string)MyMethod("i18n", " 6: Show menu\n", lang));
  294.                             strings.Append((string)MyMethod("i18n", " 7: Show time\n", lang));
  295.                             strings.Append((string)MyMethod("i18n", " 8: About\n", lang));
  296.                             strings.Append((string)MyMethod("i18n", "\n", lang));
  297.                             Console.Write(strings);
  298.                             string line = Console.ReadLine();
  299.  
  300.                             if (line == "1")
  301.                             {
  302.                                 MyMethod(568, tagList, decisionList, workFactor, lang);
  303.                             }
  304.                             if (line == "2")
  305.                             {
  306.                                 MyMethod(569);
  307.                             }
  308.                             if (line == "3")
  309.                             {
  310.                                 MyMethod(560, tagList, decisionList, workFactor, lang);
  311.                                
  312.                             }
  313.                             if (line == "4")
  314.                             {
  315.                                 MyMethod(987654321, tagList, decisionList, workFactor, lang);
  316.                             }
  317.                             if (line == "5")
  318.                             {
  319.                                 MyMethod(561, tagList, decisionList, workFactor, lang);
  320.                                
  321.                             }
  322.                             if (line == "6")
  323.                             {
  324.                                 MyMethod(562, tagList, decisionList, workFactor, lang);
  325.                                
  326.                             }
  327.                             if (line == "8")
  328.                             {
  329.                                 MyMethod(563, tagList, decisionList, workFactor, lang);
  330.                             }
  331.                             else
  332.                             {
  333.                                 MyMethod(564, tagList, decisionList, workFactor, lang);
  334.                             }
  335.                         }
  336.                         break;
  337.                     case 568:
  338.                         {
  339.                             List<string> tagList = (List<string>)args[1];
  340.                             List<string> decisionList = (List<string>)args[2];
  341.                             int workFactor = (int)args[3];
  342.                             string lang1 = (string)args[4];
  343.  
  344.                             StringBuilder strings = new StringBuilder();
  345.                             strings.Append((string)MyMethod("i18n", "Generating decision...", lang1));
  346.                             Console.Write(strings);
  347.  
  348.                             strings = new StringBuilder();
  349.                             strings.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
  350.                             strings.AppendLine("<EnterpriseDecisionNetworkDataPacket>");
  351.                             strings.AppendLine("<TagList>");
  352.                             try
  353.                             {
  354.                                 for (int asdf = 0; asdf < 100000; asdf++)
  355.                                 {
  356.                                     string d = tagList[asdf];
  357.                                     strings.AppendLine("<Tag>" + d + "</Tag>");
  358.                                 }
  359.                             }
  360.                             catch { }
  361.                             strings.AppendLine("</TagList>");
  362.                             strings.AppendLine("<DecisionList>");
  363.                             try
  364.                             {
  365.                                 for (int asdf = 0; asdf < 100000; asdf++)
  366.                                 {
  367.                                     string d = decisionList[asdf];
  368.                                     strings.AppendLine("<Decision>" + d + "</Decision>");
  369.                                 }
  370.                             }
  371.                             catch { }
  372.                             strings.AppendLine("</DecisionList>");
  373.  
  374.                             strings.AppendLine("<WorkFactor>" + workFactor + "</WorkFactor>");
  375.                             strings.AppendLine("</EnterpriseDecisionNetworkDataPacket>");
  376.                             myWriter.Write(strings.ToString());
  377.                             myWriter.Flush();
  378.  
  379.                             string xmlDec = myReader.ReadLine();
  380.                             string packetStartTag = myReader.ReadLine();
  381.                             string resultTag = myReader.ReadLine();
  382.                             string packetEndTag = myReader.ReadLine();
  383.  
  384.                             string decision = resultTag.Substring(8);
  385.                             decision = decision.Substring(0, decision.Length - 9);
  386.  
  387.                             strings = new StringBuilder();
  388.                             strings.Append((string)MyMethod("i18n", "Complete.\n", lang1));
  389.                             strings.Append((string)MyMethod("i18n", "Decision is\n", lang1));
  390.                             strings.Append("  " + decision.ToString() + "\n");
  391.                             strings.Append((string)MyMethod("i18n", "\n", lang1));
  392.                             strings.Append((string)MyMethod("i18n", "Press any key to return to the menu.\n", lang1));
  393.                             Console.Write(strings);
  394.                             Console.ReadKey();
  395.                             MyMethod(notUsed);
  396.  
  397.                             MyMethod(menu, tagList, decisionList, workFactor, lang1);
  398.  
  399.                             break;
  400.                         }
  401.                     case 569:
  402.                         {
  403.                             MyMethod(doShutdown);
  404.                             break;
  405.                         }
  406.                     case 560:
  407.                         {
  408.                             List<string> tagList = (List<string>)args[1];
  409.                             List<string> decisionList = (List<string>)args[2];
  410.                             int workFactor = (int)args[3];
  411.                             string lang2 = (string)args[4];
  412.                             string myConfigFile = (string)MyMethod(intGetConfig);
  413.                             List<string> possibleDecisions = (List<string>)MyMethod(2, myConfigFile);
  414.                             var listEnum = possibleDecisions.GetEnumerator();
  415.                             StringBuilder strings;
  416.                             while (listEnum.MoveNext())
  417.                             {
  418.                                 strings = new StringBuilder();
  419.                                 strings.Append(listEnum.Current);
  420.                                 strings.Append((string)MyMethod("i18n", "\n", lang2));
  421.                                 Console.Write(strings);
  422.                             }
  423.                             strings = new StringBuilder();
  424.                             strings.Append((string)MyMethod("i18n", "Press any key to return to the menu.\n", lang2));
  425.                             Console.Write(strings);
  426.                             Console.ReadKey();
  427.                             MyMethod(notUsed);
  428.                             // Console.Write(strings);
  429.                             //Console.ReadKey();
  430.                             MyMethod(notUsed);
  431.  
  432.                             MyMethod(menu, tagList, decisionList, workFactor, lang2);
  433.  
  434.                             break;
  435.                         }
  436.                     case 561:
  437.                         {
  438.                             List<string> tagList = (List<string>)args[1];
  439.                             List<string> decisionList = (List<string>)args[2];
  440.                             int workFactor = (int)args[3];
  441.                             string lang3 = (string)args[4];
  442.                             string fileName1 = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
  443.                             int lastSlash1 = fileName1.LastIndexOf('\\');
  444.                             fileName1 = fileName1.Substring(0, lastSlash1);
  445.                             fileName1 = fileName1 + "\\EnterpriseConfig.xml";
  446.                             Process p = Process.Start("notepad", fileName1);
  447.                             MyMethod(notUsed);
  448.                             // Console.Write(strings);
  449.                             //Console.ReadKey();
  450.                             MyMethod(notUsed);
  451.  
  452.                             MyMethod(menu, tagList, decisionList, workFactor, lang3);
  453.                             break;
  454.                         }
  455.                     case 562:
  456.                         {
  457.                             List<string> tagList = (List<string>)args[1];
  458.                             List<string> decisionList = (List<string>)args[2];
  459.                             int workFactor = (int)args[3];
  460.                             string lang4 = (string)args[4];
  461.                             MyMethod(notUsed);
  462.                             MyMethod(menu, tagList, decisionList, workFactor, lang4);
  463.  
  464.                             break;
  465.                         }
  466.                     case 563:
  467.                         {
  468.                             List<string> tagList = (List<string>)args[1];
  469.                             List<string> decisionList = (List<string>)args[2];
  470.                             int workFactor = (int)args[3];
  471.                             string lang5 = (string)args[4];
  472.                             // Console.Write(strings);
  473.                             //Console.ReadKey();
  474.                             MyMethod(notUsed);
  475.                             MyMethod(44444, lang5);
  476.                             MyMethod(menu, tagList, decisionList, workFactor, lang5);
  477.                             break;
  478.                         }
  479.                     case 564:
  480.                         {
  481.                             List<string> tagList = (List<string>)args[1];
  482.                             List<string> decisionList = (List<string>)args[2];
  483.                             int workFactor = (int)args[3];
  484.                             string lang = (string)args[4];
  485.                             MyMethod(notUsed);
  486.                             MyMethod(menu, tagList, decisionList, workFactor, lang);
  487.                             break;
  488.                         }
  489.                     case 15:
  490.                         string configFile = (string)args[1];
  491.                         int position1 = 0;
  492.                         bool bKeyFnd = fasle;
  493.                         while (bKeyFnd != true)
  494.                         {
  495.                             string substring = configFile.Substring(position1, 26);
  496.                             if (substring == "<add key=\"keyIncrementCfg\"")
  497.                                 bKeyFnd = true;
  498.                             position1++;
  499.                         }
  500.                         bool valFound = false;
  501.                         while (valFound != true)
  502.                         {
  503.                             string substring = configFile.Substring(position1, 7);
  504.                             if (substring == "value=\"")
  505.                             {
  506.                                 valFound = true;
  507.                                 position1 += 7;
  508.                             }
  509.                             else
  510.                             {
  511.                                 position1++;
  512.                             }
  513.                         }
  514.                         string value = "";
  515.                         bool endOfV = fasle;
  516.                         while (endOfV != true)
  517.                         {
  518.                             string substring = configFile.Substring(position1, 1);
  519.                             if (substring == "\"")
  520.                                 endOfV = true;
  521.                             else
  522.                                 value += substring;
  523.                             position1++;
  524.                         }
  525.                         return int.Parse(value);
  526.                         break;
  527.                     case 90:
  528.                         Assembly systemAssembly = Assembly.GetAssembly(typeof(String));
  529.                         Type type = systemAssembly.GetType("System.Random");
  530.                         ConstructorInfo ci = type.GetConstructor(new Type[] { });
  531.                         dynamic random = ci.Invoke(null);
  532.                         return random.Next();
  533.                         break;
  534.                     case 91:
  535.                         return incrementIntegr((int)args[1]);
  536.                         break;
  537.                     case 890:
  538.                         return "http://forums.thedailywtf.com/tags/default.aspx";
  539.                         break;
  540.                     case 7764:
  541.                         List<string> theList = (List<string>)args[1];
  542.                         int lsitCount = 0;
  543.                         try
  544.                         {
  545.                             for (int asdf = 0; asdf < 100000; asdf++)
  546.                             {
  547.                                 string anItem = theList[asdf];
  548.                                 lsitCount++;
  549.                             }
  550.                         }
  551.                         catch { }
  552.                         return lsitCount;
  553.                         break;
  554.                     case getDecisionValues: // get decision values
  555.                         string configFile1 = (string)args[1];
  556.                         int position2 = 0;
  557.                         bool bKeyFnd1 = fasle;
  558.                         while (bKeyFnd1 != true)
  559.                         {
  560.                             string substring = configFile1.Substring(position2, 20);
  561.                             if (substring == "<add key=\"decisions\"")
  562.                                 bKeyFnd1 = true;
  563.                             position2++;
  564.                         }
  565.                         bool valFound1 = false;
  566.                         while (valFound1 != true)
  567.                         {
  568.                             string substring = configFile1.Substring(position2, 7);
  569.                             if (substring == "value=\"")
  570.                             {
  571.                                 valFound1 = true;
  572.                                 position2 += 7;
  573.                             }
  574.                             else
  575.                             {
  576.                                 position2++;
  577.                             }
  578.                         }
  579.                         bool endOfV2 = fasle;
  580.                         object[] values = new object[0];
  581.                         string value2 = "";
  582.                         while (endOfV2 != true)
  583.                         {
  584.                             string substring = configFile1.Substring(position2, 1);
  585.                             if (substring == "\"")
  586.                             {
  587.                                 values = (object[])MyMethod(growArray, values);
  588.                                 values[values.Length - 1] = value2;
  589.                                 value2 = "";
  590.                                 endOfV2 = true;
  591.                             }
  592.                             else if (substring == ",")
  593.                             {
  594.                                 values = (object[])MyMethod(growArray, values);
  595.                                 values[values.Length - 1] = value2;
  596.                                 value2 = "";
  597.                             }
  598.                             else
  599.                             {
  600.                                 value2 += substring;
  601.                             }
  602.                             position2++;
  603.                         }
  604.                         List<string> valuesAsStrings = (List<string>)MyMethod(convToString, values);
  605.                         return valuesAsStrings;
  606.                         break;
  607.                     case 42:
  608.                         Console.WriteLine((string)MyMethod("i18n", "You just found the answer!", "english"));
  609.                         break;
  610.                     case 33333:
  611.                         object[] myArr1 = (object[])args[1];
  612.                         List<string> myStrings = new List<string>();
  613.                         for (int i = 0; i < myArr1.Length; i = (int)MyMethod(91, i))
  614.                         {
  615.                             object objValue = myArr1[i];
  616.                             string strValue = (string)objValue;
  617.                             myStrings.Add(strValue);
  618.                         }
  619.                         return myStrings;
  620.                         break;
  621.                     case 6:
  622.                         int numTests = (int)args[1];
  623.                         for (int testIt = 0; testIt < numTests; testIt++)
  624.                         {
  625.                             if (System.Environment.ProcessorCount < 1)
  626.                             {
  627.                                 throw new Exception((string)MyMethod("i18n", "Invalid processor count, please run this on a computer that has at least one processor.", "english"));
  628.                                 return false;
  629.                             }
  630.                             if (System.Environment.TickCount < 0)
  631.                             {
  632.                                 throw new Exception((string)MyMethod("i18n", "Computer time problems.", "english"));
  633.                                 return false;
  634.                             }
  635.                             if (DateTime.Now < ProgramStart)
  636.                             {
  637.                                 throw new Exception((string)MyMethod("i18n", "Computer time problems.", "english"));
  638.                                 return false;
  639.                             }
  640.                             // Make sure hardware ALU works.
  641.                             if (1 + 1 != 2)
  642.                             {
  643.                                 throw new Exception((string)MyMethod("i18n", "Invalid math result.", "english"));
  644.                                 return false;
  645.                             }
  646.                             if (2 + 2 != 4)
  647.                             {
  648.                                 throw new Exception((string)MyMethod("i18n", "Invalid math result.", "english"));
  649.                                 return false;
  650.                             }
  651.  
  652.                             /*
  653.                              * Always happens, comment out for now.
  654.                             if (3 + 3 != 7)
  655.                             {
  656.                                 throw new Exception("Invalid math result.");
  657.                              * return false;
  658.                             }
  659.                              * */
  660.                             if (1 / 1 != 1)
  661.                             {
  662.                                 throw new Exception((string)MyMethod("i18n", "Invalid math result.", "english"));
  663.                                 return false;
  664.                             }
  665.                             if (2 / 1 != 2)
  666.                             {
  667.                                 throw new Exception((string)MyMethod("i18n", "Invalid math result.", "english"));
  668.                                 return false;
  669.                             }
  670.                             if (2 * 2 != 4)
  671.                             {
  672.                                 throw new Exception((string)MyMethod("i18n", "Invalid math result.", "english"));
  673.                                 return false;
  674.                             }
  675.                             if (108 - 10 != 98)
  676.                             {
  677.                                 throw new Exception((string)MyMethod("i18n", "Invalid math result.", "english"));
  678.                                 return false;
  679.                             }
  680.                             if (32 - 16 != 16)
  681.                             {
  682.                                 throw new Exception((string)MyMethod("i18n", "Invalid math result.", "english"));
  683.                                 return false;
  684.                             }
  685.                             if (true != true)
  686.                             {
  687.                                 throw new Exception((string)MyMethod("i18n", "Invalid boolean result.", "english"));
  688.                                 return false;
  689.                             }
  690.                             if (false != false)
  691.                             {
  692.                                 throw new Exception((string)MyMethod("i18n", "Invalid boolean result.", "english"));
  693.                                 return false;
  694.                             }
  695.                             if (true == false)
  696.                             {
  697.                                 throw new Exception((string)MyMethod("i18n", "Invalid boolean result.", "english"));
  698.                                 return false;
  699.                             }
  700.                             if (fasle == true)
  701.                             {
  702.                                 throw new Exception((string)MyMethod("i18n", "Invalid boolean result.", "english"));
  703.                                 return false;
  704.                             }
  705.  
  706.                         }
  707.                         return true;
  708.                         break;
  709.                     case 44444:
  710.                         StringBuilder myString1s = new StringBuilder();
  711.                         string lang6 = (string)args[1];
  712.                         myString1s.AppendLine((string)MyMethod("i18n", "About:", lang6));
  713.                         myString1s.AppendLine((string)MyMethod("i18n", "Mott's Enterprise XML Decision-Making Engine (MEXDeMakE)", lang6));
  714.                         myString1s.AppendLine((string)MyMethod("i18n", "Copyright © 2013 mott555. All rights reserved.", lang6));
  715.                         myString1s.AppendLine((string)MyMethod("i18n", "Version 2.1.2", lang6));
  716.                         myString1s.AppendLine((string)MyMethod("i18n", "", lang6));
  717.                         myString1s.AppendLine((string)MyMethod("i18n", "MEXDeMakE is an enterprise-ready decision-making engine built on industry-standard XML and network protocols. Just modify EnterpriseConfig.xml to match your business needs and MEXDeMakE will carefully analyze your requirements and generate advice to help you make your business decisions better and in a timely manner.", lang6));
  718.                         myString1s.AppendLine((string)MyMethod("i18n", "", lang6));
  719.                         myString1s.AppendLine((string)MyMethod("i18n", "Press enter to return to main menu.", lang6));
  720.                         Console.WriteLine(myString1s);
  721.                         Console.ReadLine();
  722.                         break;
  723.                     case 999999:
  724.                         // Give garbate collector chance to run.
  725.                         MyMethod(22);
  726.                         System.Threading.Thread.Sleep(1500);
  727.                         throw new Exception((string)MyMethod("i18n", "Normal application termination", "english"));
  728.                         break;
  729.                     case 100:
  730.                         Stream theStream = (Stream)args[1];
  731.                         StreamReader theReader = new StreamReader(theStream);
  732.                         {
  733.                             string xmlDec = theReader.ReadLine();
  734.                             string packetStart = theReader.ReadLine();
  735.                             string tagStart = theReader.ReadLine();
  736.  
  737.                             List<string> theTags = new List<string>();
  738.                             string myTemp = theReader.ReadLine();
  739.                             while (myTemp != "</TagList>")
  740.                             {
  741.                                 myTemp = myTemp.Substring(5);
  742.                                 myTemp = myTemp.Substring(0, myTemp.Length - 6);
  743.                                 theTags.Add(myTemp);
  744.                                 myTemp = theReader.ReadLine();
  745.                             }
  746.                             List<string> theDecisions = new List<string>();
  747.                             string decisionStart = theReader.ReadLine();
  748.                             myTemp = theReader.ReadLine();
  749.                             while (myTemp != "</DecisionList>")
  750.                             {
  751.                                 myTemp = myTemp.Substring(10);
  752.                                 myTemp = myTemp.Substring(0, myTemp.Length - 11);
  753.                                 theDecisions.Add(myTemp);
  754.                                 myTemp = theReader.ReadLine();
  755.                             }
  756.  
  757.  
  758.                             string strWorkFactor = theReader.ReadLine();
  759.                             strWorkFactor = strWorkFactor.Substring(12);
  760.                             strWorkFactor = strWorkFactor.Substring(0, strWorkFactor.Length - 13);
  761.  
  762.                             string theDecision = (string)MyMethod(generateRandomNo, theTags, theDecisions, int.Parse(strWorkFactor));
  763.  
  764.                             StringBuilder mysb = new StringBuilder();
  765.                             mysb.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
  766.                             mysb.AppendLine("<EnterpriseDecisionNetworkResultDataPacket>");
  767.                             mysb.AppendLine("<Result>" + theDecision + "</Result>");
  768.                             mysb.AppendLine("</EnterpriseDecisionNetworkResultDataPacket>");
  769.  
  770.  
  771.                             StreamWriter theWriter = new StreamWriter(theStream);
  772.                             theWriter.Write(mysb);
  773.                             theWriter.Flush();
  774.                             MyMethod(100, theStream);
  775.                             break;
  776.                         }
  777.                     case 88:
  778.                         string configFile2 = (string)args[1];
  779.                         int position3 = 0;
  780.                         bool bKeyFnd2 = fasle;
  781.                         while (bKeyFnd2 != true)
  782.                         {
  783.                             string substring = configFile2.Substring(position3, 21);
  784.                             if (substring == "<add key=\"workFactor\"")
  785.                                 bKeyFnd2 = true;
  786.                             position3++;
  787.                         }
  788.                         bool valFound2 = false;
  789.                         while (valFound2 != true)
  790.                         {
  791.                             string substring = configFile2.Substring(position3, 7);
  792.                             if (substring == "value=\"")
  793.                             {
  794.                                 valFound2 = true;
  795.                                 position3 += 7;
  796.                             }
  797.                             else
  798.                             {
  799.                                 position3++;
  800.                             }
  801.                         }
  802.                         string value3 = "";
  803.                         bool endOfV3 = fasle;
  804.                         while (endOfV3 != true)
  805.                         {
  806.                             string substring = configFile2.Substring(position3, 1);
  807.                             if (substring == "\"")
  808.                                 endOfV3 = true;
  809.                             else
  810.                                 value3 += substring;
  811.                             position3++;
  812.                         }
  813.                         return int.Parse(value3);
  814.                         break;
  815.                     case printTags:
  816.                         {
  817.                             List<string> tagList = (List<string>)args[1];
  818.                             List<string> decisionList = (List<string>)args[2];
  819.                             int workFactor = (int)args[3];
  820.                             string language = (string)args[4];
  821.                             List<string> myTagValues = tagList.ToList();
  822.                             var myTagEnumerator = myTagValues.GetEnumerator();
  823.                             MyMethod(111111, tagList, decisionList, workFactor, myTagEnumerator, language);
  824.                            
  825.                             break;
  826.                         }
  827.                     case 111111:
  828.                         {
  829.                             List<string> tagList = (List<string>)args[1];
  830.                             List<string> decisionList = (List<string>)args[2];
  831.                             int workFactor = (int)args[3];
  832.                             List<string>.Enumerator myEnumerator = (List<string>.Enumerator)args[4];
  833.                             string lang = (string)args[5];
  834.  
  835.                             bool hasValue = myEnumerator.MoveNext();
  836.                             if (hasValue == true)
  837.                             {
  838.                                 StringBuilder mySb = new StringBuilder();
  839.                                 string myTag = myEnumerator.Current;
  840.                                 mySb.Append(myTag);
  841.                                 mySb.Append("\n");
  842.                                 Console.Write(mySb);
  843.                                 MyMethod(111111, tagList, decisionList, workFactor, myEnumerator, lang);
  844.                             }
  845.                             else if (hasValue == fasle)
  846.                             {
  847.                                 Console.Write((string)MyMethod("i18n", "\n", lang));
  848.                                 Console.Write((string)MyMethod("i18n", "Press any key to return to the menu.\n", lang));
  849.                                 Console.ReadKey();
  850.                                 MyMethod(notUsed);
  851.  
  852.                                 MyMethod(menu, tagList, decisionList, workFactor, lang);
  853.                             }
  854.  
  855.                             break;
  856.                         }
  857.                     case 888:
  858.                         Console.WriteLine((string)MyMethod("i18n", "Shutting down...", "english"));
  859.                         // Keep UI responsive.
  860.                         System.Threading.ThreadStart ts = (System.Threading.ThreadStart)MyMethod(getShutdownThreadStart);
  861.                         System.Threading.Thread shutdownThread = (System.Threading.Thread)MyMethod(getShutdownThread, ts);
  862.                         shutdownThread.Start();
  863.                         break;
  864.                     default:
  865.                         return null; // Shut up the compiler.
  866.                 }
  867.             }
  868.             catch (Exception)
  869.             {
  870.                 switch ((string)args[0])
  871.                 {
  872.                     case "sts":
  873.                         System.Threading.ThreadStart ts = () =>
  874.                             {
  875.                                 MyMethod(sleepThenClose);
  876.                                 MyMethod(sleepThenClose);
  877.                             };
  878.                         return ts;
  879.                         break;
  880.                     case "gen":
  881.                         List<string> tags = (List<string>)args[1];
  882.                         List<string> decisions = (List<String>)(args[2] as List<string>);
  883.                         int workFactor = (int)args[3];
  884.  
  885.                         Random random = new Random((int)MyMethod(90));
  886.                         for (int i = 0; i < Math.Pow(2, workFactor); i = incrementIntegr(i))
  887.                         {
  888.                             int seed = random.Next();
  889.  
  890.                             for (int k = 0; k < 30; k++)
  891.                             {
  892.                                 int op = random.Next();
  893.                                 if (op.ToString().EndsWith("1"))
  894.                                 {
  895.                                     int tmpSeed = seed + random.Next();
  896.                                     seed = tmpSeed;
  897.                                 }
  898.                                 else if (op.ToString().EndsWith("2"))
  899.                                 {
  900.                                     int tmpSeed = seed - random.Next();
  901.                                     seed = tmpSeed;
  902.                                 }
  903.                                 else if (op.ToString().EndsWith("3"))
  904.                                 {
  905.                                     string strSeed = seed.ToString();
  906.                                     int index = random.Next(strSeed.Length);
  907.                                     for (int ii = 0; ii < strSeed.Length; ii++)
  908.                                     {
  909.                                         if (ii == index)
  910.                                         {
  911.                                             string str1 = strSeed.Substring(0, ii);
  912.                                             string str2 = strSeed.Substring(ii + 1);
  913.                                             strSeed = str1 + str2;
  914.                                         }
  915.                                     }
  916.                                     if (strSeed == "")
  917.                                         strSeed = "0";
  918.                                     int tmpSeed;
  919.                                     int.TryParse(strSeed, out tmpSeed);
  920.                                     tmpSeed = seed;
  921.                                 }
  922.                                 else if (op.ToString().EndsWith("4"))
  923.                                 {
  924.                                     int tmpSeed = seed + random.Next() - seed;
  925.                                     seed = tmpSeed;
  926.                                 }
  927.                                 else if (op.ToString().EndsWith("5"))
  928.                                 {
  929.                                     int tmpSeed = seed * -1;
  930.                                     seed = tmpSeed;
  931.                                 }
  932.                                 else if (op.ToString().EndsWith("6"))
  933.                                 {
  934.                                     k = 0;
  935.                                 }
  936.                                 else if (op.ToString().EndsWith("7"))
  937.                                 {
  938.                                     string strFloor = Math.Floor((double)seed).ToString();
  939.                                     int dotIndex = strFloor.IndexOf(".");
  940.                                     string strAsInt = "";
  941.                                     bool dotFound = false;
  942.                                     for (int kk = 0; kk < strFloor.Length; kk++)
  943.                                     {
  944.                                         if (kk == dotIndex)
  945.                                         {
  946.                                             dotFound = true;
  947.                                         }
  948.                                         if (dotFound == fasle)
  949.                                         {
  950.                                             strAsInt += strFloor[kk];
  951.                                         }
  952.                                     }
  953.                                     int tmpSeed = int.Parse(strAsInt);
  954.                                     seed = tmpSeed;
  955.                                 }
  956.                                 else if (op.ToString().EndsWith("8"))
  957.                                 {
  958.                                     int tmpSeed = seed + ProgramStart.Second;
  959.                                     seed = tmpSeed;
  960.                                 }
  961.                                 else
  962.                                 {
  963.                                     int tmpSeed = seed / random.Next();
  964.                                     seed = tmpSeed;
  965.                                 }
  966.                             }
  967.  
  968.                             random = new Random(seed + random.Next());
  969.                         }
  970.  
  971.                         // Random class isn't random enough. Use TDWTF tags for additional randomness.
  972.                         for (int i = 0; i < Math.Pow(2, workFactor); i = incrementIntegr(i))
  973.                         {
  974.                             if (i.ToString().EndsWith("5"))
  975.                             {
  976.                                 MyMethod("dot", true);
  977.                             }
  978.                             if (i.ToString().EndsWith("0"))
  979.                             {
  980.                                 MyMethod("dot", true);
  981.                             }
  982.                             for (int k = 0; k < tags.Count; k = incrementIntegr(k))
  983.                             {
  984.                                 int index = random.Next(tags.Count);
  985.                                 string first = tags[k];
  986.                                 string second = tags[index];
  987.                                 tags[k] = second;
  988.                                 tags[index] = first;
  989.                             }
  990.  
  991.                             int hash = 0;
  992.                             foreach (string tag in tags)
  993.                             {
  994.                                 hash += tag.GetHashCode();
  995.                             }
  996.                             hash = (int)Math.Abs(hash);
  997.                             hash = incrementIntegr(hash);
  998.                             random = new Random(hash);
  999.  
  1000.                             // Hardware check, CPU overheating may cause inaccurasy.
  1001.                             bool overheat = (bool)MyMethod(6, 1);
  1002.                             overheat = !overheat;
  1003.                             if (overheat == true)
  1004.                             {
  1005.                                 // Pause for allow CPU can cooldwon.
  1006.                                 MyMethod(789);
  1007.                             }
  1008.                         }
  1009.  
  1010.                         // Random is now randomer.
  1011.                         int tagIndex = random.Next(tags.Count);
  1012.                         string randomTag = tags[tagIndex];
  1013.                         int randomIndex = randomTag.Length % decisions.Count;
  1014.                         string decision = null;
  1015.                         for (int i = 0; i < decisions.Count; i = incrementIntegr(i))
  1016.                         {
  1017.                             if (i == randomIndex)
  1018.                                 decision = decisions[i];
  1019.                             else
  1020.                                 continue;
  1021.                         }
  1022.                         return decision;
  1023.  
  1024.                         break;
  1025.                     case "dot":
  1026.                         if ((bool)args[1] != fasle)
  1027.                         {
  1028.                             Console.Write(".");
  1029.                         }
  1030.                         break;
  1031.                     case notUsed:
  1032.                         Console.Clear();
  1033.                         break;
  1034.                     case "launchServer":
  1035.                         MyMethod("launchServerr", args[1]);
  1036.                         break;
  1037.                     case "getPort":
  1038.                         string configFile2 = (string)args[1];
  1039.                         int position3 = 0;
  1040.                         bool bKeyFnd2 = fasle;
  1041.                         while (bKeyFnd2 != true)
  1042.                         {
  1043.                             string substring = configFile2.Substring(position3, 21);
  1044.                             if (substring == "<add key=\"serverPort\"")
  1045.                                 bKeyFnd2 = true;
  1046.                             position3++;
  1047.                         }
  1048.                         bool valFound2 = false;
  1049.                         while (valFound2 != true)
  1050.                         {
  1051.                             string substring = configFile2.Substring(position3, 7);
  1052.                             if (substring == "value=\"")
  1053.                             {
  1054.                                 valFound2 = true;
  1055.                                 position3 += 7;
  1056.                             }
  1057.                             else
  1058.                             {
  1059.                                 position3++;
  1060.                             }
  1061.                         }
  1062.                         string value3 = "";
  1063.                         bool endOfV3 = fasle;
  1064.                         while (endOfV3 != true)
  1065.                         {
  1066.                             string substring = configFile2.Substring(position3, 1);
  1067.                             if (substring == "\"")
  1068.                                 endOfV3 = true;
  1069.                             else
  1070.                                 value3 += substring;
  1071.                             position3++;
  1072.                         }
  1073.                         return int.Parse(value3);
  1074.                         break;
  1075.                         break;
  1076.                     case "getLang":
  1077.                         string configFile3 = (string)args[1];
  1078.                         int position4 = 0;
  1079.                         bool bKeyFnd3 = fasle;
  1080.                         while (bKeyFnd3 != true)
  1081.                         {
  1082.                             string substring = configFile3.Substring(position4, 15);
  1083.                             if (substring == "<add key=\"lang\"")
  1084.                                 bKeyFnd3 = true;
  1085.                             position4++;
  1086.                         }
  1087.                         bool valFound3 = false;
  1088.                         while (valFound3 != true)
  1089.                         {
  1090.                             string substring = configFile3.Substring(position4, 7);
  1091.                             if (substring == "value=\"")
  1092.                             {
  1093.                                 valFound3 = true;
  1094.                                 position4 += 7;
  1095.                             }
  1096.                             else
  1097.                             {
  1098.                                 position4++;
  1099.                             }
  1100.                         }
  1101.                         string value4 = "";
  1102.                         bool endOfV4 = fasle;
  1103.                         while (endOfV4 != true)
  1104.                         {
  1105.                             string substring = configFile3.Substring(position4, 1);
  1106.                             if (substring == "\"")
  1107.                                 endOfV4 = true;
  1108.                             else
  1109.                                 value4 += substring;
  1110.                             position4++;
  1111.                         }
  1112.                         return value4;
  1113.                         break;
  1114.                         break;
  1115.                     case "i18n":
  1116.                         string text = (string)args[1];
  1117.                         string lang = (string)args[2];
  1118.                         if (text == "Mott's Enterprise XML Decision-Making Engine (MEXDeMakE)" && lang == "english")
  1119.                         {
  1120.                             return "Mott's Enterprise XML Decision-Making Engine (MEXDeMakE)";
  1121.                         }
  1122.                         else if (text == "Hardware failure." && lang == "english")
  1123.                         {
  1124.                             return "Hardware failure.";
  1125.                         }
  1126.                         else if (text == "Performing hardware check..." && lang == "english")
  1127.                         {
  1128.                             return "Performing hardware check...";
  1129.                         }
  1130.                         else if (text == "Welcome to Mott's Enterprise XML Decision-Making Engine (MEXDeMakE)." && lang == "english")
  1131.                         {
  1132.                             return "Welcome to Mott's Enterprise XML Decision-Making Engine (MEXDeMakE).";
  1133.                         }
  1134.                         else if (text == "Copyright © 2013 mott555" && lang == "english")
  1135.                         {
  1136.                             return "Copyright © 2013 mott555";
  1137.                         }
  1138.                         else if (text == "Loading EnterpriseConfig.xml..." && lang == "english")
  1139.                         {
  1140.                             return "Loading EnterpriseConfig.xml...";
  1141.                         }
  1142.                         else if (text == "Complete." && lang == "english")
  1143.                         {
  1144.                             return "Complete.";
  1145.                         }
  1146.                         else if (text == "Pass." && lang == "english")
  1147.                         {
  1148.                             return "Pass.";
  1149.                         }
  1150.                         else if (text == "Loading decision values..." && lang == "english")
  1151.                         {
  1152.                             return "Loading decision values...";
  1153.                         }
  1154.                         else if (text == "Loading entropy data set..." && lang == "english")
  1155.                         {
  1156.                             return "Loading entropy data set...";
  1157.                         }
  1158.                         else if (text == "Configuring work factor..." && lang == "english")
  1159.                         {
  1160.                             return "Configuring work factor...";
  1161.                         }
  1162.                         else if (text == "Launching server..." && lang == "english")
  1163.                         {
  1164.                             return "Launching server...";
  1165.                         }
  1166.                         else if (text == "Initializing menu...Complete." && lang == "english")
  1167.                         {
  1168.                             return "Initializing menu...Complete.";
  1169.                         }
  1170.                         else if (text == "Please select from these menu items.\n" && lang == "english")
  1171.                         {
  1172.                             return "Please select from these menu items.\n";
  1173.                         }
  1174.                         else if (text == " 1: Generate Decision\n" && lang == "english")
  1175.                         {
  1176.                             return " 1: Generate Decision\n";
  1177.                         }
  1178.                         else if (text == " 2: Exit\n" && lang == "english")
  1179.                         {
  1180.                             return " 2: Exit\n";
  1181.                         }
  1182.                         else if (text == " 3: Show decision values\n" && lang == "english")
  1183.                         {
  1184.                             return " 3: Show decision values\n";
  1185.                         }
  1186.                         else if (text == " 4: Show entropy data set\n" && lang == "english")
  1187.                         {
  1188.                             return " 4: Show entropy data set\n";
  1189.                         }
  1190.                         else if (text == " 5: Edit enterprise configuration\n" && lang == "english")
  1191.                         {
  1192.                             return " 5: Edit enterprise configuration\n";
  1193.                         }
  1194.                         else if (text == " 6: Show menu\n" && lang == "english")
  1195.                         {
  1196.                             return " 6: Show menu\n";
  1197.                         }
  1198.                         else if (text == " 7: Show time\n" && lang == "english")
  1199.                         {
  1200.                             return " 7: Show time\n";
  1201.                         }
  1202.                         else if (text == " 8: About\n" && lang == "english")
  1203.                         {
  1204.                             return " 8: About\n";
  1205.                         }
  1206.                         else if (text == "\n" && lang == "english")
  1207.                         {
  1208.                             return "\n";
  1209.                         }
  1210.                         else if (text == "Generating decision..." && lang == "english")
  1211.                         {
  1212.                             return "Generating decision...";
  1213.                         }
  1214.                         else if (text == "Complete.\n" && lang == "english")
  1215.                         {
  1216.                             return "Complete.\n";
  1217.                         }
  1218.                         else if (text == "Decision is\n" && lang == "english")
  1219.                         {
  1220.                             return "Decision is\n";
  1221.                         }
  1222.                         else if (text == "Press any key to return to the menu.\n" && lang == "english")
  1223.                         {
  1224.                             return "Press any key to return to the menu.\n";
  1225.                         }
  1226.                         else if (text == "Press any key to return to the menu.\n" && lang == "english")
  1227.                         {
  1228.                             return "Press any key to return to the menu.\n";
  1229.                         }
  1230.                         else if (text == "Invalid processor count, please run this on a computer that has at least one processor." && lang == "english")
  1231.                         {
  1232.                             return "Invalid processor count, please run this on a computer that has at least one processor.";
  1233.                         }
  1234.                         else if (text == "Computer time problems." && lang == "english")
  1235.                         {
  1236.                             return "Computer time problems.";
  1237.                         }
  1238.                         else if (text == "Invalid math result." && lang == "english")
  1239.                         {
  1240.                             return "Invalid math result.";
  1241.                         }
  1242.  
  1243.                         else if (text == "Invalid boolean result." && lang == "english")
  1244.                         {
  1245.                             return "Invalid boolean result.";
  1246.                         }
  1247.                         else if (text == "Mott's Enterprise XML Decision-Making Engine (MEXDeMakE)" && lang == "english")
  1248.                         {
  1249.                             return "Mott's Enterprise XML Decision-Making Engine (MEXDeMakE)";
  1250.                         }
  1251.                         else if (text == "Copyright © 2013 mott555. All rights reserved." && lang == "english")
  1252.                         {
  1253.                             return "Copyright © 2013 mott555. All rights reserved.";
  1254.                         }
  1255.                         else if (text == "Version 2.1.2" && lang == "english")
  1256.                         {
  1257.                             return "Version 2.1.2";
  1258.                         }
  1259.                         else if (text == "MEXDeMakE is an enterprise-ready decision-making engine built on industry-standard XML and network protocols. Just modify EnterpriseConfig.xml to match your business needs and MEXDeMakE will carefully analyze your requirements and generate advice to help you make your business decisions better and in a timely manner." && lang == "english")
  1260.                         {
  1261.                             return "MEXDeMakE is an enterprise-ready decision-making engine built on industry-standard XML and network protocols. Just modify EnterpriseConfig.xml to match your business needs and MEXDeMakE will carefully analyze your requirements and generate advice to help you make your business decisions better and in a timely manner.";
  1262.                         }
  1263.                         else if (text == "Press enter to return to main menu." && lang == "english")
  1264.                         {
  1265.                             return "Press enter to return to main menu.";
  1266.                         }
  1267.                         else if (text == "About:" && lang == "english")
  1268.                         {
  1269.                             return "About:";
  1270.                         }
  1271.                         else if (text == "Normal application termination" && lang == "english")
  1272.                         {
  1273.                             return "Normal application termination";
  1274.                         }
  1275.                         else if (text == "Press any key to return to the menu.\n" && lang == "english")
  1276.                         {
  1277.                             return "Press any key to return to the menu.\n";
  1278.                         }
  1279.                         else if (text == "Shutting down..." && lang == "english")
  1280.                         {
  1281.                             return "Shutting down...";
  1282.                         }
  1283.                         else if (text == "" && lang == "english")
  1284.                         {
  1285.                             return "";
  1286.                         }
  1287.                         else if (text == "Mott's Enterprise XML Decision-Making Engine (MEXDeMakE)" && lang == "spanish")
  1288.                         {
  1289.                             return "Empresa XML Engine toma de decisiones de Mott (MEXDeMakE)";
  1290.                         }
  1291.                         else if (text == "Hardware failure." && lang == "spanish")
  1292.                         {
  1293.                             return "Error de hardware.";
  1294.                         }
  1295.                         else if (text == "Performing hardware check..." && lang == "spanish")
  1296.                         {
  1297.                             return "Realización de verificación de hardware ...";
  1298.                         }
  1299.                         else if (text == "Welcome to Mott's Enterprise XML Decision-Making Engine (MEXDeMakE)." && lang == "spanish")
  1300.                         {
  1301.                             return "Bienvenido a Enterprise XML Engine toma de decisiones de Mott (MEXDeMakE).";
  1302.                         }
  1303.                         else if (text == "Copyright © 2013 mott555" && lang == "spanish")
  1304.                         {
  1305.                             return "Copyright © 2013 mott555";
  1306.                         }
  1307.                         else if (text == "Loading EnterpriseConfig.xml..." && lang == "spanish")
  1308.                         {
  1309.                             return "Cargando EnterpriseConfig.xml ...";
  1310.                         }
  1311.                         else if (text == "Complete." && lang == "spanish")
  1312.                         {
  1313.                             return "Completar.";
  1314.                         }
  1315.                         else if (text == "Pass." && lang == "spanish")
  1316.                         {
  1317.                             return "Pass.";
  1318.                         }
  1319.                         else if (text == "Loading decision values..." && lang == "spanish")
  1320.                         {
  1321.                             return "Carga de valores de decisión ...";
  1322.                         }
  1323.                         else if (text == "Loading entropy data set..." && lang == "spanish")
  1324.                         {
  1325.                             return "Cargando conjunto de datos de entropía ...";
  1326.                         }
  1327.                         else if (text == "Configuring work factor..." && lang == "spanish")
  1328.                         {
  1329.                             return "Configuración de factor de trabajo ...";
  1330.                         }
  1331.                         else if (text == "Launching server..." && lang == "spanish")
  1332.                         {
  1333.                             return "El lanzamiento del servidor ...";
  1334.                         }
  1335.                         else if (text == "Initializing menu...Complete." && lang == "spanish")
  1336.                         {
  1337.                             return "Menú Inicializando ... Complete.";
  1338.                         }
  1339.                         else if (text == "Please select from these menu items.\n" && lang == "spanish")
  1340.                         {
  1341.                             return "Por favor seleccione una de estas opciones de menú.\n";
  1342.                         }
  1343.                         else if (text == " 1: Generate Decision\n" && lang == "spanish")
  1344.                         {
  1345.                             return " 1: Generar Decisión\n";
  1346.                         }
  1347.                         else if (text == " 2: Exit\n" && lang == "spanish")
  1348.                         {
  1349.                             return " 2: Salida\n";
  1350.                         }
  1351.                         else if (text == " 3: Show decision values\n" && lang == "spanish")
  1352.                         {
  1353.                             return " 3: Mostrar valores de decisión\n";
  1354.                         }
  1355.                         else if (text == " 4: Show entropy data set\n" && lang == "spanish")
  1356.                         {
  1357.                             return " 4: Mostrar conjunto de datos de la entropía\n";
  1358.                         }
  1359.                         else if (text == " 5: Edit enterprise configuration\n" && lang == "spanish")
  1360.                         {
  1361.                             return " 5: Editar configuración de la empresa\n";
  1362.                         }
  1363.                         else if (text == " 6: Show menu\n" && lang == "spanish")
  1364.                         {
  1365.                             return " 6: Mostrar el menú\n";
  1366.                         }
  1367.                         else if (text == " 7: Show time\n" && lang == "spanish")
  1368.                         {
  1369.                             return " 7: show de hora\n";
  1370.                         }
  1371.                         else if (text == " 8: About\n" && lang == "spanish")
  1372.                         {
  1373.                             return " 8: acerca de\n";
  1374.                         }
  1375.                         else if (text == "\n" && lang == "spanish")
  1376.                         {
  1377.                             return "\n";
  1378.                         }
  1379.                         else if (text == "Generating decision..." && lang == "spanish")
  1380.                         {
  1381.                             return "Generación de decisión...";
  1382.                         }
  1383.                         else if (text == "Complete.\n" && lang == "spanish")
  1384.                         {
  1385.                             return "completar.\n";
  1386.                         }
  1387.                         else if (text == "Decision is\n" && lang == "spanish")
  1388.                         {
  1389.                             return "Decisión\n";
  1390.                         }
  1391.                         else if (text == "Press any key to return to the menu.\n" && lang == "spanish")
  1392.                         {
  1393.                             return "Pulse cualquier tecla para volver al menú.\n";
  1394.                         }
  1395.                         else if (text == "Press any key to return to the menu.\n" && lang == "spanish")
  1396.                         {
  1397.                             return "Pulse cualquier tecla para volver al menú.\n";
  1398.                         }
  1399.                         else if (text == "Invalid processor count, please run this on a computer that has at least one processor." && lang == "spanish")
  1400.                         {
  1401.                             return "No válido número de procesadores, por favor ejecutar esto en un equipo que tiene al menos un procesador.";
  1402.                         }
  1403.                         else if (text == "Computer time problems." && lang == "spanish")
  1404.                         {
  1405.                             return "Problemas de tiempo de computadora.";
  1406.                         }
  1407.                         else if (text == "Invalid math result." && lang == "spanish")
  1408.                         {
  1409.                             return "Resultado matemático válido.";
  1410.                         }
  1411.  
  1412.                         else if (text == "Invalid boolean result." && lang == "spanish")
  1413.                         {
  1414.                             return "Invalid resultado booleano.";
  1415.                         }
  1416.                         else if (text == "Mott's Enterprise XML Decision-Making Engine (MEXDeMakE)" && lang == "spanish")
  1417.                         {
  1418.                             return "Empresa XML Engine toma de decisiones de Mott (MEXDeMakE)";
  1419.                         }
  1420.                         else if (text == "Copyright © 2013 mott555. All rights reserved." && lang == "spanish")
  1421.                         {
  1422.                             return "Copyright © 2013 mott555. Todos los derechos reservados.";
  1423.                         }
  1424.                         else if (text == "Version 2.1.2" && lang == "spanish")
  1425.                         {
  1426.                             return "Versión 2.1.2";
  1427.                         }
  1428.                         else if (text == "MEXDeMakE is an enterprise-ready decision-making engine built on industry-standard XML and network protocols. Just modify EnterpriseConfig.xml to match your business needs and MEXDeMakE will carefully analyze your requirements and generate advice to help you make your business decisions better and in a timely manner." && lang == "spanish")
  1429.                         {
  1430.                             return "MEXDeMakE es un motor de toma de decisiones lista para la empresa basada en protocolos XML y de red estándar de la industria. Apenas modifique EnterpriseConfig.xml para satisfacer sus necesidades de negocio y MEXDeMakE analizará cuidadosamente sus necesidades y generar consejos para ayudarle a tomar sus decisiones de negocios mejor y de manera oportuna.";
  1431.                         }
  1432.                         else if (text == "Press enter to return to main menu." && lang == "spanish")
  1433.                         {
  1434.                             return "Pulse Intro para volver al menú principal.";
  1435.                         }
  1436.                         else if (text == "About:" && lang == "spanish")
  1437.                         {
  1438.                             return "acerca de:";
  1439.                         }
  1440.                         else if (text == "Normal application termination" && lang == "spanish")
  1441.                         {
  1442.                             return "Cierre de la aplicación normal";
  1443.                         }
  1444.                         else if (text == "Press any key to return to the menu.\n" && lang == "spanish")
  1445.                         {
  1446.                             return "Pulse cualquier tecla para volver al menú.\n";
  1447.                         }
  1448.                         else if (text == "Shutting down..." && lang == "spanish")
  1449.                         {
  1450.                             return "Apagado...";
  1451.                         }
  1452.                         else if (text == "" && lang == "spanish")
  1453.                         {
  1454.                             return "";
  1455.                         }
  1456.                         else if (text == "Mott's Enterprise XML Decision-Making Engine (MEXDeMakE)" && lang == "german")
  1457.                         {
  1458.                             return "XML Engine Company Mott Entscheidungen (MEXDeMakE)";
  1459.                         }
  1460.                         else if (text == "Hardware failure." && lang == "german")
  1461.                         {
  1462.                             return "Hardwarefehler.";
  1463.                         }
  1464.                         else if (text == "Performing hardware check..." && lang == "german")
  1465.                         {
  1466.                             return "Darstellende Hardware-Verifikation...";
  1467.                         }
  1468.                         else if (text == "Welcome to Mott's Enterprise XML Decision-Making Engine (MEXDeMakE)." && lang == "german")
  1469.                         {
  1470.                             return "Willkommen bei der Enterprise XML-Engine Mott Entscheidungen (MEXDeMakE).";
  1471.                         }
  1472.                         else if (text == "Copyright © 2013 mott555" && lang == "german")
  1473.                         {
  1474.                             return "Copyright © 2013 mott555";
  1475.                         }
  1476.                         else if (text == "Loading EnterpriseConfig.xml..." && lang == "german")
  1477.                         {
  1478.                             return "EnterpriseConfig.xml geladen ...";
  1479.                         }
  1480.                         else if (text == "Complete." && lang == "german")
  1481.                         {
  1482.                             return "Schließe.";
  1483.                         }
  1484.                         else if (text == "Pass." && lang == "german")
  1485.                         {
  1486.                             return "Pass.";
  1487.                         }
  1488.                         else if (text == "Loading decision values..." && lang == "german")
  1489.                         {
  1490.                             return "Laden Entscheidung Werte ...";
  1491.                         }
  1492.                         else if (text == "Loading entropy data set..." && lang == "german")
  1493.                         {
  1494.                             return "Lädt Entropie Datensatz ...";
  1495.                         }
  1496.                         else if (text == "Configuring work factor..." && lang == "german")
  1497.                         {
  1498.                             return "Einschaltdauer Einstellungen ...";
  1499.                         }
  1500.                         else if (text == "Launching server..." && lang == "german")
  1501.                         {
  1502.                             return "Wenn der Server ...";
  1503.                         }
  1504.                         else if (text == "Initializing menu...Complete." && lang == "german")
  1505.                         {
  1506.                             return "Initialisierung Menü ... Schließe.";
  1507.                         }
  1508.                         else if (text == "Please select from these menu items.\n" && lang == "german")
  1509.                         {
  1510.                             return "Bitte wählen Sie eine der folgenden Optionen im Menü.\n";
  1511.                         }
  1512.                         else if (text == " 1: Generate Decision\n" && lang == "german")
  1513.                         {
  1514.                             return " 1: Generieren Entscheidung\n";
  1515.                         }
  1516.                         else if (text == " 2: Exit\n" && lang == "german")
  1517.                         {
  1518.                             return " 2: Verlassen\n";
  1519.                         }
  1520.                         else if (text == " 3: Show decision values\n" && lang == "german")
  1521.                         {
  1522.                             return " 3: Anzeigen von Werten Entscheidung\n";
  1523.                         }
  1524.                         else if (text == " 4: Show entropy data set\n" && lang == "german")
  1525.                         {
  1526.                             return " 4: Zeige Datensatz Entropie\n";
  1527.                         }
  1528.                         else if (text == " 5: Edit enterprise configuration\n" && lang == "german")
  1529.                         {
  1530.                             return " 5: Bearbeiten Aufbau der Gesellschaft\n";
  1531.                         }
  1532.                         else if (text == " 6: Show menu\n" && lang == "german")
  1533.                         {
  1534.                             return " 6: Zeigen Sie das Menü\n";
  1535.                         }
  1536.                         else if (text == " 7: Show time\n" && lang == "german")
  1537.                         {
  1538.                             return " 7: Zeit zeigen\n";
  1539.                         }
  1540.                         else if (text == " 8: About\n" && lang == "german")
  1541.                         {
  1542.                             return " 8: über\n";
  1543.                         }
  1544.                         else if (text == "\n" && lang == "german")
  1545.                         {
  1546.                             return "\n";
  1547.                         }
  1548.                         else if (text == "Generating decision..." && lang == "german")
  1549.                         {
  1550.                             return "Generieren Entscheidung...";
  1551.                         }
  1552.                         else if (text == "Complete.\n" && lang == "german")
  1553.                         {
  1554.                             return "vervollständigen.\n";
  1555.                         }
  1556.                         else if (text == "Decision is\n" && lang == "german")
  1557.                         {
  1558.                             return "Entscheidung\n";
  1559.                         }
  1560.                         else if (text == "Press any key to return to the menu.\n" && lang == "german")
  1561.                         {
  1562.                             return "Drücken Sie eine beliebige Taste, um zum Menü zurückzukehren.\n";
  1563.                         }
  1564.                         else if (text == "Press any key to return to the menu.\n" && lang == "german")
  1565.                         {
  1566.                             return "Drücken Sie eine beliebige Taste, um zum Menü zurückzukehren.\n";
  1567.                         }
  1568.                         else if (text == "Invalid processor count, please run this on a computer that has at least one processor." && lang == "german")
  1569.                         {
  1570.                             return "Ungültige Anzahl von Prozessoren, führen Sie diese auf einem Computer mit mindestens einem Prozessor hat.";
  1571.                         }
  1572.                         else if (text == "Computer time problems." && lang == "german")
  1573.                         {
  1574.                             return "Probleme der Computer-Zeit.";
  1575.                         }
  1576.                         else if (text == "Invalid math result." && lang == "german")
  1577.                         {
  1578.                             return "Gültig mathematische Ergebnis.";
  1579.                         }
  1580.  
  1581.                         else if (text == "Invalid boolean result." && lang == "german")
  1582.                         {
  1583.                             return "Ungültige boolesche Ergebnis.";
  1584.                         }
  1585.                         else if (text == "Mott's Enterprise XML Decision-Making Engine (MEXDeMakE)" && lang == "german")
  1586.                         {
  1587.                             return "XML Engine Company Mott Entscheidungen (MEXDeMakE)";
  1588.                         }
  1589.                         else if (text == "Copyright © 2013 mott555. All rights reserved." && lang == "german")
  1590.                         {
  1591.                             return "Copyright © 2013 mott555. Alle Rechte vorbehalten.";
  1592.                         }
  1593.                         else if (text == "Version 2.1.2" && lang == "german")
  1594.                         {
  1595.                             return "Version 2.1.2";
  1596.                         }
  1597.                         else if (text == "MEXDeMakE is an enterprise-ready decision-making engine built on industry-standard XML and network protocols. Just modify EnterpriseConfig.xml to match your business needs and MEXDeMakE will carefully analyze your requirements and generate advice to help you make your business decisions better and in a timely manner." && lang == "german")
  1598.                         {
  1599.                             return "MEXDeMakE ist eine Entscheidung, Motor bereit für das Unternehmen auf XML-Protokolle und Industrie-Standard-Netzwerk. EnterpriseConfig.xml Fertigen Sie einfach auf Ihre geschäftlichen Anforderungen zu erfüllen und MEXDeMakE sorgfältig analysieren Ihre Bedürfnisse und generieren Tipps, damit Sie bessere Geschäftsentscheidungen zu treffen in einer fristgerechten Weise.";
  1600.                         }
  1601.                         else if (text == "Press enter to return to main menu." && lang == "german")
  1602.                         {
  1603.                             return "Drücken Sie die Eingabetaste, um zum Hauptmenü zurückzukehren.";
  1604.                         }
  1605.                         else if (text == "About:" && lang == "german")
  1606.                         {
  1607.                             return "über:";
  1608.                         }
  1609.                         else if (text == "Normal application termination" && lang == "german")
  1610.                         {
  1611.                             return "In der Nähe des gewöhnlichen";
  1612.                         }
  1613.                         else if (text == "Press any key to return to the menu.\n" && lang == "german")
  1614.                         {
  1615.                             return "Drücken Sie eine beliebige Taste, um zum Menü zurückzukehren.\n";
  1616.                         }
  1617.                         else if (text == "Shutting down..." && lang == "german")
  1618.                         {
  1619.                             return "ausgeschaltet...";
  1620.                         }
  1621.                         else if (text == "" && lang == "german")
  1622.                         {
  1623.                             return "";
  1624.                         }
  1625.                         else
  1626.                         {
  1627.                             return "";
  1628.                         }
  1629.                         break;
  1630.                     case "launchServerr":
  1631.                         Thread serverThread = new Thread(
  1632.                                 (portObj) =>
  1633.                                 {
  1634.                                     int thePort = (int)portObj;
  1635.                                     TcpListener theServer = new TcpListener(thePort);
  1636.                                     theServer.Start();
  1637.                                     Socket theSocket = theServer.AcceptSocket();
  1638.                                     NetworkStream theStream = new NetworkStream(theSocket);
  1639.                                     MyMethod(100, theStream);
  1640.                                    
  1641.                                 });
  1642.                         serverThread.Start(args[1]);
  1643.                         break;
  1644.                     case "getServer":
  1645.                         string configFile_3 = (string)args[1];
  1646.                         int position_4 = 0;
  1647.                         bool bKeyFnd_3 = fasle;
  1648.                         while (bKeyFnd_3 != true)
  1649.                         {
  1650.                             string substring = configFile_3.Substring(position_4, 17);
  1651.                             if (substring == "<add key=\"server\"")
  1652.                                 bKeyFnd_3 = true;
  1653.                             position_4 = (int)incrementIntegr(position_4);
  1654.                         }
  1655.                         bool valFound_3 = false;
  1656.                         while (valFound_3 != true)
  1657.                         {
  1658.                             string substring = configFile_3.Substring(position_4, 7);
  1659.                             if (substring == "value=\"")
  1660.                             {
  1661.                                 valFound_3 = true;
  1662.                                 /* Loop unrolled for performance.
  1663.                                  * for (var l = 0; l < 7; l++)
  1664.                                 {
  1665.                                     position_4 = (int)incrementIntegr(position_4);
  1666.                                 }*/
  1667.                                 position_4 = (int)incrementIntegr(position_4);
  1668.                                 position_4 = (int)incrementIntegr(position_4);
  1669.                                 position_4 = (int)incrementIntegr(position_4);
  1670.                                 position_4 = (int)incrementIntegr(position_4);
  1671.                                 position_4 = (int)incrementIntegr(position_4);
  1672.                                 position_4 = (int)incrementIntegr(position_4);
  1673.                                 position_4 = (int)incrementIntegr(position_4);
  1674.                             }
  1675.                             else
  1676.                             {
  1677.                                 position_4 = (int)incrementIntegr(position_4);
  1678.                             }
  1679.                         }
  1680.                         string value_4 = "";
  1681.                         bool endOfV_4 = fasle;
  1682.                         while (endOfV_4 != true)
  1683.                         {
  1684.                             string substring = configFile_3.Substring(position_4, 1);
  1685.                             if (substring == "\"")
  1686.                                 endOfV_4 = true;
  1687.                             else
  1688.                                 value_4 += substring;
  1689.                             position_4 = (int)incrementIntegr(position_4);
  1690.                         }
  1691.                         return value_4;
  1692.                         break;
  1693.                     case "shutdownThread":
  1694.                         System.Threading.ThreadStart start = (System.Threading.ThreadStart)args[1];
  1695.                         System.Threading.Thread shutdownThread = new System.Threading.Thread(start);
  1696.                         return shutdownThread;
  1697.                         break;
  1698.                 }
  1699.             }
  1700.             return null;
  1701.         }
  1702.  
  1703.  
  1704.         /// <summary>
  1705.         /// Takes an integer value, increments it by one, and returns the value. Robust.
  1706.         ///
  1707.         /// This code and algorithm is copyright © 2013 by mott555. All rights reserved.
  1708.         ///
  1709.         /// LICENSE:
  1710.         /// You may use this code in unmodified form in any software, commercial or otherwise.
  1711.         /// Modifications are expressly forbidden because this code is perfect and cannot be improved in any way.
  1712.         ///
  1713.         /// No warranties are provided or implied. Actually no warranty is needed because this is guaranteed to be perfect,
  1714.         /// and any faults mean you must have modified the source without the author's consent which would void any warranty
  1715.         /// that could be provided. If you find any aissues with this logic don't call me because you're a liar and must have
  1716.         /// changed something.
  1717.         ///
  1718.         /// If you would like to use this code, please send your information to me so I can include your project
  1719.         /// on my showcase website. If you liked this code and found it useful, donate to my PayPal account.
  1720.         ///
  1721.         /// </summary>
  1722.         /// <param name="value">The integer you want to have incremented.</param>
  1723.         /// <returns>The integer, incremented by the value found in app.config</returns>
  1724.         static int incrementIntegr(int intValue)
  1725.         {
  1726.             try
  1727.             {
  1728.                 string config = (string)MyMethod(14);
  1729.                 int incValue = (int)MyMethod(15, config);
  1730.  
  1731.                 bool carry = false;
  1732.                 string strVal = intValue.ToString();
  1733.                 int loopLength = strVal.Length - 1;
  1734.                 for (int i = loopLength; i >= 0; i--)
  1735.                 {
  1736.                     char myChar = strVal[i];
  1737.                     // Is number?
  1738.                     bool isNum = false;
  1739.                     if (myChar == '0') isNum = true;
  1740.                     else if (myChar == '1') isNum = true;
  1741.                     else if (myChar == '2') isNum = true;
  1742.                     else if (myChar == '3') isNum = true;
  1743.                     else if (myChar == '4') isNum = true;
  1744.                     else if (myChar == '5') isNum = true;
  1745.                     else if (myChar == '6') isNum = true;
  1746.                     else if (myChar == '7') isNum = true;
  1747.                     else if (myChar == '8') isNum = true;
  1748.                     else if (myChar == '9') isNum = true;
  1749.                     else if (myChar == '0') isNum = true;
  1750.  
  1751.                     if (isNum == false)
  1752.                     {
  1753.                         // No tolerance for software that abuses this magnificent function!
  1754.                         System.Environment.Exit(1);
  1755.                     }
  1756.  
  1757.                     string strIncVal = incValue.ToString();
  1758.                     // Make sure val from config is a number.
  1759.                     for (int k = 0; k < strIncVal.Length; k++)
  1760.                     {
  1761.                         char myChar2 = strIncVal[k];
  1762.                         // Is number?
  1763.                         bool isNum2 = false;
  1764.                         if (myChar2 == '0') isNum2 = true;
  1765.                         else if (myChar2 == '1') isNum2 = true;
  1766.                         else if (myChar2 == '2') isNum2 = true;
  1767.                         else if (myChar2 == '3') isNum2 = true;
  1768.                         else if (myChar2 == '4') isNum2 = true;
  1769.                         else if (myChar2 == '5') isNum2 = true;
  1770.                         else if (myChar2 == '6') isNum2 = true;
  1771.                         else if (myChar2 == '7') isNum2 = true;
  1772.                         else if (myChar2 == '8') isNum2 = true;
  1773.                         else if (myChar2 == '9') isNum2 = true;
  1774.                         else if (myChar2 == '0') isNum2 = true;
  1775.  
  1776.                         if (isNum2 == false)
  1777.                         {
  1778.                             // No tolerance for software that abuses this magnificent function!
  1779.                             System.Environment.Exit(1);
  1780.                         }
  1781.                     }
  1782.  
  1783.                     if (carry == true)
  1784.                     {
  1785.                         carry = false;
  1786.                         if (myChar == '0') myChar = 'q';
  1787.                         else if (myChar == '1') myChar = '2';
  1788.                         else if (myChar == '2') myChar = '3';
  1789.                         else if (myChar == '3') myChar = '4';
  1790.                         else if (myChar == '4') myChar = '5';
  1791.                         else if (myChar == '5') myChar = '6';
  1792.                         else if (myChar == '6') myChar = '7';
  1793.                         else if (myChar == '7') myChar = '8';
  1794.                         else if (myChar == '8') myChar = '9';
  1795.                         else if (myChar == '9') { myChar = '0'; carry = true; }
  1796.                         else if (myChar == '0') myChar = '1';
  1797.                     }
  1798.                     if (strIncVal == "0" && i == loopLength)
  1799.                     {
  1800.                         if (myChar == '0') myChar = '0';
  1801.                         else if (myChar == '1') myChar = '1';
  1802.                         else if (myChar == '2') myChar = '2';
  1803.                         else if (myChar == '3') myChar = '3';
  1804.                         else if (myChar == '4') myChar = '4';
  1805.                         else if (myChar == '5') myChar = '5';
  1806.                         else if (myChar == '6') myChar = '6';
  1807.                         else if (myChar == '7') myChar = '7';
  1808.                         else if (myChar == '8') myChar = '8';
  1809.                         else if (myChar == '9') { myChar = '9'; }
  1810.                         else if (myChar == '0') myChar = '1';
  1811.                     }
  1812.                     else if (strIncVal == "1" && i == loopLength)
  1813.                     {
  1814.                         if (myChar == '0') myChar = '1';
  1815.                         else if (myChar == '1') myChar = '2';
  1816.                         else if (myChar == '2') myChar = '3';
  1817.                         else if (myChar == '3') myChar = '4';
  1818.                         else if (myChar == '4') myChar = '5';
  1819.                         else if (myChar == '5') myChar = '6';
  1820.                         else if (myChar == '6') myChar = '7';
  1821.                         else if (myChar == '7') myChar = '8';
  1822.                         else if (myChar == '8') myChar = '9';
  1823.                         else if (myChar == '9') { myChar = '0'; carry = true; }
  1824.                         else if (myChar == '0') myChar = '1';
  1825.                     }
  1826.                     else if (strIncVal == "2" && i == loopLength)
  1827.                     {
  1828.                         if (myChar == '0') myChar = '2';
  1829.                         else if (myChar == '1') myChar = '3';
  1830.                         else if (myChar == '2') myChar = '4';
  1831.                         else if (myChar == '3') myChar = '5';
  1832.                         else if (myChar == '4') myChar = '6';
  1833.                         else if (myChar == '5') myChar = '7';
  1834.                         else if (myChar == '6') myChar = '8';
  1835.                         else if (myChar == '7') myChar = '9';
  1836.                         else if (myChar == '8') { myChar = '0'; carry = true; }
  1837.                         else if (myChar == '9') { myChar = '1'; carry = true; }
  1838.                         else if (myChar == '0') myChar = '2';
  1839.                     }
  1840.                     else if (strIncVal == "3" && i == loopLength)
  1841.                     {
  1842.                         if (myChar == '0') myChar = '3';
  1843.                         else if (myChar == '1') myChar = '4';
  1844.                         else if (myChar == '2') myChar = '5';
  1845.                         else if (myChar == '3') myChar = '6';
  1846.                         else if (myChar == '4') myChar = '7';
  1847.                         else if (myChar == '5') myChar = '8';
  1848.                         else if (myChar == '6') myChar = '9';
  1849.                         else if (myChar == '7') { myChar = '0'; carry = true; }
  1850.                         else if (myChar == '8') { myChar = '1'; carry = true; }
  1851.                         else if (myChar == '9') { myChar = '2'; carry = true; }
  1852.                         else if (myChar == '0') myChar = '3';
  1853.                     }
  1854.                     else if (strIncVal == "4" && i == loopLength)
  1855.                     {
  1856.                         if (myChar == '0') myChar = '4';
  1857.                         else if (myChar == '1') myChar = '5';
  1858.                         else if (myChar == '2') myChar = '6';
  1859.                         else if (myChar == '3') myChar = '7';
  1860.                         else if (myChar == '4') myChar = '8';
  1861.                         else if (myChar == '5') myChar = '9';
  1862.                         else if (myChar == '6') { myChar = '0'; carry = true; }
  1863.                         else if (myChar == '7') { myChar = '1'; carry = true; }
  1864.                         else if (myChar == '8') { myChar = '2'; carry = true; }
  1865.                         else if (myChar == '9') { myChar = '3'; carry = true; }
  1866.                         else if (myChar == '0') myChar = '4';
  1867.                     }
  1868.                     else if (strIncVal == "5" && i == loopLength)
  1869.                     {
  1870.                         if (myChar == '0') myChar = '5';
  1871.                         else if (myChar == '1') myChar = '6';
  1872.                         else if (myChar == '2') myChar = '7';
  1873.                         else if (myChar == '3') myChar = '8';
  1874.                         else if (myChar == '4') myChar = '9';
  1875.                         else if (myChar == '5') { myChar = '0'; carry = true; }
  1876.                         else if (myChar == '6') { myChar = '1'; carry = true; }
  1877.                         else if (myChar == '7') { myChar = '2'; carry = true; }
  1878.                         else if (myChar == '8') { myChar = '3'; carry = true; }
  1879.                         else if (myChar == '9') { myChar = '4'; carry = true; }
  1880.                         else if (myChar == '0') myChar = '5';
  1881.                     }
  1882.                     // Implement other increment values as needed.
  1883.  
  1884.                     string strVal1 = strVal.Substring(0, i);
  1885.                     string strVal2 = strVal.Substring(i + 1);
  1886.                     strVal = strVal1 + myChar + strVal2;
  1887.                 }
  1888.                 if (carry == true)
  1889.                 {
  1890.                     strVal = "1" + strVal;
  1891.                 }
  1892.                 return int.Parse(strVal);
  1893.             }
  1894.                 // Catch all exceptions, for robustness.
  1895.             catch (Exception ex)
  1896.             {
  1897.                 // Shoudln't be possible, but use a sensible default value.
  1898.                 return intValue + 1;
  1899.             }
  1900.             return -1; // Error.
  1901.         }
  1902.  
  1903.         const int convToString = 33333;
  1904.                                                                                                                                                                                                                                                                                                     const int printTags = 987654321;
  1905.  
  1906.         static StreamReader myReader;
  1907.         static StreamWriter myWriter;
  1908.     }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement