|
|
|
@@ -7,6 +7,7 @@
|
|
|
|
|
#include "SiaDriveDlg.h"
|
|
|
|
|
#include "afxdialogex.h"
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <bitset>
|
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
#define new DEBUG_NEW
|
|
|
|
@@ -18,8 +19,28 @@ wept saxophone dialect depth update jaunt loincloth asleep lush gnome laptop upp
|
|
|
|
|
|
|
|
|
|
* Work Test
|
|
|
|
|
names amaze when afraid inmate hull hexagon etched niece rudely tudor unopened acidic swagger emit shrugged noises tycoon leech tubes shrugged bulb inexact plywood tuesday rims cease excess aces
|
|
|
|
|
|
|
|
|
|
* Work Test2
|
|
|
|
|
ornament alkaline gasp pepper upkeep ablaze number sizes toyed sawmill looking bygones dwarf nerves session cake jerseys niche arrow howls omission verification identity waffle pockets giving hiding river acoustic
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static std::set<std::string> GetAvailableDrives()
|
|
|
|
|
{
|
|
|
|
|
static const std::vector<char> alpha = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
|
|
|
|
|
std::bitset<sizeof(DWORD) * 8> drives(~GetLogicalDrives());
|
|
|
|
|
|
|
|
|
|
std::set<std::string> avail;
|
|
|
|
|
for (size_t i = 0; i < alpha.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
if (drives[i])
|
|
|
|
|
{
|
|
|
|
|
avail.insert(std::string(1, alpha[i]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return std::move(avail);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CAboutDlg dialog used for App About
|
|
|
|
|
|
|
|
|
|
class CAboutDlg : public CDialogEx
|
|
|
|
@@ -96,7 +117,7 @@ END_MESSAGE_MAP()
|
|
|
|
|
BOOL CSiaDriveDlg::OnInitDialog()
|
|
|
|
|
{
|
|
|
|
|
CDHtmlDialog::OnInitDialog();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add "About..." menu item to system menu.
|
|
|
|
|
|
|
|
|
|
// IDM_ABOUTBOX must be in the system command range.
|
|
|
|
@@ -167,7 +188,7 @@ void CSiaDriveDlg::OnPaint()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOL CSiaDriveDlg::CallClientScript(LPCTSTR pStrFuncName, CStringArray* pArrFuncArgs, CComVariant* pOutVarRes)
|
|
|
|
|
BOOL CSiaDriveDlg::CallClientScript(LPCTSTR pStrFuncName, const json& json, CComVariant* pOutVarRes)
|
|
|
|
|
{
|
|
|
|
|
BOOL bRes = FALSE;
|
|
|
|
|
CComVariant vaResult;
|
|
|
|
@@ -183,24 +204,14 @@ BOOL CSiaDriveDlg::CallClientScript(LPCTSTR pStrFuncName, CStringArray* pArrFunc
|
|
|
|
|
DISPID dispid = NULL;
|
|
|
|
|
if (SUCCEEDED(spScript->GetIDsOfNames(IID_NULL, &bstrMember, 1, LOCALE_USER_DEFAULT, &dispid)))
|
|
|
|
|
{
|
|
|
|
|
COleSafeArray ar;
|
|
|
|
|
ar.CreateOneDim(VT_VARIANT, pArrFuncArgs->GetSize());
|
|
|
|
|
for (long i = 0; i < pArrFuncArgs->GetSize(); i++)
|
|
|
|
|
{
|
|
|
|
|
CComVariant v(pArrFuncArgs->GetAt(i));
|
|
|
|
|
ar.PutElement(&i, &v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long l = 0;
|
|
|
|
|
COleSafeArray sa;
|
|
|
|
|
sa.CreateOneDim(VT_VARIANT, 1);
|
|
|
|
|
sa.PutElement(&l, ar);
|
|
|
|
|
VARIANT v[1];
|
|
|
|
|
v[0] = CComVariant(CA2W(json.dump().c_str()));
|
|
|
|
|
|
|
|
|
|
//Putting parameters
|
|
|
|
|
DISPPARAMS dispparams;
|
|
|
|
|
memset(&dispparams, 0, sizeof dispparams);
|
|
|
|
|
dispparams.cArgs = 1;
|
|
|
|
|
dispparams.rgvarg = sa;
|
|
|
|
|
dispparams.rgvarg = v;
|
|
|
|
|
dispparams.cNamedArgs = 0;
|
|
|
|
|
|
|
|
|
|
EXCEPINFO excepInfo;
|
|
|
|
@@ -275,11 +286,6 @@ HRESULT CSiaDriveDlg::OnButtonUnlockWallet(IHTMLElement* /*pElement*/)
|
|
|
|
|
|
|
|
|
|
HRESULT CSiaDriveDlg::OnButtonMount(IHTMLElement* /*pElement*/)
|
|
|
|
|
{
|
|
|
|
|
CStringArray driveList;
|
|
|
|
|
driveList.Add(L"S");
|
|
|
|
|
driveList.Add(L"T");
|
|
|
|
|
CallClientScript(L"setAvailableDrives", &driveList, nullptr);
|
|
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -451,6 +457,7 @@ void CSiaDriveDlg::ConfigureWallet()
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CallClientScript(L"setAvailableDrives", json(GetAvailableDrives()), nullptr);
|
|
|
|
|
SetMainWindow(L"tab_view");
|
|
|
|
|
|
|
|
|
|
switch (_siaConfig.GetUI_Main_TabIndex())
|
|
|
|
|