Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Commit

Permalink
代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
MonoLogueChi committed Mar 1, 2018
1 parent 89c18a4 commit f0e2ecd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Drcom/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.1")]
[assembly: AssemblyFileVersion("0.1.0.1")]
[assembly: AssemblyVersion("0.1.0.2")]
[assembly: AssemblyFileVersion("0.1.0.2")]
[assembly: NeutralResourcesLanguage("")]

4 changes: 2 additions & 2 deletions Drcom/net/NewApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public static string[] IsNew()

return versiondata;
}
catch (Exception e)
catch (Exception)
{
return (new string[3]{version, "未检测到最新版本" ,"未检测到更新时间"});
return (new string[3] { version, "未检测到最新版本", "未检测到更新时间" });
}
}
}
Expand Down
16 changes: 10 additions & 6 deletions Drcom/net/Setting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static string GetSetting(string key)
string value = ConfigurationManager.AppSettings[key].ToString();
return value;
}
catch (Exception e)
catch (Exception)
{
return null;
}
Expand All @@ -24,13 +24,17 @@ public static void UpdateSetting(string key, string value)
{
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

if (config.AppSettings.Settings[key] != null)
try
{
config.AppSettings.Settings.Remove(key);
if (config.AppSettings.Settings[key] != null)
{
config.AppSettings.Settings.Remove(key);
}
config.AppSettings.Settings.Add(key, value);
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
}
config.AppSettings.Settings.Add(key, value);
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
catch (Exception) { }
}
}
}

0 comments on commit f0e2ecd

Please sign in to comment.