Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string ReadAnyTextFile
- (
- [NotNull] this IrbisConnection connection,
- [NotNull] string serverPath,
- [NotNull] Encoding encoding
- )
- {
- Code.NotNull(connection, "connection");
- Code.NotNullNorEmpty(serverPath, "serverPath");
- Code.NotNull(encoding, "encoding");
- connection.RequireServerVersion("2010.1", true);
- string result = connection.FormatRecord
- (
- "&uf('+9J" + serverPath + "')",
- 1
- );
- if (!string.IsNullOrEmpty(result))
- {
- RecordField field = RecordField.Parse("1", result);
- result = field.GetFirstSubFieldValue('b');
- byte[] bytes = IrbisUtility.DecodePercentString(result);
- result = encoding.GetString(bytes);
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement