Skip to content

Commit

Permalink
优化游戏模式下的判定
Browse files Browse the repository at this point in the history
  • Loading branch information
Kai committed Sep 29, 2019
1 parent e8fe17c commit 6aa47c5
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 138 deletions.
Binary file modified .vs/EyeGuard/v15/.suo
Binary file not shown.
Binary file modified .vs/EyeGuard/v15/Server/sqlite3/storage.ide
Binary file not shown.
Binary file modified .vs/EyeGuard/v15/Server/sqlite3/storage.ide-shm
Binary file not shown.
Binary file modified .vs/EyeGuard/v15/Server/sqlite3/storage.ide-wal
Binary file not shown.
94 changes: 1 addition & 93 deletions EyeGuard/Bll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,55 +196,8 @@ public bool FullScreen()

}
#endregion


/// <summary>
/// 快捷方式所在目录
/// </summary>
private static string Iopath = Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\眼睛卫士.vbs";


/// <summary>
/// 创建快捷方式位置
/// </summary>
/// <param name="directory">快捷方式存放的位置</param>
/// <param name="shortcutName">快捷方式名称</param>
/// <param name="targetPath">程序路径</param>
/// <param name="description">描述</param>
/// <param name="iconLocation">程序图标</param>
/// <returns></returns>
public static bool Create(string directory, string shortcutName, string targetPath,
string description = null, string iconLocation = null)
{
try
{
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}

//添加引用 Com 中搜索 Windows Script Host Object Model
string shortcutPath = Path.Combine(directory, string.Format("{0}.lnk", shortcutName));
IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShell();
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(shortcutPath);//创建快捷方式对象
shortcut.TargetPath = targetPath;//指定目标路径
shortcut.WorkingDirectory = Path.GetDirectoryName(targetPath);//设置起始位置
shortcut.WindowStyle = 1;//设置运行方式,默认为常规窗口
shortcut.Description = description;//设置备注
shortcut.IconLocation = string.IsNullOrWhiteSpace(iconLocation) ? targetPath : iconLocation;//设置图标路径
shortcut.Save();//保存快捷方式

return true;
}
catch(Exception ex)
{
//MessageBox.Show(ex.Message);
}
return false;
}



/// <summary>
/// 是否开机启动
/// </summary>
Expand Down Expand Up @@ -275,51 +228,6 @@ public static void BootUp(bool Whether = true)
{
MessageBox.Show("您需要管理员权限修改", "提示");
}


/*
if (Whether)
{
Create(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup), "EyeGuard", System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName, "眼睛卫士", AppDomain.CurrentDomain.BaseDirectory + "Resources/favicon.ico");
}
else
{
//检测是否存在
if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup) + "\\EyeGuard.lnk"))
{
File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup) + "\\EyeGuard.lnk");
}
}
*/

/*
//删除旧有的vbs开机启动
if (File.Exists(Iopath))
{
File.Delete(Iopath);
}
//删除旧有快捷方式的自启
if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup) + "\\EyeGuard.lnk"))
{
File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup) + "\\EyeGuard.lnk");
}
if (Whether)
{
if (!File.Exists(Iopath))
{
string vbs = "CreateObject(\"WScript.Shell\").Run \"" + Application.ExecutablePath + "\""; ;
File.WriteAllText(Iopath, vbs, Encoding.GetEncoding(936));
}
}
else
{
// 删除该文件
File.Delete(Iopath);
}
*/
}
}
}
28 changes: 1 addition & 27 deletions EyeGuard/ConfigHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,32 +97,6 @@ public static bool SetConfig(Dictionary<string, string> dict)
catch { return false; }
}

/// <summary>
/// 获取本机MAC地址
/// </summary>
/// <returns>本机MAC地址</returns>
public static string GetMacAddress()
{
try
{
string strMac = string.Empty;
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
if ((bool)mo["IPEnabled"] == true)
{
strMac = mo["MacAddress"].ToString();
}
}
moc = null;
mc = null;
return strMac;
}
catch
{
return "unknown";
}
}

}
}
21 changes: 16 additions & 5 deletions EyeGuard/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ private void LockScreen_Click(object sender, EventArgs e)
}
}

/// <summary>
/// 设置面板实例
/// </summary>
SetUp sp;

/// <summary>
/// 设置
/// </summary>
Expand All @@ -190,9 +195,14 @@ private void SetupPanel_Click(object sender, EventArgs e)
{
if (SetUp.Function == false)
{
SetUp sp = new SetUp(md);
sp = new SetUp(md);
sp.Show();
}
else
{
//获得焦点
sp.Focus();
}
}

/// <summary>
Expand Down Expand Up @@ -269,10 +279,11 @@ private void notifyIcon_MouseClick(object sender, System.Windows.Forms.MouseEven
//鼠标左键
if (e.Button == MouseButtons.Left)
{
//获得焦点
this.Focus();

if ((int)md.TimerMode == 2)
{
//获得焦点
this.Focus();
Count = 0;
if (Tips.Function == false)
{
Expand Down Expand Up @@ -555,8 +566,8 @@ private void timer_Tick(object sender, EventArgs e)

}

//休息前的提醒
if ((md.Work - 1) * 60 == Count)
//休息前的提醒 游戏模式下不进行提醒
if ((md.Work - 1) * 60 == Count&& (int)md.TimerMode!=3)
{
if (Tips.Function == false)
{
Expand Down
6 changes: 3 additions & 3 deletions EyeGuard/UI/Tips.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ private void Tips_Closed(object sender, EventArgs e)
public void Position()
{
//这里根据字符的长度来设置窗体的长度
this.Width = (Bll.GetStringLength(TipsLable.Content.ToString()) / 2) * 38;
this.Width = (Bll.GetStringLength(TipsLable.Content.ToString()) / 2) * 38+15;

//屏幕宽高
double ScreenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
double ScreenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
double ScreenWidth = SystemParameters.PrimaryScreenWidth;
double ScreenHeight = SystemParameters.PrimaryScreenHeight;
this.Top = ScreenHeight - this.Height-100;
this.Left = (ScreenWidth/2) - (this.Width / 2);
this.Topmost = true;
Expand Down
Binary file modified EyeGuard/bin/Debug/EyeGuard.exe
Binary file not shown.
16 changes: 8 additions & 8 deletions EyeGuard/bin/Debug/EyeGuard.exe.config
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="Work" value="45"/>
<add key="BreakPoints" value="1"/>
<add key="TimerMode" value="0"/>
<add key="LockMode" value="1"/>
<add key="Display" value="1"/>
<add key="ShutdownTime" value="-1"/>
<add key="ShutdownPoints" value="-1"/>
<add key="Unlock" value="0"/>
<add key="Work" value="2" />
<add key="BreakPoints" value="1" />
<add key="TimerMode" value="0" />
<add key="LockMode" value="1" />
<add key="Display" value="1" />
<add key="ShutdownTime" value="-1" />
<add key="ShutdownPoints" value="-1" />
<add key="Unlock" value="0" />
</appSettings>
<startup>

Expand Down
Binary file modified EyeGuard/bin/Debug/EyeGuard.pdb
Binary file not shown.
1 change: 0 additions & 1 deletion EyeGuard/obj/Debug/EyeGuard.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,3 @@ E:\开源项目\EyeGuard\EyeGuard\obj\Debug\EyeGuard.exe
E:\开源项目\EyeGuard\EyeGuard\obj\Debug\EyeGuard.pdb
E:\开源项目\EyeGuard\EyeGuard\obj\Debug\UI\About.g.cs
E:\开源项目\EyeGuard\EyeGuard\obj\Debug\UI\About.baml
E:\开源项目\EyeGuard\EyeGuard\obj\Debug\EyeGuard.csprojAssemblyReference.cache
Binary file not shown.
Binary file modified EyeGuard/obj/Debug/EyeGuard.exe
Binary file not shown.
Binary file modified EyeGuard/obj/Debug/EyeGuard.pdb
Binary file not shown.
Binary file modified EyeGuard/obj/Debug/Interop.IWshRuntimeLibrary.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@

## 本软件使用.net4.5进行开发,界面使用WPF,界面UI模块使用的是开源UI组件[mahapps](https://mahapps.com/)

## 本软件始发于[吾爱破解](https://www.52pojie.cn/thread-951763-1-1.html)论坛,如果想要下载成品,可以点击[百度云](https://pan.baidu.com/s/1YRw7rBdLDN-Bl2-WzMnn2Q)进行下载,提取码为:1p49
## 本软件始发于[吾爱破解](https://www.52pojie.cn/thread-951763-1-1.html)论坛,如果想要下载成品,可以点击[蓝奏云](https://www.lanzous.com/b1004493/)进行下载,提取码为:f6s6

0 comments on commit 6aa47c5

Please sign in to comment.