hytos / ID2.Manager / ID2.Manager.Common / Globals.cs @ 296ffcbd
이력 | 보기 | 이력해설 | 다운로드 (1.81 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
using System.Threading.Tasks; |
6 |
|
7 |
using System.Security.Cryptography; |
8 |
using System.Text.RegularExpressions; |
9 |
|
10 |
namespace ID2.Manager.Common |
11 |
{ |
12 |
public class Globals |
13 |
{ |
14 |
private static Globals m_Globals; |
15 |
|
16 |
public static Globals GetInstance |
17 |
{ |
18 |
get |
19 |
{ |
20 |
if (m_Globals == null) |
21 |
{ |
22 |
m_Globals = new Globals(); |
23 |
} |
24 |
|
25 |
return m_Globals; |
26 |
} |
27 |
} |
28 |
|
29 |
public static string Name |
30 |
{ |
31 |
get |
32 |
{ |
33 |
return "Samsung IDUS"; |
34 |
} |
35 |
} |
36 |
|
37 |
public static string EncryptionSHA256(string Data) |
38 |
{ |
39 |
using (SHA256 sha = new SHA256Managed()) |
40 |
{ |
41 |
return Convert.ToBase64String(sha.ComputeHash(Encoding.UTF8.GetBytes(Data))); |
42 |
|
43 |
} |
44 |
} |
45 |
|
46 |
public static string Base64Encoding(string EncodingText, Encoding oEncoding = null) |
47 |
{ |
48 |
if (oEncoding == null) |
49 |
oEncoding = Encoding.UTF8; |
50 |
|
51 |
byte[] arr = oEncoding.GetBytes(EncodingText); |
52 |
return System.Convert.ToBase64String(arr); |
53 |
} |
54 |
|
55 |
public static byte[] Base64Decoding(string DecodingText, Encoding oEncoding = null) |
56 |
{ |
57 |
if (oEncoding == null) |
58 |
oEncoding = Encoding.UTF8; |
59 |
|
60 |
byte[] arr = System.Convert.FromBase64String(DecodingText); |
61 |
return arr; |
62 |
} |
63 |
|
64 |
public static bool IsMatchEmailFormat(string EmailText) |
65 |
{ |
66 |
return Regex.IsMatch(EmailText, @"[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?"); |
67 |
} |
68 |
} |
69 |
} |