From b8500223d5132d8233591c79c8451f7ec996a1d9 Mon Sep 17 00:00:00 2001 From: Sam Hou Date: Sun, 13 Mar 2022 12:57:41 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=B9=B6=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TimeControl/App.cs | 14 ++-- TimeControl/ControlPanel.Designer.cs | 31 ++++++--- TimeControl/ControlPanel.cs | 41 +++++++---- TimeControl/LimitedApp.cs | 13 ++-- TimeControl/ListController.cs | 68 ++++++++++++++++--- TimeControl/PasswordInput.Designer.cs | 2 +- TimeControl/PasswordInput.cs | 4 +- .../{PasswordFile.cs => TimeControlFile.cs} | 4 +- TimeControl/TimeInput.Designer.cs | 2 +- TimeControl/TimeInput.cs | 15 ++-- 10 files changed, 145 insertions(+), 49 deletions(-) rename TimeControl/{PasswordFile.cs => TimeControlFile.cs} (62%) diff --git a/TimeControl/App.cs b/TimeControl/App.cs index 78d21be..9c3e565 100644 --- a/TimeControl/App.cs +++ b/TimeControl/App.cs @@ -3,13 +3,13 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using System.IO; namespace TimeControl { public class App { - private string name; - private string location; + private readonly string name; public string Name { get { return name; }} internal int time; /// @@ -20,18 +20,20 @@ public override string ToString() { return Name + " 已使用 " + time+" 秒!"; } - public App(string name, string location) + public App(string name,int time) { + this.time = time; this.name = name; - this.location = location; - Reset(); } /// /// 运行一次(一秒) /// - public virtual void Run() + public virtual void Run(StreamWriter streamWriter) { time++; + streamWriter.WriteLine(Name); + streamWriter.WriteLine(time); + streamWriter.WriteLine("//"); } /// /// 重设时间 diff --git a/TimeControl/ControlPanel.Designer.cs b/TimeControl/ControlPanel.Designer.cs index a9ee2b8..2c705ff 100644 --- a/TimeControl/ControlPanel.Designer.cs +++ b/TimeControl/ControlPanel.Designer.cs @@ -36,6 +36,7 @@ private void InitializeComponent() this.controlTab = new System.Windows.Forms.TabControl(); this.startNow = new System.Windows.Forms.TabPage(); this.processMonitor = new System.Windows.Forms.TabPage(); + this.autoRefreshBox = new System.Windows.Forms.CheckBox(); this.refreshButton = new System.Windows.Forms.Button(); this.processNameBox = new System.Windows.Forms.TextBox(); this.removeButton = new System.Windows.Forms.Button(); @@ -53,7 +54,7 @@ private void InitializeComponent() this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.ExitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.processMonitorTimer = new System.Windows.Forms.Timer(this.components); - this.autoRefreshBox = new System.Windows.Forms.CheckBox(); + this.clearButton = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.timeBox)).BeginInit(); this.controlTab.SuspendLayout(); this.startNow.SuspendLayout(); @@ -121,6 +122,7 @@ private void InitializeComponent() // // processMonitor // + this.processMonitor.Controls.Add(this.clearButton); this.processMonitor.Controls.Add(this.autoRefreshBox); this.processMonitor.Controls.Add(this.refreshButton); this.processMonitor.Controls.Add(this.processNameBox); @@ -135,6 +137,16 @@ private void InitializeComponent() this.processMonitor.Text = "进程计时"; this.processMonitor.UseVisualStyleBackColor = true; // + // autoRefreshBox + // + this.autoRefreshBox.AutoSize = true; + this.autoRefreshBox.Location = new System.Drawing.Point(557, 78); + this.autoRefreshBox.Name = "autoRefreshBox"; + this.autoRefreshBox.Size = new System.Drawing.Size(91, 24); + this.autoRefreshBox.TabIndex = 6; + this.autoRefreshBox.Text = "自动刷新"; + this.autoRefreshBox.UseVisualStyleBackColor = true; + // // refreshButton // this.refreshButton.Location = new System.Drawing.Point(528, 156); @@ -292,15 +304,15 @@ private void InitializeComponent() this.processMonitorTimer.Interval = 1000; this.processMonitorTimer.Tick += new System.EventHandler(this.ProcessMonitorTimer_Tick); // - // autoRefreshBox + // clearButton // - this.autoRefreshBox.AutoSize = true; - this.autoRefreshBox.Location = new System.Drawing.Point(557, 78); - this.autoRefreshBox.Name = "autoRefreshBox"; - this.autoRefreshBox.Size = new System.Drawing.Size(91, 24); - this.autoRefreshBox.TabIndex = 6; - this.autoRefreshBox.Text = "自动刷新"; - this.autoRefreshBox.UseVisualStyleBackColor = true; + this.clearButton.Location = new System.Drawing.Point(528, 318); + this.clearButton.Name = "clearButton"; + this.clearButton.Size = new System.Drawing.Size(143, 45); + this.clearButton.TabIndex = 7; + this.clearButton.Text = "删除所有监控"; + this.clearButton.UseVisualStyleBackColor = true; + this.clearButton.Click += new System.EventHandler(this.clearButton_Click); // // ControlPanel // @@ -355,5 +367,6 @@ private void InitializeComponent() private System.Windows.Forms.TextBox processNameBox; private System.Windows.Forms.Button refreshButton; private System.Windows.Forms.CheckBox autoRefreshBox; + private System.Windows.Forms.Button clearButton; } } \ No newline at end of file diff --git a/TimeControl/ControlPanel.cs b/TimeControl/ControlPanel.cs index 3ac9d65..678b417 100644 --- a/TimeControl/ControlPanel.cs +++ b/TimeControl/ControlPanel.cs @@ -24,9 +24,9 @@ public ControlPanel(bool hide) { InitializeComponent(); this.hide = hide; - if (File.Exists(PasswordFile.tcPassLocation))//加载密码哈希值 + if (File.Exists(TimeControlFile.tcPassLocation))//加载密码哈希值 { - unlockPasswordHash = Convert.ToInt32(File.ReadAllText(PasswordFile.tcPassLocation)); + unlockPasswordHash = Convert.ToInt32(File.ReadAllText(TimeControlFile.tcPassLocation)); PasswordSet(); } controller = new(usageBox, processMonitorTimer); @@ -86,28 +86,24 @@ private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs Process.Start("explorer.exe", "https://icons8.com/icon/19614/icon"); } - private void AppAddButton_Click(object sender, EventArgs e)//添加打开的窗口 + private void AppAddButton_Click(object sender, EventArgs e)//添加进程 { if (processNameBox.Text.ToLower() == "timecontrol" || processNameBox.Text.ToLower() == "timecontrolconsole") { return; } - TimeInput timeInput = new(controller, processNameBox.Text); + TimeInput timeInput = new(controller, processNameBox.Text);//打开进程限时控制窗口 timeInput.ShowDialog(); } - private void RemoveButton_Click(object sender, EventArgs e)//移除所有的已添加窗口 + private void RemoveButton_Click(object sender, EventArgs e)//移除窗口 { //检测密码设置 - if (unlockPasswordHash != 0) + if (PasswordCheck()) { - PasswordInput passwordInput = new(unlockPasswordHash); - if (passwordInput.ShowDialog() == DialogResult.OK) - controller.Remove(); - } - else controller.Remove(); + } } private void RefreshButton_Click(object sender, EventArgs e)//重新获取所有软件所用时间 @@ -145,7 +141,7 @@ private void UnloackPasswordSetButton_Click(object sender, EventArgs e)//保存 { unlockPasswordHash = unlockPasswordBox.Text.GetHashCode();//保存哈希值 PasswordSet(); - File.WriteAllText(PasswordFile.tcPassLocation, unlockPasswordHash.ToString());//保存哈希值到文件 + File.WriteAllText(TimeControlFile.tcPassLocation, unlockPasswordHash.ToString());//保存哈希值到文件 } private void PasswordSet()//密码设置后调用 { @@ -153,5 +149,26 @@ private void PasswordSet()//密码设置后调用 unlockPasswordBox.Enabled = false; unloackPasswordSetButton.Enabled = false; } + + private void clearButton_Click(object sender, EventArgs e)//移除所有的已添加窗口 + { + if (PasswordCheck()) + { + controller.RemoveAll(); + } + } + private bool PasswordCheck() + { + if (unlockPasswordHash != 0) + { + PasswordInput passwordInput = new(unlockPasswordHash); + if (passwordInput.ShowDialog() == DialogResult.OK) + return true; + else + return false; + } + else + return true; + } } } diff --git a/TimeControl/LimitedApp.cs b/TimeControl/LimitedApp.cs index dcb72e3..7c25db7 100644 --- a/TimeControl/LimitedApp.cs +++ b/TimeControl/LimitedApp.cs @@ -5,22 +5,23 @@ using System.Threading.Tasks; using System.Diagnostics; using System.Windows.Forms; +using System.IO; namespace TimeControl { public class LimitedApp : App { - private int timeLimit; - public LimitedApp(string name, string location,int timeLimit) : base(name, location) + private readonly int timeLimit; + public LimitedApp(string name,int time,int timeLimit) : base(name,time) { this.timeLimit = timeLimit; } /// /// 运行一次(一秒),并根据情况显示警告或关闭进程 /// - public override void Run() + public override void Run(StreamWriter streamWriter) { - base.Run(); + time++; if (time == timeLimit - 30) { LimitWarningWindow warningWindow = new(this); @@ -30,6 +31,10 @@ public override void Run() { Ban(); } + streamWriter.WriteLine(Name); + streamWriter.WriteLine(time); + streamWriter.WriteLine(timeLimit); + streamWriter.WriteLine("//"); } /// /// 返回时间受限进程的简要概述 diff --git a/TimeControl/ListController.cs b/TimeControl/ListController.cs index a8fea5a..4b3b0c0 100644 --- a/TimeControl/ListController.cs +++ b/TimeControl/ListController.cs @@ -5,20 +5,61 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using System.IO; namespace TimeControl { - public class ListController + public class ListController { + private FileStream fileStream = new(TimeControlFile.tcTimeFileLocation, + FileMode.OpenOrCreate, + FileAccess.ReadWrite, FileShare.None); + private StreamWriter streamWriter; private ListBox listBox; private List apps; private Timer timer; - public ListController(ListBox listBox,Timer timer) + public ListController(ListBox listBox, Timer timer) { + streamWriter = new(fileStream); this.listBox = listBox; apps = new List(); this.timer = timer; + StreamReader streamReader = new(fileStream); + int lineNumber = 1; + string name = null; + int time = 0; + int timeLimit = 0; + while (!streamReader.EndOfStream)//读取文件,添加进程 + { + string line = streamReader.ReadLine(); + if (line == "//") + { + if (timeLimit == 0) + apps.Add(new App(name, time)); + else + apps.Add(new LimitedApp(name, time, timeLimit)); + + lineNumber = 1; + name = null; + time = 0; + timeLimit = 0; + + continue; + } + else + { + if (lineNumber == 1) + name = line; + else if (lineNumber == 2) + time = Convert.ToInt32(line); + else if (lineNumber == 3) + timeLimit = Convert.ToInt32(line); + + lineNumber++; + } + } + Refresh(); } /// @@ -46,7 +87,7 @@ public void AddByName(string name) { foreach (Process process in processes) { - apps.Add(new App(process.ProcessName, process.MainModule.FileName)); + apps.Add(new App(process.ProcessName, 0)); } } catch (Exception ex) @@ -60,7 +101,7 @@ public void AddByName(string name) /// /// 进程名称 /// 限制时长(秒) - public void AddByName(string name,int limitTime) + public void AddByName(string name, int limitTime) { timer.Stop(); Process[] processes = Process.GetProcessesByName(name); @@ -68,7 +109,7 @@ public void AddByName(string name,int limitTime) { foreach (Process process in processes) { - apps.Add(new LimitedApp(process.ProcessName, process.MainModule.FileName,limitTime)); + apps.Add(new LimitedApp(process.ProcessName, 0, limitTime)); } } catch (Exception ex) @@ -82,19 +123,21 @@ public void AddByName(string name,int limitTime) /// public void Run() { + fileStream.SetLength(0); foreach (App app in apps)//计算进程时间 { if (Process.GetProcessesByName(app.Name).Length != 0) { if (app is LimitedApp) { - LimitedApp limitedApp=app as LimitedApp; - limitedApp.Run(); + LimitedApp limitedApp = app as LimitedApp; + limitedApp.Run(streamWriter); } else - app.Run(); + app.Run(streamWriter); } } + streamWriter.Flush(); } /// /// 移除所列表所选的进程 @@ -106,5 +149,14 @@ public void Remove() apps.RemoveAt(listBox.SelectedIndex); Refresh(); } + /// + /// 删除所有监控 + /// + public void RemoveAll() + { + timer.Stop(); + apps.Clear(); + Refresh(); + } } } diff --git a/TimeControl/PasswordInput.Designer.cs b/TimeControl/PasswordInput.Designer.cs index ebc6285..40f4b99 100644 --- a/TimeControl/PasswordInput.Designer.cs +++ b/TimeControl/PasswordInput.Designer.cs @@ -48,7 +48,7 @@ private void InitializeComponent() this.okButton.TabIndex = 1; this.okButton.Text = "确认"; this.okButton.UseVisualStyleBackColor = true; - this.okButton.Click += new System.EventHandler(this.okButton_Click); + this.okButton.Click += new System.EventHandler(this.OkButton_Click); // // PasswordInput // diff --git a/TimeControl/PasswordInput.cs b/TimeControl/PasswordInput.cs index 6b68b77..c43ce94 100644 --- a/TimeControl/PasswordInput.cs +++ b/TimeControl/PasswordInput.cs @@ -21,11 +21,11 @@ public PasswordInput(int passwordHash) DialogResult = DialogResult.No; } - private void okButton_Click(object sender, EventArgs e) + private void OkButton_Click(object sender, EventArgs e) { if (passwordTextBox.Text.GetHashCode()==passwordHash) { - File.Delete(PasswordFile.tcPassLocation); + File.Delete(TimeControlFile.tcPassLocation); DialogResult = DialogResult.OK; Close(); } diff --git a/TimeControl/PasswordFile.cs b/TimeControl/TimeControlFile.cs similarity index 62% rename from TimeControl/PasswordFile.cs rename to TimeControl/TimeControlFile.cs index 3ab0fd1..bdd43dc 100644 --- a/TimeControl/PasswordFile.cs +++ b/TimeControl/TimeControlFile.cs @@ -6,9 +6,11 @@ namespace TimeControl { - internal class PasswordFile + internal class TimeControlFile { public static readonly string tcPassLocation = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData) + "\\TCPass.txt";//获取密码位置 + public static readonly string tcTimeFileLocation = Environment.GetFolderPath + (Environment.SpecialFolder.ApplicationData) + "\\TCTimeData.txt"; } } diff --git a/TimeControl/TimeInput.Designer.cs b/TimeControl/TimeInput.Designer.cs index b064ead..ac91dcf 100644 --- a/TimeControl/TimeInput.Designer.cs +++ b/TimeControl/TimeInput.Designer.cs @@ -51,7 +51,7 @@ private void InitializeComponent() this.okButton.TabIndex = 1; this.okButton.Text = "确定"; this.okButton.UseVisualStyleBackColor = true; - this.okButton.Click += new System.EventHandler(this.okButton_Click); + this.okButton.Click += new System.EventHandler(this.OkButton_Click); // // timeBox // diff --git a/TimeControl/TimeInput.cs b/TimeControl/TimeInput.cs index 1f208d5..86b4911 100644 --- a/TimeControl/TimeInput.cs +++ b/TimeControl/TimeInput.cs @@ -13,23 +13,28 @@ namespace TimeControl public partial class TimeInput : Form { private ListController listController; - private string appName; - public TimeInput(ListController listController,string appName) + private readonly string appName; + /// + /// 创建一个新的输入窗口,并添加进程 + /// + /// 进程列表控制器,用于添加进程 + /// 需要添加进程的名称 + public TimeInput(ListController listController, string appName) { InitializeComponent(); this.listController = listController; this.appName = appName; } - private void okButton_Click(object sender, EventArgs e) + private void OkButton_Click(object sender, EventArgs e) { - if (timeBox.Value==0) + if (timeBox.Value == 0) { listController.AddByName(appName); } else { - listController.AddByName(appName,Convert.ToInt32( timeBox.Value)); + listController.AddByName(appName, Convert.ToInt32(timeBox.Value)); } Close(); } From d5bbf8a6e2f437640ff02872990bcff52072d991 Mon Sep 17 00:00:00 2001 From: Sam Hou Date: Sun, 13 Mar 2022 17:51:20 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TimeControl/{ListController.cs => AppController.cs} | 6 +++--- TimeControl/ControlPanel.Designer.cs | 2 +- TimeControl/ControlPanel.cs | 10 +++++----- TimeControl/LimitWarningWindow.Designer.cs | 2 +- TimeControl/LimitWarningWindow.cs | 2 +- TimeControl/PasswordInput.cs | 2 +- TimeControl/TimeControlFile.cs | 4 ++-- TimeControl/TimeInput.cs | 12 ++++++------ 8 files changed, 20 insertions(+), 20 deletions(-) rename TimeControl/{ListController.cs => AppController.cs} (96%) diff --git a/TimeControl/ListController.cs b/TimeControl/AppController.cs similarity index 96% rename from TimeControl/ListController.cs rename to TimeControl/AppController.cs index 4b3b0c0..ff69198 100644 --- a/TimeControl/ListController.cs +++ b/TimeControl/AppController.cs @@ -9,9 +9,9 @@ namespace TimeControl { - public class ListController + public class AppController { - private FileStream fileStream = new(TimeControlFile.tcTimeFileLocation, + private FileStream fileStream = new(TimeControlFile.TimeFileLocation, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); private StreamWriter streamWriter; @@ -19,7 +19,7 @@ public class ListController private List apps; private Timer timer; - public ListController(ListBox listBox, Timer timer) + public AppController(ListBox listBox, Timer timer) { streamWriter = new(fileStream); this.listBox = listBox; diff --git a/TimeControl/ControlPanel.Designer.cs b/TimeControl/ControlPanel.Designer.cs index 2c705ff..48d7262 100644 --- a/TimeControl/ControlPanel.Designer.cs +++ b/TimeControl/ControlPanel.Designer.cs @@ -312,7 +312,7 @@ private void InitializeComponent() this.clearButton.TabIndex = 7; this.clearButton.Text = "删除所有监控"; this.clearButton.UseVisualStyleBackColor = true; - this.clearButton.Click += new System.EventHandler(this.clearButton_Click); + this.clearButton.Click += new System.EventHandler(this.ClearButton_Click); // // ControlPanel // diff --git a/TimeControl/ControlPanel.cs b/TimeControl/ControlPanel.cs index 678b417..0face94 100644 --- a/TimeControl/ControlPanel.cs +++ b/TimeControl/ControlPanel.cs @@ -19,14 +19,14 @@ public partial class ControlPanel : Form private bool hide = false;//指示启动后是否需要隐藏 private bool isClosable = false;//指示当前是否可以关闭 private int unlockPasswordHash = 0;//密码哈希值,用作比对 - private ListController controller;//列表、计时控制器 + private AppController controller;//列表、计时控制器 public ControlPanel(bool hide) { InitializeComponent(); this.hide = hide; - if (File.Exists(TimeControlFile.tcPassLocation))//加载密码哈希值 + if (File.Exists(TimeControlFile.PassLocation))//加载密码哈希值 { - unlockPasswordHash = Convert.ToInt32(File.ReadAllText(TimeControlFile.tcPassLocation)); + unlockPasswordHash = Convert.ToInt32(File.ReadAllText(TimeControlFile.PassLocation)); PasswordSet(); } controller = new(usageBox, processMonitorTimer); @@ -140,8 +140,8 @@ private void ControlPanel_Shown(object sender, EventArgs e)//启动隐藏参数 private void UnloackPasswordSetButton_Click(object sender, EventArgs e)//保存密码 { unlockPasswordHash = unlockPasswordBox.Text.GetHashCode();//保存哈希值 + File.WriteAllText(TimeControlFile.PassLocation, unlockPasswordHash.ToString());//保存哈希值到文件 PasswordSet(); - File.WriteAllText(TimeControlFile.tcPassLocation, unlockPasswordHash.ToString());//保存哈希值到文件 } private void PasswordSet()//密码设置后调用 { @@ -150,7 +150,7 @@ private void PasswordSet()//密码设置后调用 unloackPasswordSetButton.Enabled = false; } - private void clearButton_Click(object sender, EventArgs e)//移除所有的已添加窗口 + private void ClearButton_Click(object sender, EventArgs e)//移除所有的已添加窗口 { if (PasswordCheck()) { diff --git a/TimeControl/LimitWarningWindow.Designer.cs b/TimeControl/LimitWarningWindow.Designer.cs index 5c0be9f..a008976 100644 --- a/TimeControl/LimitWarningWindow.Designer.cs +++ b/TimeControl/LimitWarningWindow.Designer.cs @@ -49,7 +49,7 @@ private void InitializeComponent() this.closeButton.TabIndex = 1; this.closeButton.Text = "立即强制关闭(请确保已保存任何文件)"; this.closeButton.UseVisualStyleBackColor = true; - this.closeButton.Click += new System.EventHandler(this.closeButton_Click); + this.closeButton.Click += new System.EventHandler(this.CloseButton_Click); // // LimitWarningWindow // diff --git a/TimeControl/LimitWarningWindow.cs b/TimeControl/LimitWarningWindow.cs index f83a31d..3a0e1fc 100644 --- a/TimeControl/LimitWarningWindow.cs +++ b/TimeControl/LimitWarningWindow.cs @@ -20,7 +20,7 @@ public LimitWarningWindow(LimitedApp warningApp) this.warningApp = warningApp; } - private void closeButton_Click(object sender, EventArgs e) + private void CloseButton_Click(object sender, EventArgs e) { warningApp.Ban();//禁用掉app Close(); diff --git a/TimeControl/PasswordInput.cs b/TimeControl/PasswordInput.cs index c43ce94..79e31c2 100644 --- a/TimeControl/PasswordInput.cs +++ b/TimeControl/PasswordInput.cs @@ -25,7 +25,7 @@ private void OkButton_Click(object sender, EventArgs e) { if (passwordTextBox.Text.GetHashCode()==passwordHash) { - File.Delete(TimeControlFile.tcPassLocation); + File.Delete(TimeControlFile.PassLocation); DialogResult = DialogResult.OK; Close(); } diff --git a/TimeControl/TimeControlFile.cs b/TimeControl/TimeControlFile.cs index bdd43dc..37e6e9a 100644 --- a/TimeControl/TimeControlFile.cs +++ b/TimeControl/TimeControlFile.cs @@ -8,9 +8,9 @@ namespace TimeControl { internal class TimeControlFile { - public static readonly string tcPassLocation = Environment.GetFolderPath + public static readonly string PassLocation = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData) + "\\TCPass.txt";//获取密码位置 - public static readonly string tcTimeFileLocation = Environment.GetFolderPath + public static readonly string TimeFileLocation = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData) + "\\TCTimeData.txt"; } } diff --git a/TimeControl/TimeInput.cs b/TimeControl/TimeInput.cs index 86b4911..887c11b 100644 --- a/TimeControl/TimeInput.cs +++ b/TimeControl/TimeInput.cs @@ -12,17 +12,17 @@ namespace TimeControl { public partial class TimeInput : Form { - private ListController listController; + private AppController appController; private readonly string appName; /// /// 创建一个新的输入窗口,并添加进程 /// - /// 进程列表控制器,用于添加进程 + /// 进程列表控制器,用于添加进程 /// 需要添加进程的名称 - public TimeInput(ListController listController, string appName) + public TimeInput(AppController appController, string appName) { InitializeComponent(); - this.listController = listController; + this.appController = appController; this.appName = appName; } @@ -30,11 +30,11 @@ private void OkButton_Click(object sender, EventArgs e) { if (timeBox.Value == 0) { - listController.AddByName(appName); + appController.AddByName(appName); } else { - listController.AddByName(appName, Convert.ToInt32(timeBox.Value)); + appController.AddByName(appName, Convert.ToInt32(timeBox.Value)); } Close(); } From f180fa84ea0cc0989ae71b3502b23669a273c8ee Mon Sep 17 00:00:00 2001 From: Sam Hou Date: Sun, 13 Mar 2022 17:51:20 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=8F=8A=E5=AE=89=E8=A3=85=E7=A8=8B=E5=BA=8F=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TCSetup/TCSetup.vdproj | 42 +++++++++++++++---- .../{ListController.cs => AppController.cs} | 6 +-- TimeControl/ControlPanel.Designer.cs | 2 +- TimeControl/ControlPanel.cs | 10 ++--- TimeControl/LimitWarningWindow.Designer.cs | 2 +- TimeControl/LimitWarningWindow.cs | 2 +- TimeControl/PasswordInput.cs | 2 +- TimeControl/TimeControl.csproj | 2 +- TimeControl/TimeControlFile.cs | 4 +- TimeControl/TimeInput.cs | 12 +++--- 10 files changed, 55 insertions(+), 29 deletions(-) rename TimeControl/{ListController.cs => AppController.cs} (96%) diff --git a/TCSetup/TCSetup.vdproj b/TCSetup/TCSetup.vdproj index 91f4db3..bf67629 100644 --- a/TCSetup/TCSetup.vdproj +++ b/TCSetup/TCSetup.vdproj @@ -21,6 +21,12 @@ } "Entry" { + "MsmKey" = "8:_9BF8F60AD5F2474D82994CD2D95F44A1" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_B7C31D1C4E42443D89CA87F9596A43B7" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -127,6 +133,26 @@ } "File" { + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9BF8F60AD5F2474D82994CD2D95F44A1" + { + "SourcePath" = "8:..\\TimeControl\\icons8_sand_watch.ico" + "TargetName" = "8:icons8_sand_watch.ico" + "Tag" = "8:" + "Folder" = "8:_57FF55C0487B4507A7ADC64F8E5966A5" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } } "FileType" { @@ -183,15 +209,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:TimeControl" - "ProductCode" = "8:{BB3E5E5C-6F52-48B4-893C-57EB236F23D6}" - "PackageCode" = "8:{65B804AE-9561-4656-8793-2FB8B8BEBCDF}" + "ProductCode" = "8:{9EE926BC-8A8C-4684-A53E-1EF64E1537E1}" + "PackageCode" = "8:{1E6EC692-5BBF-4CB3-B4B3-5DE3068A184B}" "UpgradeCode" = "8:{A7DC5BC4-7E3E-4B58-A0AD-3C9AC9F873C1}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:FALSE" - "ProductVersion" = "8:3.1.1" + "ProductVersion" = "8:3.1.2" "Manufacturer" = "8:SamHou" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:" @@ -201,7 +227,7 @@ "Keywords" = "8:" "ARPCOMMENTS" = "8:TimeControl安装程序" "ARPURLINFOABOUT" = "8:" - "ARPPRODUCTICON" = "8:" + "ARPPRODUCTICON" = "8:_9BF8F60AD5F2474D82994CD2D95F44A1" "ARPIconIndex" = "3:0" "SearchPath" = "8:" "UseSystemSearchPath" = "11:TRUE" @@ -379,7 +405,7 @@ "Target" = "8:_B7C31D1C4E42443D89CA87F9596A43B7" "Folder" = "8:_EF355E43AD4E49F3B0AE27E1F063797B" "WorkingFolder" = "8:_57FF55C0487B4507A7ADC64F8E5966A5" - "Icon" = "8:" + "Icon" = "8:_9BF8F60AD5F2474D82994CD2D95F44A1" "Feature" = "8:" } "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_5426797F4F7D48478759844D9558460B" @@ -393,7 +419,7 @@ "Target" = "8:_B7C31D1C4E42443D89CA87F9596A43B7" "Folder" = "8:_24D444A51FBD4D6AB659A544BB198230" "WorkingFolder" = "8:_57FF55C0487B4507A7ADC64F8E5966A5" - "Icon" = "8:" + "Icon" = "8:_9BF8F60AD5F2474D82994CD2D95F44A1" "Feature" = "8:" } } @@ -797,7 +823,7 @@ { "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_5003B007B32D429B83CC5372AB9FC0AF" { - "SourcePath" = "8:..\\TimeControlConsole\\obj\\x64\\Release\\net6.0-windows10.0.22000.0\\apphost.exe" + "SourcePath" = "8:..\\TimeControlConsole\\obj\\Release\\net6.0-windows10.0.22000.0\\apphost.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_57FF55C0487B4507A7ADC64F8E5966A5" @@ -825,7 +851,7 @@ } "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_B7C31D1C4E42443D89CA87F9596A43B7" { - "SourcePath" = "8:..\\TimeControl\\obj\\x64\\Release\\net6.0-windows10.0.22000.0\\apphost.exe" + "SourcePath" = "8:..\\TimeControl\\obj\\Release\\net6.0-windows10.0.22000.0\\apphost.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_57FF55C0487B4507A7ADC64F8E5966A5" diff --git a/TimeControl/ListController.cs b/TimeControl/AppController.cs similarity index 96% rename from TimeControl/ListController.cs rename to TimeControl/AppController.cs index 4b3b0c0..ff69198 100644 --- a/TimeControl/ListController.cs +++ b/TimeControl/AppController.cs @@ -9,9 +9,9 @@ namespace TimeControl { - public class ListController + public class AppController { - private FileStream fileStream = new(TimeControlFile.tcTimeFileLocation, + private FileStream fileStream = new(TimeControlFile.TimeFileLocation, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); private StreamWriter streamWriter; @@ -19,7 +19,7 @@ public class ListController private List apps; private Timer timer; - public ListController(ListBox listBox, Timer timer) + public AppController(ListBox listBox, Timer timer) { streamWriter = new(fileStream); this.listBox = listBox; diff --git a/TimeControl/ControlPanel.Designer.cs b/TimeControl/ControlPanel.Designer.cs index 2c705ff..48d7262 100644 --- a/TimeControl/ControlPanel.Designer.cs +++ b/TimeControl/ControlPanel.Designer.cs @@ -312,7 +312,7 @@ private void InitializeComponent() this.clearButton.TabIndex = 7; this.clearButton.Text = "删除所有监控"; this.clearButton.UseVisualStyleBackColor = true; - this.clearButton.Click += new System.EventHandler(this.clearButton_Click); + this.clearButton.Click += new System.EventHandler(this.ClearButton_Click); // // ControlPanel // diff --git a/TimeControl/ControlPanel.cs b/TimeControl/ControlPanel.cs index 678b417..0face94 100644 --- a/TimeControl/ControlPanel.cs +++ b/TimeControl/ControlPanel.cs @@ -19,14 +19,14 @@ public partial class ControlPanel : Form private bool hide = false;//指示启动后是否需要隐藏 private bool isClosable = false;//指示当前是否可以关闭 private int unlockPasswordHash = 0;//密码哈希值,用作比对 - private ListController controller;//列表、计时控制器 + private AppController controller;//列表、计时控制器 public ControlPanel(bool hide) { InitializeComponent(); this.hide = hide; - if (File.Exists(TimeControlFile.tcPassLocation))//加载密码哈希值 + if (File.Exists(TimeControlFile.PassLocation))//加载密码哈希值 { - unlockPasswordHash = Convert.ToInt32(File.ReadAllText(TimeControlFile.tcPassLocation)); + unlockPasswordHash = Convert.ToInt32(File.ReadAllText(TimeControlFile.PassLocation)); PasswordSet(); } controller = new(usageBox, processMonitorTimer); @@ -140,8 +140,8 @@ private void ControlPanel_Shown(object sender, EventArgs e)//启动隐藏参数 private void UnloackPasswordSetButton_Click(object sender, EventArgs e)//保存密码 { unlockPasswordHash = unlockPasswordBox.Text.GetHashCode();//保存哈希值 + File.WriteAllText(TimeControlFile.PassLocation, unlockPasswordHash.ToString());//保存哈希值到文件 PasswordSet(); - File.WriteAllText(TimeControlFile.tcPassLocation, unlockPasswordHash.ToString());//保存哈希值到文件 } private void PasswordSet()//密码设置后调用 { @@ -150,7 +150,7 @@ private void PasswordSet()//密码设置后调用 unloackPasswordSetButton.Enabled = false; } - private void clearButton_Click(object sender, EventArgs e)//移除所有的已添加窗口 + private void ClearButton_Click(object sender, EventArgs e)//移除所有的已添加窗口 { if (PasswordCheck()) { diff --git a/TimeControl/LimitWarningWindow.Designer.cs b/TimeControl/LimitWarningWindow.Designer.cs index 5c0be9f..a008976 100644 --- a/TimeControl/LimitWarningWindow.Designer.cs +++ b/TimeControl/LimitWarningWindow.Designer.cs @@ -49,7 +49,7 @@ private void InitializeComponent() this.closeButton.TabIndex = 1; this.closeButton.Text = "立即强制关闭(请确保已保存任何文件)"; this.closeButton.UseVisualStyleBackColor = true; - this.closeButton.Click += new System.EventHandler(this.closeButton_Click); + this.closeButton.Click += new System.EventHandler(this.CloseButton_Click); // // LimitWarningWindow // diff --git a/TimeControl/LimitWarningWindow.cs b/TimeControl/LimitWarningWindow.cs index f83a31d..3a0e1fc 100644 --- a/TimeControl/LimitWarningWindow.cs +++ b/TimeControl/LimitWarningWindow.cs @@ -20,7 +20,7 @@ public LimitWarningWindow(LimitedApp warningApp) this.warningApp = warningApp; } - private void closeButton_Click(object sender, EventArgs e) + private void CloseButton_Click(object sender, EventArgs e) { warningApp.Ban();//禁用掉app Close(); diff --git a/TimeControl/PasswordInput.cs b/TimeControl/PasswordInput.cs index c43ce94..79e31c2 100644 --- a/TimeControl/PasswordInput.cs +++ b/TimeControl/PasswordInput.cs @@ -25,7 +25,7 @@ private void OkButton_Click(object sender, EventArgs e) { if (passwordTextBox.Text.GetHashCode()==passwordHash) { - File.Delete(TimeControlFile.tcPassLocation); + File.Delete(TimeControlFile.PassLocation); DialogResult = DialogResult.OK; Close(); } diff --git a/TimeControl/TimeControl.csproj b/TimeControl/TimeControl.csproj index 7f10d86..151956f 100644 --- a/TimeControl/TimeControl.csproj +++ b/TimeControl/TimeControl.csproj @@ -5,7 +5,7 @@ net6.0-windows10.0.22000.0 true SamHou - 3.1.1 + 3.1.2 TimeControl.Program False diff --git a/TimeControl/TimeControlFile.cs b/TimeControl/TimeControlFile.cs index bdd43dc..37e6e9a 100644 --- a/TimeControl/TimeControlFile.cs +++ b/TimeControl/TimeControlFile.cs @@ -8,9 +8,9 @@ namespace TimeControl { internal class TimeControlFile { - public static readonly string tcPassLocation = Environment.GetFolderPath + public static readonly string PassLocation = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData) + "\\TCPass.txt";//获取密码位置 - public static readonly string tcTimeFileLocation = Environment.GetFolderPath + public static readonly string TimeFileLocation = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData) + "\\TCTimeData.txt"; } } diff --git a/TimeControl/TimeInput.cs b/TimeControl/TimeInput.cs index 86b4911..887c11b 100644 --- a/TimeControl/TimeInput.cs +++ b/TimeControl/TimeInput.cs @@ -12,17 +12,17 @@ namespace TimeControl { public partial class TimeInput : Form { - private ListController listController; + private AppController appController; private readonly string appName; /// /// 创建一个新的输入窗口,并添加进程 /// - /// 进程列表控制器,用于添加进程 + /// 进程列表控制器,用于添加进程 /// 需要添加进程的名称 - public TimeInput(ListController listController, string appName) + public TimeInput(AppController appController, string appName) { InitializeComponent(); - this.listController = listController; + this.appController = appController; this.appName = appName; } @@ -30,11 +30,11 @@ private void OkButton_Click(object sender, EventArgs e) { if (timeBox.Value == 0) { - listController.AddByName(appName); + appController.AddByName(appName); } else { - listController.AddByName(appName, Convert.ToInt32(timeBox.Value)); + appController.AddByName(appName, Convert.ToInt32(timeBox.Value)); } Close(); } From c509718d7f8dfec489da0c9c30421517ec7332a5 Mon Sep 17 00:00:00 2001 From: Sam Hou Date: Fri, 18 Mar 2022 22:26:59 +0800 Subject: [PATCH 4/7] bug fix --- TimeControl/ControlPanel.cs | 13 +++++++------ TimeControl/Lock.cs | 8 ++++---- TimeControl/Password.cs | 20 ++++++++++++++++++++ TimeControl/PasswordInput.cs | 8 +++++--- TimeControl/TimeControl.csproj | 4 ++++ TimeControl/killtc.bat | 2 ++ 6 files changed, 42 insertions(+), 13 deletions(-) create mode 100644 TimeControl/Password.cs create mode 100644 TimeControl/killtc.bat diff --git a/TimeControl/ControlPanel.cs b/TimeControl/ControlPanel.cs index 0face94..5258c04 100644 --- a/TimeControl/ControlPanel.cs +++ b/TimeControl/ControlPanel.cs @@ -18,7 +18,7 @@ public partial class ControlPanel : Form { private bool hide = false;//指示启动后是否需要隐藏 private bool isClosable = false;//指示当前是否可以关闭 - private int unlockPasswordHash = 0;//密码哈希值,用作比对 + private string unlockPasswordHash = "";//密码哈希值,用作比对 private AppController controller;//列表、计时控制器 public ControlPanel(bool hide) { @@ -26,7 +26,7 @@ public ControlPanel(bool hide) this.hide = hide; if (File.Exists(TimeControlFile.PassLocation))//加载密码哈希值 { - unlockPasswordHash = Convert.ToInt32(File.ReadAllText(TimeControlFile.PassLocation)); + unlockPasswordHash = File.ReadAllText(TimeControlFile.PassLocation); PasswordSet(); } controller = new(usageBox, processMonitorTimer); @@ -72,7 +72,7 @@ private void ControlPanel_FormClosing(object sender, FormClosingEventArgs e)// private void ExitToolStripMenuItem_Click(object sender, EventArgs e)//正常退出程序 { PasswordInput passwordInput = new(unlockPasswordHash); - if (unlockPasswordHash != 0)//检测是否设置了管理码 + if (!string.IsNullOrEmpty( unlockPasswordHash))//检测是否设置了管理码 { if (passwordInput.ShowDialog() == DialogResult.OK) ForceClose(); @@ -139,7 +139,8 @@ private void ControlPanel_Shown(object sender, EventArgs e)//启动隐藏参数 } private void UnloackPasswordSetButton_Click(object sender, EventArgs e)//保存密码 { - unlockPasswordHash = unlockPasswordBox.Text.GetHashCode();//保存哈希值 + + unlockPasswordHash = Password.ComputeHash( unlockPasswordBox.Text);//保存哈希值 File.WriteAllText(TimeControlFile.PassLocation, unlockPasswordHash.ToString());//保存哈希值到文件 PasswordSet(); } @@ -157,9 +158,9 @@ private void ClearButton_Click(object sender, EventArgs e)//移除所有的已 controller.RemoveAll(); } } - private bool PasswordCheck() + private bool PasswordCheck()//检测密码是否正确 { - if (unlockPasswordHash != 0) + if (!string.IsNullOrEmpty( unlockPasswordHash)) { PasswordInput passwordInput = new(unlockPasswordHash); if (passwordInput.ShowDialog() == DialogResult.OK) diff --git a/TimeControl/Lock.cs b/TimeControl/Lock.cs index 6f3143c..ac856dd 100644 --- a/TimeControl/Lock.cs +++ b/TimeControl/Lock.cs @@ -14,12 +14,12 @@ namespace TimeControl public partial class Lock : Form { private bool usePassword = true; - private int unlockPasswordHash; - public Lock(int minutes,int unlockPasswordHash) + private string unlockPasswordHash; + public Lock(int minutes,string unlockPasswordHash) { InitializeComponent(); progressBar.Maximum = minutes * 60; - if(unlockPasswordHash==0) + if (!string.IsNullOrEmpty(unlockPasswordHash)) { usePassword = false; } this.unlockPasswordHash = unlockPasswordHash; } @@ -53,7 +53,7 @@ private void UnlockButton_Click(object sender, EventArgs e) { if (usePassword == true) { - if (unlockPasswordBox.Text.GetHashCode() == unlockPasswordHash) + if (Password.ComputeHash(unlockPasswordBox.Text) == unlockPasswordHash) { progressBar.Value = progressBar.Maximum; Close(); diff --git a/TimeControl/Password.cs b/TimeControl/Password.cs new file mode 100644 index 0000000..a3bd7ee --- /dev/null +++ b/TimeControl/Password.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Security.Cryptography; + +namespace TimeControl +{ + internal static class Password + { + public static string ComputeHash(string str) + { + byte[] bytes = Encoding.UTF8.GetBytes(str); + MD5 md5 = MD5.Create(); + md5.ComputeHash(bytes); + return Encoding.UTF8.GetString(md5.ComputeHash(bytes)); + } + } +} diff --git a/TimeControl/PasswordInput.cs b/TimeControl/PasswordInput.cs index 79e31c2..78f714b 100644 --- a/TimeControl/PasswordInput.cs +++ b/TimeControl/PasswordInput.cs @@ -8,13 +8,14 @@ using System.Threading.Tasks; using System.Windows.Forms; using System.IO; +using System.Security.Cryptography; namespace TimeControl { public partial class PasswordInput : Form { - private int passwordHash; - public PasswordInput(int passwordHash) + private string passwordHash; + public PasswordInput(string passwordHash) { InitializeComponent(); this.passwordHash = passwordHash; @@ -23,7 +24,8 @@ public PasswordInput(int passwordHash) private void OkButton_Click(object sender, EventArgs e) { - if (passwordTextBox.Text.GetHashCode()==passwordHash) + + if (Password.ComputeHash(passwordTextBox.Text)==passwordHash ) { File.Delete(TimeControlFile.PassLocation); DialogResult = DialogResult.OK; diff --git a/TimeControl/TimeControl.csproj b/TimeControl/TimeControl.csproj index 151956f..be48d0a 100644 --- a/TimeControl/TimeControl.csproj +++ b/TimeControl/TimeControl.csproj @@ -58,4 +58,8 @@ + + + + \ No newline at end of file diff --git a/TimeControl/killtc.bat b/TimeControl/killtc.bat new file mode 100644 index 0000000..a99ce55 --- /dev/null +++ b/TimeControl/killtc.bat @@ -0,0 +1,2 @@ +taskkill /F /IM TimeControl.exe +taskkill /F /IM TimeControlConsole.exe \ No newline at end of file From df4377c6a9621e035390252de4e9cb8553348167 Mon Sep 17 00:00:00 2001 From: Sam Hou Date: Fri, 18 Mar 2022 22:30:15 +0800 Subject: [PATCH 5/7] bug fix --- TimeControl/Lock.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TimeControl/Lock.cs b/TimeControl/Lock.cs index ac856dd..8f68d6c 100644 --- a/TimeControl/Lock.cs +++ b/TimeControl/Lock.cs @@ -19,7 +19,7 @@ public Lock(int minutes,string unlockPasswordHash) { InitializeComponent(); progressBar.Maximum = minutes * 60; - if (!string.IsNullOrEmpty(unlockPasswordHash)) + if (string.IsNullOrEmpty(unlockPasswordHash)) { usePassword = false; } this.unlockPasswordHash = unlockPasswordHash; } From 1b5d4a7d3b9fae439d02231af18fe38a80093c6c Mon Sep 17 00:00:00 2001 From: Sam Hou Date: Sat, 19 Mar 2022 11:05:55 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E5=AE=9E=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TimeControl/Program.cs | 19 +++++++++++++++++++ TimeControl/TimeControl.csproj | 5 +---- TimeControl/killtc.bat | 2 -- 3 files changed, 20 insertions(+), 6 deletions(-) delete mode 100644 TimeControl/killtc.bat diff --git a/TimeControl/Program.cs b/TimeControl/Program.cs index 1403c74..5b3d2aa 100644 --- a/TimeControl/Program.cs +++ b/TimeControl/Program.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; +using System.Diagnostics; namespace TimeControl { @@ -22,6 +23,24 @@ static void Main(string[] args) hide = true; } } + Process[] processes = Process.GetProcessesByName("TimeControl"); + if (processes.Length > 1) + { + if (MessageBox.Show( + "ǰѾTimeControlʵǷҪ", + "ʾ", + MessageBoxButtons.OKCancel, + MessageBoxIcon.Information) == DialogResult.OK) + { + foreach (Process process in processes) + { + if (process.Id != Environment.ProcessId) + process.Kill(); + } + } + else + return; + } Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); diff --git a/TimeControl/TimeControl.csproj b/TimeControl/TimeControl.csproj index be48d0a..55cf783 100644 --- a/TimeControl/TimeControl.csproj +++ b/TimeControl/TimeControl.csproj @@ -13,6 +13,7 @@ AnyCPU 7.0 AnyCPU;x64;x86 + False @@ -58,8 +59,4 @@ - - - - \ No newline at end of file diff --git a/TimeControl/killtc.bat b/TimeControl/killtc.bat deleted file mode 100644 index a99ce55..0000000 --- a/TimeControl/killtc.bat +++ /dev/null @@ -1,2 +0,0 @@ -taskkill /F /IM TimeControl.exe -taskkill /F /IM TimeControlConsole.exe \ No newline at end of file From c460a2179c1491b00be1417e998dab870c2dc906 Mon Sep 17 00:00:00 2001 From: Sam Hou Date: Sun, 20 Mar 2022 10:36:40 +0800 Subject: [PATCH 7/7] update version number --- TCSetup/TCSetup.vdproj | 10 +++++----- TimeControl/TimeControl.csproj | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TCSetup/TCSetup.vdproj b/TCSetup/TCSetup.vdproj index bf67629..16d26ff 100644 --- a/TCSetup/TCSetup.vdproj +++ b/TCSetup/TCSetup.vdproj @@ -209,15 +209,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:TimeControl" - "ProductCode" = "8:{9EE926BC-8A8C-4684-A53E-1EF64E1537E1}" - "PackageCode" = "8:{1E6EC692-5BBF-4CB3-B4B3-5DE3068A184B}" + "ProductCode" = "8:{58790286-6BF3-4D15-BE41-3514CFB9D21B}" + "PackageCode" = "8:{15145DC8-E457-4268-AA72-57CBF07212D1}" "UpgradeCode" = "8:{A7DC5BC4-7E3E-4B58-A0AD-3C9AC9F873C1}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:FALSE" - "ProductVersion" = "8:3.1.2" + "ProductVersion" = "8:3.1.3" "Manufacturer" = "8:SamHou" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:" @@ -823,7 +823,7 @@ { "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_5003B007B32D429B83CC5372AB9FC0AF" { - "SourcePath" = "8:..\\TimeControlConsole\\obj\\Release\\net6.0-windows10.0.22000.0\\apphost.exe" + "SourcePath" = "8:..\\TimeControlConsole\\obj\\Debug\\net6.0-windows10.0.22000.0\\apphost.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_57FF55C0487B4507A7ADC64F8E5966A5" @@ -851,7 +851,7 @@ } "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_B7C31D1C4E42443D89CA87F9596A43B7" { - "SourcePath" = "8:..\\TimeControl\\obj\\Release\\net6.0-windows10.0.22000.0\\apphost.exe" + "SourcePath" = "8:..\\TimeControl\\obj\\Debug\\net6.0-windows10.0.22000.0\\apphost.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_57FF55C0487B4507A7ADC64F8E5966A5" diff --git a/TimeControl/TimeControl.csproj b/TimeControl/TimeControl.csproj index 55cf783..ba01615 100644 --- a/TimeControl/TimeControl.csproj +++ b/TimeControl/TimeControl.csproj @@ -5,7 +5,7 @@ net6.0-windows10.0.22000.0 true SamHou - 3.1.2 + 3.1.3 TimeControl.Program False