Beispiel #1
0
            /// <summary>
            /// Unlocks any lock on the file
            /// </summary>
            /// <param name="filePointer">File pointer</param>
            public MicrofocusFileIntResult V6_unlock(IntPtr filePointer)
            {
                if (filePointer == IntPtr.Zero)
                {
                    throw new ArgumentOutOfRangeException("File pointer cannot be zero");
                }

                var result = new MicrofocusFileIntResult();

                lock (SyncObj)
                {
                    result.Result     = MicrofocusV6Unlock(filePointer);
                    result.StatusCode = GetLastOperationStatusCode();
                }
                return(result);
            }
Beispiel #2
0
            /// <summary>
            /// Delete data from file
            /// </summary>
            /// <param name="filePointer">File pointer</param>
            /// <param name="record">Record data</param>
            /// <returns>Number of deleted chars. If any error occurs, the number of writed char is zero and f_errno has the error code</returns>
            public MicrofocusFileIntResult V6_delete(IntPtr filePointer, byte[] record)
            {
                if (filePointer == IntPtr.Zero)
                {
                    throw new ArgumentOutOfRangeException("File pointer cannot be zero");
                }
                if (record == null)
                {
                    throw new ArgumentNullException(nameof(record));
                }

                var result = new MicrofocusFileIntResult();

                lock (SyncObj)
                {
                    result.Result     = MicrofocusV6Delete(filePointer, record);
                    result.StatusCode = GetLastOperationStatusCode();
                }
                return(result);
            }
Beispiel #3
0
            /// <summary>
            /// Executes a start to the given file
            /// </summary>
            /// <param name="filePointer">File pointer</param>
            /// <param name="record">Record that contains all key fields needed for the start</param>
            /// <param name="keyIndex">Key used for start (zero based)</param>
            /// <param name="keySize">Key size for the start (zero = use all the key)</param>
            /// <param name="mode">What kind of starts will be executed</param>
            public MicrofocusFileIntResult V6_start(IntPtr filePointer, byte[] record, int keyIndex, int keySize, int mode)
            {
                if (filePointer == IntPtr.Zero)
                {
                    throw new ArgumentOutOfRangeException("File pointer cannot be zero");
                }
                if (record == null)
                {
                    throw new ArgumentNullException(nameof(record));
                }

                // Eseguo l'operazione
                var result = new MicrofocusFileIntResult();

                lock (SyncObj)
                {
                    result.Result     = MicrofocusV6Start(filePointer, record, keyIndex, keySize, mode);
                    result.StatusCode = GetLastOperationStatusCode();
                }
                return(result);
            }
Beispiel #4
0
            /// <summary>
            /// Reads a record from the file
            /// </summary>
            /// <remarks>
            /// When file is open in IO, then the record will be locked. Otherwise no lock will be managed
            /// </remarks>
            /// <param name="filePointer">File pointer</param>
            /// <param name="record">Record data (array char size must match the maximum file size). In input there is the key to read, in output the full record</param>
            /// <param name="keyIndex">Key index to use (zero based)</param>
            /// <param name="withLock">True for lock the record</param>
            /// <returns>Number of readed chars (zero if not found)</returns>
            public MicrofocusFileIntResult V6_read(IntPtr filePointer, byte[] record, int keyIndex, bool withLock = false)
            {
                if (filePointer == IntPtr.Zero)
                {
                    throw new ArgumentOutOfRangeException("File pointer cannot be zero");
                }
                if (record == null)
                {
                    throw new ArgumentNullException(nameof(record));
                }

                var result = new MicrofocusFileIntResult();

                lock (SyncObj)
                {
                    SetLock(withLock);
                    result.Result     = (int)MicrofocusV6Read(filePointer, record, keyIndex);
                    result.StatusCode = GetLastOperationStatusCode();
                }
                return(result);
            }