Пример #1
0
        public static void AnalyzePacketString(string str)
        {
            Debug.Log("Total Length: " + str.Length);
            Debug.Log("Block Size: " + str.Length / 5f);

            int i = 0;

            while (i < str.Length)
            {
                var sb = new StringBuilder();

                sb.Append("Index: " + i);
                uint packet = Base64Tools.ParseInt30Fast(str.Substring(i, 5));
                sb.Append(", Packet: " + packet.ToString());
                uint mid = BoctPacketTools.GetMaterialPart(packet);
                sb.Append(", Material ID: " + mid);

                uint len = BoctPacketTools.GetAddressLengthPart(packet);
                sb.Append(", Address Length: " + len);

                var list = new List <byte>();
                for (uint j = 0; j < len; j++)
                {
                    uint pos = BoctPacketTools.GetPosition(packet, j + 1);
                    list.Add((byte)pos);
                }

                Debug.Log(sb.ToString());

                i += 5;
            }
        }
Пример #2
0
        static bool InsertBoctFromBoctPacket30(string str, Boct target)
        {
            if (str.Length < 5 || str.Length % 5 != 0)
            {
                return(false);
            }

            int i = 0;

            while (i < str.Length)
            {
                uint packet = Base64Tools.ParseInt30Fast(str.Substring(i, 5));

                uint mid = BoctPacketTools.GetMaterialPart(packet);

                uint len = BoctPacketTools.GetAddressLengthPart(packet);

                var list = new List <byte>();
                for (uint j = 0; j < len; j++)
                {
                    uint pos = BoctPacketTools.GetPosition(packet, j + 1);
                    list.Add((byte)pos);
                }

                BoctTools.InsertBoct(list, target, (int)mid);

                i += 5;
            }
            return(true);
        }