blob: 1250a2ebe8d06c41bdadd8e811f418862926849e (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
using Agger.Registro;
using Gestor.Common.Helpers;
using System;
using System.Runtime.CompilerServices;
namespace Gestor.Application.Helpers
{
public class ApplicationHelper
{
private static string _numeroSerial;
private const string ChaveSerial = "NS";
public static bool Beta
{
get;
set;
}
public static DateTime ChecagemVersao
{
get;
set;
}
public static bool Conectado
{
get;
set;
}
public static long IdFornecedor
{
get;
set;
}
public static string NumeroSerial
{
get
{
return ApplicationHelper._numeroSerial ?? ApplicationHelper.GetSerialNumber();
}
set
{
ApplicationHelper._numeroSerial = value;
}
}
public static string Subkey
{
get;
set;
}
public static Version Versao
{
get;
set;
}
static ApplicationHelper()
{
ApplicationHelper.Conectado = true;
ApplicationHelper.Beta = false;
ApplicationHelper.ChecagemVersao = Funcoes.GetNetworkTime();
}
public ApplicationHelper()
{
}
internal static string GetSerialNumber()
{
string numeroSerial;
string str;
try
{
string str1 = (new RegistryHelper(ApplicationHelper.Subkey)).Read("NS", true);
if (string.IsNullOrEmpty(str1))
{
str = null;
}
else
{
str = EncryptionHelper.Decrypt(str1);
}
ApplicationHelper.NumeroSerial = str;
numeroSerial = ApplicationHelper.NumeroSerial;
}
catch (Exception exception)
{
numeroSerial = null;
}
return numeroSerial;
}
}
}
|