<PackageReference Include="Relativity.Server.Import.SDK" Version="2.9.2" />

OpticonFileReader

using kCura.WinEDDS.Api; using Microsoft.VisualBasic.CompilerServices; using Relativity.DataExchange.Data; using Relativity.DataExchange.Io; using Relativity.DataExchange.Process; using System; using System.IO; using System.Runtime.Serialization; using System.Text; namespace kCura.WinEDDS { public class OpticonFileReader : DelimitedFileImporter2, IImageReader { private enum Columns { BatesNumber = 0, FileLocation = 2, MultiPageIndicator = 3 } [Serializable] public class InvalidLineFormatException : Exception { public InvalidLineFormatException(int lineNumber, int numberOfColumns) : base($"""{lineNumber}""{numberOfColumns}""") { } protected InvalidLineFormatException(SerializationInfo info, StreamingContext context) : base(info, context) { } } private ImageLoadFile _settings; public ImageLoadFile Settings => _settings; public int CurrentRecordNumber => base.CurrentLineNumber; public bool HasMoreRecords => !HasReachedEof; public OpticonFileReader(int folderID, ImageLoadFile args, ProcessContext context, Guid processID, bool doRetryLogic) : base(',', doRetryLogic) { _settings = args; } public void AdvanceRecord() { AdvanceLine(); } void IImageReader.AdvanceRecord() { this.AdvanceRecord(); } public new void Close() { base.Close(); } void IImageReader.Close() { this.Close(); } public ImageRecord GetImageRecord() { string[] line = GetLine(); if (line.Length < 4) throw new InvalidLineFormatException(base.CurrentLineNumber, line.Length); return new ImageRecord { BatesNumber = line[0], FileLocation = line[2], IsNewDoc = (Operators.CompareString(line[3].ToLower(), "y", false) == 0) }; } ImageRecord IImageReader.GetImageRecord() { return this.GetImageRecord(); } public override object ReadFile(string path) { throw new MethodAccessException("Unsupported Operation"); } public long? CountRecords() { return FileSystem.Instance.File.CountLinesInFile(Settings.FileName); } long? IImageReader.CountRecords() { return this.CountRecords(); } public void Cancel() { base.Context.RetryOptions = RetryOptions.None; } void IImageReader.Cancel() { this.Cancel(); } public void Initialize() { base.Reader = new StreamReader(_settings.FileName, Encoding.Default, true); Rewind(); } void IImageReader.Initialize() { this.Initialize(); } } }