當前位置: 首頁>>代碼示例>>C#>>正文


C# IO.ReadByte方法代碼示例

本文整理匯總了C#中System.IO.ReadByte方法的典型用法代碼示例。如果您正苦於以下問題:C# IO.ReadByte方法的具體用法?C# IO.ReadByte怎麽用?C# IO.ReadByte使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.IO的用法示例。


在下文中一共展示了IO.ReadByte方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FileDirectoryDescriptor

        public FileDirectoryDescriptor(sio.FileStream fs)
        {
            int i;

            hdr = misc.ReadStruct<Header>(fs);
            name = fs.ReadString(hdr.lenFilId);
            isDirectory = (hdr.filFlags & 2) == 2;
            if (!isDirectory)
                if ((i = name.LastIndexOf(';')) > -1)
                    name = name.Remove(i, name.Length - i);

            for (i = DefaultSize + hdr.lenFilId; i < hdr.lenDirRec; i++) //skip 'System use' field
                fs.ReadByte();
        }
開發者ID:bsv798,項目名稱:p3fes,代碼行數:14,代碼來源:iso.cs

示例2: VolumePartition

        public VolumePartition(sio.FileStream fs)
        {
            bool termFound;

            termFound = false;
            while (!termFound)
            {
                switch (fs.ReadByte())
                {
                    case 0:
                        throw new NotImplementedException("Boot records are not supported");
                    case 1:
                        primary = new PrimaryVolumeDescriptor(fs);
                        break;
                    case 2:
                        throw new NotImplementedException("Supplementary descriptors are not supported");
                    case 3:
                        partition = new VolumePartitionDescriptor(fs);
                        break;
                    case 255:
                        terminator = new VolumeDescriptorSetTerminator(fs);
                        termFound = true;
                        break;
                    default:
                        throw new NotImplementedException(string.Format("{0:x}: descriptor is not supported", fs.Position - 1));
                }
            }

            fs.Position = (long)primary.hdr3.locLTbl * ISO9660.logSize + ISO9660.fsOff;
            paths = new PathTableRecords(fs, primary.hdr3.pthTblSizeL);
            for (int i = 0; i < paths.Count; i++)
            {
                fs.Position = (long)paths[i].hdr.locExtent * ISO9660.logSize + ISO9660.fsOff;
                paths[i].files = new FileRecords(fs, paths[i].name, paths[i].fullName);
            }
        }
開發者ID:bsv798,項目名稱:p3fes,代碼行數:36,代碼來源:iso.cs

示例3: FileRecords

        public FileRecords(sio.FileStream fs, string dirName, string dirFullName)
        {
            FileDirectoryDescriptor fd;
            long recEnd;

            files = new List<FileDirectoryDescriptor>();

            recEnd = fs.Position;
            fd = new FileDirectoryDescriptor(fs); //curr dir
            fd.name = dirName;
            fd.fullName = dirFullName;
            files.Add(fd);
            recEnd += fd.hdr.datLenL;

            fs.Position += fs.ReadByte(); //skip parent dir
            while (fs.Position < recEnd)
            {
                fd = new FileDirectoryDescriptor(fs);
                if (fd.hdr.lenDirRec > FileDirectoryDescriptor.DefaultSize)
                {
                    fd.fullName = dirFullName + fd.name;
                    if (fd.isDirectory)
                        if (fd.fullName.Length > 0)
                            fd.fullName += config.dirSep;
                    files.Add(fd);
                }
                fs.CondAlign(ISO9660.logSize, FileDirectoryDescriptor.DefaultSize);
            }
        }
開發者ID:bsv798,項目名稱:p3fes,代碼行數:29,代碼來源:iso.cs

示例4: VolumeDescriptor

        public VolumeDescriptor(sio.FileStream fs)
        {
            hdr1 = misc.ReadStruct<Header1>(fs);

            if (hdr1.stdIdb.ToStr() != stdIds)
                throw new NotImplementedException("This is not iso9660 filesystem");
            if (fs.ReadByte() > 0)
                throw new NotImplementedException("Not supported format of iso9660 filesystem");
        }
開發者ID:bsv798,項目名稱:p3fes,代碼行數:9,代碼來源:iso.cs

示例5: GetArchType

        private int GetArchType(sio.BinaryReader br, long len, out int fileCount)
        {
            sio.MemoryStream ms;
            long prevPos;
            long lastPos;
            byte b;
            byte[] bb;
            int size;
            int i;
            bool tru;

            bb = new byte[0xfc];

            ms = (sio.MemoryStream)br.BaseStream;
            fileCount = 0;
            prevPos = ms.Position;
            lastPos = prevPos + len;
            if (lastPos < 0x4)
                return 0;

            if (br.ReadInt32() == 0x64)
            {
                fileCount = br.ReadInt32();
                size = (fileCount + 1) << 3;
                if (fileCount > 0)
                    if (br.ReadInt32() == size)
                    {
                        ms.Position += size - 0xc - 0x8;
                        size = br.ReadInt32() + br.ReadInt32();
                        if (size <= lastPos)
                            return 1;
                    }
            }

            fileCount = 0;
            ms.Position = prevPos;
            if (lastPos > 0xff)
            {
                while (ms.Position < lastPos)
                {
                    for (i = 0; i < bb.Length; i++)
                    {
                        b = br.ReadByte();
                        if (b == 0)
                            break;
                        else if ((b < 0x20) || (b > 0x7f))
                        {
                            i = 0;
                            break;
                        }
                        bb[i] = b;
                    }
                    if (i > 0)
                    {
                        if (!stre.Regex.IsMatch(ste.ASCII.GetString(bb, 0, i), "^(\\w*[/.]*){1,}.\\w+$"))
                            break;
                    }
                    else if (fileCount == 0)
                        break;
                    ms.Position += bb.Length - i - 1;
                    size = br.ReadInt32();
                    if (size < 0 || size > lastPos)
                        break;
                    ms.Position += size;
                    ms.AlignPos(0x40);
                    if (size == 0)
                        if (fileCount == 0)
                            break;
                        else
                            if (lastPos - ms.Position < 0x800)
                                return 2;
                    fileCount++;
                }
                if (fileCount > 0)
                    if (ms.Position == lastPos)
                        return 2;
            }

            fileCount = 0;
            ms.Position = prevPos;
            if (br.ReadInt32() == 1)
                if (br.ReadInt32() == 0)
                    if (br.ReadInt32() == 0x30525053)
                        if (br.ReadInt32() == 0x20)
                            if (br.ReadInt32() - len - 0x4 < 0x40)
                            {
                                fileCount = br.ReadInt16();
                                return 3;
                            }
            #if DEBUG
                            else
                                throw new ArgumentException("spr0 size mismatch!");
                        else
                            throw new ArgumentException("spr0 header size mismatch!");
            #endif

            fileCount = 0;
            ms.Position = prevPos;
            if (br.ReadInt32() == 0)
                if (br.ReadInt32() - len - 0x4 < 0x40)
//.........這裏部分代碼省略.........
開發者ID:bsv798,項目名稱:p3fes,代碼行數:101,代碼來源:arch.cs

示例6: ExtractTmx0Ps2

        private void ExtractTmx0Ps2(string extrPath, sio.BinaryReader br, long len)
        {
            sio.MemoryStream ms;
            long startPos;
            long lastPos;
            long curPos;
            byte b;
            int size;
            bool found;
            string name;

            ms = (sio.MemoryStream)br.BaseStream;
            startPos = ms.Position;
            lastPos = startPos + len;
            curPos = ms.Position;
            size = 0;
            name = null;
            found = false;

            while (curPos < lastPos)
            {
                ms.Position = curPos;
                b = br.ReadByte();
                if (b == 0x2)
                {
                    if (br.ReadByte() == 0)
                        if (br.ReadInt16() == 0)
                        {
                            size = br.ReadInt32();
                            if (br.ReadInt32() == 0x30584D54) //tmx0
                                if (br.ReadInt32() == 0)
                                {
                                    name = misc.InsertCounter("tmx", gFileCount++);
                                    found = true;
                                }
                        }
                }
                else if (b == 0x15)
                {
                    if (br.ReadByte() == 0)
                        if (br.ReadInt16() == 0)
                        {
                            size = br.ReadInt32() + 0xc;
                            br.ReadInt32();
                            if (br.ReadInt32() == 1)
                                if (br.ReadInt32() == 0x8)
                                {
                                    ms.Position += 0x4;
                                    if (br.ReadInt32() == 0x325350) //ps2
                                    {
                                        name = misc.InsertCounter("ps2", gFileCount++);
                                        found = true;
                                    }
                                }
                        }
                }
                if (found)
                {
                    ms.Position = curPos;
                    sw.WriteLine(string.Format("{0:x8},{1:x8}", curPos - startPos, size));
                    sw.WriteLine(name);
                    ms.Extract(extrPath + name, size);
                    curPos += size - 1;
                    found = false;
                }
                curPos++;
            }
        }
開發者ID:bsv798,項目名稱:p3fes,代碼行數:68,代碼來源:arch.cs

示例7: ExtractNamedBinary

        private void ExtractNamedBinary(string extrPath, sio.BinaryReader br, long len)
        {
            sio.MemoryStream ms;
            long lastPos;
            string name;
            byte b;
            byte[] bb;
            int size;
            int i;

            bb = new byte[0xfc];
            ms = (sio.MemoryStream)br.BaseStream;
            lastPos = ms.Position + len;
            while (ms.Position < lastPos)
            {
                for (i = 0; i < bb.Length; i++)
                {
                    b = br.ReadByte();
                    if (b == 0)
                        break;
                    else if ((b < 0x20) || (b > 0x7f))
                    {
                        i = 0;
                        break;
                    }
                    bb[i] = b;
                }
                ms.Position += bb.Length - i - 1;
                size = br.ReadInt32();
                if ((size == 0) || (i == 0))
                    if (lastPos - ms.Position < 0x800)
                        break;
                name = misc.InsertCounter(ste.ASCII.GetString(bb, 0, i), gFileCount++);
                GetArchs(extrPath, name, ms, size);
                //sw.WriteLine(name);
                ms.AlignPos(0x40);
            }
        }
開發者ID:bsv798,項目名稱:p3fes,代碼行數:38,代碼來源:arch.cs

示例8: ExtractCin

        private void ExtractCin(string extrPath, sio.BinaryReader br, long len)
        {
            sio.MemoryStream ms;
            int count;
            long startPos;
            long pos;
            string name;

            ms = (sio.MemoryStream)br.BaseStream;
            startPos = ms.Position;

            ms.Position += 0x8;
            count = br.ReadInt16();
            ms.Position += 0x10;
            while (count > 0)
            {
                ms.Position += 0x11;
                if (br.ReadByte() == 0xfe)
                    count--;
            }
            ms.Position += 0xd;
            pos = ms.Position - startPos;
            pos = misc.Align(pos, 0x40);

            ms.Position = startPos;
            name = misc.InsertCounter("dat", gFileCount++);
            sw.WriteLine(name);
            ms.Extract(extrPath + name, pos);
            if (pos < (len - 0x100))
                GetArchs(extrPath, misc.InsertCounter("dat", gFileCount++), ms, len - (int)pos);
            else
                ms.Position = startPos + len;
        }
開發者ID:bsv798,項目名稱:p3fes,代碼行數:33,代碼來源:arch.cs


注:本文中的System.IO.ReadByte方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。