summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Helpers/Instancia.cs
blob: b67323bdec853bf9cc3ee18bf3996eb65b259c11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.IO;
using Gestor.Common.Helpers;
using Gestor.Infrastructure.UnitOfWork.Generic;
using Gestor.Infrastructure.UnitOfWork.Logic;

namespace Gestor.Application.Helpers;

public class Instancia
{
	public static string Conexao;

	public static App App { get; set; }

	public static UnitOfWork Commited => UnitOfWork();

	public static UnitOfWork Read => UnitOfWork(withTransaction: false);

	private static UnitOfWork UnitOfWork(bool withTransaction = true)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		DataBaseParameters.NovoGestor = true;
		Conexao = Conexao ?? Connection.GetConnection();
		if (Conexao == null)
		{
			return App.ConnectionRetry().Result;
		}
		UnitOfWork val = new UnitOfWork(Conexao, withTransaction);
		if (!((GenericUnitOfWork)val).HasSession)
		{
			return App.ConnectionRetry().Result;
		}
		return val;
	}

	public static void ExcluirCfg()
	{
		File.Delete("Data_" + Connection.Catalog + ".cfg");
		File.Delete("File_" + Connection.Catalog + ".cfg");
		File.Delete("Sign_" + Connection.Catalog + ".cfg");
	}

	public static void DeleteCfg()
	{
		string text = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data");
		string text2 = Connection.Catalog + ".cfg";
		if (File.Exists(text + text2))
		{
			File.Delete(text + text2);
		}
	}
}