SHARE
TWEET

Untitled

a guest Dec 13th, 2018 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         public void GetMCCFromHexadecimal(string hexCode) {
  2.             string versionBinaryCode = HexToBinary.HexStringToBinary(hexCode).Substring(0, 5);
  3.             string sectionBinaryCode = HexToBinary.HexStringToBinary(hexCode).Substring(11, 2);
  4.             string TypeBinaryCode = HexToBinary.HexStringToBinary (hexCode).Substring(13, 4);
  5.             string MCCTBinaryCode = HexToBinary.HexStringToBinary (hexCode).Substring(17, 40);
  6.  
  7.             int sectionCode = Convert.ToInt32(sectionBinaryCode, 2);
  8.             string type = Convert.ToInt32(TypeBinaryCode, 2).ToString();
  9.             string MCCT = Convert.ToInt64(MCCTBinaryCode, 2).ToString();
  10.  
  11.             //Check version to discard furnitures
  12.             if (versionBinaryCode == "10001")
  13.             {
  14.                 //Version 17 is a furniture
  15.                 return;
  16.             }
  17.  
  18.             //***
  19.             string activeFlagBinaryCode = HexToBinary.HexStringToBinary(hexCode).Substring(57, 1);
  20.             int activeFlag = Convert.ToInt32(activeFlagBinaryCode, 2);
  21.             if (activeFlag == 0)
  22.             {
  23.                 return;
  24.             }
  25.             //***
  26.  
  27.             // Check if the tag section is different from the current section
  28.             if (sectionCode != Configuration.SectionType)
  29.             {
  30.                 return;
  31.             }
  32.  
  33.             // Check if the code is empty (all zeros)
  34.             bool emptyTag = true;
  35.  
  36.             for (int i = 0; i < MCCT.Length; i++)
  37.             {
  38.                 if (MCCT[i] != '0')
  39.                 {
  40.                     emptyTag = false;
  41.                 }
  42.             }
  43.  
  44.             // Check if the code is empty (all zeros)
  45.             if (emptyTag)
  46.             {
  47.                 return;
  48.             }
  49.  
  50.             while(MCCT.Length < 12)
  51.             {
  52.                 MCCT = "0" + MCCT;
  53.             }
  54.  
  55.             string MCC = MCCT.Substring (0, 10);
  56.  
  57.             if (!CurrentScannedCodes.Contains(type + MCC)) {
  58.                 AddCode (type + MCC);
  59.                 AddCodeToCurrentScannedCodes(type + MCC);
  60.             }
  61.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top