-
Notifications
You must be signed in to change notification settings - Fork 0
/
StringResource.cs
71 lines (60 loc) · 1.69 KB
/
StringResource.cs
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
using DKCommunicationNET. Language;
namespace DKCommunicationNET;
/// <summary>
/// DKCommunication的字符串资源及多语言管理中心
/// </summary>
internal class StringResources
{
#region Constractor
static StringResources ( )
{
if ( System. Globalization. CultureInfo. CurrentCulture. ToString ( ). StartsWith ( "zh" ) )
{
SetLanguageChinese ( );
}
else
{
SeteLanguageEnglish ( );
}
}
#endregion
/// <summary>
/// 获取或设置系统的语言选项 ->
/// Gets or sets the language options for the system
/// </summary>
public static Chinese Language = new ( );
/// <summary>
/// 将语言设置为中文 ->
/// Set the language to Chinese
/// </summary>
public static void SetLanguageChinese ( )
{
Language = new Chinese ( );
}
/// <summary>
/// 将语言设置为英文 ->
/// Set the language to English
/// </summary>
public static void SeteLanguageEnglish ( )
{
Language = new English ( );
}
/// <summary>
/// 获取当前源码行数
/// </summary>
/// <returns></returns>
public static int GetLineNum ( )
{
System. Diagnostics. StackTrace st = new System. Diagnostics. StackTrace ( 1 , true );
return st. GetFrame ( 0 ). GetFileLineNumber ( );
}
/// <summary>
/// 获取当前源码的源文件名
/// </summary>
/// <returns></returns>
public static string GetCurSourceFileName ( )
{
System. Diagnostics. StackTrace st = new System. Diagnostics. StackTrace ( 1 , true );
return st. GetFrame ( 0 ). GetFileName ( );
}
}