public static DecimalField Extract(IRfcInterop interop, IntPtr dataHandle, string name) { RfcResultCodes resultCode = interop.GetString( dataHandle: dataHandle, name: name, stringBuffer: Array.Empty <char>(), bufferLength: 0, stringLength: out uint stringLength, errorInfo: out RfcErrorInfo errorInfo); if (resultCode != RfcResultCodes.RFC_BUFFER_TOO_SMALL) { resultCode.ThrowOnError(errorInfo); return(new DecimalField(name, 0)); } var buffer = new char[stringLength + 1]; resultCode = interop.GetString( dataHandle: dataHandle, name: name, stringBuffer: buffer, bufferLength: (uint)buffer.Length, stringLength: out _, errorInfo: out errorInfo); resultCode.ThrowOnError(errorInfo); var decimalValue = decimal.Parse(new string(buffer, 0, (int)stringLength), CultureInfo.InvariantCulture); return(new DecimalField(name, decimalValue)); }
public static StringField Extract(IRfcInterop interop, IntPtr dataHandle, string name) { RfcResultCodes resultCode = interop.GetString( dataHandle: dataHandle, name: name, stringBuffer: Array.Empty <char>(), bufferLength: 0, stringLength: out uint stringLength, errorInfo: out RfcErrorInfo errorInfo); if (resultCode != RfcResultCodes.RFC_BUFFER_TOO_SMALL) { resultCode.ThrowOnError(errorInfo); return(new StringField(name, string.Empty)); } var buffer = new char[stringLength + 1]; resultCode = interop.GetString( dataHandle: dataHandle, name: name, stringBuffer: buffer, bufferLength: (uint)buffer.Length, stringLength: out _, errorInfo: out errorInfo); resultCode.ThrowOnError(errorInfo); return(new StringField(name, new string(buffer, 0, (int)stringLength))); }
public static DateField Extract(IRfcInterop interop, IntPtr dataHandle, string name) { char[] buffer = EmptyRfcDateString.ToCharArray(); RfcResultCodes resultCode = interop.GetDate( dataHandle: dataHandle, name: name, emptyDate: buffer, errorInfo: out RfcErrorInfo errorInfo); resultCode.ThrowOnError(errorInfo); string dateString = new string(buffer); if (dateString == EmptyRfcDateString || dateString == ZeroRfcDateString) { return(new DateField(name, null)); } Match match = Regex.Match(dateString, "^(?<Year>[0-9]{4})(?<Month>[0-9]{2})(?<Day>[0-9]{2})$"); if (!match.Success) { return(new DateField(name, null)); } int year = int.Parse(match.Groups["Year"].Value); int month = int.Parse(match.Groups["Month"].Value); int day = int.Parse(match.Groups["Day"].Value); return(new DateField(name, new DateTime(year, month, day))); }
public static TimeField Extract(IRfcInterop interop, IntPtr dataHandle, string name) { char[] buffer = EmptyRfcTimeString.ToCharArray(); RfcResultCodes resultCode = interop.GetTime( dataHandle: dataHandle, name: name, emptyTime: buffer, out RfcErrorInfo errorInfo); resultCode.ThrowOnError(errorInfo); var timeString = new string(buffer); if (timeString == EmptyRfcTimeString || timeString == ZeroRfcTimeString) { return(new TimeField(name, null)); } Match match = Regex.Match(timeString, "^(?<Hours>[0-9]{2})(?<Minutes>[0-9]{2})(?<Seconds>[0-9]{2})$"); if (!match.Success) { return(new TimeField(name, null)); } int hours = int.Parse(match.Groups["Hours"].Value); int minutes = int.Parse(match.Groups["Minutes"].Value); int seconds = int.Parse(match.Groups["Seconds"].Value); return(new TimeField(name, new TimeSpan(hours, minutes, seconds))); }
public static TOutput Extract <TOutput>(IRfcInterop interop, IntPtr dataHandle) { Type outputType = typeof(TOutput); Func <IRfcInterop, IntPtr, object> extractFunc = ExtractFuncsCache.GetOrAdd(outputType, BuildExtractFunc); return((TOutput)extractFunc(interop, dataHandle)); }
private IRfcFunction CreateFromDescriptionHandle(IRfcInterop interop, IntPtr functionDescriptionHandle) { IntPtr functionHandle = interop.CreateFunction(functionDescriptionHandle, out RfcErrorInfo errorInfo); errorInfo.ThrowOnError(); return(new RfcFunction(interop, _rfcConnectionHandle, functionHandle)); }
public override void Apply(IRfcInterop interop, IntPtr dataHandle) { RfcResultCodes resultCode = interop.SetDate( dataHandle: dataHandle, name: Name, date: (Value?.ToString("yyyyMMdd") ?? ZeroRfcDateString).ToCharArray(), errorInfo: out RfcErrorInfo errorInfo); resultCode.ThrowOnError(errorInfo); }
private IntPtr GetTransactionHandle(IRfcInterop interop) { RfcResultCodes resultCode = _interop.GetTransactionId(_rfcConnectionHandle, out var tid, out RfcErrorInfo errorInfo); resultCode.ThrowOnError(errorInfo); IntPtr result = _interop.CreateTransaction(_rfcConnectionHandle, tid, null, out errorInfo); errorInfo.ThrowOnError(); return(result); }
public override void Apply(IRfcInterop interop, IntPtr dataHandle) { RfcResultCodes resultCode = interop.SetFloat( dataHandle: dataHandle, name: Name, value: Value, errorInfo: out RfcErrorInfo errorInfo); resultCode.ThrowOnError(errorInfo); }
public static void Apply(IRfcInterop interop, IntPtr dataHandle, object input) { if (input == null) { return; } Type inputType = input.GetType(); Action <IRfcInterop, IntPtr, object> applyAction = ApplyActionsCache.GetOrAdd(inputType, BuildApplyAction); applyAction(interop, dataHandle, input); }
public static LongField Extract(IRfcInterop interop, IntPtr dataHandle, string name) { RfcResultCodes resultCode = interop.GetInt8( dataHandle: dataHandle, name: name, out long value, out RfcErrorInfo errorInfo); resultCode.ThrowOnError(errorInfo); return(new LongField(name, value)); }
public static DoubleField Extract(IRfcInterop interop, IntPtr dataHandle, string name) { RfcResultCodes resultCode = interop.GetFloat( dataHandle: dataHandle, name: name, out double value, out RfcErrorInfo errorInfo); resultCode.ThrowOnError(errorInfo); return(new DoubleField(name, value)); }
public override void Apply(IRfcInterop interop, IntPtr dataHandle) { RfcResultCodes resultCode = interop.GetStructure( dataHandle: dataHandle, name: Name, structHandle: out IntPtr structHandle, out RfcErrorInfo errorInfo); resultCode.ThrowOnError(errorInfo); InputMapper.Apply(interop, structHandle, Value); }
public override void Apply(IRfcInterop interop, IntPtr dataHandle) { string stringValue = Value?.ToString("hhmmss") ?? ZeroRfcTimeString; RfcResultCodes resultCode = interop.SetTime( dataHandle: dataHandle, name: Name, time: stringValue.ToCharArray(), out RfcErrorInfo errorInfo); resultCode.ThrowOnError(errorInfo); }
public override void Apply(IRfcInterop interop, IntPtr dataHandle) { var stringValue = Value.ToString(CultureInfo.InvariantCulture); RfcResultCodes resultCode = interop.SetString( dataHandle: dataHandle, name: Name, value: stringValue, valueLength: (uint)stringValue.Length, errorInfo: out RfcErrorInfo errorInfo); resultCode.ThrowOnError(errorInfo); }
public static StructureField <T> Extract <T>(IRfcInterop interop, IntPtr dataHandle, string name) { RfcResultCodes resultCode = interop.GetStructure( dataHandle: dataHandle, name: name, structHandle: out IntPtr structHandle, out RfcErrorInfo errorInfo); resultCode.ThrowOnError(errorInfo); T structValue = OutputMapper.Extract <T>(interop, structHandle); return(new StructureField <T>(name, structValue)); }
public override void Apply(IRfcInterop interop, IntPtr dataHandle) { if (Value == null) { return; } RfcResultCodes resultCode = interop.SetString( dataHandle: dataHandle, name: Name, value: Value, valueLength: (uint)Value.Length, errorInfo: out RfcErrorInfo errorInfo); resultCode.ThrowOnError(errorInfo); }
public static TableField <T> Extract <T>(IRfcInterop interop, IntPtr dataHandle, string name) { RfcResultCodes resultCode = interop.GetTable( dataHandle: dataHandle, name: name, tableHandle: out IntPtr tableHandle, errorInfo: out RfcErrorInfo errorInfo); resultCode.ThrowOnError(errorInfo); resultCode = interop.GetRowCount( tableHandle: tableHandle, out uint rowCount, out errorInfo); resultCode.ThrowOnError(errorInfo); var rows = new T[rowCount]; for (int i = 0; i < rowCount; i++) { IntPtr rowHandle = interop.GetCurrentRow( tableHandle: tableHandle, errorInfo: out errorInfo); errorInfo.ThrowOnError(); rows[i] = OutputMapper.Extract <T>(interop, rowHandle); resultCode = interop.MoveToNextRow( tableHandle: tableHandle, errorInfo: out errorInfo); if (resultCode == RfcResultCodes.RFC_TABLE_MOVE_EOF) { return(new TableField <T>(name, rows.Take(i + 1).ToArray())); } resultCode.ThrowOnError(errorInfo); } return(new TableField <T>(name, rows)); }
public override void Apply(IRfcInterop interop, IntPtr dataHandle) { RfcResultCodes resultCode = interop.GetTable( dataHandle: dataHandle, name: Name, out IntPtr tableHandle, out RfcErrorInfo errorInfo); resultCode.ThrowOnError(errorInfo); if (Value == null) { return; } foreach (TItem row in Value) { IntPtr lineHandle = interop.AppendNewRow(tableHandle, out errorInfo); errorInfo.ThrowOnError(); InputMapper.Apply(interop, lineHandle, row); } }
public ReadBapi(IRfcInterop interop) : base(interop) { }
public RfcTransactionFunction(IRfcInterop interop, IntPtr transactionHandle, IntPtr functionHandle) { _interop = interop; _transactionHandle = transactionHandle; _functionHandle = functionHandle; }
public override void Apply(IRfcInterop interop, IntPtr dataHandle) { throw new NotImplementedException(); }
public RfcFunction(IRfcInterop interop, IntPtr rfcConnectionHandle, IntPtr functionHandle) { _interop = interop; _rfcConnectionHandle = rfcConnectionHandle; _functionHandle = functionHandle; }
public RfcLibrary(IRfcInterop interop) { _interop = interop; }
public ReadTable(IPropertyCache cache, IRfcInterop interop) : base(interop) { _cache = cache; }
protected RfcConnectionBase(IRfcInterop interop, RfcConnectionOption options) { _interop = interop; _options = options; }
public abstract void Apply(IRfcInterop interop, IntPtr dataHandle);
public RfcConnection(IRfcInterop interop, string connectionString) : base(interop, new RfcConnectionOption().Parse(connectionString)) { }
public RfcConnection(IRfcInterop interop, RfcConnectionOption options) : base(interop, options) { }
public RfcConnection(IRfcInterop interop, IOptionsSnapshot <RfcConnectionOption> options) : base(interop, options.Value) { }