コード例 #1
0
        //GIF files use LSB-First packing order so I have to account for this.
        private void DecryptImageData(string stream)
        {
            string builder3 = "";
            string builder  = "";
            string number   = "";
            string binary   = GifHelper.HexToBinary(stream);
            string binary2  = "";
            int    pixel    = 0;

            for (int i = 0; i < binary.Length - LZWCompressionSize; i += LZWCompressionSize)
            {
                number   = Convert.ToInt32(binary.Substring(i, LZWCompressionSize), 2).ToString();
                binary2 += binary.Substring(i, 8) + ", ";
                builder += number + ", ";
                pixel++;
            }

            for (int i = 0; i < stream.Length - 2; i += 2)
            {
                builder3 += stream.Substring(i, 2) + " ";
            }

            Debug.Log("EST PIXELS: " + pixel);
            Debug.Log("IMAGE DATA SUBBLOCK 1 DATA: " + builder3);
            Debug.Log("IMAGE BLOCK BINARY: " + binary2);
            Debug.Log("IMAGE DATA DECRYPTED: " + builder);
        }
コード例 #2
0
 private void packetFieldDecrypt(string input)
 {
     string packetField = GifHelper.HexToBinary(input);
     LocalColorTableFlag = packetField.Substring(0, 1) == "1";
     InterlaceFlag = packetField.Substring(1, 1) == "1";
     SortFlag = packetField.Substring(2, 1) =="1";
     ResevedForFutureUse = packetField.Substring(3, 2);
     LocalColorTableSize = GifHelper.HexToDecimal(packetField.Substring(5, 3));
 }
コード例 #3
0
        private void PacketField(string packetField)
        {
            packetField = GifHelper.HexToBinary(packetField);
            //Debug.LogWarning("GCE PACKET FIELD BINARY: " + packetField);

            FutureUse      = GifHelper.HexToDecimal(packetField.Substring(0, 3));
            DisposalMethod = GifHelper.HexToDecimal(packetField.Substring(3, 3));

            UserInput       = packetField.Substring(6, 1) == "1";
            HasTransparency = packetField.Substring(7, 1) == "1";
        }
コード例 #4
0
        private void DecodePacketField(string packetField)
        {
            //Debug.LogError("LOGICAL DESCRIPTOR PACKETFIELD: " + packetField);
            string binary = GifHelper.HexToBinary(packetField);

            HasGlobalColorTable      = binary.Substring(0, 1) == "1";
            IsGlobalColorTableSorted = binary.Substring(4, 1) == "1";

            long resolution = Convert.ToInt64(binary.Substring(1, 3), 2);

            ColorResolution = (int)resolution + 1;

            long size = Convert.ToInt64(binary.Substring(5, 3), 2);

            GlobalColorTableSize = (int)(Mathf.Pow(2, size + 1) * 3);
            //Debug.LogError("Global Color Table Size: " + GlobalColorTableSize);
        }
コード例 #5
0
        public void Set(string stream)
        {
            Debug.Log("GRAPHICS CONTROL EXTENSION: " + stream);
            ErrorCheck(stream);

            string size = stream.Substring(4, 2);

            size      = GifHelper.HexToBinary(size);
            BlockSize = (int)Convert.ToInt64(size, 2);

            string packetField = stream.Substring(6, 2);

            PacketField(packetField);

            string delay = stream.Substring(8, 4);

            Delay = GifHelper.HexToDecimal(delay);

            string transparentIndex = stream.Substring(12, 2);

            TransparencyIndex = GifHelper.HexToDecimal(transparentIndex);
            //Debug.LogWarning("GCE TRANSPARENCY INDEX: " + TransparencyIndex);
        }