Beispiel #1
0
        public void CompressData(List <byte[]> list)
        {
            BitWriter BitW = new BitWriter();

            int DictPart = FindDictPart();

            List <bool> returned = new List <bool>();

            for (int i1 = list.Count - 1; i1 >= 0; i1--)
            {
                Console.Write("\r{0} glyph left             ", i1);

                for (int i2 = list[i1].Length - 1; i2 >= 0; i2--)
                {
                    int s4 = list[i1][i2];
                    int i  = 1;

                    while (Dictionary.Dictionary[i][2] != s4)
                    {
                        i++;
                        if (Dictionary.Dictionary[i][1] != 0)
                        {
                            if ((s4 >> 4) > ((s4 << 4) >> 4))
                            {
                                s4 = s4 - (1 << 4);
                            }
                            else
                            {
                                s4 = s4 - 1;
                            }
                            i = 1;
                        }
                    }
                    int v0 = i;
                    while (v0 != 0)
                    {
                        v0 = FindDictIndex(v0, DictPart, returned);
                    }
                }
            }
            for (int i = returned.Count - 1; i >= 0; i--)
            {
                BitW.Write(returned[i]);
            }


            CompressedData             = BitW.GetArray();
            Header.CompressedBlockSize = Convert.ToInt32(CompressedData.Length);
            WriteGlyphPosition();

            Console.WriteLine("\rComplete             ");
        }