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: 0x02000029 RID: 41
	public class File : ZionFoundation.Components.File, IDisposable
	{
		// Token: 0x1700006E RID: 110
		// (get) Token: 0x0600012C RID: 300 RVA: 0x0000763C File Offset: 0x0000583C
		public string OCR
		{
			get
			{
				return string.Format("{0}\\{1}.ocr", base.Directory, base.Name);
			}
		}

		// Token: 0x1700006F RID: 111
		// (get) Token: 0x0600012D RID: 301 RVA: 0x00007654 File Offset: 0x00005854
		public string META
		{
			get
			{
				return string.Format("{0}\\{1}.ztd", base.Directory, base.Name);
			}
		}

		// Token: 0x17000070 RID: 112
		// (get) Token: 0x0600012E RID: 302 RVA: 0x0000766C File Offset: 0x0000586C
		public string VERIFY
		{
			get
			{
				return string.Format("{0}\\{1}.vrf", base.Directory, base.Name);
			}
		}

		// Token: 0x0600012F RID: 303 RVA: 0x00007684 File Offset: 0x00005884
		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: 0x06000130 RID: 304 RVA: 0x0000771B File Offset: 0x0000591B
		public new void Move(string folder)
		{
			base.Move(folder);
			System.IO.File.Move(this.META, System.IO.Path.Combine(folder, base.Name + ".ztd"));
		}

		// Token: 0x06000131 RID: 305 RVA: 0x00007748 File Offset: 0x00005948
		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: 0x17000071 RID: 113
		// (get) Token: 0x06000132 RID: 306 RVA: 0x000077BC File Offset: 0x000059BC
		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: 0x17000072 RID: 114
		// (get) Token: 0x06000133 RID: 307 RVA: 0x00007810 File Offset: 0x00005A10
		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: 0x17000073 RID: 115
		// (get) Token: 0x06000134 RID: 308 RVA: 0x00007864 File Offset: 0x00005A64
		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: 0x17000074 RID: 116
		// (get) Token: 0x06000135 RID: 309 RVA: 0x000078B8 File Offset: 0x00005AB8
		public string LawsuitNumber
		{
			get
			{
				return this.GetField("NrProcesso").Value;
			}
		}

		// Token: 0x17000075 RID: 117
		// (get) Token: 0x06000136 RID: 310 RVA: 0x000078DC File Offset: 0x00005ADC
		public string PublicationContent
		{
			get
			{
				return this.GetField("ConteudoCompleto").Value;
			}
		}

		// Token: 0x06000137 RID: 311 RVA: 0x00007900 File Offset: 0x00005B00
		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: 0x04000079 RID: 121
		private ZionVault.Binder.OCR.Document ocrObject;

		// Token: 0x0400007A RID: 122
		private ZionVault.Binder.Output.Document metaObject;

		// Token: 0x0400007B RID: 123
		private ZionVault.Binder.Verified.Document verifyObject;

		// Token: 0x0400007C RID: 124
		public bool Disposed;
	}
}
