private static int FPDF_SaveBlock(IntPtr fileWrite, IntPtr data, uint size)
        {
            var write = new FPDF_FILEWRITE();

            Marshal.PtrToStructure(fileWrite, write);

            var stream = StreamManager.Get((int)write.stream);

            if (stream == null)
            {
                return(0);
            }

            var buffer = new byte[size];

            Marshal.Copy(data, buffer, 0, (int)size);

            try
            {
                stream.Write(buffer, 0, (int)size);
                return((int)size);
            }
            catch
            {
                return(0);
            }
        }
        public PageResult OnGet(int?port)
        {
            if (port.HasValue)
            {
                var streamSimulator = _manager.Get(port.Value);
                StreamSettings = streamSimulator?.Settings;
            }

            return(Page());
        }
Пример #3
0
        private static int FPDF_GetBlock(IntPtr param, uint position, IntPtr buffer, uint size)
        {
            var stream = StreamManager.Get((int)param);

            if (stream == null)
            {
                return(0);
            }
            byte[] managedBuffer = new byte[size];

            stream.Position = position;
            int read = stream.Read(managedBuffer, 0, (int)size);

            if (read != size)
            {
                return(0);
            }

            Marshal.Copy(managedBuffer, 0, buffer, (int)size);
            return(1);
        }