PreviewImageFileProcess
using Relativity.DataExchange.Logger;
using Relativity.DataExchange.Process;
using Relativity.Logging;
using System;
using System.Runtime.CompilerServices;
namespace kCura.WinEDDS
{
public class PreviewImageFileProcess : ProcessBase2
{
public ImageLoadFile LoadFile;
[CompilerGenerated]
[AccessedThroughProperty("_imageFilePreviewer")]
private ImageFilePreviewer __imageFilePreviewer;
private DateTime _startTime;
private int _errorCount;
private int _warningCount;
[CompilerGenerated]
private int _TimeZoneOffset;
private virtual ImageFilePreviewer _imageFilePreviewer {
[CompilerGenerated]
get {
return __imageFilePreviewer;
}
[MethodImpl(MethodImplOptions.Synchronized)]
[CompilerGenerated]
set {
ImageFilePreviewer.StatusMessageEventHandler obj = _imageFileImporter_StatusMessage;
ImageFilePreviewer _imageFilePreviewer = __imageFilePreviewer;
if (_imageFilePreviewer != null)
_imageFilePreviewer.StatusMessage -= obj;
__imageFilePreviewer = value;
_imageFilePreviewer = __imageFilePreviewer;
if (_imageFilePreviewer != null)
_imageFilePreviewer.StatusMessage += obj;
}
}
public int TimeZoneOffset { get; set; }
[Obsolete("This constructor is marked for deprecation. Please use the constructor that requires a logger instance.")]
public PreviewImageFileProcess()
: this(RelativityLogger.Instance)
{
}
public PreviewImageFileProcess(ILog logger)
: base(logger)
{
}
protected override void OnExecute()
{
_startTime = DateTime.Now;
_warningCount = 0;
_errorCount = 0;
_imageFilePreviewer = new ImageFilePreviewer(base.Context, true);
_imageFilePreviewer.ReadFile(LoadFile.FileName);
base.Context.PublishProcessCompleted();
}
private unsafe void _imageFileImporter_StatusMessage(StatusEventArgs e)
{
checked {
long currentRecordIndex;
switch (e.EventType) {
case EventType2.End:
break;
case EventType2.Error: {
ref int warningCount;
*(ref warningCount = ref _errorCount) = warningCount + 1;
ProcessContext context4 = base.Context;
currentRecordIndex = e.CurrentRecordIndex;
context4.PublishErrorEvent(currentRecordIndex.ToString(), e.Message);
break;
}
case EventType2.Progress: {
ProcessContext context3 = base.Context;
currentRecordIndex = e.CurrentRecordIndex;
context3.PublishStatusEvent(currentRecordIndex.ToString(), e.Message);
base.Context.PublishProgress(e.TotalRecords, e.CurrentRecordIndex, _warningCount, _errorCount, _startTime, DateTime.Now, 0, 0, base.ProcessId, null, null, null);
break;
}
case EventType2.Status: {
ProcessContext context2 = base.Context;
currentRecordIndex = e.CurrentRecordIndex;
context2.PublishStatusEvent(currentRecordIndex.ToString(), e.Message);
break;
}
case EventType2.Warning: {
ref int warningCount;
*(ref warningCount = ref _warningCount) = warningCount + 1;
ProcessContext context = base.Context;
currentRecordIndex = e.CurrentRecordIndex;
context.PublishWarningEvent(currentRecordIndex.ToString(), e.Message);
break;
}
}
}
}
}
}