Created
May 19, 2018 07:02
-
-
Save SteveGilham/27a733c96b499c9a4ed9c63f6d73141a to your computer and use it in GitHub Desktop.
a more complex cmdlet in C++/CLI -- header file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| using namespace System; | |
| using namespace System::IO; | |
| using namespace System::Management::Automation; | |
| namespace PSBook { namespace Commands | |
| { | |
| [Cmdlet(VerbsCommon::Set, "FileTouchTime", DefaultParameterSetName = "Path", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact::Medium)] | |
| public ref class SetFileTouchTimeCommand : | |
| public PSCmdlet | |
| { | |
| public: | |
| SetFileTouchTimeCommand(void); | |
| [Parameter(ParameterSetName = "Path", Mandatory = true, Position = 1, | |
| ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] | |
| property String ^ Path; | |
| [Parameter(ParameterSetName = "FileInfo", Mandatory = true, Position = 1, | |
| ValueFromPipeline = true)] | |
| property FileInfo ^ FileInfo; | |
| [Parameter] | |
| property DateTime Date; | |
| protected: | |
| virtual void ProcessRecord(void) override; | |
| private: | |
| void TouchFile(System::IO::FileInfo ^ fileInfo); | |
| void HandleFileNotFound(String ^ path, Exception ^ exception); | |
| Resources::ResourceManager ^ rm; | |
| }; | |
| }} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment