Пример #1
0
    public long Read(Stream sOutput, string pathSourceFile)
    {
        threadDone.Reset();

        long res = 0;

        using (FileStream fs = new FileStream(pathSourceFile, FileMode.Open, FileAccess.Read))
        {
            res          = fs.Length;
            bReading     = true;
            m_fileStream = fs;
            threadWakeUp.Set();

            byte[] buff;
            int    len;
            do
            {
                pc.consGetChunk(out buff, out len);
                if (len > 0)
                {
                    sOutput.Write(buff, 0, len);
                }
                pc.consFreeChunk();
            }while(len > 0);

            m_fileStream = null;
        }
        return(res);
    }