using System;
using System.IO;
using System.Linq;
using ZionFoundation.Components;
using ZionVault.Binder.OCR;
using ZionVault.Binder.Output;
using ZionVault.Binder.Verified;

namespace ZionRobot.Models.Items
{
	// Token: 0x02000031 RID: 49
	public class File : ZionFoundation.Components.File, IDisposable
	{
		// Token: 0x1700008D RID: 141
		// (get) Token: 0x06000172 RID: 370 RVA: 0x000088AC File Offset: 0x00006AAC
		public string OCR
		{
			get
			{
				return string.Format("{0}\\{1}.ocr", base.Directory, base.Name);
			}
		}

		// Token: 0x1700008E RID: 142
		// (get) Token: 0x06000173 RID: 371 RVA: 0x000088C4 File Offset: 0x00006AC4
		public string META
		{
			get
			{
				return string.Format("{0}\\{1}.ztd", base.Directory, base.Name);
			}
		}

		// Token: 0x1700008F RID: 143
		// (get) Token: 0x06000174 RID: 372 RVA: 0x000088DC File Offset: 0x00006ADC
		public string VERIFY
		{
			get
			{
				return string.Format("{0}\\{1}.vrf", base.Directory, base.Name);
			}
		}

		// Token: 0x06000175 RID: 373 RVA: 0x000088F4 File Offset: 0x00006AF4
		public File(string path) : base(path)
		{
			bool flag = System.IO.File.Exists(this.META) && (this.METAObject.Status == "INTEGRATED" || this.METAObject.Status == "GROUPED");
			if (flag)
			{
				base.Status = "INTEGRATED";
			}
			else
			{
				bool flag2 = System.IO.File.Exists(this.META);
				if (flag2)
				{
					base.Status = "INTEGRATION";
				}
				else
				{
					base.Status = "EXTRACTION";
				}
			}
			this.Disposed = false;
		}

		// Token: 0x06000176 RID: 374 RVA: 0x0000898B File Offset: 0x00006B8B
		public new void Move(string folder)
		{
			base.Move(folder);
			System.IO.File.Move(this.META, System.IO.Path.Combine(folder, base.Name + ".ztd"));
		}

		// Token: 0x06000177 RID: 375 RVA: 0x000089B8 File Offset: 0x00006BB8
		public void Dispose()
		{
			bool flag = this.OCRObject != null;
			if (flag)
			{
				this.OCRObject.Dispose();
			}
			bool flag2 = this.METAObject != null;
			if (flag2)
			{
				this.METAObject.Dispose();
			}
			bool flag3 = this.VERIFYObject != null;
			if (flag3)
			{
				this.VERIFYObject.Dispose();
			}
			GC.SuppressFinalize(this);
			GC.Collect();
			GC.WaitForPendingFinalizers();
			this.Disposed = true;
		}

		// Token: 0x17000090 RID: 144
		// (get) Token: 0x06000178 RID: 376 RVA: 0x00008A2C File Offset: 0x00006C2C
		public ZionVault.Binder.OCR.Document OCRObject
		{
			get
			{
				bool flag = System.IO.File.Exists(this.OCR);
				ZionVault.Binder.OCR.Document result;
				if (flag)
				{
					bool flag2 = this.ocrObject != null;
					if (flag2)
					{
						result = this.ocrObject;
					}
					else
					{
						this.ocrObject = new ZionVault.Binder.OCR.Document(this.OCR, false);
						result = this.ocrObject;
					}
				}
				else
				{
					result = null;
				}
				return result;
			}
		}

		// Token: 0x17000091 RID: 145
		// (get) Token: 0x06000179 RID: 377 RVA: 0x00008A80 File Offset: 0x00006C80
		public ZionVault.Binder.Output.Document METAObject
		{
			get
			{
				bool flag = System.IO.File.Exists(this.META);
				ZionVault.Binder.Output.Document result;
				if (flag)
				{
					bool flag2 = this.metaObject != null;
					if (flag2)
					{
						result = this.metaObject;
					}
					else
					{
						this.metaObject = new ZionVault.Binder.Output.Document(this.META, false);
						result = this.metaObject;
					}
				}
				else
				{
					result = null;
				}
				return result;
			}
		}

		// Token: 0x17000092 RID: 146
		// (get) Token: 0x0600017A RID: 378 RVA: 0x00008AD4 File Offset: 0x00006CD4
		public ZionVault.Binder.Verified.Document VERIFYObject
		{
			get
			{
				bool flag = System.IO.File.Exists(this.VERIFY);
				ZionVault.Binder.Verified.Document result;
				if (flag)
				{
					bool flag2 = this.verifyObject != null;
					if (flag2)
					{
						result = this.verifyObject;
					}
					else
					{
						this.verifyObject = new ZionVault.Binder.Verified.Document(this.VERIFY, false);
						result = this.verifyObject;
					}
				}
				else
				{
					result = null;
				}
				return result;
			}
		}

		// Token: 0x17000093 RID: 147
		// (get) Token: 0x0600017B RID: 379 RVA: 0x00008B28 File Offset: 0x00006D28
		public string LawsuitNumber
		{
			get
			{
				return this.GetField("NrProcesso").Value;
			}
		}

		// Token: 0x17000094 RID: 148
		// (get) Token: 0x0600017C RID: 380 RVA: 0x00008B4C File Offset: 0x00006D4C
		public string PublicationContent
		{
			get
			{
				return this.GetField("ConteudoCompleto").Value;
			}
		}

		// Token: 0x0600017D RID: 381 RVA: 0x00008B70 File Offset: 0x00006D70
		private ZionVault.Binder.Output.Field GetField(string fieldName)
		{
			return (from field in this.METAObject.AllFields
			where field.Name == fieldName
			select field).FirstOrDefault<ZionVault.Binder.Output.Field>();
		}

		// Token: 0x0400008D RID: 141
		private ZionVault.Binder.OCR.Document ocrObject;

		// Token: 0x0400008E RID: 142
		private ZionVault.Binder.Output.Document metaObject;

		// Token: 0x0400008F RID: 143
		private ZionVault.Binder.Verified.Document verifyObject;

		// Token: 0x04000090 RID: 144
		public bool Disposed;
	}
}
