Skip to content

Commit 3a3cd7b

Browse files
authored
Merge pull request #54 from FFMG/develop
Develop
2 parents 64fd9e0 + f941b36 commit 3a3cd7b

File tree

149 files changed

+6404
-4856
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+6404
-4856
lines changed

monitor/ActionMonitor/Action.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void Action::SetCommandPath(const std::wstring& szPath )
126126
* \param isPrivileged if we need administrator privilege to run this.
127127
* \return BOOL true.
128128
*/
129-
ActiveAction* Action::CreateActiveAction(CWnd* pWnd, const std::wstring& szCommandLine, const bool isPrivileged) const
129+
ActiveAction* Action::CreateActiveAction(IVirtualMachines& virtualMachines, CWnd* pWnd, const std::wstring& szCommandLine, const bool isPrivileged) const
130130
{
131131
// not sure how to do that...
132132
if ( Len() == 0)
@@ -144,12 +144,12 @@ ActiveAction* Action::CreateActiveAction(CWnd* pWnd, const std::wstring& szComma
144144
ActiveAction* aa;
145145
if( szCommandLine.length() == 0 )
146146
{
147-
aa = CreateActiveActionWithNoCommandLine( pWnd, isPrivileged);
147+
aa = CreateActiveActionWithNoCommandLine( virtualMachines, pWnd, isPrivileged);
148148
}
149149
else
150150
{
151151
// so now, at last we can call the command line
152-
aa = CreateActiveActionDirect( pWnd, szCommandLine.c_str(), isPrivileged);
152+
aa = CreateActiveActionDirect( virtualMachines, pWnd, szCommandLine.c_str(), isPrivileged);
153153
}
154154

155155
// now that we are back from calling the plugin, restore the keyboard state.
@@ -164,7 +164,7 @@ ActiveAction* Action::CreateActiveAction(CWnd* pWnd, const std::wstring& szComma
164164
* \param isPrivileged if this action is privileged or not.
165165
* \return bool success or not.
166166
*/
167-
ActiveAction* Action::CreateActiveActionWithNoCommandLine(CWnd* pWnd, const bool isPrivileged ) const
167+
ActiveAction* Action::CreateActiveActionWithNoCommandLine(IVirtualMachines& virtualMachines, CWnd* pWnd, const bool isPrivileged ) const
168168
{
169169
// the command line we will try and make.
170170
std::wstring szCommandLine = L"";
@@ -209,7 +209,7 @@ ActiveAction* Action::CreateActiveActionWithNoCommandLine(CWnd* pWnd, const bool
209209
}
210210

211211
// we can now do it direct.
212-
return CreateActiveActionDirect( pWnd, szCommandLine, isPrivileged);
212+
return CreateActiveActionDirect( virtualMachines, pWnd, szCommandLine, isPrivileged);
213213
}
214214

215215
/**
@@ -367,7 +367,7 @@ bool Action::Execute(const std::vector<std::wstring>& argv, const bool isPrivile
367367
* \param isPrivileged if we need administrator privilege to run this.
368368
* \return TRUE|FALSE success or not.
369369
*/
370-
ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& szCommandLine, const bool isPrivileged) const
370+
ActiveAction* Action::CreateActiveActionDirect(IVirtualMachines& virtualMachines, CWnd* pWnd, const std::wstring& szCommandLine, const bool isPrivileged) const
371371
{
372372
// sanity check
373373
if (0 == _szFile.length())
@@ -383,7 +383,7 @@ ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& s
383383
//
384384
if (LuaVirtualMachine::IsExt(_szFile ))
385385
{
386-
auto ala = new ActiveLuaAction(*this, hTopHWnd, szCommandLine, isPrivileged);
386+
auto ala = new ActiveLuaAction(*this, virtualMachines, hTopHWnd, szCommandLine, isPrivileged);
387387
if (ala->Initialize())
388388
{
389389
return ala;
@@ -399,7 +399,7 @@ ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& s
399399
//
400400
if (PythonVirtualMachine::IsExt(_szFile))
401401
{
402-
auto apa = new ActivePythonAction(*this, hTopHWnd, szCommandLine, isPrivileged);
402+
auto apa = new ActivePythonAction(*this, virtualMachines, hTopHWnd, szCommandLine, isPrivileged);
403403
if(apa->Initialize() )
404404
{
405405
return apa;
@@ -415,13 +415,13 @@ ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& s
415415
//
416416
if (PowershellVirtualMachine::IsExt(_szFile))
417417
{
418-
auto apa = new ActivePowershellAction(*this, hTopHWnd, szCommandLine, isPrivileged);
418+
auto apa = new ActivePowershellAction(*this, virtualMachines, hTopHWnd, szCommandLine, isPrivileged);
419419
if (apa->Initialize())
420420
{
421421
return apa;
422422
}
423423

424-
// did not work, try the default way...
424+
// did not work, try the default way...`
425425
delete apa;
426426
}
427427
#endif // ACTIONMONITOR_PS_PLUGIN
@@ -431,7 +431,7 @@ ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& s
431431
//
432432
if (ShellVirtualMachine::IsExt(_szFile))
433433
{
434-
auto asa = new ActiveShellAction(*this, hTopHWnd, szCommandLine, isPrivileged);
434+
auto asa = new ActiveShellAction(*this, virtualMachines, hTopHWnd, szCommandLine, isPrivileged);
435435
if (asa->Initialize())
436436
{
437437
return asa;
@@ -447,7 +447,7 @@ ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& s
447447
//
448448
if (CsVirtualMachine::IsExt(_szFile))
449449
{
450-
auto acsa = new ActiveCsAction(*this, hTopHWnd, szCommandLine, isPrivileged);
450+
auto acsa = new ActiveCsAction(*this, virtualMachines, hTopHWnd, szCommandLine, isPrivileged);
451451
if (acsa->Initialize())
452452
{
453453
return acsa;
@@ -463,7 +463,7 @@ ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& s
463463
//
464464
if (PluginVirtualMachine::IsExt(_szFile))
465465
{
466-
auto apa = new ActivePluginAction(*this, hTopHWnd, szCommandLine, isPrivileged);
466+
auto apa = new ActivePluginAction(*this, virtualMachines, hTopHWnd, szCommandLine, isPrivileged);
467467
if (apa->Initialize())
468468
{
469469
return apa;
@@ -477,21 +477,21 @@ ActiveAction* Action::CreateActiveActionDirect(CWnd* pWnd, const std::wstring& s
477477
// Batch files...
478478
if( myodd::files::IsExtension (_szFile, _T("bat")))
479479
{
480-
return new ActiveBatchAction(*this, hTopHWnd, szCommandLine );
480+
return new ActiveBatchAction(*this, virtualMachines, hTopHWnd, szCommandLine );
481481
}
482482
if (myodd::files::IsExtension(_szFile, _T("cmd")))
483483
{
484-
return new ActiveCmdAction(*this, hTopHWnd, szCommandLine);
484+
return new ActiveCmdAction(*this, virtualMachines, hTopHWnd, szCommandLine);
485485
}
486486
if (myodd::files::IsExtension(_szFile, _T("com")))
487487
{
488-
return new ActiveComAction(*this, hTopHWnd, szCommandLine);
488+
return new ActiveComAction(*this, virtualMachines, hTopHWnd, szCommandLine);
489489
}
490490
if (myodd::files::IsExtension(_szFile, _T("exe")))
491491
{
492-
return new ActiveExeAction(*this, hTopHWnd, szCommandLine, isPrivileged);
492+
return new ActiveExeAction(*this, virtualMachines, hTopHWnd, szCommandLine, isPrivileged);
493493
}
494494

495495
// run the default action.
496-
return new ActiveDefaultAction( *this, hTopHWnd, szCommandLine, isPrivileged );
496+
return new ActiveDefaultAction( *this, virtualMachines, hTopHWnd, szCommandLine, isPrivileged );
497497
}

monitor/ActionMonitor/Action.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <vector>
4+
#include "../api/IVirtualMachines.h"
45

56
class ActiveAction;
67
class Action
@@ -22,11 +23,11 @@ class Action
2223

2324
// Do that action with the arguments passed
2425
// if we have no argument then we look in the clipboard
25-
virtual ActiveAction* CreateActiveAction(CWnd* pWnd, const std::wstring& szCommandLine, bool isPrivileged) const;
26+
virtual ActiveAction* CreateActiveAction(IVirtualMachines& virtualMachines, CWnd* pWnd, const std::wstring& szCommandLine, bool isPrivileged) const;
2627

2728
// Same as CreateActiveAction( ... ) but we don't get anything from the clipboard
2829
// only will use what was given to us without further checks.
29-
ActiveAction* CreateActiveActionDirect(CWnd* pWnd, const std::wstring& szCommandLine, bool isPrivileged ) const;
30+
ActiveAction* CreateActiveActionDirect( IVirtualMachines& virtualMachines, CWnd* pWnd, const std::wstring& szCommandLine, bool isPrivileged ) const;
3031

3132
/**
3233
* \brief get the command string
@@ -39,7 +40,7 @@ class Action
3940
size_t Len() const { return _szCommand.length();}
4041

4142
protected:
42-
ActiveAction* CreateActiveActionWithNoCommandLine(CWnd* pWnd, bool isPrivileged ) const;
43+
ActiveAction* CreateActiveActionWithNoCommandLine(IVirtualMachines& virtualMachines, CWnd* pWnd, bool isPrivileged ) const;
4344

4445
/**
4546
* \brief convert a multi line piece of text to a single line.

monitor/ActionMonitor/ActionBye.cpp

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,45 @@
1-
// Action.cpp: implementation of the Action class.
1+
//This file is part of Myoddweb.Piger.
22
//
3-
//////////////////////////////////////////////////////////////////////
4-
3+
// Myoddweb.Piger is free software: you can redistribute it and/or modify
4+
// it under the terms of the GNU General Public License as published by
5+
// the Free Software Foundation, either version 3 of the License, or
6+
// (at your option) any later version.
7+
//
8+
// Myoddweb.Piger is distributed in the hope that it will be useful,
9+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
11+
// GNU General Public License for more details.
12+
//
13+
// You should have received a copy of the GNU General Public License
14+
// along with Myoddweb.Piger. If not, see<https://www.gnu.org/licenses/gpl-3.0.en.html>.
515
#include "stdafx.h"
616
#include "ActionBye.h"
717
#include "ActionsCore.h"
818
#include "ActiveByeAction.h"
919

1020
/**
11-
* todo
12-
* @param void
13-
* @return void
21+
* \brief Constructor
22+
* \param application the application to close the app
1423
*/
15-
ActionBye::ActionBye( ) : Action( ACTION_CORE_BYE, L"" )
24+
ActionBye::ActionBye(IApplication& application ) :
25+
Action( ACTION_CORE_BYE, L"" ),
26+
_application(application)
1627
{
1728
}
1829

1930
/**
20-
* Destructor
21-
* @param void
22-
* @return void
31+
* \copydoc
2332
*/
2433
ActionBye::~ActionBye()
2534
{
2635
}
2736

2837
/**
29-
* Run the command, we take into account the current selection and command parameters given.
30-
* @param HWND hTopWindow the last foreground window
31-
* @return BOOL true.
38+
* \copydoc
3239
*/
33-
ActiveAction* ActionBye::CreateActiveAction(CWnd* pWnd, const MYODD_STRING& szCommandLine, bool isPrivileged) const
40+
ActiveAction* ActionBye::CreateActiveAction(IVirtualMachines& virtualMachines, CWnd* pWnd, const MYODD_STRING& szCommandLine, bool isPrivileged) const
3441
{
3542
// get the last forground window handle
36-
HWND hTopHWnd = pWnd ? pWnd->GetSafeHwnd() : NULL;
37-
return new ActiveByeAction( *this, hTopHWnd );
43+
const auto hTopHWnd = pWnd ? pWnd->GetSafeHwnd() : nullptr;
44+
return new ActiveByeAction( _application, *this, virtualMachines, hTopHWnd );
3845
}

monitor/ActionMonitor/ActionBye.h

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1-
// Action.h: interface for the Action class.
1+
//This file is part of Myoddweb.Piger.
22
//
3-
//////////////////////////////////////////////////////////////////////
4-
5-
#ifndef __ActionBye_h__
6-
#define __ActionBye_h__
3+
// Myoddweb.Piger is free software: you can redistribute it and/or modify
4+
// it under the terms of the GNU General Public License as published by
5+
// the Free Software Foundation, either version 3 of the License, or
6+
// (at your option) any later version.
7+
//
8+
// Myoddweb.Piger is distributed in the hope that it will be useful,
9+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
11+
// GNU General Public License for more details.
12+
//
13+
// You should have received a copy of the GNU General Public License
14+
// along with Myoddweb.Piger. If not, see<https://www.gnu.org/licenses/gpl-3.0.en.html>.
715
#pragma once
816

917
#include "Action.h"
18+
#include "IApplication.h"
1019

11-
class ActionBye : public Action
20+
class ActionBye final : public Action
1221
{
1322
public:
14-
ActionBye();
23+
explicit ActionBye(IApplication& application);
1524
virtual ~ActionBye();
1625

17-
virtual ActiveAction* CreateActiveAction(CWnd* pWnd, const MYODD_STRING& szCommandLine, bool isPrivileged) const;
18-
};
26+
ActiveAction* CreateActiveAction(IVirtualMachines& virtualMachines, CWnd* pWnd, const MYODD_STRING& szCommandLine, bool isPrivileged) const override;
1927

20-
#endif // __Action_h__
28+
private:
29+
IApplication& _application;
30+
};

monitor/ActionMonitor/ActionLoad.cpp

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,47 @@
1-
// Action.cpp: implementation of the Action class.
1+
//This file is part of Myoddweb.Piger.
22
//
3-
//////////////////////////////////////////////////////////////////////
4-
3+
// Myoddweb.Piger is free software: you can redistribute it and/or modify
4+
// it under the terms of the GNU General Public License as published by
5+
// the Free Software Foundation, either version 3 of the License, or
6+
// (at your option) any later version.
7+
//
8+
// Myoddweb.Piger is distributed in the hope that it will be useful,
9+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
11+
// GNU General Public License for more details.
12+
//
13+
// You should have received a copy of the GNU General Public License
14+
// along with Myoddweb.Piger. If not, see<https://www.gnu.org/licenses/gpl-3.0.en.html>.
515
#include "stdafx.h"
616
#include "ActionLoad.h"
717
#include "ActionsCore.h"
8-
#include "ActiveUserMessageAction.h"
18+
#include "ActiveLoadAction.h"
919

1020
/**
11-
* todo
12-
* @param void
13-
* @return void
21+
* \brief Constructor
22+
* \param application the application to close the app
1423
*/
15-
ActionLoad::ActionLoad( ) : Action( ACTION_CORE_LOAD, L"")
24+
ActionLoad::ActionLoad(IApplication& application) :
25+
Action( ACTION_CORE_LOAD, L""),
26+
_application(application)
1627
{
1728
}
1829

1930
/**
20-
* Destructor
21-
* @param void
22-
* @return void
31+
* \copydoc
2332
*/
2433
ActionLoad::~ActionLoad()
2534
{
2635
}
2736

2837
/**
29-
* Run the command, we take into account the current selection and command parameters given.
30-
* @param const MYODD_STRING& szCommandLine the command line argument.
31-
* @param bool isPrivileged if we need administrator privilege to run this.
32-
* @return BOOL true.
38+
* \copydoc
3339
*/
34-
ActiveAction* ActionLoad::CreateActiveAction(CWnd* pWnd, const MYODD_STRING& szCommandLine, bool isPrivileged) const
40+
ActiveAction* ActionLoad::CreateActiveAction(IVirtualMachines& virtualMachines, CWnd* pWnd, const MYODD_STRING& szCommandLine, bool isPrivileged) const
3541
{
3642
// get the last forground window handle
37-
auto hTopHWnd = pWnd ? pWnd->GetSafeHwnd() : NULL;
38-
return new ActiveUserMessageAction(*this, hTopHWnd, UWM_KEYBOARD_RELOAD);
43+
const auto hTopHWnd = pWnd ? pWnd->GetSafeHwnd() : nullptr;
44+
45+
// display the version.
46+
return new ActiveLoadAction(_application, *this, virtualMachines, hTopHWnd);
3947
}

monitor/ActionMonitor/ActionLoad.h

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1-
// Action.h: interface for the Action class.
1+
//This file is part of Myoddweb.Piger.
22
//
3-
//////////////////////////////////////////////////////////////////////
4-
5-
#ifndef __ActionLoad_h__
6-
#define __ActionLoad_h__
3+
// Myoddweb.Piger is free software: you can redistribute it and/or modify
4+
// it under the terms of the GNU General Public License as published by
5+
// the Free Software Foundation, either version 3 of the License, or
6+
// (at your option) any later version.
7+
//
8+
// Myoddweb.Piger is distributed in the hope that it will be useful,
9+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
11+
// GNU General Public License for more details.
12+
//
13+
// You should have received a copy of the GNU General Public License
14+
// along with Myoddweb.Piger. If not, see<https://www.gnu.org/licenses/gpl-3.0.en.html>.
715
#pragma once
8-
16+
#include "IApplication.h"
917
#include "Action.h"
1018

11-
class ActionLoad : public Action
19+
class ActionLoad final : public Action
1220
{
1321
public:
14-
ActionLoad();
22+
explicit ActionLoad(IApplication& application);
1523
virtual ~ActionLoad();
1624

17-
virtual ActiveAction* CreateActiveAction(CWnd* pWnd, const MYODD_STRING& szCommandLine, bool isPrivileged) const;
18-
};
25+
ActiveAction* CreateActiveAction(IVirtualMachines& virtualMachines, CWnd* pWnd, const MYODD_STRING& szCommandLine, bool isPrivileged) const override;
1926

20-
#endif // __Action_h__
27+
private:
28+
IApplication& _application;
29+
};

0 commit comments

Comments
 (0)