Skip to content

Commit

Permalink
新增检查到更新时显示更新内容。
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongyang219 committed Jan 20, 2018
1 parent c4b4ba3 commit f32ccab
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
18 changes: 14 additions & 4 deletions TrafficMonitor/TrafficMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,21 @@ void CTrafficMonitorApp::CheckUpdate(bool message)
return;
}

size_t index, index1, index2, index3;
size_t index, index1, index2, index3, index4, index5;
index = version_info.find(L"<version>");
index1 = version_info.find(L"</version>");
index2 = version_info.find(L"<link>");
index3 = version_info.find(L"</link>");
wstring version;
wstring link;
index4 = version_info.find(L"<contents>");
index5 = version_info.find(L"</contents>");
wstring version; //程序版本
wstring link; //下载链接
wstring contents; //更新内容
version = version_info.substr(index + 9, index1 - index - 9);
link = version_info.substr(index2 + 6, index3 - index2 - 6);
contents = version_info.substr(index4 + 10, index5 - index4 - 10);
CString contents_str = contents.c_str();
contents_str.Replace(L"\\n", L"\r\n");
if (index == wstring::npos || index1 == wstring::npos || index2 == wstring::npos || index3 == wstring::npos || version.empty() || link.empty())
{
if (message)
Expand All @@ -84,7 +90,11 @@ void CTrafficMonitorApp::CheckUpdate(bool message)
if (version > VERSION) //如果服务器上的版本大于本地版本
{
CString info;
info.Format(_T("检测到新版本 V%s,是否前往更新?"), version.c_str());
if (contents.empty())
info.Format(_T("检测到新版本 V%s,是否前往更新?"), version.c_str());
else
info.Format(_T("检测到新版本 V%s,更新内容:\r\n%s\r\n是否前往更新?"), version.c_str(), contents_str);

if (AfxMessageBox(info, MB_YESNO | MB_ICONQUESTION) == IDYES)
{
ShellExecute(NULL, _T("open"), link.c_str(), NULL, NULL, SW_SHOW); //转到下载链接
Expand Down
20 changes: 15 additions & 5 deletions TrafficMonitor/config.ini
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
[config]
transparency=80
always_on_top=0
always_on_top=1
lock_window_pos=0
show_notify_icon=1
show_cpu_memory=1
mouse_penetrate=0
show_task_bar_wnd=1
position_x=1830
position_y=1316
text_color=16384
position_x=1592
position_y=800
text_color=16777215
hide_main_window=0
skin_selected=.\skins\0ĬÈÏƤ·ô
skin_selected=\皮肤04
swap_up_down=0
font_name=微软雅黑
font_size=10
hide_main_wnd_when_fullscreen=1
up_string=上传: $
down_string=下载: $
cpu_string=CPU: $
memory_string=内存: $
[connection]
auto_select=1
connection_name=Marvell AVASTAR Wireless-AC Network Controller-WFP Native MAC Layer LightWeight Filter-0000
Expand All @@ -23,6 +28,11 @@ task_bar_text_color=16777215
tack_bar_show_cpu_memory=1
tack_bar_font_name=微软雅黑
tack_bar_font_size=9
task_bar_swap_up_down=0
up_string=↑: $
down_string=↓: $
cpu_string=CPU: $
memory_string=内存: $
[other]
no_multistart_warning=0
[general]
Expand Down
2 changes: 1 addition & 1 deletion TrafficMonitor/history_traffic.dat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
2018/01/20 35
2018/01/20 544
2017/06/25 0
2017/06/04 10
2017/05/30 263
Expand Down

0 comments on commit f32ccab

Please sign in to comment.