-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLang.cs
132 lines (118 loc) · 3.96 KB
/
Lang.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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.IO;
using System.Threading;
using System.Diagnostics;
using System.ComponentModel;
using System.Net;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using System.Collections;
using System.Runtime.InteropServices;
namespace Configurator
{
public partial class Form1 : Form
{
/// <summary>
/// Чтение строки с файла языка
/// </summary>
/// <param name="t1">Имя контрола</param>
/// <param name="section">Секция</param>
/// <returns>Возвращает строку</returns>
public string read_string(string t1, string section)
{
string l = Properties.Settings.Default.lang;
string s = "asdas";
Utils.INI.GetPrivateProfileString(section, t1, "sss", s, 1000, Application.StartupPath +"\\"+ l + ".lang");
s = s.Replace("\n", "/n");
return s;
}
public void load_leng()
{
if (!File.Exists("test.lang"))
return;
//watch.Start();
List<string> lang = Utils.ReadData("test.lang");
foreach (string t in lang)
{
try
{
string[] temp1 = t.Split('=');
Control[] t1 = Controls.Find(temp1[0].Trim(), true);
string[] temp2 = temp1[1].Split('&');
if (temp2[0].Trim() != "...")
{
try
{
Label temp = t1[0] as Label;
temp.Text = temp2[0].Trim();
}
catch
{
}
try
{
CheckBox temp = t1[0] as CheckBox;
temp.Text = temp2[0].Trim();
}
catch
{
}
#region
try
{
TabPage temp = t1[0] as TabPage;
temp.Text = temp2[0].Trim();
}
catch
{
}
#endregion
#region
try
{
GroupBox temp = t1[0] as GroupBox;
temp.Text = temp2[0].Trim();
}
catch
{
}
#endregion
#region
try
{
Button temp = t1[0] as Button;
temp.Text = temp2[0].Trim();
}
catch
{
}
#endregion
#region
try
{
LinkLabel temp = t1[0] as LinkLabel;
temp.Text = temp2[0].Trim();
}
catch
{
}
#endregion
}
if (temp2[1].Trim() != "...")
{
string tt = temp2[1].Trim().Replace("|n", "\r\n");
toolTip1.SetToolTip(t1[0], tt);
}
}
catch
{
}
}
}
}
}