1010#include " DragDropManager.h"
1111#include " DPIManager.h"
1212#include " SettingsManager.h"
13+ #include " CacheManager.h"
1314
1415#pragma comment(lib, "comctl32.lib")
1516#pragma comment(lib, "shell32.lib")
@@ -139,25 +140,58 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow, LPWSTR lpCmdLine)
139140 }
140141 if (!filePath.empty ())
141142 {
142- if (g_parser.LoadPDB (filePath))
143+ size_t dotPos = filePath.find_last_of (L' .' );
144+ if (dotPos != std::wstring::npos)
143145 {
144- g_parser.SetProgressCallback ([](int progress, const std::wstring& text) {
145- std::wstring status = L" 解析中: " + text + L" (" + std::to_wstring (progress) + L" %)" ;
146- UpdateStatusBar (status);
147- });
148- g_moduleInfo = g_parser.ParseModule ();
149- g_moduleInfo.pdbFileName = filePath;
150- g_pdbLoaded = true ;
151-
152- PopulateTreeView ();
153-
154- std::wstringstream ss;
155- ss << L" 已加载: " << filePath
156- << L" | 函数: " << g_moduleInfo.functions .size ()
157- << L" | 类: " << g_moduleInfo.classes .size ()
158- << L" | 结构体: " << g_moduleInfo.structs .size ()
159- << L" | 联合体: " << g_moduleInfo.unions .size ();
160- UpdateStatusBar (ss.str ());
146+ std::wstring extension = filePath.substr (dotPos);
147+ for (size_t i = 0 ; i < extension.length (); i++)
148+ {
149+ extension[i] = towlower (extension[i]);
150+ }
151+
152+ if (extension == L" .pdb" )
153+ {
154+ if (g_parser.LoadPDB (filePath))
155+ {
156+ g_parser.SetProgressCallback ([](int progress, const std::wstring& text) {
157+ std::wstring status = L" 解析中: " + text + L" (" + std::to_wstring (progress) + L" %)" ;
158+ UpdateStatusBar (status);
159+ });
160+ g_moduleInfo = g_parser.ParseModule ();
161+ g_moduleInfo.pdbFileName = filePath;
162+ g_pdbLoaded = true ;
163+
164+ PopulateTreeView ();
165+
166+ std::wstringstream ss;
167+ ss << L" 已加载: " << filePath
168+ << L" | 函数: " << g_moduleInfo.functions .size ()
169+ << L" | 类: " << g_moduleInfo.classes .size ()
170+ << L" | 结构体: " << g_moduleInfo.structs .size ()
171+ << L" | 联合体: " << g_moduleInfo.unions .size ();
172+ UpdateStatusBar (ss.str ());
173+ }
174+ }
175+ else if (extension == L" .pdbbc" )
176+ {
177+ ModuleInfo moduleInfo;
178+ std::wstring errorMsg;
179+ if (CacheManager::GetInstance ().LoadCache (moduleInfo, filePath, errorMsg))
180+ {
181+ g_moduleInfo = moduleInfo;
182+ g_pdbLoaded = true ;
183+
184+ PopulateTreeView ();
185+
186+ std::wstringstream ss;
187+ ss << L" 已从缓存加载: " << filePath
188+ << L" | 函数: " << g_moduleInfo.functions .size ()
189+ << L" | 类: " << g_moduleInfo.classes .size ()
190+ << L" | 结构体: " << g_moduleInfo.structs .size ()
191+ << L" | 联合体: " << g_moduleInfo.unions .size ();
192+ UpdateStatusBar (ss.str ());
193+ }
194+ }
161195 }
162196 }
163197 }
@@ -183,6 +217,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
183217 case ID_MENU_OPEN :
184218 OpenPDBFile (hWnd);
185219 break ;
220+ case ID_MENU_OPEN_CACHE :
221+ OpenCacheFile (hWnd);
222+ break ;
186223 case ID_MENU_EXPORT_CSV :
187224 ExportToCSV (hWnd);
188225 break ;
0 commit comments