-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
279 additions
and
69 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\SpfAnalyzer\SpfAnalyzer.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="System.Management.Automation"> | ||
<HintPath>..\..\..\..\..\Windows\assembly\GAC_MSIL\System.Management.Automation\1.0.0.0__31bf3856ad364e35\System.Management.Automation.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<Target Name="CopyFiles" AfterTargets="CopyFilesToOutputDirectory"> | ||
<ItemGroup> | ||
<!-- Because this ItemGroup is inside the target, this will enumerate | ||
all files just before calling Copy. If the ItemGroup were outside | ||
the target , it would enumerate the files during evaluation, before | ||
the build starts, which may miss files created during the build. --> | ||
<BuildOutput Include="$(TargetPath)" /> | ||
</ItemGroup> | ||
<Copy SourceFiles="@(BuildOutput)" DestinationFolder="$(ProjectDir)/../../Module/SpfAnalyzer/lib/net8.0/" /> | ||
</Target> | ||
|
||
</Project> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Management.Automation; | ||
using System.Runtime.CompilerServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using SpfAnalyzer; | ||
|
||
namespace AutomationHelper | ||
{ | ||
public class Logger:ILogger | ||
{ | ||
private readonly PSCmdlet _cmdlet; | ||
public Logger(PSCmdlet cmdlet) | ||
{ | ||
_cmdlet = cmdlet; | ||
} | ||
public void LogWarning(string message) | ||
{ | ||
_cmdlet.WriteWarning(message); | ||
} | ||
public void LogError(string message, Exception? exception, int eventId, Object? targetObject ) | ||
{ | ||
ErrorCategory category = ErrorCategory.NotSpecified; | ||
if(Enum.IsDefined(typeof(ErrorCategory), eventId)) | ||
{ | ||
category = (ErrorCategory)eventId; | ||
} | ||
var err = new ErrorRecord(exception ?? new Exception(message), message, category, targetObject); | ||
_cmdlet.WriteError(err); | ||
} | ||
public void LogVerbose(string message) | ||
{ | ||
_cmdlet.WriteVerbose(message); | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.