Skip to content

Commit d5bbf8a

Browse files
committed
修改名称
1 parent b850022 commit d5bbf8a

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99

1010
namespace TimeControl
1111
{
12-
public class ListController
12+
public class AppController
1313
{
14-
private FileStream fileStream = new(TimeControlFile.tcTimeFileLocation,
14+
private FileStream fileStream = new(TimeControlFile.TimeFileLocation,
1515
FileMode.OpenOrCreate,
1616
FileAccess.ReadWrite, FileShare.None);
1717
private StreamWriter streamWriter;
1818
private ListBox listBox;
1919
private List<App> apps;
2020
private Timer timer;
2121

22-
public ListController(ListBox listBox, Timer timer)
22+
public AppController(ListBox listBox, Timer timer)
2323
{
2424
streamWriter = new(fileStream);
2525
this.listBox = listBox;

TimeControl/ControlPanel.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TimeControl/ControlPanel.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ public partial class ControlPanel : Form
1919
private bool hide = false;//指示启动后是否需要隐藏
2020
private bool isClosable = false;//指示当前是否可以关闭
2121
private int unlockPasswordHash = 0;//密码哈希值,用作比对
22-
private ListController controller;//列表、计时控制器
22+
private AppController controller;//列表、计时控制器
2323
public ControlPanel(bool hide)
2424
{
2525
InitializeComponent();
2626
this.hide = hide;
27-
if (File.Exists(TimeControlFile.tcPassLocation))//加载密码哈希值
27+
if (File.Exists(TimeControlFile.PassLocation))//加载密码哈希值
2828
{
29-
unlockPasswordHash = Convert.ToInt32(File.ReadAllText(TimeControlFile.tcPassLocation));
29+
unlockPasswordHash = Convert.ToInt32(File.ReadAllText(TimeControlFile.PassLocation));
3030
PasswordSet();
3131
}
3232
controller = new(usageBox, processMonitorTimer);
@@ -140,8 +140,8 @@ private void ControlPanel_Shown(object sender, EventArgs e)//启动隐藏参数
140140
private void UnloackPasswordSetButton_Click(object sender, EventArgs e)//保存密码
141141
{
142142
unlockPasswordHash = unlockPasswordBox.Text.GetHashCode();//保存哈希值
143+
File.WriteAllText(TimeControlFile.PassLocation, unlockPasswordHash.ToString());//保存哈希值到文件
143144
PasswordSet();
144-
File.WriteAllText(TimeControlFile.tcPassLocation, unlockPasswordHash.ToString());//保存哈希值到文件
145145
}
146146
private void PasswordSet()//密码设置后调用
147147
{
@@ -150,7 +150,7 @@ private void PasswordSet()//密码设置后调用
150150
unloackPasswordSetButton.Enabled = false;
151151
}
152152

153-
private void clearButton_Click(object sender, EventArgs e)//移除所有的已添加窗口
153+
private void ClearButton_Click(object sender, EventArgs e)//移除所有的已添加窗口
154154
{
155155
if (PasswordCheck())
156156
{

TimeControl/LimitWarningWindow.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TimeControl/LimitWarningWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public LimitWarningWindow(LimitedApp warningApp)
2020
this.warningApp = warningApp;
2121
}
2222

23-
private void closeButton_Click(object sender, EventArgs e)
23+
private void CloseButton_Click(object sender, EventArgs e)
2424
{
2525
warningApp.Ban();//禁用掉app
2626
Close();

TimeControl/PasswordInput.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ private void OkButton_Click(object sender, EventArgs e)
2525
{
2626
if (passwordTextBox.Text.GetHashCode()==passwordHash)
2727
{
28-
File.Delete(TimeControlFile.tcPassLocation);
28+
File.Delete(TimeControlFile.PassLocation);
2929
DialogResult = DialogResult.OK;
3030
Close();
3131
}

TimeControl/TimeControlFile.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ namespace TimeControl
88
{
99
internal class TimeControlFile
1010
{
11-
public static readonly string tcPassLocation = Environment.GetFolderPath
11+
public static readonly string PassLocation = Environment.GetFolderPath
1212
(Environment.SpecialFolder.ApplicationData) + "\\TCPass.txt";//获取密码位置
13-
public static readonly string tcTimeFileLocation = Environment.GetFolderPath
13+
public static readonly string TimeFileLocation = Environment.GetFolderPath
1414
(Environment.SpecialFolder.ApplicationData) + "\\TCTimeData.txt";
1515
}
1616
}

TimeControl/TimeInput.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,29 @@ namespace TimeControl
1212
{
1313
public partial class TimeInput : Form
1414
{
15-
private ListController listController;
15+
private AppController appController;
1616
private readonly string appName;
1717
/// <summary>
1818
/// 创建一个新的输入窗口,并添加进程
1919
/// </summary>
20-
/// <param name="listController">进程列表控制器,用于添加进程</param>
20+
/// <param name="appController">进程列表控制器,用于添加进程</param>
2121
/// <param name="appName">需要添加进程的名称</param>
22-
public TimeInput(ListController listController, string appName)
22+
public TimeInput(AppController appController, string appName)
2323
{
2424
InitializeComponent();
25-
this.listController = listController;
25+
this.appController = appController;
2626
this.appName = appName;
2727
}
2828

2929
private void OkButton_Click(object sender, EventArgs e)
3030
{
3131
if (timeBox.Value == 0)
3232
{
33-
listController.AddByName(appName);
33+
appController.AddByName(appName);
3434
}
3535
else
3636
{
37-
listController.AddByName(appName, Convert.ToInt32(timeBox.Value));
37+
appController.AddByName(appName, Convert.ToInt32(timeBox.Value));
3838
}
3939
Close();
4040
}

0 commit comments

Comments
 (0)