hytos / ID2.Manager / ID2.Manager.Common / Globals.cs @ 00d11333
이력 | 보기 | 이력해설 | 다운로드 (1.81 KB)
1 | 35d01ef5 | yoush97 | 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 | c52f8bbe | yoush97 | using System.Text.RegularExpressions; |
9 | 35d01ef5 | yoush97 | |
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 | 296ffcbd | yoush97 | return "Samsung IDUS"; |
34 | 35d01ef5 | yoush97 | } |
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 | c52f8bbe | yoush97 | public static string Base64Encoding(string EncodingText, Encoding oEncoding = null) |
47 | 35d01ef5 | yoush97 | { |
48 | if (oEncoding == null) |
||
49 | c52f8bbe | yoush97 | oEncoding = Encoding.UTF8; |
50 | 35d01ef5 | yoush97 | |
51 | byte[] arr = oEncoding.GetBytes(EncodingText); |
||
52 | return System.Convert.ToBase64String(arr); |
||
53 | } |
||
54 | |||
55 | c52f8bbe | yoush97 | public static byte[] Base64Decoding(string DecodingText, Encoding oEncoding = null) |
56 | 35d01ef5 | yoush97 | { |
57 | if (oEncoding == null) |
||
58 | c52f8bbe | yoush97 | oEncoding = Encoding.UTF8; |
59 | 35d01ef5 | yoush97 | |
60 | byte[] arr = System.Convert.FromBase64String(DecodingText); |
||
61 | return arr; |
||
62 | } |
||
63 | c52f8bbe | yoush97 | |
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 | 35d01ef5 | yoush97 | } |
69 | } |