not check update when no configurationtags/3.2
@@ -82,17 +82,16 @@ namespace Shadowsocks.View | |||||
Configuration config = controller.GetConfigurationCopy(); | Configuration config = controller.GetConfigurationCopy(); | ||||
if (config.autoCheckUpdate) | |||||
{ | |||||
_isStartupChecking = true; | |||||
updateChecker.CheckUpdate(config, 3000); | |||||
} | |||||
if (config.isDefault) | if (config.isDefault) | ||||
{ | { | ||||
_isFirstRun = true; | _isFirstRun = true; | ||||
ShowConfigForm(); | ShowConfigForm(); | ||||
} | } | ||||
else if(config.autoCheckUpdate) | |||||
{ | |||||
_isStartupChecking = true; | |||||
updateChecker.CheckUpdate(config, 3000); | |||||
} | |||||
} | } | ||||
void controller_Errored(object sender, System.IO.ErrorEventArgs e) | void controller_Errored(object sender, System.IO.ErrorEventArgs e) | ||||
@@ -262,12 +261,10 @@ namespace Shadowsocks.View | |||||
if (updateChecker.NewVersionFound) | if (updateChecker.NewVersionFound) | ||||
{ | { | ||||
ShowBalloonTip(String.Format(I18N.GetString("Shadowsocks {0} Update Found"), updateChecker.LatestVersionNumber), I18N.GetString("Click here to update"), ToolTipIcon.Info, 5000); | ShowBalloonTip(String.Format(I18N.GetString("Shadowsocks {0} Update Found"), updateChecker.LatestVersionNumber), I18N.GetString("Click here to update"), ToolTipIcon.Info, 5000); | ||||
_isFirstRun = false; | |||||
} | } | ||||
else if (!_isStartupChecking) | else if (!_isStartupChecking) | ||||
{ | { | ||||
ShowBalloonTip(I18N.GetString("Shadowsocks"), I18N.GetString("No update is available"), ToolTipIcon.Info, 5000); | ShowBalloonTip(I18N.GetString("Shadowsocks"), I18N.GetString("No update is available"), ToolTipIcon.Info, 5000); | ||||
_isFirstRun = false; | |||||
} | } | ||||
_isStartupChecking = false; | _isStartupChecking = false; | ||||
} | } | ||||
@@ -389,7 +386,12 @@ namespace Shadowsocks.View | |||||
{ | { | ||||
configForm = null; | configForm = null; | ||||
Utils.ReleaseMemory(true); | Utils.ReleaseMemory(true); | ||||
ShowFirstTimeBalloon(); | |||||
if (_isFirstRun) | |||||
{ | |||||
CheckUpdateForFirstRun(); | |||||
ShowFirstTimeBalloon(); | |||||
_isFirstRun = false; | |||||
} | |||||
} | } | ||||
private void Config_Click(object sender, EventArgs e) | private void Config_Click(object sender, EventArgs e) | ||||
@@ -404,18 +406,24 @@ namespace Shadowsocks.View | |||||
Application.Exit(); | Application.Exit(); | ||||
} | } | ||||
private void ShowFirstTimeBalloon() | |||||
private void CheckUpdateForFirstRun() | |||||
{ | { | ||||
if (_isFirstRun) | |||||
Configuration config = controller.GetConfigurationCopy(); | |||||
if (!config.isDefault) | |||||
{ | { | ||||
_notifyIcon.BalloonTipTitle = I18N.GetString("Shadowsocks is here"); | |||||
_notifyIcon.BalloonTipText = I18N.GetString("You can turn on/off Shadowsocks in the context menu"); | |||||
_notifyIcon.BalloonTipIcon = ToolTipIcon.Info; | |||||
_notifyIcon.ShowBalloonTip(0); | |||||
_isFirstRun = false; | |||||
_isStartupChecking = true; | |||||
updateChecker.CheckUpdate(config, 3000); | |||||
} | } | ||||
} | } | ||||
private void ShowFirstTimeBalloon() | |||||
{ | |||||
_notifyIcon.BalloonTipTitle = I18N.GetString("Shadowsocks is here"); | |||||
_notifyIcon.BalloonTipText = I18N.GetString("You can turn on/off Shadowsocks in the context menu"); | |||||
_notifyIcon.BalloonTipIcon = ToolTipIcon.Info; | |||||
_notifyIcon.ShowBalloonTip(0); | |||||
} | |||||
private void AboutItem_Click(object sender, EventArgs e) | private void AboutItem_Click(object sender, EventArgs e) | ||||
{ | { | ||||
Process.Start("https://github.com/shadowsocks/shadowsocks-windows"); | Process.Start("https://github.com/shadowsocks/shadowsocks-windows"); | ||||
@@ -60,7 +60,6 @@ | |||||
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet> | <CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet> | ||||
<Prefer32Bit>false</Prefer32Bit> | <Prefer32Bit>false</Prefer32Bit> | ||||
<DebugSymbols>true</DebugSymbols> | <DebugSymbols>true</DebugSymbols> | ||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<PropertyGroup> | <PropertyGroup> | ||||
<ApplicationManifest>app.manifest</ApplicationManifest> | <ApplicationManifest>app.manifest</ApplicationManifest> | ||||
@@ -347,25 +346,25 @@ | |||||
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System" /> | <Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System" /> | ||||
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System.IO" /> | <Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System.IO" /> | ||||
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System.Xml.Linq" /> | <Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System.Xml.Linq" /> | ||||
<Code xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Type="Fragment" Language="cs"><![CDATA[ | |||||
var config = XElement.Load(Config.ItemSpec).Elements("Costura").FirstOrDefault(); | |||||
if (config == null) return true; | |||||
var excludedAssemblies = new List<string>(); | |||||
var attribute = config.Attribute("ExcludeAssemblies"); | |||||
if (attribute != null) | |||||
foreach (var item in attribute.Value.Split('|').Select(x => x.Trim()).Where(x => x != string.Empty)) | |||||
excludedAssemblies.Add(item); | |||||
var element = config.Element("ExcludeAssemblies"); | |||||
if (element != null) | |||||
foreach (var item in element.Value.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).Where(x => x != string.Empty)) | |||||
excludedAssemblies.Add(item); | |||||
var filesToCleanup = Files.Select(f => f.ItemSpec).Where(f => !excludedAssemblies.Contains(Path.GetFileNameWithoutExtension(f), StringComparer.InvariantCultureIgnoreCase)); | |||||
foreach (var item in filesToCleanup) | |||||
File.Delete(item); | |||||
<Code xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Type="Fragment" Language="cs"><![CDATA[ | |||||
var config = XElement.Load(Config.ItemSpec).Elements("Costura").FirstOrDefault(); | |||||
if (config == null) return true; | |||||
var excludedAssemblies = new List<string>(); | |||||
var attribute = config.Attribute("ExcludeAssemblies"); | |||||
if (attribute != null) | |||||
foreach (var item in attribute.Value.Split('|').Select(x => x.Trim()).Where(x => x != string.Empty)) | |||||
excludedAssemblies.Add(item); | |||||
var element = config.Element("ExcludeAssemblies"); | |||||
if (element != null) | |||||
foreach (var item in element.Value.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).Where(x => x != string.Empty)) | |||||
excludedAssemblies.Add(item); | |||||
var filesToCleanup = Files.Select(f => f.ItemSpec).Where(f => !excludedAssemblies.Contains(Path.GetFileNameWithoutExtension(f), StringComparer.InvariantCultureIgnoreCase)); | |||||
foreach (var item in filesToCleanup) | |||||
File.Delete(item); | |||||
]]></Code> | ]]></Code> | ||||
</Task> | </Task> | ||||
</UsingTask> | </UsingTask> | ||||
@@ -23,10 +23,13 @@ | |||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | ||||
<OutputPath>bin\x86\Debug\</OutputPath> | <OutputPath>bin\x86\Debug\</OutputPath> | ||||
<PlatformTarget>x86</PlatformTarget> | <PlatformTarget>x86</PlatformTarget> | ||||
<DefineConstants>TRACE;DEBUG</DefineConstants> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> | <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> | ||||
<OutputPath>bin\x86\Release\</OutputPath> | <OutputPath>bin\x86\Release\</OutputPath> | ||||
<PlatformTarget>x86</PlatformTarget> | <PlatformTarget>x86</PlatformTarget> | ||||
<Optimize>true</Optimize> | |||||
<DefineConstants>TRACE</DefineConstants> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<PropertyGroup> | <PropertyGroup> | ||||
<StartupObject /> | <StartupObject /> | ||||