Skip to content

Commit

Permalink
Merge pull request #11 from yamatora/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
yamatora authored Sep 11, 2022
2 parents ca307cb + 6968efe commit 448872d
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 13 deletions.
3 changes: 3 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ dotnet_diagnostic.CS8603.severity = none

# Default severity for all analyzer diagnostics
dotnet_analyzer_diagnostic.severity = none

# CS8625: null リテラルを null 非許容参照型に変換できません。
dotnet_diagnostic.CS8625.severity = none
1 change: 1 addition & 0 deletions src/doc/doc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 5 additions & 1 deletion src/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ General purpose library for [yamatora](https://github.com/yamatora)

# Repository

[https://github.com/yamatora/libymtr](https://github.com/yamatora/libymtr)
[https://github.com/yamatora/libymtr](https://github.com/yamatora/libymtr)

# Package

[https://www.nuget.org/packages/libymtr](https://www.nuget.org/packages/libymtr)
2 changes: 2 additions & 0 deletions src/libymtr/Network/Tcp.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#pragma warning disable CS0168 // 変数は宣言されていますが、使用されていません
#pragma warning disable CS0649 //
#pragma warning disable CS8618 // null 非許容のフィールドには、コンストラクターの終了時に null 以外の値が入っていなければなりません。Null 許容として宣言することをご検討ください。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Net;
using System.Net.Sockets;
Expand Down
1 change: 1 addition & 0 deletions src/libymtr/Network/WebClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Net.Http;

Expand Down
18 changes: 9 additions & 9 deletions src/libymtr/Windows/Registry/Environment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Security.Principal;
//using System.Security.Principal;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Reflection;
Expand Down Expand Up @@ -40,14 +40,14 @@ public static string[] GetEnvironmentVariable(string varName, EnvironmentVariabl
public static bool SetEnvirionmentVariable(string varName, string[] valueArray, EnvironmentVariableTarget target = EnvironmentVariableTarget.User, bool forceReboot = false) {
Windows.CheckOS();

// Check running as admin
var principal = (WindowsPrincipal)Thread.CurrentPrincipal;
if (!principal.IsInRole(WindowsBuiltInRole.Administrator)) {
if (forceReboot) {
throw new Exception(MSG_ADMIN_ONLY);
}
return false;
}
//// Check running as admin
//var principal = (WindowsPrincipal)Thread.CurrentPrincipal;
//if (!principal.IsInRole(WindowsBuiltInRole.Administrator)) {
// if (forceReboot) {
// throw new Exception(MSG_ADMIN_ONLY);
// }
// return false;
//}

// Set values
var value = Generic.ConcatByChar(';', valueArray);
Expand Down
21 changes: 18 additions & 3 deletions src/libymtr/libymtr.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<ProduceReferenceAssembly>True</ProduceReferenceAssembly>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<Company>yamatora</Company>
<PackageId>libymtr</PackageId>
<Title>libymtr</Title>
<Authors>yamatora</Authors>
<PackageProjectUrl>https://github.com/yamatora/libymtr</PackageProjectUrl>
<AssemblyVersion>1.0.2</AssemblyVersion>
<Version>1.0.2</Version>
</PropertyGroup>

<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
</ItemGroup>

</Project>

0 comments on commit 448872d

Please sign in to comment.