diff --git a/BesLyric/BesLyric.aps b/BesLyric/BesLyric.aps
index 46196ad..2346eac 100644
Binary files a/BesLyric/BesLyric.aps and b/BesLyric/BesLyric.aps differ
diff --git a/BesLyric/BesLyric.rc b/BesLyric/BesLyric.rc
index be8e73f..7e1c9ce 100644
Binary files a/BesLyric/BesLyric.rc and b/BesLyric/BesLyric.rc differ
diff --git a/BesLyric/BesLyric.vcxproj b/BesLyric/BesLyric.vcxproj
index ffc58ac..7202fd1 100644
--- a/BesLyric/BesLyric.vcxproj
+++ b/BesLyric/BesLyric.vcxproj
@@ -138,6 +138,7 @@
+
@@ -184,6 +185,7 @@
+
diff --git a/BesLyric/BesLyric.vcxproj.filters b/BesLyric/BesLyric.vcxproj.filters
index 6b61d4c..154683e 100644
--- a/BesLyric/BesLyric.vcxproj.filters
+++ b/BesLyric/BesLyric.vcxproj.filters
@@ -205,6 +205,9 @@
Header Files\lib\md5
+
+ Source Files\entity
+
@@ -374,6 +377,9 @@
Header Files\lib\md5
+
+ Header Files\entity
+
diff --git a/BesLyric/Define.h b/BesLyric/Define.h
index 1521709..e37d75e 100644
--- a/BesLyric/Define.h
+++ b/BesLyric/Define.h
@@ -167,7 +167,7 @@ struct UpdateItem
Y��ʾ�ΰ汾���ϴ���ʱ����
Z��ʾ�ĺţ�С����ʱ����
*/
-static const wstring VERSION_NUMBER = L"2.2.3"; //�汾�ţ�ע��ÿ�θ��İ汾��ʱ��Ҫ����2����1�������1���� BesLyric.rc �е�Version��
+static const wstring VERSION_NUMBER = L"2.2.4"; //�汾�ţ�ע��ÿ�θ��İ汾��ʱ��Ҫ����2����1�������1���� BesLyric.rc �е�Version��
// v 2.1.10 �Լ���ǰ�İ汾ʹ�õ�����
static const wstring LINK_VERSION_LOG= L"http://files.cnblogs.com/files/BensonLaur/versionLog.zip"; //���ӣ�ָ��汾��־�ļ�
diff --git a/BesLyric/MainDlg.cpp b/BesLyric/MainDlg.cpp
index e1b237d..a9ffc82 100644
--- a/BesLyric/MainDlg.cpp
+++ b/BesLyric/MainDlg.cpp
@@ -61,12 +61,12 @@ void CMainDlg::test()
//CDownloader::DownloadFile( L"http://music.163.com/song/media/outer/url?id=1111.mp3",
// L"C:\\Users\\BensonLaur\\Desktop\\NetEase\\test.mp3");
- string md5;
- CCheckIntegrityThread::GetFileMd5(L"E:\\git\\BesLyric\\Debug\\imgdecoder-gdip.dll", md5);
- CCheckIntegrityThread::GetFileMd5(L"E:\\git\\BesLyric\\Debug\\render-gdi.dll", md5);
- CCheckIntegrityThread::GetFileMd5(L"E:\\git\\BesLyric\\Debug\\soui.dll", md5);
- CCheckIntegrityThread::GetFileMd5(L"E:\\git\\BesLyric\\Debug\\soui-sys-resource.dll", md5);
- CCheckIntegrityThread::GetFileMd5(L"E:\\git\\BesLyric\\Debug\\utilities.dll", md5);
+ //string md5;
+ //CCheckIntegrityThread::GetFileMd5(L"E:\\git\\BesLyric\\Debug\\imgdecoder-gdip.dll", md5);
+ //CCheckIntegrityThread::GetFileMd5(L"E:\\git\\BesLyric\\Debug\\render-gdi.dll", md5);
+ //CCheckIntegrityThread::GetFileMd5(L"E:\\git\\BesLyric\\Debug\\soui.dll", md5);
+ //CCheckIntegrityThread::GetFileMd5(L"E:\\git\\BesLyric\\Debug\\soui-sys-resource.dll", md5);
+ //CCheckIntegrityThread::GetFileMd5(L"E:\\git\\BesLyric\\Debug\\utilities.dll", md5);
}
@@ -78,19 +78,6 @@ CMainDlg::CMainDlg() : SHostWnd(_T("LAYOUT:XML_MAINWND"))
m_pageResult = NULL;
m_pageSearchLyric = NULL;
m_pageSearchNcmID = NULL;
-
- //初始化etc文件并清理相关文件
- initFloderAndFile();
-
-
- //启动自动更新线程
- AutoUpdateThread::getSingleton().Start();
-
- //检测程序的完整性
- CCheckIntegrityThread::getSingleton().Start(false);
-
- //test
- test();
}
CMainDlg::~CMainDlg()
@@ -134,7 +121,17 @@ BOOL CMainDlg::OnInitDialog(HWND hWnd, LPARAM lParam)
//初始化记录页面播放足迹,详看变量的说明
FootPrintPage = -1;
- test();
+ //test();
+ //初始化页面之后再执行耗时的操作
+
+ //初始化etc文件并清理相关文件
+ initFloderAndFile();
+
+ //启动自动更新线程
+ AutoUpdateThread::getSingleton().Start();
+
+ //检测程序的完整性
+ CCheckIntegrityThread::getSingleton().Start(false);
return 0;
}
diff --git a/BesLyric/PageSearchNcmID.cpp b/BesLyric/PageSearchNcmID.cpp
index 42587b8..e50924c 100644
--- a/BesLyric/PageSearchNcmID.cpp
+++ b/BesLyric/PageSearchNcmID.cpp
@@ -8,12 +8,10 @@
#include "entity\NcmIDManager.h"
#include "utility\Downloader.h"
+#include "entity\LoadAndCheckNcmIDThread.h"
CPageSearchNcmID::CPageSearchNcmID()
{
- if(!CNcmIDManager::GetInstance()->LoadDataPairs())
- _MessageBox(NULL, L"����ncm��idӳ���ļ�ʧ��", L"��ʾ", MB_OK|MB_ICONINFORMATION);
-
m_pMainWnd = NULL; /* ������ָ�� */
m_window_search_ncm_id_tip = NULL;
@@ -72,6 +70,9 @@ void CPageSearchNcmID::Init(SHostWnd *pMainWnd)
pMcListView->SetAdapter(pAdapter);
pAdapter->Release();
}
+
+ //���̼߳��غͼ��NCMID ,֮����ʹ���̣߳�����Ϊ�ò���������ʱ
+ CLoadAndCheckNcmIDThread::getSingleton().Start();
}
//��������ڶ���
@@ -137,7 +138,7 @@ void CPageSearchNcmID::OnBtnSelectID()
{
if(!bValid)
{
- _MessageBox(M()->m_hWnd, L"��ǰ��дIDΪ��ЧID��ƥ��IDʧ��", L"��ʾ", MB_OK|MB_ICONINFORMATION);
+ _MessageBox(M()->m_hWnd, L"��ǰ��дIDΪ��ЧID �� ���Ӧ��������û�а�Ȩ��ƥ��IDʧ��", L"��ʾ", MB_OK|MB_ICONINFORMATION);
return;
}
}
@@ -233,113 +234,6 @@ void CPageSearchNcmID::ShowIDResult(IDSearchResult* pResult)
}
-////ѡ��ԭ��ʱ���·��
-//void CPageSearchNcmID::OnBtnSelectOriginLyricPath(LPCWSTR pFilePath)
-//{
-// BOOL bRet = TRUE;
-// LPCWSTR pPath = NULL;
-//
-// if(pFilePath == NULL)
-// {
-// SStringW pathBefore = m_editOriginLyricPath->GetWindowTextW();
-// CBrowseDlg Browser;
-// BOOL bRet = Browser.DoDirBrowse(::GetActiveWindow(),_T("ѡ�� ��ԭ��ʡ� ����·��"), TRUE, pathBefore);
-//
-// if(bRet == TRUE)
-// pPath = Browser.GetDirPath();
-// }
-// else
-// pPath = pFilePath;
-//
-// if(bRet == TRUE)
-// {
-// m_editOriginLyricPath->SetWindowTextW(pPath);
-// }
-//}
-//
-////ѡ��Lrc��ʱ���·��
-//void CPageSearchNcmID::OnBtnSelectLrcLyricPath(LPCWSTR pFilePath)
-//{
-// BOOL bRet = TRUE;
-// LPCWSTR pPath = NULL;
-//
-// if(pFilePath == NULL)
-// {
-// SStringW pathBefore = m_editLrcLyricPath->GetWindowTextW();
-// CBrowseDlg Browser;
-// BOOL bRet = Browser.DoDirBrowse(::GetActiveWindow(),_T("ѡ�� ��LRC��ʡ� ����·��"), TRUE, pathBefore);
-//
-// if(bRet == TRUE)
-// pPath = Browser.GetDirPath();
-// }
-// else
-// pPath = pFilePath;
-//
-// if(bRet == TRUE)
-// {
-// m_editLrcLyricPath->SetWindowTextW(pPath);
-// }
-//}
-//
-////����ԭ���
-//void CPageSearchNcmID::OnBtnSaveOriginLyricPath()
-//{
-// SStringW strContent = CStringHelper::Trim(m_editOriginLyricContent->GetWindowTextW(),L" \t\r\n");
-//
-// if(strContent.GetLength() == 0)
-// {
-// _MessageBox(M()->m_hWnd, L"�������Ϊ�գ������棡", L"��ʾ", MB_OK|MB_ICONINFORMATION);
-// return;
-// }
-//
-// SStringW strPath = m_editOriginLyricPath->GetWindowTextW();
-// SStringW strSong = CStringHelper::Trim(m_editOriginLyricName->GetWindowTextW());
-// SStringW strArtist = CStringHelper::Trim(m_editOriginLyricArtist->GetWindowTextW());
-// SStringW strConnector = (strSong.GetLength()!=0 && strArtist.GetLength() != 0)? L"-":L"";
-//
-// CFileDialogEx saveDlg(FALSE, strArtist+ strConnector+ strSong ,strPath.GetBuffer(1),L"txt",L"ԭ����ļ�(txt)\0*.txt;\0\0",OFN_OVERWRITEPROMPT, M()->m_hWnd);
-// int ret = saveDlg.DoModal();
-// if(ret == TRUE)
-// {
-// //���ı����ݱ��浽�ļ���
-// SStringW savePath = saveDlg.m_szFileName;
-// if(FileOperator::WriteToUtf8File(wstring(savePath.GetBuffer(1)), wstring(strContent.GetBuffer(1))))
-// _MessageBox(M()->m_hWnd, (L"ԭ����ѱ��棡\\n\\n����·����\\n"+savePath).GetBuffer(1), L"��ʾ", MB_OK|MB_ICONINFORMATION);
-// else
-// _MessageBox(M()->m_hWnd, (L"�������ʧ�ܣ�\\n\\n·����\\n"+savePath).GetBuffer(1), L"��ʾ", MB_OK|MB_ICONWARNING);
-// }
-//}
-//
-////����Lrc���
-//void CPageSearchNcmID::OnBtnSaveLrcLyricPath()
-//{
-// SStringW strContent = CStringHelper::Trim(m_editLrcLyricContent->GetWindowTextW(),L" \t\r\n");
-//
-// if(strContent.GetLength() == 0)
-// {
-// _MessageBox(M()->m_hWnd, L"�������Ϊ�գ������棡", L"��ʾ", MB_OK|MB_ICONINFORMATION);
-// return;
-// }
-//
-// SStringW strPath = m_editLrcLyricPath->GetWindowTextW();
-// SStringW strSong = CStringHelper::Trim(m_editLrcLyricName->GetWindowTextW());
-// SStringW strArtist = CStringHelper::Trim(m_editLrcLyricArtist->GetWindowTextW());
-// SStringW strConnector = (strSong.GetLength()!=0 && strArtist.GetLength() != 0)? L"-":L"";
-//
-// CFileDialogEx saveDlg(FALSE, strSong+ strConnector+ strArtist ,strPath.GetBuffer(1),L"lrc",L"LRC����ļ�(lrc)\0*.lrc;\0\0",OFN_OVERWRITEPROMPT, M()->m_hWnd);
-// int ret = saveDlg.DoModal();
-// if(ret == TRUE)
-// {
-// //���ı����ݱ��浽�ļ���
-// SStringW savePath = saveDlg.m_szFileName;
-// if(FileOperator::WriteToUtf8File(wstring(savePath.GetBuffer(1)), wstring(strContent.GetBuffer(1))))
-// _MessageBox(M()->m_hWnd, (L"LRC����ѱ��棡\\n\\n����·����\\n"+savePath).GetBuffer(1), L"��ʾ", MB_OK|MB_ICONINFORMATION);
-// else
-// _MessageBox(M()->m_hWnd, (L"�������ʧ�ܣ�\\n\\n·����\\n"+savePath).GetBuffer(1), L"��ʾ", MB_OK|MB_ICONWARNING);
-// }
-//}
-//
-
//���ݲ²����Զ���������ؼ��ʲ���ʼ����
void CPageSearchNcmID::OnSearchWithGuess(SongInfoGuessResult* pGuessRes)
{
diff --git a/BesLyric/PageSearchNcmID.h b/BesLyric/PageSearchNcmID.h
index 775139a..a82803a 100644
--- a/BesLyric/PageSearchNcmID.h
+++ b/BesLyric/PageSearchNcmID.h
@@ -68,11 +68,39 @@ class CSongIDMcAdapterFix : public SMcAdapterBase
pItem->FindChildByName(L"txt_mclv_music_artist")->SetWindowText(SStringW().Format(L"%s",pli->strMusicArtist.c_str()));
pItem->FindChildByName(L"txt_mclv_ncm_id")->SetWindowText(SStringW().Format(L"%s",pli->strSongID.c_str()));
+ SButton *pBtnView = pItem->FindChildByName2(L"btn_mclv_view");
+ pBtnView->SetUserData(position);
+ SButton *pBtnListen = pItem->FindChildByName2(L"btn_mclv_listen");
+ pBtnListen->SetUserData(position);
SButton *pBtnSelect = pItem->FindChildByName2(L"btn_mclv_select");
pBtnSelect->SetUserData(position);
+
+ pBtnView->GetEventSet()->subscribeEvent(EVT_CMD,Subscriber(&CSongIDMcAdapterFix::OnButtonViewClick,this));
+ pBtnListen->GetEventSet()->subscribeEvent(EVT_CMD,Subscriber(&CSongIDMcAdapterFix::OnButtonListenClick,this));
pBtnSelect->GetEventSet()->subscribeEvent(EVT_CMD,Subscriber(&CSongIDMcAdapterFix::OnButtonSelectClick,this));
}
+
+ bool OnButtonViewClick(EventArgs *pEvt)
+ {
+ SButton *pBtn = sobj_cast(pEvt->sender);
+ int iItem = pBtn->GetUserData();
+ SONG_ID_INFO *pli =m_IDInfo.GetData()+iItem;
+
+ wstring strLink = L"http://music.163.com/#/song?id=" + pli->strSongID;
+ ShellExecute(NULL,L"open",strLink.c_str() ,NULL, NULL,SW_SHOWNORMAL);
+ return true;
+ }
+
+ bool OnButtonListenClick(EventArgs *pEvt)
+ {
+ SButton *pBtn = sobj_cast(pEvt->sender);
+ int iItem = pBtn->GetUserData();
+ SONG_ID_INFO *pli =m_IDInfo.GetData()+iItem;
+
+ ShellExecute(NULL,L"open",(L"http://music.163.com/song/media/outer/url?id=" + pli->strSongID).c_str() ,NULL, NULL,SW_SHOWNORMAL);
+ return true;
+ }
bool OnButtonSelectClick(EventArgs *pEvt)
{
diff --git a/BesLyric/entity/CheckIntegrityThread.cpp b/BesLyric/entity/CheckIntegrityThread.cpp
index 89995ae..e621617 100644
--- a/BesLyric/entity/CheckIntegrityThread.cpp
+++ b/BesLyric/entity/CheckIntegrityThread.cpp
@@ -49,11 +49,10 @@ bool CCheckIntegrityThread::Start(bool bShowPassTip)
//��������߳�
m_handleThreadCheking = ::CreateThread(NULL, 0, ProcChecking, this, 0 ,NULL);
- ::WaitForSingleObject(m_EventUpdateDownloadDone, INFINITE); //�ȴ�update �ļ��������,�ŵ�������
-
+ //����UI�߳�
m_handleThreadUI = ::CreateThread(NULL, 0, ProcUI, this, 0 ,NULL);
- return (m_handleThreadCheking != NULL && m_handleThreadUI!=NULL);
+ return (m_handleThreadCheking != NULL);
}
@@ -114,6 +113,10 @@ DWORD WINAPI CCheckIntegrityThread::ProcUI(LPVOID pParam)
dlg.SetEventHandleForWndHandle(pThread->m_EventWndInitDone, &pThread->m_hCheckWnd, pThread);
+
+ ::WaitForSingleObject(pThread->m_EventUpdateDownloadDone, INFINITE); //�ȴ�update �ļ��������,�ŵ�������
+
+
int ret = dlg.DoModal(NULL);
return 0;
@@ -348,7 +351,8 @@ bool CCheckIntegrityThread::DownloadUpdateFileAndMark()
wstring strTempUpdate = m_wstrEtcFloder + L"tempDir\\update.xml" ;
if(!CDownloader::DownloadFile(LINK_UPDATE_ITEM_FILE, strTempUpdate))
{
- _MessageBox(NULL, L"������update.xml�ļ���������ʧ��", L"��ʾ", MB_OK|MB_ICONWARNING);
+ //����ʾʧ�ܣ���Ȼÿ�β�������������ʾ��һ��
+ //_MessageBox(NULL, L"������update.xml�ļ���������ʧ��", L"��ʾ", MB_OK|MB_ICONWARNING);
return false;
}
diff --git a/BesLyric/entity/LoadAndCheckNcmIDThread.cpp b/BesLyric/entity/LoadAndCheckNcmIDThread.cpp
new file mode 100644
index 0000000..57a1ae7
--- /dev/null
+++ b/BesLyric/entity/LoadAndCheckNcmIDThread.cpp
@@ -0,0 +1,23 @@
+#include "stdafx.h"
+#include "LoadAndCheckNcmIDThread.h"
+#include "NcmIDManager.h"
+
+//��ʼ�߳�
+bool CLoadAndCheckNcmIDThread::Start()
+{
+ //�����߳�
+ m_handleThread = ::CreateThread(NULL, 0, ProcLoadAndCheckNcmID, this, 0 ,NULL);
+
+ return (m_handleThread != NULL);
+}
+
+//�����߳�
+void CLoadAndCheckNcmIDThread::Stop(){}
+
+//��⣨�����أ� �߳�ִ�е�ַ
+DWORD WINAPI CLoadAndCheckNcmIDThread::ProcLoadAndCheckNcmID(LPVOID pParam)
+{
+ CNcmIDManager::GetInstance()->LoadAndCheckDataPairs();
+
+ return 0;
+}
diff --git a/BesLyric/entity/LoadAndCheckNcmIDThread.h b/BesLyric/entity/LoadAndCheckNcmIDThread.h
new file mode 100644
index 0000000..983b3cf
--- /dev/null
+++ b/BesLyric/entity/LoadAndCheckNcmIDThread.h
@@ -0,0 +1,52 @@
+/*
+ BesLyric һ�� ����������ʵ�õ� ר�������������������ֹ�����ʵ� �������������
+ Copyright (C) 2017
+ Author: BensonLaur
+ Author:
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+/**
+* @file LoadAndCheckNcmIDThread.h
+*
+* Describe ����һ���̣߳���������ncm ID ��������� ID�ĺϷ��� (֮����ʹ���̣߳�����Ϊ���������ܱȽϺ�ʱ��������ʱ���ᵼ�½��������Ӻ�)
+*/
+
+#pragma once
+#include "stdafx.h"
+#include "../utility/SSingleton.h"
+
+
+class CLoadAndCheckNcmIDThread : public Singleton
+{
+public:
+ // �������������
+ CLoadAndCheckNcmIDThread():m_handleThread(NULL){}
+
+ //��ʼ�߳�
+ bool Start();
+
+ //�����߳�
+ void Stop();
+
+private:
+
+ // �߳�ִ�е�ַ
+ static DWORD WINAPI ProcLoadAndCheckNcmID(LPVOID pParam);
+
+private:
+ HANDLE m_handleThread;
+};
+
diff --git a/BesLyric/entity/NcmIDManager.cpp b/BesLyric/entity/NcmIDManager.cpp
index 45fbeab..3827d1e 100644
--- a/BesLyric/entity/NcmIDManager.cpp
+++ b/BesLyric/entity/NcmIDManager.cpp
@@ -30,7 +30,7 @@ bool CNcmIDManager::SaveDataPairs()
}
//�������ݶ�
-bool CNcmIDManager::LoadDataPairs()
+bool CNcmIDManager::LoadAndCheckDataPairs()
{
//���ļ���������
wstring wstrPath = FileHelper::GetCurrentDirectoryStr() + FLODER_NAME_ETC + L"\\" + NCM_ID_FILE_NAME;
@@ -80,7 +80,7 @@ bool CNcmIDManager::LoadDataPairs()
}
}
else
- SaveDataPairs();
+ SaveDataPairs(); //�ļ������ڣ������յ��ļ�
//��������Ŀ���У���ʱ�����ݽ��м�У�飬���´���
map< wstring, wstring> mapNcmIDTemp;
diff --git a/BesLyric/entity/NcmIDManager.h b/BesLyric/entity/NcmIDManager.h
index 89b2fe6..fa82bfa 100644
--- a/BesLyric/entity/NcmIDManager.h
+++ b/BesLyric/entity/NcmIDManager.h
@@ -38,7 +38,7 @@ class CNcmIDManager
public:
bool SaveDataPairs(); //�������ݶ�
- bool LoadDataPairs(); //�������ݶ�
+ bool LoadAndCheckDataPairs(); //�������ݶ�,���������ȥ����Ч��
bool FindID( wstring fileName,OUT wstring& id); //����ID
void InsertNcmIDPair( wstring fileName, wstring id); //����ID��
diff --git a/BesLyric/res/resource.h b/BesLyric/res/resource.h
index 74c1173..41bbf36 100644
Binary files a/BesLyric/res/resource.h and b/BesLyric/res/resource.h differ
diff --git a/BesLyric/uires/xml/page_search_ncm_id.xml b/BesLyric/uires/xml/page_search_ncm_id.xml
index f28816d..613319c 100644
--- a/BesLyric/uires/xml/page_search_ncm_id.xml
+++ b/BesLyric/uires/xml/page_search_ncm_id.xml
@@ -74,7 +74,9 @@
- 选用
+ 查看
+ 试听
+ 选用