当前位置: 首页>>代码示例>>C#>>正文


C# Inflater.SetInput方法代码示例

本文整理汇总了C#中Inflater.SetInput方法的典型用法代码示例。如果您正苦于以下问题:C# Inflater.SetInput方法的具体用法?C# Inflater.SetInput怎么用?C# Inflater.SetInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Inflater的用法示例。


在下文中一共展示了Inflater.SetInput方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadCompressed

        public static void ReadCompressed(Stream s, List<string> classnames)
        {
            long start = s.Position;
            BinaryReader br = new BinaryReader(s);
            byte[] mem = new byte[(int)s.Length + 8];
            byte[] buf = new byte[3];
            s.Read(buf, 0, 3);
            s.Seek(start+4, SeekOrigin.Begin);
            int size = br.ReadInt32();
            s.Seek(start+8, SeekOrigin.Begin);
            s.Read(mem, 0, (int)s.Length);
            s.Close();
            br.Close();

            try
            {
                s = new MemoryStream(mem);
                if (Encoding.Default.GetString(buf) == "CWS")
                {
                    Inflater i = new Inflater();
                    i.SetInput(mem);
                    byte[] mem2 = new byte[size + 8];
                    i.Inflate(mem2, 8, size);
                    s = new MemoryStream(mem2);
                    mem = new byte[0];
                }

                s.Seek(0x15, SeekOrigin.Begin);
                br = new BinaryReader(s);
                while (br.BaseStream.Position < br.BaseStream.Length)
                {
                    uint taglen = br.ReadUInt16();
                    uint len = taglen & 0x3f;
                    uint tag = (taglen - len) / 64;
                    if (len == 63)
                        len = br.ReadUInt32();
                    start = br.BaseStream.Position;

                    if (tag == 82)
                    {
                        FlashABC fabc = new FlashABC(br.BaseStream, len);
                        fabc.FindClasses(classnames);
                    }
                    br.BaseStream.Seek(start + len, SeekOrigin.Begin);
                }
                br.Close();
            }
            catch (Exception e)
            {
                Debug.Print(e.StackTrace);
                return;
            }
        }
开发者ID:TheCrazyT,项目名称:FlashABCRead,代码行数:53,代码来源:FlashRead.cs

示例2: SetInflaterInput

 /// <summary>
 /// Call <see cref="Inflater.SetInput(byte[], int, int)"/> passing the current clear text buffer contents.
 /// </summary>
 /// <param name="inflater">The inflater to set input for.</param>
 public void SetInflaterInput(Inflater inflater)
 {
     if ( available > 0 ) {
         inflater.SetInput(clearText, clearTextLength - available, available);
         available = 0;
     }
 }
开发者ID:Mikolaytis,项目名称:Mikolaytis,代码行数:11,代码来源:InflaterInputStream.cs

示例3: FlashReadFile

        public FlashReadFile(string file)
        {
            FileStream fs = new FileStream(file, FileMode.Open);
            BinaryReader br = new BinaryReader(fs);
            byte[] mem = new byte[(int)fs.Length + 8];
            byte[] buf = new byte[3];
            fs.Read(buf, 0, 3);
            fs.Seek(4, SeekOrigin.Begin);
            int size = br.ReadInt32();
            fs.Seek(8, SeekOrigin.Begin);
            fs.Read(mem, 0, (int)fs.Length);
            fs.Close();
            br.Close();

            s = new MemoryStream(mem);
            if (Encoding.Default.GetString(buf) == "CWS")
            {
                Inflater i = new Inflater();
                i.SetInput(mem);
                byte[] mem2 = new byte[size + 8];
                i.Inflate(mem2, 8, size);
                s = new MemoryStream(mem2);
                mem = new byte[0];
            }
            s.Seek(0x15, SeekOrigin.Begin);
            br = new BinaryReader(s);
            while (br.BaseStream.Position < br.BaseStream.Length)
            {
                uint taglen = br.ReadUInt16();
                uint len = taglen & 0x3f;
                uint tag = (taglen - len) / 64;
                if (len == 63)
                    len = br.ReadUInt32();
                long start = br.BaseStream.Position;

                if (tag == 82)
                {
                    FlashABC fabc = new FlashABC(br.BaseStream, len);
                    List<string> classnames = new List<string>();
                    classnames.Add("cPlayerData");
                    fabc.FindClasses(classnames);
                }
                //Debug.Print("{0} {1}", tag, len+2);
                br.BaseStream.Seek(start + len, SeekOrigin.Begin);
            }
            fClass.InitClasses();
            br.Close();
        }
开发者ID:TheCrazyT,项目名称:FlashABCRead,代码行数:48,代码来源:FlashRead.cs

示例4: CheckReader

        void CheckReader()
        {
            if (reader == null) {
                if (!record.IsCompressed)
                    throw new InvalidOperationException();
                int compressedSize = checked((int)record.Size);
                int uncompressedSize = checked((int)compressedReader.ReadUInt32());

                byte[] compressedData = new byte[compressedSize];
                byte[] uncompressedData = new byte[uncompressedSize];

                int compressedRead = compressedReader.Read(compressedData, 0, compressedSize);
                Inflater inflater = new Inflater();
                inflater.SetInput(compressedData);
                int uncompressedRead = inflater.Inflate(uncompressedData, 0, uncompressedSize);
                reader = new BinaryReader(new MemoryStream(uncompressedData, false));
                endOffset = uncompressedSize;
            }
        }
开发者ID:Burton-Radons,项目名称:Alexandria,代码行数:19,代码来源:RecordReader.cs

示例5: Inflate

    static int Inflate(Inflater inf, byte [] src, byte [] dest)
    {
        int offset, length, remain;

        inf.Reset ();
        inf.SetInput (src);

        offset = 0;
        while (!inf.IsNeedingInput) {
            remain = Math.Min (dest.Length - offset, BlockSize);
            if (remain == 0)
                break;

            length = inf.Inflate (dest, offset, remain);
            offset += length;
        }

        return inf.TotalOut;
    }
开发者ID:AveProjVstm,项目名称:MonoVstm,代码行数:19,代码来源:zipmark.cs

示例6: SetInflaterInput

 public void SetInflaterInput(Inflater inflater)
 {
     if (this.available > 0)
     {
         inflater.SetInput(this.clearText, this.clearTextLength - this.available, this.available);
         this.available = 0;
     }
 }
开发者ID:fanthos,项目名称:Game-Heal,代码行数:8,代码来源:InflaterInputBuffer.cs

示例7: CheckSwf

        private bool CheckSwf(bool is_comp)
        {
            this.format = MediaFormat.SWF;
            this.reader = new BinaryReader(this.stream);

            if (is_comp) {
                int size = -1;

                this.reader.BaseStream.Position = 4; // Skip head
                size = Convert.ToInt32(this.reader.ReadUInt32());

                // Read swf head
                byte[] uncompressed = new byte[size];
                this.reader.BaseStream.Position = 0;
                this.reader.Read(uncompressed, 0, 8);

                // Read compressed data
                byte[] compressed = this.reader.ReadBytes(size);
                this.stream.Close(); // Close the old stream

                // Uncompress
                Inflater zipInflator = new Inflater();
                zipInflator.SetInput(compressed);
                zipInflator.Inflate(uncompressed, 8, size - 8);

                // Setup new uncompressed reader
                this.reader = new BinaryReader(new MemoryStream(uncompressed));
                this.reader.BaseStream.Position = 0;
            }

            // Skip header signature/version etc etc
            this.reader.BaseStream.Position = 8;

            // Read rect
            uint bits = ReadUBits(5);
            ReadSBits(bits); // Read xmin
            this.width = ReadSBits(bits) / 20; // Read xmax
            ReadSBits(bits); // Read ymin
            this.height = ReadSBits(bits) / 20; // Read ymax

            return true;
        }
开发者ID:nhtera,项目名称:CrowdCMS,代码行数:42,代码来源:MediaInfo.cs

示例8: Decompress

        public static string Decompress(String str)
        {
            // Initialize decompressor.
            byte[] compressedBytes = Convert.FromBase64String(str);
            Inflater decompressor = new Inflater();
            decompressor.SetInput(compressedBytes); // Give the decompressor the
            // data to decompress.

            byte[] ret = null;

            using (MemoryStream memStream = new MemoryStream(compressedBytes.Length))
            {
                // Decompress the data
                byte[] buf = new byte[compressedBytes.Length + 100];
                while (!decompressor.IsFinished)
                {
                    memStream.Write(buf, 0, decompressor.Inflate(buf));
                }

                memStream.Close();
                ret = memStream.ToArray();
            }

            return ASCIIEncoding.UTF8.GetString(ret);
        }
开发者ID:harryho,项目名称:demo-fx-trading-platform-prototype,代码行数:25,代码来源:Connector.cs


注:本文中的Inflater.SetInput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。