FIX: [STUDIO-3892] warn bambu source dll from another install
Change-Id: I23ae1b93d99035135786a6f40321475ea6c1c373
This commit is contained in:
parent
7a3dcda2a2
commit
87e8c64cb0
|
@ -79,14 +79,15 @@ void wxMediaCtrl2::Load(wxURI url)
|
||||||
key2.QueryRawValue("Source Filter", clsid);
|
key2.QueryRawValue("Source Filter", clsid);
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": clsid %1% path %2%") % clsid % path;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": clsid %1% path %2%") % clsid % path;
|
||||||
|
|
||||||
|
std::string data_dir_str = Slic3r::data_dir();
|
||||||
|
boost::filesystem::path data_dir_path(data_dir_str);
|
||||||
|
auto dll_path = data_dir_path / "plugins" / "BambuSource.dll";
|
||||||
|
|
||||||
if (path.empty() || !wxFile::Exists(path) || clsid != CLSID_BAMBU_SOURCE) {
|
if (path.empty() || !wxFile::Exists(path) || clsid != CLSID_BAMBU_SOURCE) {
|
||||||
std::string data_dir_str = Slic3r::data_dir();
|
|
||||||
boost::filesystem::path data_dir_path(data_dir_str);
|
|
||||||
auto dll_path = data_dir_path / "plugins" / "BambuSource.dll";
|
|
||||||
if (boost::filesystem::exists(dll_path)) {
|
if (boost::filesystem::exists(dll_path)) {
|
||||||
CallAfter(
|
CallAfter(
|
||||||
[dll_path] {
|
[dll_path] {
|
||||||
int res = wxMessageBox(_L("BambuSource has not correctly been registered for media playing! Press Yes to re-register it."), _L("Error"), wxYES_NO);
|
int res = wxMessageBox(_L("BambuSource has not correctly been registered for media playing! Press Yes to re-register it."), _L("Error"), wxYES_NO | wxICON_ERROR);
|
||||||
if (res == wxYES) {
|
if (res == wxYES) {
|
||||||
SHELLEXECUTEINFO info{sizeof(info), 0, NULL, L"runas", L"regsvr32", dll_path.wstring().c_str(), SW_HIDE };
|
SHELLEXECUTEINFO info{sizeof(info), 0, NULL, L"runas", L"regsvr32", dll_path.wstring().c_str(), SW_HIDE };
|
||||||
::ShellExecuteEx(&info);
|
::ShellExecuteEx(&info);
|
||||||
|
@ -94,7 +95,7 @@ void wxMediaCtrl2::Load(wxURI url)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
CallAfter([] {
|
CallAfter([] {
|
||||||
wxMessageBox(_L("Missing BambuSource component registered for media playing! Please re-install BambuStutio or seek after-sales help."), _L("Error"), wxOK);
|
wxMessageBox(_L("Missing BambuSource component registered for media playing! Please re-install BambuStutio or seek after-sales help."), _L("Error"), wxOK | wxICON_ERROR);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
m_error = clsid != CLSID_BAMBU_SOURCE ? 101 : path.empty() ? 102 : 103;
|
m_error = clsid != CLSID_BAMBU_SOURCE ? 101 : path.empty() ? 102 : 103;
|
||||||
|
@ -104,6 +105,17 @@ void wxMediaCtrl2::Load(wxURI url)
|
||||||
wxPostEvent(this, event);
|
wxPostEvent(this, event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (path != dll_path) {
|
||||||
|
static bool notified = false;
|
||||||
|
if (!notified) CallAfter([dll_path] {
|
||||||
|
int res = wxMessageBox(_L("Using a BambuSource from a different install, video play may not work correctly!"), _L("Warning"), wxOK | wxICON_WARNING);
|
||||||
|
if (res == wxYES) {
|
||||||
|
SHELLEXECUTEINFO info{sizeof(info), 0, NULL, L"runas", L"regsvr32", dll_path.wstring().c_str(), SW_HIDE};
|
||||||
|
::ShellExecuteEx(&info);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
notified = true;
|
||||||
|
}
|
||||||
wxRegKey keyWmp(wxRegKey::HKCU, "SOFTWARE\\Microsoft\\MediaPlayer\\Player\\Extensions\\.");
|
wxRegKey keyWmp(wxRegKey::HKCU, "SOFTWARE\\Microsoft\\MediaPlayer\\Player\\Extensions\\.");
|
||||||
keyWmp.Create();
|
keyWmp.Create();
|
||||||
long permissions = 0;
|
long permissions = 0;
|
||||||
|
|
Loading…
Reference in New Issue