RPCV2Lib.rpcCracker.getData C# (CSharp) 메소드

getData() 공개 메소드

public getData ( ) : Byte[]
리턴 Byte[]
        public Byte[] getData()
        {
            uint length = get_uint32();

            Byte[] buf = new Byte[length];

            for (int bufi = 0; bufi < length; ++bufi)
            {
                buf[bufi] = data[i];
                ++i;
            }

            if (length % 4 != 0)
                i += (4 - length % 4);

            return buf;
        }

Usage Example

예제 #1
0
파일: nfsd.cs 프로젝트: petebarber/NFS
        private void Write(rpcCracker cracker, rpcPacker packer)
        {
            fhandle	fh			= new fhandle(cracker);
            uint	beginOffset	= cracker.get_uint32();
            uint	offset		= cracker.get_uint32();
            uint	totalcount	= cracker.get_uint32();
            Byte[] data			= cracker.getData();

            FileStream fs;

            try
            {
                fs = new FileStream(FileTable.LookupFileEntry(fh).Name, FileMode.Open, FileAccess.Write);
            }
            catch (System.IO.FileNotFoundException)
            {
                FileTable.Remove(fh);
                throw;
            }

            try
            {
                fs.Position = offset;

                fs.Write(data, 0, data.Length);

                attrstat.PackSuccess(packer, new fattr(fh));
            }
            finally
            {
                fs.Close();
            }
        }