Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void GetMCCFromHexadecimal(string hexCode) {
- string versionBinaryCode = HexToBinary.HexStringToBinary(hexCode).Substring(0, 5);
- string sectionBinaryCode = HexToBinary.HexStringToBinary(hexCode).Substring(11, 2);
- string TypeBinaryCode = HexToBinary.HexStringToBinary (hexCode).Substring(13, 4);
- string MCCTBinaryCode = HexToBinary.HexStringToBinary (hexCode).Substring(17, 40);
- int sectionCode = Convert.ToInt32(sectionBinaryCode, 2);
- string type = Convert.ToInt32(TypeBinaryCode, 2).ToString();
- string MCCT = Convert.ToInt64(MCCTBinaryCode, 2).ToString();
- //Check version to discard furnitures
- if (versionBinaryCode == "10001")
- {
- //Version 17 is a furniture
- return;
- }
- //***
- string activeFlagBinaryCode = HexToBinary.HexStringToBinary(hexCode).Substring(57, 1);
- int activeFlag = Convert.ToInt32(activeFlagBinaryCode, 2);
- if (activeFlag == 0)
- {
- return;
- }
- //***
- // Check if the tag section is different from the current section
- if (sectionCode != Configuration.SectionType)
- {
- return;
- }
- // Check if the code is empty (all zeros)
- bool emptyTag = true;
- for (int i = 0; i < MCCT.Length; i++)
- {
- if (MCCT[i] != '0')
- {
- emptyTag = false;
- }
- }
- // Check if the code is empty (all zeros)
- if (emptyTag)
- {
- return;
- }
- while(MCCT.Length < 12)
- {
- MCCT = "0" + MCCT;
- }
- string MCC = MCCT.Substring (0, 10);
- if (!CurrentScannedCodes.Contains(type + MCC)) {
- AddCode (type + MCC);
- AddCodeToCurrentScannedCodes(type + MCC);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement