Skip to content

Commit

Permalink
Release 8 (#120)
Browse files Browse the repository at this point in the history
* Update Build (#87)

* adjust build props

* rename namespace

* remove versions form projects

* enable logging

* update deps 1

* use new test dl

* update tests

* change test

* update deps 2

* update deps 3

* removed a couple of warnings

* Versioning (#88)

* add gitversion

* nbgv and ci updates

* add global json

* test

* add delay

* update projects (#91)

* update projects

* remove url combine

* update projects

* Download manager update (#93)

* remove net48 target

* make dl fully async

* start generic verification context

* new verification

* fix local files get disposed

* disposing

* make download config immutable

* release 4.0

* fix not using io.abstractions

* add test cases

* Bump Microsoft.NET.Test.Sdk from 17.4.1 to 17.5.0 (#100)

Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.4.1 to 17.5.0.
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md)
- [Commits](microsoft/vstest@v17.4.1...v17.5.0)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump System.IO.Abstractions from 19.1.13 to 19.2.1 (#101)

Bumps [System.IO.Abstractions](https://github.com/TestableIO/System.IO.Abstractions) from 19.1.13 to 19.2.1.
- [Release notes](https://github.com/TestableIO/System.IO.Abstractions/releases)
- [Commits](TestableIO/System.IO.Abstractions@v19.1.13...v19.2.1)

---
updated-dependencies:
- dependency-name: System.IO.Abstractions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update deps

* New pipeline (#105)

* rename and move

* move ns

* renames

* add progress

* rename

* update progress

* added tests

* update ref

* rename and move

* move ns

* renames

* add progress

* rename

* update progress

* added tests

* update ref

* use .net 7 sdk

* use preview

* import parent

* add test

* update version

* add process elevation

* ignore test

* use config provider

* fix build from merge

* update and move verification

* update deps

* to class

* update deps

* add CurrentProcessInfo

* increase version

* merge cpi and elevation

* remove test

* move namespace

* don't move ns

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
AnakinRaW and dependabot[bot] authored May 10, 2023
1 parent ec3cd2e commit 7f990a4
Show file tree
Hide file tree
Showing 21 changed files with 136 additions and 82 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
<PrivateAssets>all</PrivateAssets>
<Version>3.5.119</Version>
<Version>3.6.128</Version>
</PackageReference>
<PackageReference Include="SauceControl.InheritDoc" Version="1.3.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1">
<PackageReference Include="GitHubActionsTestLogger" Version="2.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.3.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="19.2.16" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="19.2.22" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -36,5 +36,5 @@
<ItemGroup>
<ProjectReference Include="..\src\CommonUtilities.DownloadManager.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>net48;net6.0-windows</TargetFrameworks>
<RootNamespace>AnakinRaW.CommonUtilities.FileSystem.Windows</RootNamespace>
<AssemblyName>AnakinRaW.CommonUtilities.FileSystem.Windows</AssemblyName>
<Nullable>enable</Nullable>
Expand All @@ -21,13 +21,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
<PackageReference Include="Validation" Version="2.5.51" PrivateAssets="compile"/>
<PackageReference Include="Validation" Version="2.5.51" PrivateAssets="compile" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\CommonUtilities.FileSystem\src\Commonutilities.FileSystem.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1">
<PackageReference Include="GitHubActionsTestLogger" Version="2.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.IO.Abstractions" Version="19.2.16" />
<PackageReference Include="System.IO.Abstractions" Version="19.2.22" />
<PackageReference Include="Validation" Version="2.5.51" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1">
<PackageReference Include="GitHubActionsTestLogger" Version="2.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="19.2.16" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="19.2.22" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -33,5 +33,5 @@
<ItemGroup>
<ProjectReference Include="..\src\Commonutilities.FileSystem.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Validation" Version="2.5.51" PrivateAssets="compile"/>
<PackageReference Include="Validation" Version="2.5.51" PrivateAssets="compile" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\CommonUtilities.Registry\src\CommonUtilities.Registry.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1">
<PackageReference Include="GitHubActionsTestLogger" Version="2.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1">
<PackageReference Include="GitHubActionsTestLogger" Version="2.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1">
<PackageReference Include="GitHubActionsTestLogger" Version="2.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="19.2.16" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="19.2.22" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion src/CommonUtilities.Xml/src/CommonUtilities.Xml.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Validation" Version="2.5.51" PrivateAssets="compile"/>
<PackageReference Include="Validation" Version="2.5.51" PrivateAssets="compile" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/CommonUtilities/src/CommonUtilities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="System.IO.Abstractions" Version="19.2.16" />
<PackageReference Include="System.IO.Abstractions" Version="19.2.22" />
<PackageReference Include="Validation" Version="2.5.51" />
<PackageReference Include="Vanara.PInvoke.Security" Version="3.4.14" />
</ItemGroup>
Expand Down
74 changes: 74 additions & 0 deletions src/CommonUtilities/src/Process/CurrentProcessInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#if NET6_0
using System;
#else
using Vanara.PInvoke;
#endif
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace AnakinRaW.CommonUtilities;

/// <summary>
/// Provides information about the current process.
/// </summary>
internal sealed class CurrentProcessInfo : ICurrentProcessInfo
{
/// <summary>
/// Gets an instance of <see cref="CurrentProcessInfo"/> representing the current process.
/// </summary>
public static readonly CurrentProcessInfo Current = new();

/// <inheritdoc/>
public bool IsElevated { get; }

/// <inheritdoc/>
public string? ProcessFilePath { get; }

/// <inheritdoc/>
public int Id { get; }

/// <summary>
/// Initializes a new instance of the <see cref="CurrentProcessInfo"/> struct representing the current process.
/// </summary>
private CurrentProcessInfo()
{
var p = Process.GetCurrentProcess();
Id = p.Id;
#if NET6_0
var processPath = Environment.ProcessPath;
#else
var processPath = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
? Kernel32.GetModuleFileName(HINSTANCE.NULL)
: Process.GetCurrentProcess().MainModule.FileName;
#endif

ProcessFilePath = processPath;

IsElevated = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
? ProcessElevationWindows.IsProcessElevated()
: ProcessElevationLinux.IsElevated();
}
}


/// <summary>
/// Provides access to information about the current process.
/// </summary>
public interface ICurrentProcessInfoProvider
{
/// <summary>
/// Gets the current process information.
/// </summary>
/// <returns>An <see cref="ICurrentProcessInfo"/> instance that contains information about the current process.</returns>
public ICurrentProcessInfo GetCurrentProcessInfo();
}

/// <inheritdoc/>
public sealed class CurrentProcessInfoProvider : ICurrentProcessInfoProvider
{
/// <inheritdoc/>
public ICurrentProcessInfo GetCurrentProcessInfo()
{
return CurrentProcessInfo.Current;
}
}
22 changes: 22 additions & 0 deletions src/CommonUtilities/src/Process/ICurrentProcessInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace AnakinRaW.CommonUtilities;

/// <summary>
/// Service to query whether the current process is elevated.
/// </summary>
public interface ICurrentProcessInfo
{
/// <summary>
/// Returns <see langword="true"/> if the current process is elevated; <see langword="false"/> otherwise.
/// </summary>
bool IsElevated { get; }

/// <summary>
/// Gets the file path of the current process, or null if the path could not be determined.
/// </summary>
string? ProcessFilePath { get; }

/// <summary>
/// Gets the ID of the current process.
/// </summary>
int Id { get; }
}
12 changes: 0 additions & 12 deletions src/CommonUtilities/src/Process/IProcessElevation.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/CommonUtilities/src/Process/ProcessElevation.Linux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace AnakinRaW.CommonUtilities;

internal sealed class ProcessElevationLinux
internal static class ProcessElevationLinux
{
// ReSharper disable once IdentifierTypo
[DllImport("libc", SetLastError = true)]
Expand Down
30 changes: 0 additions & 30 deletions src/CommonUtilities/src/Process/ProcessElevation.cs

This file was deleted.

7 changes: 4 additions & 3 deletions src/CommonUtilities/test/CommonUtilities.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@
<PropertyGroup>
<RootNamespace>AnakinRaW.CommonUtilities.Test</RootNamespace>
<AssemblyName>AnakinRaW.CommonUtilities.Test</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1">
<PackageReference Include="GitHubActionsTestLogger" Version="2.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="19.2.16" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="19.2.22" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
Expand All @@ -37,5 +38,5 @@
<ItemGroup>
<ProjectReference Include="..\src\CommonUtilities.csproj" />
</ItemGroup>

</Project>
14 changes: 14 additions & 0 deletions src/CommonUtilities/test/CurrentProcessInfoTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Xunit;

namespace AnakinRaW.CommonUtilities.Test;

public class CurrentProcessInfoTests
{
[Fact]
public void TestCurrentProcess()
{
var currentProcessInfo = CurrentProcessInfo.Current;
Assert.NotEqual(0, currentProcessInfo.Id);
Assert.NotNull(currentProcessInfo.ProcessFilePath);
}
}
12 changes: 0 additions & 12 deletions src/CommonUtilities/test/ProcessElevationTest.cs

This file was deleted.

2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "7.0",
"version": "8.0",
"assemblyVersion": {
"precision": "major"
},
Expand Down

0 comments on commit 7f990a4

Please sign in to comment.