Skip to content

Commit

Permalink
update to 5.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Soul Dark committed Jul 21, 2018
1 parent 4d49f82 commit 9d3fad0
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 15 deletions.
2 changes: 1 addition & 1 deletion shadowsocks-csharp/Controller/UpdateChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class UpdateChecker

public const string Name = "ShadowsocksR";
public const string Copyright = "Copyright © BreakWa11 2017. Fork from Shadowsocks by clowwindy";
public const string Version = "4.0.0";
public const string Version = "5.0.2";
#if !_DOTNET_4_0
public const string NetVer = "2.0";
#elif !_CONSOLE
Expand Down
13 changes: 8 additions & 5 deletions shadowsocks-csharp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using Shadowsocks.Controller;
using Shadowsocks.Properties;
using Shadowsocks.Util;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Threading;
using System.Windows.Forms;
using Microsoft.Win32;
Expand All @@ -17,9 +16,9 @@ namespace Shadowsocks
{
static class Program
{
static ShadowsocksController _controller;
private static ShadowsocksController _controller;
#if !_CONSOLE
static MenuViewController _viewController;
public static MenuViewController _viewController { get; set; }
#endif

/// <summary>
Expand All @@ -40,14 +39,18 @@ static void Main(string[] args)
return;
}
}

if (Utils.is360Exist()){
return;
}

using (Mutex mutex = new Mutex(false, "Global\\ShadowsocksR_" + Application.StartupPath.GetHashCode()))
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.EnableVisualStyles();
Application.ApplicationExit += Application_ApplicationExit;
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
Application.SetCompatibleTextRenderingDefault(false);

if (!mutex.WaitOne(0, false))
{
MessageBox.Show(I18N.GetString("Find Shadowsocks icon in your notify tray.") + "\n" +
Expand Down
24 changes: 23 additions & 1 deletion shadowsocks-csharp/Util/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
using System.Security.Cryptography;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using OpenDNS;
using Shadowsocks.Controller;
using Shadowsocks.Encryption;
using Shadowsocks;
using Shadowsocks.Model;

namespace Shadowsocks.Util
Expand Down Expand Up @@ -490,6 +491,27 @@ public static int GetDpiMul()
return (dpi * 4 + 48) / 96;
}

public static bool is360Exist()
{
List<Process> process = new List<Process>(Process.GetProcessesByName("ZhuDongFangYu"));
process.AddRange(Process.GetProcessesByName("360Safe"));
string registry_path_360Safe = (IntPtr.Size == 4 ? @"Software\Microsoft\Windows\CurrentVersion\App Paths\360safe.exe" : @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths\360safe.exe");
string registry_path_360Se6 = (IntPtr.Size == 4 ? @"Software\Microsoft\Windows\CurrentVersion\App Paths\360se6.exe" : @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths\360se6.exe");
RegistryKey registry_360Safe = Registry.LocalMachine.OpenSubKey(registry_path_360Safe);
RegistryKey registry_360Se6 = Registry.LocalMachine.OpenSubKey(registry_path_360Se6);
if (
process.Count != 0 ||
registry_360Safe != null||
registry_360Se6 != null
)
{
//因为只有国行小白才会看到本消息,所以用中文
MessageBox.Show(I18N.GetString("SSRR无法运行于安装有360的电脑,告辞!"));
return true;
}
return false;
}

#if !_CONSOLE
public enum DeviceCap
{
Expand Down
36 changes: 29 additions & 7 deletions shadowsocks-csharp/View/MenuViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
using Shadowsocks.Model;
using Shadowsocks.Properties;
using System;
using System.IO;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

Expand All @@ -15,6 +13,7 @@
using ZXing.QrCode;
using System.Threading;
using System.Text.RegularExpressions;
using Shadowsocks.Util;

namespace Shadowsocks.View
{
Expand Down Expand Up @@ -68,6 +67,7 @@ public class MenuViewController
private SubscribeForm subScribeForm;
private LogForm logForm;
private string _urlToOpen;
private System.Timers.Timer timerDetect360;
private System.Timers.Timer timerDelayCheckUpdate;

private bool configfrom_open = false;
Expand Down Expand Up @@ -105,13 +105,24 @@ public MenuViewController(ShadowsocksController controller)
updateSubscribeManager = new UpdateSubscribeManager();

LoadCurrentConfiguration();
timerDetect360 = new System.Timers.Timer(1000.0*30);
timerDetect360.Elapsed += timerDetect360_Elapsed;
timerDetect360.Start();

timerDelayCheckUpdate = new System.Timers.Timer(1000.0 * 10);
timerDelayCheckUpdate.Elapsed += timer_Elapsed;
timerDelayCheckUpdate.Elapsed += timerDelayCheckUpdate_Elapsed;
timerDelayCheckUpdate.Start();
}

private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
private void timerDetect360_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (Utils.is360Exist())
{
Quit();
}
}

private void timerDelayCheckUpdate_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (timerDelayCheckUpdate != null)
{
Expand Down Expand Up @@ -638,7 +649,7 @@ void updateChecker_NewVersionFound(object sender, EventArgs e)
I18N.GetString("Click menu to download"), ToolTipIcon.Info, 10000);
_notifyIcon.BalloonTipClicked += notifyIcon1_BalloonTipClicked;

timerDelayCheckUpdate.Elapsed -= timer_Elapsed;
timerDelayCheckUpdate.Elapsed -= timerDelayCheckUpdate_Elapsed;
timerDelayCheckUpdate.Stop();
timerDelayCheckUpdate = null;
}
Expand Down Expand Up @@ -970,7 +981,7 @@ private void Setting_Click(object sender, EventArgs e)
ShowSettingForm();
}

private void Quit_Click(object sender, EventArgs e)
private void Quit()
{
controller.Stop();
if (configForm != null)
Expand All @@ -983,16 +994,27 @@ private void Quit_Click(object sender, EventArgs e)
serverLogForm.Close();
serverLogForm = null;
}
if (timerDetect360 != null)
{
timerDetect360.Elapsed -= timerDetect360_Elapsed;
timerDetect360.Stop();
timerDetect360 = null;
}
if (timerDelayCheckUpdate != null)
{
timerDelayCheckUpdate.Elapsed -= timer_Elapsed;
timerDelayCheckUpdate.Elapsed -= timerDelayCheckUpdate_Elapsed;
timerDelayCheckUpdate.Stop();
timerDelayCheckUpdate = null;
}
_notifyIcon.Visible = false;
Application.Exit();
}

private void Quit_Click(object sender, EventArgs e)
{
Quit();
}

private void OpenWiki_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/shadowsocksrr/shadowsocks-rss/wiki");
Expand Down
2 changes: 1 addition & 1 deletion shadowsocks-csharp/ssr-win-4.0.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:files="https://sourceforge.net/api/files.rdf#" xmlns:media="http://video.search.yahoo.com/mrss/" xmlns:doap="http://usefulinc.com/ns/doap#" xmlns:sf="https://sourceforge.net/api/sfelements.rdf#" version="2.0">
<channel xmlns:files="https://sourceforge.net/api/files.rdf#" xmlns:media="http://video.search.yahoo.com/mrss/" xmlns:doap="http://usefulinc.com/ns/doap#" xmlns:sf="https://sourceforge.net/api/sfelements.rdf#">
<item>
<media:content xmlns:media="http://video.search.yahoo.com/mrss/" type="application/zip; charset=binary" url="https://github.com/SoDa-GitHub/shadowsocksrr-csharp/releases/download/5.0.0/ShadowsocksR-win-5.0.1.zip" filesize="397252"></media:content>
<media:content xmlns:media="http://video.search.yahoo.com/mrss/" type="application/zip; charset=binary" url="https://github.com/SoDa-GitHub/shadowsocksrr-csharp/releases/download/5.0.2/ShadowsocksR-win-5.0.2.7z" filesize="828351"></media:content>
</item>
</channel>
</rss>
Expand Down

0 comments on commit 9d3fad0

Please sign in to comment.