This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add even more madness to already too much madness
- Loading branch information
Showing
12 changed files
with
388 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<Version>3.10.0</Version> | ||
<Version>3.11.0</Version> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
|
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
Large diffs are not rendered by default.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
JustArchiNET.Madness/DirectoryInfoMadness/DirectoryInfo.cs
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,50 @@ | ||
// _ __ __ | ||
// ___ ___ ___ _ __ __| | __ _ | \/ | | ||
// / __|/ __| / _ \| '_ \ / _` | / _` || |\/| | | ||
// \__ \\__ \| __/| | | || (_| || (_| || | | | | ||
// |___/|___/ \___||_| |_| \__,_| \__,_||_| |_| | ||
// | | ||
// Copyright 2021-2023 Łukasz "JustArchi" Domeradzki | ||
// Contact: [email protected] | ||
// | | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System.IO; | ||
using System.Security.AccessControl; | ||
using JetBrains.Annotations; | ||
using JustArchiNET.Madness.ArgumentNullExceptionMadness; | ||
using JustArchiNET.Madness.FileMadness; | ||
using JustArchiNET.Madness.Helpers; | ||
using JustArchiNET.Madness.Internal; | ||
|
||
namespace JustArchiNET.Madness.DirectoryInfoMadness; | ||
|
||
[MadnessType(EMadnessType.Replacement)] | ||
[PublicAPI] | ||
public sealed class DirectoryInfo { | ||
private readonly System.IO.DirectoryInfo UnderlyingDirectoryInfo; | ||
|
||
[MadnessType(EMadnessType.Implementation)] | ||
public UnixFileMode UnixFileMode { | ||
get => UnixFileMode.None; | ||
set => NativeMethods.Chmod(UnderlyingDirectoryInfo.FullName, value); | ||
} | ||
|
||
[MadnessType(EMadnessType.Proxy)] | ||
public DirectoryInfo(string path) : this(new System.IO.DirectoryInfo(path)) { } | ||
|
||
internal DirectoryInfo(System.IO.DirectoryInfo directoryInfo) => UnderlyingDirectoryInfo = directoryInfo ?? throw new ArgumentNullException(nameof(directoryInfo)); | ||
|
||
[MadnessType(EMadnessType.Proxy)] | ||
public void SetAccessControl(DirectorySecurity directorySecurity) => UnderlyingDirectoryInfo.SetAccessControl(directorySecurity); | ||
} |
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,66 @@ | ||
// _ __ __ | ||
// ___ ___ ___ _ __ __| | __ _ | \/ | | ||
// / __|/ __| / _ \| '_ \ / _` | / _` || |\/| | | ||
// \__ \\__ \| __/| | | || (_| || (_| || | | | | ||
// |___/|___/ \___||_| |_| \__,_| \__,_||_| |_| | ||
// | | ||
// Copyright 2021-2023 Łukasz "JustArchi" Domeradzki | ||
// Contact: [email protected] | ||
// | | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System.Collections.Generic; | ||
using System.IO; | ||
using JetBrains.Annotations; | ||
using JustArchiNET.Madness.Helpers; | ||
using DirectoryInfo = JustArchiNET.Madness.DirectoryInfoMadness.DirectoryInfo; | ||
|
||
namespace JustArchiNET.Madness.DirectoryMadness; | ||
|
||
[MadnessType(EMadnessType.Replacement)] | ||
[PublicAPI] | ||
public static class Directory { | ||
[MadnessType(EMadnessType.Replacement)] | ||
public static DirectoryInfo CreateDirectory(string path) { | ||
System.IO.DirectoryInfo directoryInfo = System.IO.Directory.CreateDirectory(path); | ||
|
||
return new DirectoryInfo(directoryInfo); | ||
} | ||
|
||
[MadnessType(EMadnessType.Proxy)] | ||
public static void Delete(string path) => System.IO.Directory.Delete(path); | ||
|
||
[MadnessType(EMadnessType.Proxy)] | ||
public static void Delete(string path, bool recursive) => System.IO.Directory.Delete(path, recursive); | ||
|
||
[MadnessType(EMadnessType.Proxy)] | ||
public static IEnumerable<string> EnumerateDirectories(string path) => System.IO.Directory.EnumerateDirectories(path); | ||
|
||
[MadnessType(EMadnessType.Proxy)] | ||
public static IEnumerable<string> EnumerateFiles(string path, string searchPattern) => System.IO.Directory.EnumerateFiles(path, searchPattern); | ||
|
||
[MadnessType(EMadnessType.Proxy)] | ||
public static IEnumerable<string> EnumerateFiles(string path, string searchPattern, SearchOption searchOption) => System.IO.Directory.EnumerateFiles(path, searchPattern, searchOption); | ||
|
||
[MadnessType(EMadnessType.Proxy)] | ||
public static IEnumerable<string> EnumerateFileSystemEntries(string path) => System.IO.Directory.EnumerateFileSystemEntries(path); | ||
|
||
[MadnessType(EMadnessType.Proxy)] | ||
public static bool Exists(string path) => System.IO.Directory.Exists(path); | ||
|
||
[MadnessType(EMadnessType.Proxy)] | ||
public static string GetCurrentDirectory() => System.IO.Directory.GetCurrentDirectory(); | ||
|
||
[MadnessType(EMadnessType.Proxy)] | ||
public static void SetCurrentDirectory(string path) => System.IO.Directory.SetCurrentDirectory(path); | ||
} |
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,50 @@ | ||
// _ __ __ | ||
// ___ ___ ___ _ __ __| | __ _ | \/ | | ||
// / __|/ __| / _ \| '_ \ / _` | / _` || |\/| | | ||
// \__ \\__ \| __/| | | || (_| || (_| || | | | | ||
// |___/|___/ \___||_| |_| \__,_| \__,_||_| |_| | ||
// | | ||
// Copyright 2021-2023 Łukasz "JustArchi" Domeradzki | ||
// Contact: [email protected] | ||
// | | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System.IO; | ||
using System.Security.AccessControl; | ||
using JetBrains.Annotations; | ||
using JustArchiNET.Madness.ArgumentNullExceptionMadness; | ||
using JustArchiNET.Madness.FileMadness; | ||
using JustArchiNET.Madness.Helpers; | ||
using JustArchiNET.Madness.Internal; | ||
|
||
namespace JustArchiNET.Madness.FileInfoMadness; | ||
|
||
[MadnessType(EMadnessType.Replacement)] | ||
[PublicAPI] | ||
public sealed class FileInfo { | ||
private readonly System.IO.FileInfo UnderlyingFileInfo; | ||
|
||
[MadnessType(EMadnessType.Implementation)] | ||
public UnixFileMode UnixFileMode { | ||
get => UnixFileMode.None; | ||
set => NativeMethods.Chmod(UnderlyingFileInfo.FullName, value); | ||
} | ||
|
||
[MadnessType(EMadnessType.Proxy)] | ||
public FileInfo(string path) : this(new System.IO.FileInfo(path)) { } | ||
|
||
internal FileInfo(System.IO.FileInfo fileInfo) => UnderlyingFileInfo = fileInfo ?? throw new ArgumentNullException(nameof(fileInfo)); | ||
|
||
[MadnessType(EMadnessType.Proxy)] | ||
public void SetAccessControl(FileSecurity fileSecurity) => UnderlyingFileInfo.SetAccessControl(fileSecurity); | ||
} |
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,45 @@ | ||
// _ __ __ | ||
// ___ ___ ___ _ __ __| | __ _ | \/ | | ||
// / __|/ __| / _ \| '_ \ / _` | / _` || |\/| | | ||
// \__ \\__ \| __/| | | || (_| || (_| || | | | | ||
// |___/|___/ \___||_| |_| \__,_| \__,_||_| |_| | ||
// | | ||
// Copyright 2021-2023 Łukasz "JustArchi" Domeradzki | ||
// Contact: [email protected] | ||
// | | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System.Diagnostics.CodeAnalysis; | ||
using JetBrains.Annotations; | ||
using JustArchiNET.Madness.Helpers; | ||
|
||
namespace JustArchiNET.Madness.FileMadness; | ||
|
||
[MadnessType(EMadnessType.Implementation)] | ||
[PublicAPI] | ||
[SuppressMessage("ReSharper", "InconsistentNaming")] | ||
public enum UnixFileMode { | ||
None = 0, | ||
OtherExecute = 1, | ||
OtherWrite = 2, | ||
OtherRead = 4, | ||
GroupExecute = 8, | ||
GroupWrite = 16, | ||
GroupRead = 32, | ||
UserExecute = 64, | ||
UserWrite = 128, | ||
UserRead = 256, | ||
StickyBit = 512, | ||
SetGroup = 1024, | ||
SetUser = 2048 | ||
} |
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,30 @@ | ||
// _ __ __ | ||
// ___ ___ ___ _ __ __| | __ _ | \/ | | ||
// / __|/ __| / _ \| '_ \ / _` | / _` || |\/| | | ||
// \__ \\__ \| __/| | | || (_| || (_| || | | | | ||
// |___/|___/ \___||_| |_| \__,_| \__,_||_| |_| | ||
// | | ||
// Copyright 2021-2023 Łukasz "JustArchi" Domeradzki | ||
// Contact: [email protected] | ||
// | | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System.Runtime.InteropServices; | ||
using JustArchiNET.Madness.FileMadness; | ||
|
||
namespace JustArchiNET.Madness.Internal; | ||
|
||
internal static class NativeMethods { | ||
[DllImport("libc", EntryPoint = "chmod", SetLastError = true)] | ||
internal static extern int Chmod(string path, UnixFileMode mode); | ||
} |
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
40 changes: 40 additions & 0 deletions
40
JustArchiNET.Madness/NewtonsoftJsonMadness/JsonTextReader.cs
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,40 @@ | ||
// _ __ __ | ||
// ___ ___ ___ _ __ __| | __ _ | \/ | | ||
// / __|/ __| / _ \| '_ \ / _` | / _` || |\/| | | ||
// \__ \\__ \| __/| | | || (_| || (_| || | | | | ||
// |___/|___/ \___||_| |_| \__,_| \__,_||_| |_| | ||
// | | ||
// Copyright 2021-2023 Łukasz "JustArchi" Domeradzki | ||
// Contact: [email protected] | ||
// | | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using JetBrains.Annotations; | ||
using JustArchiNET.Madness.Helpers; | ||
|
||
namespace JustArchiNET.Madness.NewtonsoftJsonMadness; | ||
|
||
[MadnessType(EMadnessType.Replacement)] | ||
[PublicAPI] | ||
public class JsonTextReader : Newtonsoft.Json.JsonTextReader, IAsyncDisposable { | ||
public JsonTextReader(TextReader reader) : base(reader) { } | ||
|
||
public ValueTask DisposeAsync() { | ||
Dispose(true); | ||
|
||
return default(ValueTask); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
JustArchiNET.Madness/NewtonsoftJsonMadness/JsonTextWriter.cs
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,40 @@ | ||
// _ __ __ | ||
// ___ ___ ___ _ __ __| | __ _ | \/ | | ||
// / __|/ __| / _ \| '_ \ / _` | / _` || |\/| | | ||
// \__ \\__ \| __/| | | || (_| || (_| || | | | | ||
// |___/|___/ \___||_| |_| \__,_| \__,_||_| |_| | ||
// | | ||
// Copyright 2021-2023 Łukasz "JustArchi" Domeradzki | ||
// Contact: [email protected] | ||
// | | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using JetBrains.Annotations; | ||
using JustArchiNET.Madness.Helpers; | ||
|
||
namespace JustArchiNET.Madness.NewtonsoftJsonMadness; | ||
|
||
[MadnessType(EMadnessType.Replacement)] | ||
[PublicAPI] | ||
public class JsonTextWriter : Newtonsoft.Json.JsonTextWriter, IAsyncDisposable { | ||
public JsonTextWriter(TextWriter writer) : base(writer) { } | ||
|
||
public ValueTask DisposeAsync() { | ||
Dispose(true); | ||
|
||
return default(ValueTask); | ||
} | ||
} |
Oops, something went wrong.