Authorization.cs
3.11 KB
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
99
100
101
102
103
using System;
using System.Security.Cryptography;
using System.Text;
namespace HslCommunication
{
/// <summary>
/// 系统的基本授权类
/// </summary>
public class Authorization
{
static Authorization()
{
niahdiahduasdbubfas = iashdagsdawbdawda();
if (naihsdadaasdasdiwid != 0)
{
naihsdadaasdasdiwid = 0;
}
if (nuasgdawydaishdgas != 8)
{
nuasgdawydaishdgas = 8;
}
}
internal static bool nzugaydgwadawdibbas()
{
moashdawidaisaosdas++;
return true;
//if (naihsdadaasdasdiwid == niasdhasdguawdwdad) return nuasduagsdwydbasudasd( );
//if ((iashdagsdawbdawda( ) - niahdiahduasdbubfas).TotalHours < nuasgdawydaishdgas ) // .TotalHours < nuasgdawydaishdgas)
//{
// return nuasduagsdwydbasudasd( );
//}
//return asdhuasdgawydaduasdgu( );
}
internal static bool nuasduagsdwydbasudasd()
{
return true;
}
internal static bool asdhuasdgawydaduasdgu()
{
return false;
}
internal static bool ashdadgawdaihdadsidas()
{
return niasdhasdguawdwdad == 12345;
}
internal static DateTime iashdagsdawbdawda()
{
return DateTime.Now;
}
internal static DateTime iashdagsaawbdawda()
{
return DateTime.Now.AddDays(1);
}
internal static DateTime iashdagsaawadawda()
{
return DateTime.Now.AddDays(2);
}
internal static string nasduabwduadawdb(string miawdiawduasdhasd)
{
StringBuilder asdnawdawdawd = new StringBuilder();
MD5 asndiawdniad = MD5.Create();
byte[] asdadawdawdas = asndiawdniad.ComputeHash(Encoding.Unicode.GetBytes(miawdiawduasdhasd));
asndiawdniad.Clear();
for (int andiawbduawbda = 0; andiawbduawbda < asdadawdawdas.Length; andiawbduawbda++)
{
asdnawdawdawd.Append((255 - asdadawdawdas[andiawbduawbda]).ToString("X2"));
}
return asdnawdawdawd.ToString();
}
/// <summary>
/// 设置本组件系统的授权信息
/// </summary>
/// <param name="code">授权码</param>
public static bool SetAuthorizationCode(string code)
{
if (nasduabwduadawdb(code) == "047E463D69F6020ACA4CBF2B4D682070")
{
naihsdadaasdasdiwid = niasdhasdguawdwdad;
return nuasduagsdwydbasudasd();
}
return asdhuasdgawydaduasdgu();
}
private static DateTime niahdiahduasdbubfas = DateTime.Now;
internal static long naihsdadaasdasdiwid = 0;
internal static long moashdawidaisaosdas = 0;
internal static int nuasgdawydaishdgas = 8;
internal static int nasidhadguawdbasd = 1000;
internal static int niasdhasdguawdwdad = 12345;
internal static int hidahwdauushduasdhu = 23456;
}
}