diff --git a/.gitignore b/.gitignore
index e140a18..c7e04b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@
build
coverage.json
+coverage.cobertura.xml
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 53b649e..3887a50 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,22 +17,23 @@ build-debug:
tags:
- docker
- lnx
+ - 64bit
rules:
- if: $CI_COMMIT_TAG == null
script:
- dotnet restore --no-cache --force
- dotnet build -c Debug --nologo --no-restore --no-incremental
- mkdir ./artifacts
- - mv ./AMWD.Common/bin/Debug/*.nupkg ./artifacts/
- - mv ./AMWD.Common/bin/Debug/*.snupkg ./artifacts/
- - mv ./AMWD.Common.AspNetCore/bin/Debug/*.nupkg ./artifacts/
- - mv ./AMWD.Common.AspNetCore/bin/Debug/*.snupkg ./artifacts/
- - mv ./AMWD.Common.EntityFrameworkCore/bin/Debug/*.nupkg ./artifacts/
- - mv ./AMWD.Common.EntityFrameworkCore/bin/Debug/*.snupkg ./artifacts/
- - mv ./AMWD.Common.MessagePack/bin/Debug/*.nupkg ./artifacts/
- - mv ./AMWD.Common.MessagePack/bin/Debug/*.snupkg ./artifacts/
- - mv ./AMWD.Common.Test/bin/Debug/*.nupkg ./artifacts/
- - mv ./AMWD.Common.Test/bin/Debug/*.snupkg ./artifacts/
+ - mv ./src/AMWD.Common/bin/Debug/*.nupkg ./artifacts/
+ - mv ./src/AMWD.Common/bin/Debug/*.snupkg ./artifacts/
+ - mv ./src/AMWD.Common.AspNetCore/bin/Debug/*.nupkg ./artifacts/
+ - mv ./src/AMWD.Common.AspNetCore/bin/Debug/*.snupkg ./artifacts/
+ - mv ./src/AMWD.Common.EntityFrameworkCore/bin/Debug/*.nupkg ./artifacts/
+ - mv ./src/AMWD.Common.EntityFrameworkCore/bin/Debug/*.snupkg ./artifacts/
+ - mv ./src/AMWD.Common.MessagePack/bin/Debug/*.nupkg ./artifacts/
+ - mv ./src/AMWD.Common.MessagePack/bin/Debug/*.snupkg ./artifacts/
+ - mv ./src/AMWD.Common.Test/bin/Debug/*.nupkg ./artifacts/
+ - mv ./src/AMWD.Common.Test/bin/Debug/*.snupkg ./artifacts/
artifacts:
paths:
- artifacts/*.nupkg
@@ -46,15 +47,24 @@ test-debug:
tags:
- docker
- lnx
+ - 64bit
rules:
- if: $CI_COMMIT_TAG == null
- # line-coverage
- #coverage: '/Total[^|]*\|\s*([0-9.%]+)/'
- # branch-coverage
- coverage: '/Total[^|]*\|[^|]*\|\s*([0-9.%]+)/'
+ #coverage: /Line coverage[\s\S].+%/
+ coverage: /Branch coverage[\s\S].+%/
+ before_script:
+ - dotnet tool install dotnet-reportgenerator-globaltool --tool-path /dotnet-tools
script:
- dotnet restore --no-cache --force
- - dotnet test -c Debug --nologo --no-restore
+ - dotnet test -c Debug --nologo --no-restore /p:CoverletOutputFormat=Cobertura
+ - /dotnet-tools/reportgenerator "-reports:${CI_PROJECT_DIR}/**/coverage.cobertura.xml" "-targetdir:/reports" -reportType:TextSummary
+ - cat /reports/Summary.txt
+ artifacts:
+ when: always
+ reports:
+ coverage_report:
+ coverage_format: cobertura
+ path: ./**/coverage.cobertura.xml
@@ -63,22 +73,23 @@ build-release:
tags:
- docker
- lnx
+ - 64bit
rules:
- if: $CI_COMMIT_TAG != null
script:
- dotnet restore --no-cache --force
- dotnet build -c Release --nologo --no-restore --no-incremental
- mkdir ./artifacts
- - mv ./AMWD.Common/bin/Release/*.nupkg ./artifacts/
- - mv ./AMWD.Common/bin/Release/*.snupkg ./artifacts/
- - mv ./AMWD.Common.AspNetCore/bin/Release/*.nupkg ./artifacts/
- - mv ./AMWD.Common.AspNetCore/bin/Release/*.snupkg ./artifacts/
- - mv ./AMWD.Common.EntityFrameworkCore/bin/Release/*.nupkg ./artifacts/
- - mv ./AMWD.Common.EntityFrameworkCore/bin/Release/*.snupkg ./artifacts/
- - mv ./AMWD.Common.MessagePack/bin/Release/*.nupkg ./artifacts/
- - mv ./AMWD.Common.MessagePack/bin/Release/*.snupkg ./artifacts/
- - mv ./AMWD.Common.Test/bin/Release/*.nupkg ./artifacts/
- - mv ./AMWD.Common.Test/bin/Release/*.snupkg ./artifacts/
+ - mv ./src/AMWD.Common/bin/Release/*.nupkg ./artifacts/
+ - mv ./src/AMWD.Common/bin/Release/*.snupkg ./artifacts/
+ - mv ./src/AMWD.Common.AspNetCore/bin/Release/*.nupkg ./artifacts/
+ - mv ./src/AMWD.Common.AspNetCore/bin/Release/*.snupkg ./artifacts/
+ - mv ./src/AMWD.Common.EntityFrameworkCore/bin/Release/*.nupkg ./artifacts/
+ - mv ./src/AMWD.Common.EntityFrameworkCore/bin/Release/*.snupkg ./artifacts/
+ - mv ./src/AMWD.Common.MessagePack/bin/Release/*.nupkg ./artifacts/
+ - mv ./src/AMWD.Common.MessagePack/bin/Release/*.snupkg ./artifacts/
+ - mv ./src/AMWD.Common.Test/bin/Release/*.nupkg ./artifacts/
+ - mv ./src/AMWD.Common.Test/bin/Release/*.snupkg ./artifacts/
artifacts:
paths:
- artifacts/*.nupkg
@@ -92,15 +103,24 @@ test-release:
tags:
- docker
- lnx
+ - 64bit
rules:
- if: $CI_COMMIT_TAG != null
- # line-coverage
- #coverage: '/Total[^|]*\|\s*([0-9.%]+)/'
- # branch-coverage
- coverage: '/Total[^|]*\|[^|]*\|\s*([0-9.%]+)/'
+ #coverage: /Line coverage[\s\S].+%/
+ coverage: /Branch coverage[\s\S].+%/
+ before_script:
+ - dotnet tool install dotnet-reportgenerator-globaltool --tool-path /dotnet-tools
script:
- dotnet restore --no-cache --force
- - dotnet test -c Release --nologo --no-restore
+ - dotnet test -c Release --nologo --no-restore /p:CoverletOutputFormat=Cobertura
+ - /dotnet-tools/reportgenerator "-reports:${CI_PROJECT_DIR}/**/coverage.cobertura.xml" "-targetdir:/reports" -reportType:TextSummary
+ - cat /reports/Summary.txt
+ artifacts:
+ when: always
+ reports:
+ coverage_report:
+ coverage_format: cobertura
+ path: ./**/coverage.cobertura.xml
deploy-common:
stage: deploy
@@ -110,6 +130,7 @@ deploy-common:
tags:
- docker
- lnx
+ - 64bit
rules:
- if: $CI_COMMIT_TAG =~ /^v[0-9.]+/
script:
@@ -123,12 +144,13 @@ deploy-aspnet:
tags:
- docker
- lnx
+ - 64bit
rules:
- if: $CI_COMMIT_TAG =~ /^asp\/v[0-9.]+/
script:
- dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.AspNetCore.*.nupkg
-deploy-entityframework:
+deploy-efcore:
stage: deploy
dependencies:
- build-release
@@ -136,12 +158,13 @@ deploy-entityframework:
tags:
- docker
- lnx
+ - 64bit
rules:
- if: $CI_COMMIT_TAG =~ /^efc\/v[0-9.]+/
script:
- dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/AMWD.Common.EntityFrameworkCore.*.nupkg
-deploy-messagepack:
+deploy-msgpack:
stage: deploy
dependencies:
- build-release
@@ -149,6 +172,7 @@ deploy-messagepack:
tags:
- docker
- lnx
+ - 64bit
rules:
- if: $CI_COMMIT_TAG =~ /^msgpack\/v[0-9.]+/
script:
@@ -162,6 +186,7 @@ deploy-test:
tags:
- docker
- lnx
+ - 64bit
rules:
- if: $CI_COMMIT_TAG =~ /^test\/v[0-9.]+/
script:
diff --git a/AMWD.Common/InternalsVisibleTo.cs b/AMWD.Common/InternalsVisibleTo.cs
deleted file mode 100644
index cd080bc..0000000
--- a/AMWD.Common/InternalsVisibleTo.cs
+++ /dev/null
@@ -1,3 +0,0 @@
-using System.Runtime.CompilerServices;
-
-[assembly: InternalsVisibleTo("UnitTests")]
diff --git a/AMWD.Common/Packing/Tar/Interfaces/IArchiveDataWriter.cs b/AMWD.Common/Packing/Tar/Interfaces/IArchiveDataWriter.cs
deleted file mode 100644
index d621ed3..0000000
--- a/AMWD.Common/Packing/Tar/Interfaces/IArchiveDataWriter.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-namespace AMWD.Common.Packing.Tar.Interfaces
-{
- ///
- /// Interface of a archive writer.
- ///
- public interface IArchiveDataWriter
- {
- ///
- /// Write bytes of data from to corresponding archive.
- ///
- /// The data storage.
- /// How many bytes to be written to the corresponding archive.
- int Write(byte[] buffer, int count);
-
- ///
- /// Gets a value indicating whether the writer can write.
- ///
- bool CanWrite { get; }
- }
-
- ///
- /// The writer delegate.
- ///
- /// The writer.
- public delegate void WriteDataDelegate(IArchiveDataWriter writer);
-}
diff --git a/AMWD.Common/Packing/Tar/Interfaces/ITarHeader.cs b/AMWD.Common/Packing/Tar/Interfaces/ITarHeader.cs
deleted file mode 100644
index f4a474f..0000000
--- a/AMWD.Common/Packing/Tar/Interfaces/ITarHeader.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-using System;
-using AMWD.Common.Packing.Tar.Utils;
-
-namespace AMWD.Common.Packing.Tar.Interfaces
-{
- ///
- /// See "struct star_header" in
- ///
- public interface ITarHeader
- {
- ///
- /// The name field is the file name of the file, with directory names (if any) preceding the file name,
- /// separated by slashes.
- ///
- ///
- /// name
- ///
- /// Byte offset: 0
- ///
- string FileName { get; set; }
-
- ///
- /// The mode field provides nine bits specifying file permissions and three bits to specify
- /// the Set UID, Set GID, and Save Text (sticky) modes.
- /// When special permissions are required to create a file with a given mode,
- /// and the user restoring files from the archive does not hold such permissions,
- /// the mode bit(s) specifying those special permissions are ignored.
- /// Modes which are not supported by the operating system restoring files from the archive will be ignored.
- /// Unsupported modes should be faked up when creating or updating an archive; e.g.,
- /// the group permission could be copied from the other permission.
- ///
- ///
- /// mode
- ///
- /// Byte offset: 100
- ///
- int Mode { get; set; }
-
- ///
- /// The uid field is the numeric user ID of the file owners.
- /// If the operating system does not support numeric user ID, this field should be ignored.
- ///
- ///
- /// uid
- ///
- /// Byte offset: 108
- ///
- int UserId { get; set; }
-
- ///
- /// The gid fields is the numeric group ID of the file owners.
- /// If the operating system does not support numeric group ID, this field should be ignored.
- ///
- ///
- /// gid
- ///
- /// Byte offset: 116
- ///
- int GroupId { get; set; }
-
- ///
- /// The size field is the size of the file in bytes;
- /// linked files are archived with this field specified as zero.
- ///
- ///
- /// size
- ///
- /// Byte offset: 124
- ///
- long SizeInBytes { get; set; }
-
- ///
- /// mtime
- /// byte offset: 136
- /// The mtime field represents the data modification time of the file at the time it was archived.
- /// It represents the integer number of seconds since January 1, 1970, 00:00 Coordinated Universal Time.
- ///
- ///
- /// mtime
- ///
- /// Byte offset: 136
- ///
- DateTime LastModification { get; set; }
-
- ///
- /// The typeflag field specifies the type of file archived.
- /// If a particular implementation does not recognize or permit the specified type,
- /// the file will be extracted as if it were a regular file.
- /// As this action occurs, tar issues a warning to the standard error.
- ///
- ///
- /// typeflag
- ///
- /// Byte offset: 156
- ///
- EntryType EntryType { get; set; }
-
- ///
- /// The uname field will contain the ASCII representation of the owner of the file.
- /// If found, the user ID is used rather than the value in the uid field.
- ///
- ///
- /// uname
- ///
- /// Byte offset: 265
- ///
- string UserName { get; set; }
-
- ///
- /// The gname field will contain the ASCII representation of the group of the file.
- /// If found, the group ID is used rather than the values in the gid field.
- ///
- ///
- /// gname
- ///
- /// Byte offset: 297
- ///
- string GroupName { get; set; }
-
- ///
- /// The size of this header.
- ///
- int HeaderSize { get; }
- }
-}
diff --git a/AMWD.Common/Packing/Tar/TarReader.cs b/AMWD.Common/Packing/Tar/TarReader.cs
deleted file mode 100644
index 51f891f..0000000
--- a/AMWD.Common/Packing/Tar/TarReader.cs
+++ /dev/null
@@ -1,205 +0,0 @@
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using AMWD.Common.Packing.Tar.Interfaces;
-using AMWD.Common.Packing.Tar.Utils;
-
-namespace AMWD.Common.Packing.Tar
-{
- ///
- /// Extract contents of a tar file represented by a stream for the TarReader constructor.
- ///
- ///
- /// Constructs TarReader object to read data from `tarredData` stream.
- ///
- /// Copied from: DotnetMakeDeb
- ///
- /// A stream to read tar archive from
- public class TarReader(Stream tarredData)
- {
- private readonly byte[] _dataBuffer = new byte[512];
- private readonly UsTarHeader _header = new();
- private readonly Stream _inStream = tarredData;
- private long _remainingBytesInFile;
-
- ///
- /// Gets the file info (the header).
- ///
- public ITarHeader FileInfo => _header;
-
- ///
- /// Read all files from an archive to a directory. It creates some child directories to
- /// reproduce a file structure from the archive.
- ///
- /// The out directory.
- ///
- /// CAUTION! This method is not safe. It's not tar-bomb proof.
- /// {see http://en.wikipedia.org/wiki/Tar_(file_format) }
- /// If you are not sure about the source of an archive you extracting,
- /// then use MoveNext and Read and handle paths like ".." and "../.." according
- /// to your business logic.
- public void ReadToEnd(string destDirectory)
- {
- while (MoveNext(skipData: false))
- {
- string fileNameFromArchive = FileInfo.FileName;
- string totalPath = destDirectory + Path.DirectorySeparatorChar + fileNameFromArchive;
- if (UsTarHeader.IsPathSeparator(fileNameFromArchive[fileNameFromArchive.Length - 1]) || FileInfo.EntryType == EntryType.Directory)
- {
- // Record is a directory
- Directory.CreateDirectory(totalPath);
- continue;
- }
-
- // If record is a file
- string fileName = Path.GetFileName(totalPath);
- string directory = totalPath.Remove(totalPath.Length - fileName.Length);
- Directory.CreateDirectory(directory);
-
- using FileStream file = File.Create(totalPath);
- Read(file);
- }
- }
-
- ///
- /// Read data from the current archive to a Stream.
- ///
- /// A stream to read data to
- ///
- public void Read(Stream dataDestanation)
- {
- Debug.WriteLine("tar stream position Read in: " + _inStream.Position);
-
- int readBytes;
- while ((readBytes = Read(out byte[] read)) != -1)
- {
- Debug.WriteLine("tar stream position Read while(...) : " + _inStream.Position);
- dataDestanation.Write(read, 0, readBytes);
- }
-
- Debug.WriteLine("tar stream position Read out: " + _inStream.Position);
- }
-
- ///
- /// Reads data from the current archive to a buffer array.
- ///
- /// The buffer array.
- /// The nuber of bytes read.
- protected int Read(out byte[] buffer)
- {
- if (_remainingBytesInFile == 0)
- {
- buffer = null;
- return -1;
- }
-
- int align512 = -1;
- long toRead = _remainingBytesInFile - 512;
-
- if (toRead > 0)
- {
- toRead = 512;
- }
- else
- {
- align512 = 512 - (int)_remainingBytesInFile;
- toRead = _remainingBytesInFile;
- }
-
- int bytesRead = _inStream.Read(_dataBuffer, 0, (int)toRead);
- _remainingBytesInFile -= bytesRead;
-
- if (_inStream.CanSeek && align512 > 0)
- {
- _inStream.Seek(align512, SeekOrigin.Current);
- }
- else
- while (align512 > 0)
- {
- _inStream.ReadByte();
- --align512;
- }
-
- buffer = _dataBuffer;
- return bytesRead;
- }
-
- ///
- /// Check if all bytes in buffer are zeroes
- ///
- /// buffer to check
- /// true if all bytes are zeroes, otherwise false
- private static bool IsEmpty(IEnumerable buffer)
- {
- foreach (byte b in buffer)
- {
- if (b != 0)
- return false;
- }
- return true;
- }
-
- ///
- /// Move internal pointer to a next file in archive.
- ///
- /// Should be true if you want to read a header only, otherwise false
- /// false on End Of File otherwise true
- ///
- /// Example:
- /// while(MoveNext())
- /// {
- /// Read(dataDestStream);
- /// }
- ///
- public bool MoveNext(bool skipData)
- {
- Debug.WriteLine("tar stream position MoveNext in: " + _inStream.Position);
- if (_remainingBytesInFile > 0)
- {
- if (!skipData)
- {
- throw new TarException(
- "You are trying to change file while not all the data from the previous one was read. If you do want to skip files use skipData parameter set to true.");
- }
-
- // Skip to the end of file.
- if (_inStream.CanSeek)
- {
- long remainer = _remainingBytesInFile % 512;
- _inStream.Seek(_remainingBytesInFile + (512 - (remainer == 0 ? 512 : remainer)), SeekOrigin.Current);
- }
- else
- {
- while (Read(out _) != -1) ;
- }
- }
-
- byte[] bytes = _header.GetBytes();
-
- int headerRead = _inStream.Read(bytes, 0, _header.HeaderSize);
- if (headerRead < 512)
- throw new TarException("Can not read header");
-
- if (IsEmpty(bytes))
- {
- headerRead = _inStream.Read(bytes, 0, _header.HeaderSize);
- if (headerRead == 512 && IsEmpty(bytes))
- {
- Debug.WriteLine("tar stream position MoveNext out(false): " + _inStream.Position);
- return false;
- }
- throw new TarException("Broken archive");
- }
-
- if (_header.UpdateHeaderFromBytes())
- {
- throw new TarException("Checksum check failed");
- }
-
- _remainingBytesInFile = _header.SizeInBytes;
-
- Debug.WriteLine("tar stream position MoveNext out(true): " + _inStream.Position);
- return true;
- }
- }
-}
diff --git a/AMWD.Common/Packing/Tar/TarWriter.cs b/AMWD.Common/Packing/Tar/TarWriter.cs
deleted file mode 100644
index 12f90f9..0000000
--- a/AMWD.Common/Packing/Tar/TarWriter.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-using System;
-using System.IO;
-using AMWD.Common.Packing.Tar.Interfaces;
-using AMWD.Common.Packing.Tar.Utils;
-
-namespace AMWD.Common.Packing.Tar
-{
- ///
- /// Writes a tar (see GNU tar) archive to a stream.
- ///
- ///
- /// Copied from: DotnetMakeDeb
- ///
- public class TarWriter : LegacyTarWriter
- {
- ///
- /// Initilizes a new instance of the class.
- ///
- /// The stream to write the archive to.
- public TarWriter(Stream outStream)
- : base(outStream)
- { }
-
- ///
- /// Writes an entry header (file, dir, ...) to the archive.
- ///
- /// The name.
- /// The last modification time.
- /// The number of bytes.
- /// The user id.
- /// The group id.
- /// The access mode.
- /// The entry type.
- protected override void WriteHeader(string name, DateTime lastModificationTime, long count, int userId, int groupId, int mode, EntryType entryType)
- {
- var tarHeader = new UsTarHeader()
- {
- FileName = name,
- Mode = mode,
- UserId = userId,
- GroupId = groupId,
- SizeInBytes = count,
- LastModification = lastModificationTime,
- EntryType = entryType,
- UserName = Convert.ToString(userId, 8),
- GroupName = Convert.ToString(groupId, 8)
- };
- OutStream.Write(tarHeader.GetHeaderValue(), 0, tarHeader.HeaderSize);
- }
-
- ///
- /// Writes an entry header (file, dir, ...) to the archive.
- /// Hashes the username and groupname down to a HashCode.
- ///
- /// The name.
- /// The last modification time.
- /// The number of bytes.
- /// The username.
- /// The group name.
- /// The access mode.
- /// The entry type.
- protected virtual void WriteHeader(string name, DateTime lastModificationTime, long count, string userName, string groupName, int mode, EntryType entryType)
- {
- WriteHeader(
- name: name,
- lastModificationTime: lastModificationTime,
- count: count,
- userId: userName.GetHashCode(),
- groupId: groupName.GetHashCode(),
- mode: mode,
- entryType: entryType);
- }
-
- ///
- /// Writes a file to the archive.
- ///
- /// The file name.
- /// The filesize in bytes.
- /// The username.
- /// The group name.
- /// The access mode.
- /// The last modification time.
- /// The write handle.
- public virtual void Write(string name, long dataSizeInBytes, string userName, string groupName, int mode, DateTime lastModificationTime, WriteDataDelegate writeDelegate)
- {
- var writer = new DataWriter(OutStream, dataSizeInBytes);
- WriteHeader(name, lastModificationTime, dataSizeInBytes, userName, groupName, mode, EntryType.File);
- while (writer.CanWrite)
- {
- writeDelegate(writer);
- }
- AlignTo512(dataSizeInBytes, false);
- }
-
- ///
- /// Writes a file to the archive.
- ///
- /// The file stream to add to the archive.
- /// The filesize in bytes.
- /// The file name.
- /// The user id.
- /// The group id.
- /// The access mode.
- /// The last modification time.
- public void Write(Stream data, long dataSizeInBytes, string fileName, string userId, string groupId, int mode,
- DateTime lastModificationTime)
- {
- WriteHeader(fileName, lastModificationTime, dataSizeInBytes, userId, groupId, mode, EntryType.File);
- WriteContent(dataSizeInBytes, data);
- AlignTo512(dataSizeInBytes, false);
- }
- }
-}
diff --git a/AMWD.Common/Packing/Tar/Utils/DataWriter.cs b/AMWD.Common/Packing/Tar/Utils/DataWriter.cs
deleted file mode 100644
index 2401fcd..0000000
--- a/AMWD.Common/Packing/Tar/Utils/DataWriter.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System.IO;
-using AMWD.Common.Packing.Tar.Interfaces;
-
-namespace AMWD.Common.Packing.Tar.Utils
-{
- internal class DataWriter : IArchiveDataWriter
- {
- private readonly long _size;
- private long _remainingBytes;
- private readonly Stream _stream;
-
- public DataWriter(Stream data, long dataSizeInBytes)
- {
- _size = dataSizeInBytes;
- _remainingBytes = _size;
- _stream = data;
- }
-
- public bool CanWrite { get; private set; } = true;
-
- public int Write(byte[] buffer, int count)
- {
- if (_remainingBytes == 0)
- {
- CanWrite = false;
- return -1;
- }
-
- int bytesToWrite;
- if (_remainingBytes - count < 0)
- {
- bytesToWrite = (int)_remainingBytes;
- }
- else
- {
- bytesToWrite = count;
- }
-
- _stream.Write(buffer, 0, bytesToWrite);
- _remainingBytes -= bytesToWrite;
-
- return bytesToWrite;
- }
- }
-}
diff --git a/AMWD.Common/Packing/Tar/Utils/EntryType.cs b/AMWD.Common/Packing/Tar/Utils/EntryType.cs
deleted file mode 100644
index 2eadbec..0000000
--- a/AMWD.Common/Packing/Tar/Utils/EntryType.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-namespace AMWD.Common.Packing.Tar.Utils
-{
- ///
- /// See "Values used in typeflag field." in
- ///
- public enum EntryType : byte
- {
- ///
- /// AREGTYPE, regular file
- ///
- File = 0,
-
- ///
- /// REGTYPE, regular file
- ///
- FileObsolete = 0x30,
-
- ///
- /// LNKTYPE, link
- ///
- HardLink = 0x31,
-
- ///
- /// SYMTYPE, reserved
- ///
- SymLink = 0x32,
-
- ///
- /// CHRTYPE, character special
- ///
- CharDevice = 0x33,
-
- ///
- /// BLKTYPE, block special
- ///
- BlockDevice = 0x34,
-
- ///
- /// DIRTYPE, directory
- ///
- Directory = 0x35,
-
- ///
- /// FIFOTYPE, FIFO special
- ///
- Fifo = 0x36,
-
- ///
- /// CONTTYPE, reserved
- ///
- Content = 0x37,
-
- ///
- /// XHDTYPE, Extended header referring to the next file in the archive
- ///
- ExtendedHeader = 0x78,
-
- ///
- /// XGLTYPE, Global extended header
- ///
- GlobalExtendedHeader = 0x67,
-
- ///
- /// GNUTYPE_LONGLINK, Identifies the *next* file on the tape as having a long linkname.
- ///
- LongLink = 0x4b,
-
- ///
- /// GNUTYPE_LONGNAME, Identifies the *next* file on the tape as having a long name.
- ///
- LongName = 0x4c
- }
-}
diff --git a/AMWD.Common/Packing/Tar/Utils/LegacyTarWriter.cs b/AMWD.Common/Packing/Tar/Utils/LegacyTarWriter.cs
deleted file mode 100644
index 1944326..0000000
--- a/AMWD.Common/Packing/Tar/Utils/LegacyTarWriter.cs
+++ /dev/null
@@ -1,329 +0,0 @@
-using System;
-using System.IO;
-using System.Text;
-using System.Threading;
-using AMWD.Common.Packing.Tar.Interfaces;
-
-namespace AMWD.Common.Packing.Tar.Utils
-{
- ///
- /// Implements a legacy TAR writer.
- ///
- ///
- /// Writes tar (see GNU tar) archive to a stream
- ///
- /// Copied from: DotnetMakeDeb
- ///
- /// stream to write archive to
- public class LegacyTarWriter(Stream outStream) : IDisposable
- {
- private readonly Stream _outStream = outStream;
- private bool _isClosed;
-
- ///
- /// The buffer for writing.
- ///
- protected byte[] buffer = new byte[1024];
-
- ///
- /// Gets or sets a value indicating whether to read on zero.
- ///
- public bool ReadOnZero { get; set; } = true;
-
- ///
- /// Gets the output stream.
- ///
- protected virtual Stream OutStream
- {
- get { return _outStream; }
- }
-
- #region IDisposable Members
-
- ///
- public void Dispose()
- => Close();
-
- #endregion IDisposable Members
-
- ///
- /// Writes a directory entry.
- ///
- /// The path to the directory.
- /// The user id.
- /// The group id.
- /// The access mode.
- /// is not set.
- public void WriteDirectoryEntry(string path, int userId, int groupId, int mode)
- {
- if (string.IsNullOrEmpty(path))
- throw new ArgumentNullException(nameof(path), "The path is not set.");
- if (path[path.Length - 1] != '/')
- path += '/';
-
- DateTime lastWriteTime;
- if (Directory.Exists(path))
- {
- lastWriteTime = Directory.GetLastWriteTime(path);
- }
- else
- {
- lastWriteTime = DateTime.Now;
- }
-
- // handle long path names (> 99 characters)
- if (path.Length > 99)
- {
- WriteLongName(
- name: path,
- userId: userId,
- groupId: groupId,
- mode: mode,
- lastModificationTime: lastWriteTime);
-
- // shorten the path name so it can be written properly
- path = path.Substring(0, 99);
- }
-
- WriteHeader(path, lastWriteTime, 0, userId, groupId, mode, EntryType.Directory);
- }
-
- ///
- /// Writes a directory and its contents.
- ///
- /// The directory.
- /// Write also sub-directories.
- /// is not set.
- public void WriteDirectory(string directory, bool doRecursive)
- {
- if (string.IsNullOrEmpty(directory))
- throw new ArgumentNullException(nameof(directory), "The directory is not set.");
-
- WriteDirectoryEntry(directory, 0, 0, 0755);
-
- string[] files = Directory.GetFiles(directory);
- foreach (string fileName in files)
- Write(fileName);
-
- string[] directories = Directory.GetDirectories(directory);
- foreach (string dirName in directories)
- {
- WriteDirectoryEntry(dirName, 0, 0, 0755);
- if (doRecursive)
- WriteDirectory(dirName, true);
- }
- }
-
- ///
- /// Writes a file.
- ///
- /// The file.
- /// is not set.
- public void Write(string fileName)
- {
- if (string.IsNullOrEmpty(fileName))
- throw new ArgumentNullException(nameof(fileName), "The file name is not set.");
-
- using var fileStream = File.OpenRead(fileName);
- Write(fileStream, fileStream.Length, fileName, 61, 61, 511, File.GetLastWriteTime(fileStream.Name));
- }
-
- ///
- /// Writes a file stream.
- ///
- /// The file stream.
- public void Write(FileStream file)
- {
- string path = Path.GetFullPath(file.Name).Replace(Path.GetPathRoot(file.Name), string.Empty);
- path = path.Replace(Path.DirectorySeparatorChar, '/');
- Write(file, file.Length, path, 61, 61, 511, File.GetLastWriteTime(file.Name));
- }
-
- ///
- /// Writes a stream.
- ///
- /// The contents.
- /// The file size in bytes.
- /// The file name.
- public void Write(Stream data, long dataSizeInBytes, string name)
- => Write(data, dataSizeInBytes, name, 61, 61, 511, DateTime.Now);
-
- ///
- /// Writes a file to the archive.
- ///
- /// The file name.
- /// The file size in bytes.
- /// The user id.
- /// The group id.
- /// The access mode.
- /// The last modification timestamp.
- /// The .
- public virtual void Write(string name, long dataSizeInBytes, int userId, int groupId, int mode, DateTime lastModificationTime, WriteDataDelegate writeDelegate)
- {
- var writer = new DataWriter(OutStream, dataSizeInBytes);
-
- WriteHeader(name, lastModificationTime, dataSizeInBytes, userId, groupId, mode, EntryType.File);
-
- while (writer.CanWrite)
- writeDelegate(writer);
-
- AlignTo512(dataSizeInBytes, false);
- }
-
- ///
- /// Writes a stream as file to the archive.
- ///
- /// The content as .
- /// The file size in bytes.
- /// The file name.
- /// The user id.
- /// The group id.
- /// The access mode.
- /// The last modification timestamp.
- /// This writer is already closed.
- public virtual void Write(Stream data, long dataSizeInBytes, string name, int userId, int groupId, int mode, DateTime lastModificationTime)
- {
- if (_isClosed)
- throw new TarException("Can not write to the closed writer");
-
- // handle long file names (> 99 characters)
- if (name.Length > 99)
- {
- WriteLongName(
- name: name,
- userId: userId,
- groupId: groupId,
- mode: mode,
- lastModificationTime: lastModificationTime);
-
- // shorten the file name so it can be written properly
- name = name.Substring(0, 99);
- }
-
- WriteHeader(name, lastModificationTime, dataSizeInBytes, userId, groupId, mode, EntryType.File);
- WriteContent(dataSizeInBytes, data);
- AlignTo512(dataSizeInBytes, false);
- }
-
- ///
- /// Handle long file or path names (> 99 characters).
- /// Write header and content, which its content contain the long (complete) file/path name.
- /// This handling method is adapted from https://github.com/qmfrederik/dotnet-packaging/pull/50/files#diff-f64c58cc18e8e445cee6ffed7a0d765cdb442c0ef21a3ed80bd20514057967b1
- ///
- /// File name or path name.
- /// User ID.
- /// Group ID.
- /// Mode.
- /// Last modification time.
- private void WriteLongName(string name, int userId, int groupId, int mode, DateTime lastModificationTime)
- {
- // must include a trailing \0
- int nameLength = Encoding.UTF8.GetByteCount(name);
- byte[] entryName = new byte[nameLength + 1];
-
- Encoding.UTF8.GetBytes(name, 0, name.Length, entryName, 0);
-
- // add a "././@LongLink" pseudo-entry which contains the full name
- using var nameStream = new MemoryStream(entryName);
- WriteHeader("././@LongLink", lastModificationTime, entryName.Length, userId, groupId, mode, EntryType.LongName);
- WriteContent(entryName.Length, nameStream);
- AlignTo512(entryName.Length, false);
- }
-
- ///
- /// Writes a stream as file to the archive.
- ///
- /// The size of the file in bytes.
- /// The file content as stream.
- /// has not enough to read from.
- protected void WriteContent(long count, Stream data)
- {
- while (count > 0 && count > buffer.Length)
- {
- int bytesRead = data.Read(buffer, 0, buffer.Length);
- if (bytesRead < 0)
- throw new IOException($"{nameof(LegacyTarWriter)} unable to read from provided stream");
-
- if (bytesRead == 0)
- {
- if (ReadOnZero)
- Thread.Sleep(100);
- else
- break;
- }
- OutStream.Write(buffer, 0, bytesRead);
- count -= bytesRead;
- }
- if (count > 0)
- {
- int bytesRead = data.Read(buffer, 0, (int)count);
- if (bytesRead < 0)
- throw new IOException($"{nameof(LegacyTarWriter)} unable to read from provided stream");
-
- if (bytesRead == 0)
- {
- while (count > 0)
- {
- OutStream.WriteByte(0);
- --count;
- }
- }
- else
- OutStream.Write(buffer, 0, bytesRead);
- }
- }
-
- ///
- /// Writes a entry header to the archive.
- ///
- /// The file name.
- /// The last modification time.
- /// The number of bytes.
- /// The user id.
- /// The group id.
- /// The file mode.
- /// The entry type
- protected virtual void WriteHeader(string name, DateTime lastModificationTime, long count, int userId, int groupId, int mode, EntryType entryType)
- {
- var header = new TarHeader
- {
- FileName = name,
- LastModification = lastModificationTime,
- SizeInBytes = count,
- UserId = userId,
- GroupId = groupId,
- Mode = mode,
- EntryType = entryType
- };
- OutStream.Write(header.GetHeaderValue(), 0, header.HeaderSize);
- }
-
- ///
- /// Aligns the entry to 512 bytes.
- ///
- public void AlignTo512(long size, bool acceptZero)
- {
- size %= 512;
- if (size == 0 && !acceptZero) return;
- while (size < 512)
- {
- OutStream.WriteByte(0);
- size++;
- }
- }
-
- ///
- /// Closes the writer and aligns to 512 bytes.
- ///
- public virtual void Close()
- {
- if (_isClosed)
- return;
-
- AlignTo512(0, true);
- AlignTo512(0, true);
-
- _isClosed = true;
- }
- }
-}
diff --git a/AMWD.Common/Packing/Tar/Utils/TarException.cs b/AMWD.Common/Packing/Tar/Utils/TarException.cs
deleted file mode 100644
index ed83e55..0000000
--- a/AMWD.Common/Packing/Tar/Utils/TarException.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System;
-
-namespace AMWD.Common.Packing.Tar.Utils
-{
- ///
- /// Represents errors that occur during tar archive execution.
- ///
- public class TarException : Exception
- {
- ///
- /// Initializes a new instance of the class.
- ///
- public TarException()
- : base()
- { }
-
- ///
- /// Initializes a new instance of the class with a specified
- /// error message.
- ///
- /// The message that describes the error.
- public TarException(string message)
- : base(message)
- { }
-
- ///
- /// Initializes a new instance of the System.Exception class with a specified error
- /// message and a reference to the inner exception that is the cause of this exception.
- ///
- /// The error message that explains the reason for the exception.
- /// The exception that is the cause of the current exception, or a null reference
- /// if no inner exception is specified.
- public TarException(string message, Exception innerException)
- : base(message, innerException)
- { }
-
-#if !NET8_0_OR_GREATER
-
- ///
- /// Initializes a new instance of the class with serialized data.
- ///
- /// The that holds the serialized
- /// object data about the exception being thrown.
- /// The that contains contextual information
- /// about the source or destination.
- protected TarException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
- : base(info, context)
- { }
-
-#endif
- }
-}
diff --git a/AMWD.Common/Packing/Tar/Utils/TarHeader.cs b/AMWD.Common/Packing/Tar/Utils/TarHeader.cs
deleted file mode 100644
index c1f1107..0000000
--- a/AMWD.Common/Packing/Tar/Utils/TarHeader.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-using System;
-using System.Linq;
-using System.Net;
-using System.Text;
-using AMWD.Common.Packing.Tar.Interfaces;
-
-namespace AMWD.Common.Packing.Tar.Utils
-{
- internal class TarHeader : ITarHeader
- {
- private static readonly byte[] _spaces = Encoding.ASCII.GetBytes(" ");
- private readonly byte[] _buffer = new byte[512];
-
- private string _fileName;
- private long _headerChecksum;
-
- public TarHeader()
- {
- // Default values
- Mode = 511; // 0777 dec
- UserId = 61; // 101 dec
- GroupId = 61; // 101 dec
- }
-
- public EntryType EntryType { get; set; }
-
- public virtual string FileName
- {
- get => _fileName.Replace("\0", string.Empty);
- set
- {
- if (value.Length > 100)
- throw new TarException("A file name can not be more than 100 chars long");
-
- _fileName = value;
- }
- }
-
- public int Mode { get; set; }
-
- public string ModeString
- => Convert.ToString(Mode, 8).PadLeft(7, '0');
-
- public int UserId { get; set; }
-
- public virtual string UserName
- {
- get => UserId.ToString();
- set => UserId = int.Parse(value);
- }
-
- public string UserIdString
- => Convert.ToString(UserId, 8).PadLeft(7, '0');
-
- public int GroupId { get; set; }
-
- public virtual string GroupName
- {
- get => GroupId.ToString();
- set => GroupId = int.Parse(value);
- }
-
- public string GroupIdString
- => Convert.ToString(GroupId, 8).PadLeft(7, '0');
-
- public long SizeInBytes { get; set; }
-
- public string SizeString
- => Convert.ToString(SizeInBytes, 8).PadLeft(11, '0');
-
- public DateTime LastModification { get; set; }
-
- public string LastModificationString
- {
- get
- {
- long unixTime = ((DateTimeOffset)DateTime.SpecifyKind(LastModification, DateTimeKind.Utc)).ToUnixTimeSeconds();
- return Convert.ToString(unixTime, 8).PadLeft(11, '0');
- }
- }
-
- public string HeaderChecksumString
- => Convert.ToString(_headerChecksum, 8).PadLeft(6, '0');
-
- public virtual int HeaderSize => 512;
-
- public byte[] GetBytes() => _buffer.ToArray();
-
- public virtual bool UpdateHeaderFromBytes()
- {
- FileName = Encoding.ASCII.GetString(_buffer, 0, 100);
-
- // Thanks to Shasha Alperocivh. Trimming nulls.
- Mode = Convert.ToInt32(Encoding.ASCII.GetString(_buffer, 100, 7).Trim(), 8);
- UserId = Convert.ToInt32(Encoding.ASCII.GetString(_buffer, 108, 7).Trim(), 8);
- GroupId = Convert.ToInt32(Encoding.ASCII.GetString(_buffer, 116, 7).Trim(), 8);
-
- EntryType = (EntryType)_buffer[156];
-
- if ((_buffer[124] & 0x80) == 0x80) // if size in binary
- {
- long sizeBigEndian = BitConverter.ToInt64(_buffer, 0x80);
- SizeInBytes = IPAddress.NetworkToHostOrder(sizeBigEndian);
- }
- else
- {
- SizeInBytes = Convert.ToInt64(Encoding.ASCII.GetString(_buffer, 124, 11), 8);
- }
- long unixTimeStamp = Convert.ToInt64(Encoding.ASCII.GetString(_buffer, 136, 11), 8);
- LastModification = DateTimeOffset.FromUnixTimeSeconds(unixTimeStamp).DateTime;
-
- int storedChecksum = Convert.ToInt32(Encoding.ASCII.GetString(_buffer, 148, 6));
- RecalculateChecksum(_buffer);
- if (storedChecksum == _headerChecksum)
- return true;
-
- RecalculateAltChecksum(_buffer);
- return storedChecksum == _headerChecksum;
- }
-
- private void RecalculateAltChecksum(byte[] buf)
- {
- _spaces.CopyTo(buf, 148);
- _headerChecksum = 0;
- foreach (byte b in buf)
- {
- if ((b & 0x80) == 0x80)
- {
- _headerChecksum -= b ^ 0x80;
- }
- else
- {
- _headerChecksum += b;
- }
- }
- }
-
- public virtual byte[] GetHeaderValue()
- {
- // Clean old values
- Array.Clear(_buffer, 0, _buffer.Length);
-
- if (string.IsNullOrEmpty(FileName))
- throw new TarException("FileName can not be empty.");
-
- if (FileName.Length >= 100)
- throw new TarException("FileName is too long. It must be less than 100 bytes.");
-
- // Fill header
- Encoding.ASCII.GetBytes(FileName.PadRight(100, '\0')).CopyTo(_buffer, 0);
- Encoding.ASCII.GetBytes(ModeString).CopyTo(_buffer, 100);
- Encoding.ASCII.GetBytes(UserIdString).CopyTo(_buffer, 108);
- Encoding.ASCII.GetBytes(GroupIdString).CopyTo(_buffer, 116);
- Encoding.ASCII.GetBytes(SizeString).CopyTo(_buffer, 124);
- Encoding.ASCII.GetBytes(LastModificationString).CopyTo(_buffer, 136);
-
- // buffer[156] = 20;
- _buffer[156] = ((byte)EntryType);
-
- RecalculateChecksum(_buffer);
-
- // Write checksum
- Encoding.ASCII.GetBytes(HeaderChecksumString).CopyTo(_buffer, 148);
-
- return _buffer;
- }
-
- protected virtual void RecalculateChecksum(byte[] buf)
- {
- // Set default value for checksum. That is 8 spaces.
- _spaces.CopyTo(buf, 148);
-
- // Calculate checksum
- _headerChecksum = 0;
- foreach (byte b in buf)
- _headerChecksum += b;
- }
- }
-}
diff --git a/AMWD.Common/Packing/Tar/Utils/UsTarHeader.cs b/AMWD.Common/Packing/Tar/Utils/UsTarHeader.cs
deleted file mode 100644
index 4f26bf3..0000000
--- a/AMWD.Common/Packing/Tar/Utils/UsTarHeader.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-using System;
-using System.Net;
-using System.Text;
-
-namespace AMWD.Common.Packing.Tar.Utils
-{
- ///
- /// UsTar header implementation.
- ///
- internal class UsTarHeader : TarHeader
- {
- private const string Magic = "ustar";
- private const string Version = " ";
-
- private string _groupName;
-
- private string _namePrefix = string.Empty;
- private string _userName;
-
- public override string UserName
- {
- get => _userName.Replace("\0", string.Empty);
- set
- {
- if (value.Length > 32)
- throw new TarException("user name can not be longer than 32 chars");
-
- _userName = value;
- }
- }
-
- public override string GroupName
- {
- get => _groupName.Replace("\0", string.Empty);
- set
- {
- if (value.Length > 32)
- throw new TarException("group name can not be longer than 32 chars");
-
- _groupName = value;
- }
- }
-
- public override string FileName
- {
- get => _namePrefix.Replace("\0", string.Empty) + base.FileName.Replace("\0", string.Empty);
- set
- {
- if (value.Length > 100)
- {
- if (value.Length > 255)
- throw new TarException("UsTar fileName can not be longer thatn 255 chars");
-
- int position = value.Length - 100;
-
- // Find first path separator in the remaining 100 chars of the file name
- while (!IsPathSeparator(value[position]))
- {
- ++position;
- if (position == value.Length)
- {
- break;
- }
- }
- if (position == value.Length)
- position = value.Length - 100;
- _namePrefix = value.Substring(0, position);
-
- base.FileName = value.Substring(position, value.Length - position);
- }
- else
- {
- base.FileName = value;
- }
- }
- }
-
- public override bool UpdateHeaderFromBytes()
- {
- byte[] bytes = GetBytes();
-
- UserName = Encoding.ASCII.GetString(bytes, 0x109, 32);
- GroupName = Encoding.ASCII.GetString(bytes, 0x129, 32);
- _namePrefix = Encoding.ASCII.GetString(bytes, 347, 157);
-
- return base.UpdateHeaderFromBytes();
- }
-
- internal static bool IsPathSeparator(char ch)
- => ch == '\\' || ch == '/' || ch == '|'; // All the path separators I ever met.
-
- public override byte[] GetHeaderValue()
- {
- byte[] header = base.GetHeaderValue();
-
- Encoding.ASCII.GetBytes(Magic).CopyTo(header, 0x101); // Mark header as ustar
- Encoding.ASCII.GetBytes(Version).CopyTo(header, 0x106);
- Encoding.ASCII.GetBytes(UserName).CopyTo(header, 0x109);
- Encoding.ASCII.GetBytes(GroupName).CopyTo(header, 0x129);
- Encoding.ASCII.GetBytes(_namePrefix).CopyTo(header, 347);
-
- if (SizeInBytes >= 0x1FFFFFFFF)
- {
- byte[] bytes = BitConverter.GetBytes(IPAddress.HostToNetworkOrder(SizeInBytes));
- SetMarker(AlignTo12(bytes)).CopyTo(header, 124);
- }
-
- RecalculateChecksum(header);
- Encoding.ASCII.GetBytes(HeaderChecksumString).CopyTo(header, 148);
-
- return header;
- }
-
- private static byte[] SetMarker(byte[] bytes)
- {
- bytes[0] |= 0x80;
- return bytes;
- }
-
- private static byte[] AlignTo12(byte[] bytes)
- {
- byte[] retVal = new byte[12];
- bytes.CopyTo(retVal, 12 - bytes.Length);
- return retVal;
- }
- }
-}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b9ff10d..4638b9e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,7 @@
All notable changes to this project will be documented in this file.
-The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Upcoming - 0000-00-00
@@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+- Solution restructured to use multiple test projects
- Optimized for C# 12
- `IPNetwork` is used from (as `Microsoft.AspNetCore.HttpOverrides` is tagged as "out of support"):
- .NET Standard 2.0 and .NET 6.0: `Microsoft.AspNetCore.HttpOverrides.IPNetwork`
diff --git a/Common.sln b/Common.sln
index c1d89ff..eb68539 100644
--- a/Common.sln
+++ b/Common.sln
@@ -3,23 +3,31 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AMWD.Common", "AMWD.Common\AMWD.Common.csproj", "{F512C474-B670-4E47-911E-7C0674AA8E7E}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F2C7556A-99EB-43EB-8954-56A24AFE928F}"
+ ProjectSection(SolutionItems) = preProject
+ src\Directory.Build.props = src\Directory.Build.props
+ EndProjectSection
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AMWD.Common.AspNetCore", "AMWD.Common.AspNetCore\AMWD.Common.AspNetCore.csproj", "{725F40C9-8172-487F-B3D0-D7E38B4DB197}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E5DF156A-6C8B-4004-BA4C-A8DDE6FD3ECD}"
+ ProjectSection(SolutionItems) = preProject
+ test\Directory.Build.props = test\Directory.Build.props
+ EndProjectSection
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AMWD.Common.EntityFrameworkCore", "AMWD.Common.EntityFrameworkCore\AMWD.Common.EntityFrameworkCore.csproj", "{7091CECF-C981-4FB9-9CC6-91C4E65A6356}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AMWD.Common", "src\AMWD.Common\AMWD.Common.csproj", "{F512C474-B670-4E47-911E-7C0674AA8E7E}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AMWD.Common.AspNetCore", "src\AMWD.Common.AspNetCore\AMWD.Common.AspNetCore.csproj", "{725F40C9-8172-487F-B3D0-D7E38B4DB197}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AMWD.Common.EntityFrameworkCore", "src\AMWD.Common.EntityFrameworkCore\AMWD.Common.EntityFrameworkCore.csproj", "{7091CECF-C981-4FB9-9CC6-91C4E65A6356}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AMWD.Common.MessagePack", "src\AMWD.Common.MessagePack\AMWD.Common.MessagePack.csproj", "{EA014C15-93B6-4F2C-8229-1C13E22BF84A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AMWD.Common.Test", "src\AMWD.Common.Test\AMWD.Common.Test.csproj", "{6EBA2792-0B66-4C90-89A1-4E1D26D16443}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AMWD.Common.Tests", "test\AMWD.Common.Tests\AMWD.Common.Tests.csproj", "{9469D87B-126E-4338-92E3-701F762CB54D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AFBF83AE-FE7D-48C1-B7E7-31BF3E17C6FB}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F2C7556A-99EB-43EB-8954-56A24AFE928F}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E5DF156A-6C8B-4004-BA4C-A8DDE6FD3ECD}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AMWD.Common.Test", "AMWD.Common.Test\AMWD.Common.Test.csproj", "{6EBA2792-0B66-4C90-89A1-4E1D26D16443}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests", "UnitTests\UnitTests.csproj", "{9469D87B-126E-4338-92E3-701F762CB54D}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{86DE1B7C-3ECF-49B1-AB28-A976A3973FF5}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{86DE1B7C-3ECF-49B1-AB28-A976A3973FF5}"
ProjectSection(SolutionItems) = preProject
CHANGELOG.md = CHANGELOG.md
icon.png = icon.png
@@ -27,13 +35,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{86DE1B7C-3
README.md = README.md
EndProjectSection
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{7196DA2B-D858-4B25-BC23-865175CFCDEC}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7196DA2B-D858-4B25-BC23-865175CFCDEC}"
ProjectSection(SolutionItems) = preProject
.gitlab-ci.yml = .gitlab-ci.yml
directory.build.props = directory.build.props
EndProjectSection
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{93EC8B16-7DEF-4E39-B590-E804DEF7C607}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{93EC8B16-7DEF-4E39-B590-E804DEF7C607}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
@@ -41,7 +49,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{93EC8B16
nuget.config = nuget.config
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AMWD.Common.MessagePack", "AMWD.Common.MessagePack\AMWD.Common.MessagePack.csproj", "{EA014C15-93B6-4F2C-8229-1C13E22BF84A}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AMWD.Common.AspNetCore.Tests", "test\AMWD.Common.AspNetCore.Tests\AMWD.Common.AspNetCore.Tests.csproj", "{2CDA58C2-DE85-478D-9474-A937A20BECD1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -61,6 +69,10 @@ Global
{7091CECF-C981-4FB9-9CC6-91C4E65A6356}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7091CECF-C981-4FB9-9CC6-91C4E65A6356}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7091CECF-C981-4FB9-9CC6-91C4E65A6356}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EA014C15-93B6-4F2C-8229-1C13E22BF84A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EA014C15-93B6-4F2C-8229-1C13E22BF84A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EA014C15-93B6-4F2C-8229-1C13E22BF84A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EA014C15-93B6-4F2C-8229-1C13E22BF84A}.Release|Any CPU.Build.0 = Release|Any CPU
{6EBA2792-0B66-4C90-89A1-4E1D26D16443}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6EBA2792-0B66-4C90-89A1-4E1D26D16443}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EBA2792-0B66-4C90-89A1-4E1D26D16443}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -69,10 +81,10 @@ Global
{9469D87B-126E-4338-92E3-701F762CB54D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9469D87B-126E-4338-92E3-701F762CB54D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9469D87B-126E-4338-92E3-701F762CB54D}.Release|Any CPU.Build.0 = Release|Any CPU
- {EA014C15-93B6-4F2C-8229-1C13E22BF84A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {EA014C15-93B6-4F2C-8229-1C13E22BF84A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {EA014C15-93B6-4F2C-8229-1C13E22BF84A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {EA014C15-93B6-4F2C-8229-1C13E22BF84A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2CDA58C2-DE85-478D-9474-A937A20BECD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2CDA58C2-DE85-478D-9474-A937A20BECD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2CDA58C2-DE85-478D-9474-A937A20BECD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2CDA58C2-DE85-478D-9474-A937A20BECD1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -81,12 +93,13 @@ Global
{F512C474-B670-4E47-911E-7C0674AA8E7E} = {F2C7556A-99EB-43EB-8954-56A24AFE928F}
{725F40C9-8172-487F-B3D0-D7E38B4DB197} = {F2C7556A-99EB-43EB-8954-56A24AFE928F}
{7091CECF-C981-4FB9-9CC6-91C4E65A6356} = {F2C7556A-99EB-43EB-8954-56A24AFE928F}
+ {EA014C15-93B6-4F2C-8229-1C13E22BF84A} = {F2C7556A-99EB-43EB-8954-56A24AFE928F}
{6EBA2792-0B66-4C90-89A1-4E1D26D16443} = {F2C7556A-99EB-43EB-8954-56A24AFE928F}
{9469D87B-126E-4338-92E3-701F762CB54D} = {E5DF156A-6C8B-4004-BA4C-A8DDE6FD3ECD}
{86DE1B7C-3ECF-49B1-AB28-A976A3973FF5} = {AFBF83AE-FE7D-48C1-B7E7-31BF3E17C6FB}
{7196DA2B-D858-4B25-BC23-865175CFCDEC} = {AFBF83AE-FE7D-48C1-B7E7-31BF3E17C6FB}
{93EC8B16-7DEF-4E39-B590-E804DEF7C607} = {AFBF83AE-FE7D-48C1-B7E7-31BF3E17C6FB}
- {EA014C15-93B6-4F2C-8229-1C13E22BF84A} = {F2C7556A-99EB-43EB-8954-56A24AFE928F}
+ {2CDA58C2-DE85-478D-9474-A937A20BECD1} = {E5DF156A-6C8B-4004-BA4C-A8DDE6FD3ECD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {961E8DF8-DDF5-4D10-A510-CE409E9962AC}
diff --git a/Directory.Build.props b/Directory.Build.props
index 553ca7c..8665a0f 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,41 +1,11 @@
- {semvertag:main}{!:-dev}
+ 12.0
true
false
- true
-
- true
- snupkg
- false
-
- https://wiki.am-wd.de/libs/common
- Library with classes and extensions used frequently on AM.WD projects.
-
- git
- https://git.am-wd.de/AM.WD/common.git
- true
AM.WD
Andreas Müller
- © {copyright:2020-} AM.WD
- MIT
-
-
- true
-
-
-
-
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
diff --git a/README.md b/README.md
index b8c7d1f..c583682 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ To save time, they are all packed to NuGet packages.
| AMWD.Common.EntityFrameworkCore |  |
| AMWD.Common.MessagePack |  |
| AMWD.Common.Test |  |
-| CI / CD |   |
+| CI / CD |   |
## Documentation
diff --git a/UnitTests/Common/Packing/Tar/TarReaderTests.cs b/UnitTests/Common/Packing/Tar/TarReaderTests.cs
deleted file mode 100644
index 3e5abc7..0000000
--- a/UnitTests/Common/Packing/Tar/TarReaderTests.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace UnitTests.Common.Packing.Tar
-{
- internal class TarReaderTests
- {
- }
-}
diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj
deleted file mode 100644
index aed5779..0000000
--- a/UnitTests/UnitTests.csproj
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
- net8.0
- 12.0
- false
- true
- false
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/AMWD.Common.AspNetCore/AMWD.Common.AspNetCore.csproj b/src/AMWD.Common.AspNetCore/AMWD.Common.AspNetCore.csproj
similarity index 57%
rename from AMWD.Common.AspNetCore/AMWD.Common.AspNetCore.csproj
rename to src/AMWD.Common.AspNetCore/AMWD.Common.AspNetCore.csproj
index 7cece0b..689c55c 100644
--- a/AMWD.Common.AspNetCore/AMWD.Common.AspNetCore.csproj
+++ b/src/AMWD.Common.AspNetCore/AMWD.Common.AspNetCore.csproj
@@ -2,25 +2,15 @@
net6.0;net8.0
- 12.0
- asp/v[0-9]*
- AMWD.Common.AspNetCore
+ amwd-common-aspnetcore
AMWD.Common.AspNetCore
- true
+ asp/v[0-9]*
AMWD.Common.AspNetCore
- icon.png
- README.md
-
AM.WD Common Library for ASP.NET Core
-
-
-
-
-
diff --git a/AMWD.Common.AspNetCore/Attributes/BasicAuthenticationAttribute.cs b/src/AMWD.Common.AspNetCore/Attributes/BasicAuthenticationAttribute.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Attributes/BasicAuthenticationAttribute.cs
rename to src/AMWD.Common.AspNetCore/Attributes/BasicAuthenticationAttribute.cs
diff --git a/AMWD.Common.AspNetCore/Attributes/GoogleReCaptchaAttribute.cs b/src/AMWD.Common.AspNetCore/Attributes/GoogleReCaptchaAttribute.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Attributes/GoogleReCaptchaAttribute.cs
rename to src/AMWD.Common.AspNetCore/Attributes/GoogleReCaptchaAttribute.cs
diff --git a/AMWD.Common.AspNetCore/Attributes/IPAllowListAttribute.cs b/src/AMWD.Common.AspNetCore/Attributes/IPAllowListAttribute.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Attributes/IPAllowListAttribute.cs
rename to src/AMWD.Common.AspNetCore/Attributes/IPAllowListAttribute.cs
diff --git a/AMWD.Common.AspNetCore/Attributes/IPBlockListAttribute.cs b/src/AMWD.Common.AspNetCore/Attributes/IPBlockListAttribute.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Attributes/IPBlockListAttribute.cs
rename to src/AMWD.Common.AspNetCore/Attributes/IPBlockListAttribute.cs
diff --git a/AMWD.Common.AspNetCore/Extensions/ApplicationBuilderExtensions.cs b/src/AMWD.Common.AspNetCore/Extensions/ApplicationBuilderExtensions.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Extensions/ApplicationBuilderExtensions.cs
rename to src/AMWD.Common.AspNetCore/Extensions/ApplicationBuilderExtensions.cs
diff --git a/AMWD.Common.AspNetCore/Extensions/HtmlExtensions.cs b/src/AMWD.Common.AspNetCore/Extensions/HtmlExtensions.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Extensions/HtmlExtensions.cs
rename to src/AMWD.Common.AspNetCore/Extensions/HtmlExtensions.cs
diff --git a/AMWD.Common.AspNetCore/Extensions/HttpContextExtensions.cs b/src/AMWD.Common.AspNetCore/Extensions/HttpContextExtensions.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Extensions/HttpContextExtensions.cs
rename to src/AMWD.Common.AspNetCore/Extensions/HttpContextExtensions.cs
diff --git a/AMWD.Common.AspNetCore/Extensions/LoggerExtensions.cs b/src/AMWD.Common.AspNetCore/Extensions/LoggerExtensions.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Extensions/LoggerExtensions.cs
rename to src/AMWD.Common.AspNetCore/Extensions/LoggerExtensions.cs
diff --git a/AMWD.Common.AspNetCore/Extensions/ModelStateDictionaryExtensions.cs b/src/AMWD.Common.AspNetCore/Extensions/ModelStateDictionaryExtensions.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Extensions/ModelStateDictionaryExtensions.cs
rename to src/AMWD.Common.AspNetCore/Extensions/ModelStateDictionaryExtensions.cs
diff --git a/AMWD.Common.AspNetCore/Extensions/ServiceCollectionExtensions.cs b/src/AMWD.Common.AspNetCore/Extensions/ServiceCollectionExtensions.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Extensions/ServiceCollectionExtensions.cs
rename to src/AMWD.Common.AspNetCore/Extensions/ServiceCollectionExtensions.cs
diff --git a/AMWD.Common.AspNetCore/Extensions/SessionExtensions.cs b/src/AMWD.Common.AspNetCore/Extensions/SessionExtensions.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Extensions/SessionExtensions.cs
rename to src/AMWD.Common.AspNetCore/Extensions/SessionExtensions.cs
diff --git a/AMWD.Common.AspNetCore/ModelBinders/InvariantFloatingPointModelBinder.cs b/src/AMWD.Common.AspNetCore/ModelBinders/InvariantFloatingPointModelBinder.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/ModelBinders/InvariantFloatingPointModelBinder.cs
rename to src/AMWD.Common.AspNetCore/ModelBinders/InvariantFloatingPointModelBinder.cs
diff --git a/AMWD.Common.AspNetCore/ModelBinders/InvariantFloatingPointModelBinderProvider.cs b/src/AMWD.Common.AspNetCore/ModelBinders/InvariantFloatingPointModelBinderProvider.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/ModelBinders/InvariantFloatingPointModelBinderProvider.cs
rename to src/AMWD.Common.AspNetCore/ModelBinders/InvariantFloatingPointModelBinderProvider.cs
diff --git a/AMWD.Common.AspNetCore/Security/BasicAuthentication/BasicAuthenticationHandler.cs b/src/AMWD.Common.AspNetCore/Security/BasicAuthentication/BasicAuthenticationHandler.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Security/BasicAuthentication/BasicAuthenticationHandler.cs
rename to src/AMWD.Common.AspNetCore/Security/BasicAuthentication/BasicAuthenticationHandler.cs
diff --git a/AMWD.Common.AspNetCore/Security/BasicAuthentication/BasicAuthenticationMiddleware.cs b/src/AMWD.Common.AspNetCore/Security/BasicAuthentication/BasicAuthenticationMiddleware.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Security/BasicAuthentication/BasicAuthenticationMiddleware.cs
rename to src/AMWD.Common.AspNetCore/Security/BasicAuthentication/BasicAuthenticationMiddleware.cs
diff --git a/AMWD.Common.AspNetCore/Security/BasicAuthentication/IBasicAuthenticationValidator.cs b/src/AMWD.Common.AspNetCore/Security/BasicAuthentication/IBasicAuthenticationValidator.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Security/BasicAuthentication/IBasicAuthenticationValidator.cs
rename to src/AMWD.Common.AspNetCore/Security/BasicAuthentication/IBasicAuthenticationValidator.cs
diff --git a/AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathExtensions.cs b/src/AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathExtensions.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathExtensions.cs
rename to src/AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathExtensions.cs
diff --git a/AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathMiddleware.cs b/src/AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathMiddleware.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathMiddleware.cs
rename to src/AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathMiddleware.cs
diff --git a/AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathOptions.cs b/src/AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathOptions.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathOptions.cs
rename to src/AMWD.Common.AspNetCore/Security/PathProtection/ProtectedPathOptions.cs
diff --git a/AMWD.Common.AspNetCore/TagHelpers/ConditionClassTagHelper.cs b/src/AMWD.Common.AspNetCore/TagHelpers/ConditionClassTagHelper.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/TagHelpers/ConditionClassTagHelper.cs
rename to src/AMWD.Common.AspNetCore/TagHelpers/ConditionClassTagHelper.cs
diff --git a/AMWD.Common.AspNetCore/TagHelpers/EmailTagHelper.cs b/src/AMWD.Common.AspNetCore/TagHelpers/EmailTagHelper.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/TagHelpers/EmailTagHelper.cs
rename to src/AMWD.Common.AspNetCore/TagHelpers/EmailTagHelper.cs
diff --git a/AMWD.Common.AspNetCore/TagHelpers/IntegrityHashTagHelper.cs b/src/AMWD.Common.AspNetCore/TagHelpers/IntegrityHashTagHelper.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/TagHelpers/IntegrityHashTagHelper.cs
rename to src/AMWD.Common.AspNetCore/TagHelpers/IntegrityHashTagHelper.cs
diff --git a/AMWD.Common.AspNetCore/TagHelpers/NumberInputTagHelper.cs b/src/AMWD.Common.AspNetCore/TagHelpers/NumberInputTagHelper.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/TagHelpers/NumberInputTagHelper.cs
rename to src/AMWD.Common.AspNetCore/TagHelpers/NumberInputTagHelper.cs
diff --git a/AMWD.Common.AspNetCore/Utilities/HtmlHelper.cs b/src/AMWD.Common.AspNetCore/Utilities/HtmlHelper.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Utilities/HtmlHelper.cs
rename to src/AMWD.Common.AspNetCore/Utilities/HtmlHelper.cs
diff --git a/AMWD.Common.AspNetCore/Utilities/PasswordHelper.cs b/src/AMWD.Common.AspNetCore/Utilities/PasswordHelper.cs
similarity index 100%
rename from AMWD.Common.AspNetCore/Utilities/PasswordHelper.cs
rename to src/AMWD.Common.AspNetCore/Utilities/PasswordHelper.cs
diff --git a/AMWD.Common.EntityFrameworkCore/AMWD.Common.EntityFrameworkCore.csproj b/src/AMWD.Common.EntityFrameworkCore/AMWD.Common.EntityFrameworkCore.csproj
similarity index 73%
rename from AMWD.Common.EntityFrameworkCore/AMWD.Common.EntityFrameworkCore.csproj
rename to src/AMWD.Common.EntityFrameworkCore/AMWD.Common.EntityFrameworkCore.csproj
index a85eb4e..b07b8ad 100644
--- a/AMWD.Common.EntityFrameworkCore/AMWD.Common.EntityFrameworkCore.csproj
+++ b/src/AMWD.Common.EntityFrameworkCore/AMWD.Common.EntityFrameworkCore.csproj
@@ -2,25 +2,15 @@
net6.0;net8.0
- 12.0
- efc/v[0-9]*
- AMWD.Common.EntityFrameworkCore
+ amwd-common-efcore
AMWD.Common.EntityFrameworkCore
- true
+ efc/v[0-9]*
AMWD.Common.EntityFrameworkCore
- icon.png
- README.md
-
AM.WD Common Library for EntityFramework Core
-
-
-
-
-
diff --git a/AMWD.Common.EntityFrameworkCore/Attributes/DatabaseIndexAttribute.cs b/src/AMWD.Common.EntityFrameworkCore/Attributes/DatabaseIndexAttribute.cs
similarity index 100%
rename from AMWD.Common.EntityFrameworkCore/Attributes/DatabaseIndexAttribute.cs
rename to src/AMWD.Common.EntityFrameworkCore/Attributes/DatabaseIndexAttribute.cs
diff --git a/AMWD.Common.EntityFrameworkCore/Converters/DateOnlyConverter.cs b/src/AMWD.Common.EntityFrameworkCore/Converters/DateOnlyConverter.cs
similarity index 100%
rename from AMWD.Common.EntityFrameworkCore/Converters/DateOnlyConverter.cs
rename to src/AMWD.Common.EntityFrameworkCore/Converters/DateOnlyConverter.cs
diff --git a/AMWD.Common.EntityFrameworkCore/Converters/NullableDateOnlyConverter.cs b/src/AMWD.Common.EntityFrameworkCore/Converters/NullableDateOnlyConverter.cs
similarity index 100%
rename from AMWD.Common.EntityFrameworkCore/Converters/NullableDateOnlyConverter.cs
rename to src/AMWD.Common.EntityFrameworkCore/Converters/NullableDateOnlyConverter.cs
diff --git a/AMWD.Common.EntityFrameworkCore/Converters/NullableTimeOnlyConverter.cs b/src/AMWD.Common.EntityFrameworkCore/Converters/NullableTimeOnlyConverter.cs
similarity index 100%
rename from AMWD.Common.EntityFrameworkCore/Converters/NullableTimeOnlyConverter.cs
rename to src/AMWD.Common.EntityFrameworkCore/Converters/NullableTimeOnlyConverter.cs
diff --git a/AMWD.Common.EntityFrameworkCore/Converters/TimeOnlyConverter.cs b/src/AMWD.Common.EntityFrameworkCore/Converters/TimeOnlyConverter.cs
similarity index 100%
rename from AMWD.Common.EntityFrameworkCore/Converters/TimeOnlyConverter.cs
rename to src/AMWD.Common.EntityFrameworkCore/Converters/TimeOnlyConverter.cs
diff --git a/AMWD.Common.EntityFrameworkCore/Exceptions/DatabaseProviderException.cs b/src/AMWD.Common.EntityFrameworkCore/Exceptions/DatabaseProviderException.cs
similarity index 100%
rename from AMWD.Common.EntityFrameworkCore/Exceptions/DatabaseProviderException.cs
rename to src/AMWD.Common.EntityFrameworkCore/Exceptions/DatabaseProviderException.cs
diff --git a/AMWD.Common.EntityFrameworkCore/Extensions/DatabaseFacadeExtensions.cs b/src/AMWD.Common.EntityFrameworkCore/Extensions/DatabaseFacadeExtensions.cs
similarity index 100%
rename from AMWD.Common.EntityFrameworkCore/Extensions/DatabaseFacadeExtensions.cs
rename to src/AMWD.Common.EntityFrameworkCore/Extensions/DatabaseFacadeExtensions.cs
diff --git a/AMWD.Common.EntityFrameworkCore/Extensions/DbContextExensions.cs b/src/AMWD.Common.EntityFrameworkCore/Extensions/DbContextExensions.cs
similarity index 100%
rename from AMWD.Common.EntityFrameworkCore/Extensions/DbContextExensions.cs
rename to src/AMWD.Common.EntityFrameworkCore/Extensions/DbContextExensions.cs
diff --git a/AMWD.Common.EntityFrameworkCore/Extensions/DbContextOptionsBuilderExtensions.cs b/src/AMWD.Common.EntityFrameworkCore/Extensions/DbContextOptionsBuilderExtensions.cs
similarity index 100%
rename from AMWD.Common.EntityFrameworkCore/Extensions/DbContextOptionsBuilderExtensions.cs
rename to src/AMWD.Common.EntityFrameworkCore/Extensions/DbContextOptionsBuilderExtensions.cs
diff --git a/AMWD.Common.EntityFrameworkCore/Extensions/ModelBuilderExtensions.cs b/src/AMWD.Common.EntityFrameworkCore/Extensions/ModelBuilderExtensions.cs
similarity index 100%
rename from AMWD.Common.EntityFrameworkCore/Extensions/ModelBuilderExtensions.cs
rename to src/AMWD.Common.EntityFrameworkCore/Extensions/ModelBuilderExtensions.cs
diff --git a/AMWD.Common.EntityFrameworkCore/Extensions/ModelConfigurationBuilderExtensions.cs b/src/AMWD.Common.EntityFrameworkCore/Extensions/ModelConfigurationBuilderExtensions.cs
similarity index 100%
rename from AMWD.Common.EntityFrameworkCore/Extensions/ModelConfigurationBuilderExtensions.cs
rename to src/AMWD.Common.EntityFrameworkCore/Extensions/ModelConfigurationBuilderExtensions.cs
diff --git a/AMWD.Common.EntityFrameworkCore/GlobalSuppressions.cs b/src/AMWD.Common.EntityFrameworkCore/GlobalSuppressions.cs
similarity index 100%
rename from AMWD.Common.EntityFrameworkCore/GlobalSuppressions.cs
rename to src/AMWD.Common.EntityFrameworkCore/GlobalSuppressions.cs
diff --git a/AMWD.Common.EntityFrameworkCore/Utilities/DatabaseMigrationOptions.cs b/src/AMWD.Common.EntityFrameworkCore/Utilities/DatabaseMigrationOptions.cs
similarity index 100%
rename from AMWD.Common.EntityFrameworkCore/Utilities/DatabaseMigrationOptions.cs
rename to src/AMWD.Common.EntityFrameworkCore/Utilities/DatabaseMigrationOptions.cs
diff --git a/AMWD.Common.EntityFrameworkCore/Utilities/DatabaseProviderOptions.cs b/src/AMWD.Common.EntityFrameworkCore/Utilities/DatabaseProviderOptions.cs
similarity index 100%
rename from AMWD.Common.EntityFrameworkCore/Utilities/DatabaseProviderOptions.cs
rename to src/AMWD.Common.EntityFrameworkCore/Utilities/DatabaseProviderOptions.cs
diff --git a/AMWD.Common.MessagePack/AMWD.Common.MessagePack.csproj b/src/AMWD.Common.MessagePack/AMWD.Common.MessagePack.csproj
similarity index 53%
rename from AMWD.Common.MessagePack/AMWD.Common.MessagePack.csproj
rename to src/AMWD.Common.MessagePack/AMWD.Common.MessagePack.csproj
index 986d0c6..39bf8b2 100644
--- a/AMWD.Common.MessagePack/AMWD.Common.MessagePack.csproj
+++ b/src/AMWD.Common.MessagePack/AMWD.Common.MessagePack.csproj
@@ -2,27 +2,17 @@
netstandard2.0;net6.0;net8.0
- 12.0
- msgpack/v[0-9]*
- AMWD.Common.MessagePack
+ amwd-common-msgpack
AMWD.Common.MessagePack
- true
+ msgpack/v[0-9]*
AMWD.Common.MessagePack
- icon.png
- README.md
-
AM.WD Common Library for MessagePack
-
-
-
-
-
-
+
diff --git a/AMWD.Common.MessagePack/Formatters/IPAddressArrayFormatter.cs b/src/AMWD.Common.MessagePack/Formatters/IPAddressArrayFormatter.cs
similarity index 100%
rename from AMWD.Common.MessagePack/Formatters/IPAddressArrayFormatter.cs
rename to src/AMWD.Common.MessagePack/Formatters/IPAddressArrayFormatter.cs
diff --git a/AMWD.Common.MessagePack/Formatters/IPAddressFormatter.cs b/src/AMWD.Common.MessagePack/Formatters/IPAddressFormatter.cs
similarity index 100%
rename from AMWD.Common.MessagePack/Formatters/IPAddressFormatter.cs
rename to src/AMWD.Common.MessagePack/Formatters/IPAddressFormatter.cs
diff --git a/AMWD.Common.MessagePack/Formatters/IPAddressListFormatter.cs b/src/AMWD.Common.MessagePack/Formatters/IPAddressListFormatter.cs
similarity index 100%
rename from AMWD.Common.MessagePack/Formatters/IPAddressListFormatter.cs
rename to src/AMWD.Common.MessagePack/Formatters/IPAddressListFormatter.cs
diff --git a/AMWD.Common.MessagePack/Formatters/IPNetworkArrayFormatter.cs b/src/AMWD.Common.MessagePack/Formatters/IPNetworkArrayFormatter.cs
similarity index 100%
rename from AMWD.Common.MessagePack/Formatters/IPNetworkArrayFormatter.cs
rename to src/AMWD.Common.MessagePack/Formatters/IPNetworkArrayFormatter.cs
diff --git a/AMWD.Common.MessagePack/Formatters/IPNetworkFormatter.cs b/src/AMWD.Common.MessagePack/Formatters/IPNetworkFormatter.cs
similarity index 100%
rename from AMWD.Common.MessagePack/Formatters/IPNetworkFormatter.cs
rename to src/AMWD.Common.MessagePack/Formatters/IPNetworkFormatter.cs
diff --git a/AMWD.Common.MessagePack/Formatters/IPNetworkListFormatter.cs b/src/AMWD.Common.MessagePack/Formatters/IPNetworkListFormatter.cs
similarity index 100%
rename from AMWD.Common.MessagePack/Formatters/IPNetworkListFormatter.cs
rename to src/AMWD.Common.MessagePack/Formatters/IPNetworkListFormatter.cs
diff --git a/AMWD.Common.MessagePack/Utilities/NetworkHelper.cs b/src/AMWD.Common.MessagePack/Utilities/NetworkHelper.cs
similarity index 100%
rename from AMWD.Common.MessagePack/Utilities/NetworkHelper.cs
rename to src/AMWD.Common.MessagePack/Utilities/NetworkHelper.cs
diff --git a/AMWD.Common.Test/AMWD.Common.Test.csproj b/src/AMWD.Common.Test/AMWD.Common.Test.csproj
similarity index 53%
rename from AMWD.Common.Test/AMWD.Common.Test.csproj
rename to src/AMWD.Common.Test/AMWD.Common.Test.csproj
index fcb3652..8bc807f 100644
--- a/AMWD.Common.Test/AMWD.Common.Test.csproj
+++ b/src/AMWD.Common.Test/AMWD.Common.Test.csproj
@@ -2,28 +2,18 @@
netstandard2.0
- 12.0
- test/v[0-9]*
- AMWD.Common.Test
+ amwd-common-test
AMWD.Common.Test
- true
+ test/v[0-9]*
AMWD.Common.Test
- icon.png
- README.md
-
AM.WD Common Library for Unit-Testing
-
-
-
-
-
-
+
diff --git a/AMWD.Common.Test/HttpMessageHandlerMoq.cs b/src/AMWD.Common.Test/HttpMessageHandlerMoq.cs
similarity index 100%
rename from AMWD.Common.Test/HttpMessageHandlerMoq.cs
rename to src/AMWD.Common.Test/HttpMessageHandlerMoq.cs
diff --git a/AMWD.Common.Test/SnapshotAssert.cs b/src/AMWD.Common.Test/SnapshotAssert.cs
similarity index 100%
rename from AMWD.Common.Test/SnapshotAssert.cs
rename to src/AMWD.Common.Test/SnapshotAssert.cs
diff --git a/AMWD.Common.Test/TcpClientMoq.cs b/src/AMWD.Common.Test/TcpClientMoq.cs
similarity index 100%
rename from AMWD.Common.Test/TcpClientMoq.cs
rename to src/AMWD.Common.Test/TcpClientMoq.cs
diff --git a/AMWD.Common/AMWD.Common.csproj b/src/AMWD.Common/AMWD.Common.csproj
similarity index 67%
rename from AMWD.Common/AMWD.Common.csproj
rename to src/AMWD.Common/AMWD.Common.csproj
index e37a629..f436227 100644
--- a/AMWD.Common/AMWD.Common.csproj
+++ b/src/AMWD.Common/AMWD.Common.csproj
@@ -2,24 +2,14 @@
netstandard2.0;net8.0
- 12.0
- AMWD.Common
+ amwd-common
AMWD.Common
- true
AMWD.Common
- icon.png
- README.md
-
AM.WD Common Library
-
-
-
-
-
diff --git a/AMWD.Common/Cli/Argument.cs b/src/AMWD.Common/Cli/Argument.cs
similarity index 100%
rename from AMWD.Common/Cli/Argument.cs
rename to src/AMWD.Common/Cli/Argument.cs
diff --git a/AMWD.Common/Cli/CommandLineParser.cs b/src/AMWD.Common/Cli/CommandLineParser.cs
similarity index 100%
rename from AMWD.Common/Cli/CommandLineParser.cs
rename to src/AMWD.Common/Cli/CommandLineParser.cs
diff --git a/AMWD.Common/Cli/EnumerableWalker.cs b/src/AMWD.Common/Cli/EnumerableWalker.cs
similarity index 100%
rename from AMWD.Common/Cli/EnumerableWalker.cs
rename to src/AMWD.Common/Cli/EnumerableWalker.cs
diff --git a/AMWD.Common/Cli/Option.cs b/src/AMWD.Common/Cli/Option.cs
similarity index 100%
rename from AMWD.Common/Cli/Option.cs
rename to src/AMWD.Common/Cli/Option.cs
diff --git a/AMWD.Common/Comparer/DomainComparer.cs b/src/AMWD.Common/Comparer/DomainComparer.cs
similarity index 100%
rename from AMWD.Common/Comparer/DomainComparer.cs
rename to src/AMWD.Common/Comparer/DomainComparer.cs
diff --git a/AMWD.Common/Comparer/IPAddressComparer.cs b/src/AMWD.Common/Comparer/IPAddressComparer.cs
similarity index 100%
rename from AMWD.Common/Comparer/IPAddressComparer.cs
rename to src/AMWD.Common/Comparer/IPAddressComparer.cs
diff --git a/AMWD.Common/Comparer/VersionStringComparer.cs b/src/AMWD.Common/Comparer/VersionStringComparer.cs
similarity index 100%
rename from AMWD.Common/Comparer/VersionStringComparer.cs
rename to src/AMWD.Common/Comparer/VersionStringComparer.cs
diff --git a/AMWD.Common/Converters/ByteArrayHexConverter.cs b/src/AMWD.Common/Converters/ByteArrayHexConverter.cs
similarity index 100%
rename from AMWD.Common/Converters/ByteArrayHexConverter.cs
rename to src/AMWD.Common/Converters/ByteArrayHexConverter.cs
diff --git a/AMWD.Common/Converters/IPAddressConverter.cs b/src/AMWD.Common/Converters/IPAddressConverter.cs
similarity index 100%
rename from AMWD.Common/Converters/IPAddressConverter.cs
rename to src/AMWD.Common/Converters/IPAddressConverter.cs
diff --git a/AMWD.Common/Converters/IPNetworkConverter.cs b/src/AMWD.Common/Converters/IPNetworkConverter.cs
similarity index 100%
rename from AMWD.Common/Converters/IPNetworkConverter.cs
rename to src/AMWD.Common/Converters/IPNetworkConverter.cs
diff --git a/AMWD.Common/Extensions/CollectionExtensions.cs b/src/AMWD.Common/Extensions/CollectionExtensions.cs
similarity index 100%
rename from AMWD.Common/Extensions/CollectionExtensions.cs
rename to src/AMWD.Common/Extensions/CollectionExtensions.cs
diff --git a/AMWD.Common/Extensions/CryptographyHelperExtensions.cs b/src/AMWD.Common/Extensions/CryptographyHelperExtensions.cs
similarity index 100%
rename from AMWD.Common/Extensions/CryptographyHelperExtensions.cs
rename to src/AMWD.Common/Extensions/CryptographyHelperExtensions.cs
diff --git a/AMWD.Common/Extensions/DateTimeExtensions.cs b/src/AMWD.Common/Extensions/DateTimeExtensions.cs
similarity index 100%
rename from AMWD.Common/Extensions/DateTimeExtensions.cs
rename to src/AMWD.Common/Extensions/DateTimeExtensions.cs
diff --git a/AMWD.Common/Extensions/EnumExtensions.cs b/src/AMWD.Common/Extensions/EnumExtensions.cs
similarity index 100%
rename from AMWD.Common/Extensions/EnumExtensions.cs
rename to src/AMWD.Common/Extensions/EnumExtensions.cs
diff --git a/AMWD.Common/Extensions/ExceptionExtensions.cs b/src/AMWD.Common/Extensions/ExceptionExtensions.cs
similarity index 100%
rename from AMWD.Common/Extensions/ExceptionExtensions.cs
rename to src/AMWD.Common/Extensions/ExceptionExtensions.cs
diff --git a/AMWD.Common/Extensions/IPAddressExtensions.cs b/src/AMWD.Common/Extensions/IPAddressExtensions.cs
similarity index 100%
rename from AMWD.Common/Extensions/IPAddressExtensions.cs
rename to src/AMWD.Common/Extensions/IPAddressExtensions.cs
diff --git a/AMWD.Common/Extensions/JsonExtensions.cs b/src/AMWD.Common/Extensions/JsonExtensions.cs
similarity index 100%
rename from AMWD.Common/Extensions/JsonExtensions.cs
rename to src/AMWD.Common/Extensions/JsonExtensions.cs
diff --git a/AMWD.Common/Extensions/ReaderWriterLockSlimExtensions.cs b/src/AMWD.Common/Extensions/ReaderWriterLockSlimExtensions.cs
similarity index 100%
rename from AMWD.Common/Extensions/ReaderWriterLockSlimExtensions.cs
rename to src/AMWD.Common/Extensions/ReaderWriterLockSlimExtensions.cs
diff --git a/AMWD.Common/Extensions/ReflectionExtensions.cs b/src/AMWD.Common/Extensions/ReflectionExtensions.cs
similarity index 100%
rename from AMWD.Common/Extensions/ReflectionExtensions.cs
rename to src/AMWD.Common/Extensions/ReflectionExtensions.cs
diff --git a/AMWD.Common/Extensions/StreamExtensions.cs b/src/AMWD.Common/Extensions/StreamExtensions.cs
similarity index 100%
rename from AMWD.Common/Extensions/StreamExtensions.cs
rename to src/AMWD.Common/Extensions/StreamExtensions.cs
diff --git a/AMWD.Common/Extensions/StringExtensions.cs b/src/AMWD.Common/Extensions/StringExtensions.cs
similarity index 87%
rename from AMWD.Common/Extensions/StringExtensions.cs
rename to src/AMWD.Common/Extensions/StringExtensions.cs
index 7a7e802..bb50e3a 100644
--- a/AMWD.Common/Extensions/StringExtensions.cs
+++ b/src/AMWD.Common/Extensions/StringExtensions.cs
@@ -41,7 +41,7 @@ namespace System
if (InvalidHexCharRegex().IsMatch(str))
yield break;
#else
- if (Regex.IsMatch(str, "[^0-9a-fA-F]"))
+ if (Regex.IsMatch(str, "[^0-9a-fA-F]", RegexOptions.Compiled))
yield break;
#endif
@@ -180,18 +180,30 @@ namespace System
/// true when the email address is valid, other wise false.
public static bool IsValidEmailAddress(this string emailAddress, IEnumerable nameservers)
{
+ if (string.IsNullOrWhiteSpace(emailAddress))
+ return false;
+
try
{
var mailAddress = new MailAddress(emailAddress);
- bool isValid = mailAddress.Address == emailAddress;
+ if (mailAddress.Address != emailAddress)
+ return false;
- if (isValid && nameservers?.Any() == true)
+#if NET8_0_OR_GREATER
+ if (!ValidEmailRegex().IsMatch(emailAddress))
+ return false;
+#else
+ string emailRegex = @"^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$";
+ if (!Regex.IsMatch(emailAddress, emailRegex, RegexOptions.Compiled))
+ return false;
+#endif
+
+ if (nameservers?.Any() == true)
{
var dnsClientType = Type.GetType("DNS.Client.DnsClient, DNS") ?? throw new DllNotFoundException("The DNS NuGet package is required: https://www.nuget.org/packages/DNS/7.0.0");
var recordTypeType = Type.GetType("DNS.Protocol.RecordType, DNS");
var resolveMethodInfo = dnsClientType.GetMethod("Resolve", [typeof(string), recordTypeType, typeof(CancellationToken)]);
- bool exists = false;
foreach (var nameserver in nameservers)
{
object dnsClient = Activator.CreateInstance(dnsClientType, [nameserver]);
@@ -210,21 +222,13 @@ namespace System
foreach (object item in (list as IEnumerable))
{
int type = (int)item.GetType().GetProperty("Type").GetValue(item);
- if (type == 15)
- {
- exists = true;
- break;
- }
+ if (type == 15) // MX found
+ return true;
}
-
- if (exists)
- break;
}
-
- isValid &= exists;
}
- return isValid;
+ return true;
}
catch
{
@@ -244,8 +248,11 @@ namespace System
=> sb.Append(value).Append(newLine);
#if NET8_0_OR_GREATER
- [GeneratedRegex("[^0-9a-fA-F]")]
+ [GeneratedRegex("[^0-9a-fA-F]", RegexOptions.Compiled)]
private static partial Regex InvalidHexCharRegex();
+
+ [GeneratedRegex(@"^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", RegexOptions.Compiled)]
+ private static partial Regex ValidEmailRegex();
#endif
}
}
diff --git a/src/AMWD.Common/InternalsVisibleTo.cs b/src/AMWD.Common/InternalsVisibleTo.cs
new file mode 100644
index 0000000..6c9f07b
--- /dev/null
+++ b/src/AMWD.Common/InternalsVisibleTo.cs
@@ -0,0 +1,4 @@
+using System.Runtime.CompilerServices;
+
+[assembly: InternalsVisibleTo("AMWD.Common.Tests")]
+[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
diff --git a/AMWD.Common/Logging/FileLogger.cs b/src/AMWD.Common/Logging/FileLogger.cs
similarity index 100%
rename from AMWD.Common/Logging/FileLogger.cs
rename to src/AMWD.Common/Logging/FileLogger.cs
diff --git a/AMWD.Common/Logging/NullScope.cs b/src/AMWD.Common/Logging/NullScope.cs
similarity index 100%
rename from AMWD.Common/Logging/NullScope.cs
rename to src/AMWD.Common/Logging/NullScope.cs
diff --git a/AMWD.Common/Packing/Ar/ArFileInfo.cs b/src/AMWD.Common/Packing/Ar/ArFileInfo.cs
similarity index 100%
rename from AMWD.Common/Packing/Ar/ArFileInfo.cs
rename to src/AMWD.Common/Packing/Ar/ArFileInfo.cs
diff --git a/AMWD.Common/Packing/Ar/ArReader.cs b/src/AMWD.Common/Packing/Ar/ArReader.cs
similarity index 95%
rename from AMWD.Common/Packing/Ar/ArReader.cs
rename to src/AMWD.Common/Packing/Ar/ArReader.cs
index 28b2e41..821b3e6 100644
--- a/AMWD.Common/Packing/Ar/ArReader.cs
+++ b/src/AMWD.Common/Packing/Ar/ArReader.cs
@@ -14,7 +14,7 @@ namespace AMWD.Common.Packing.Ar
// Source: http://en.wikipedia.org/wiki/Ar_%28Unix%29
private readonly Stream _inStream;
- private readonly List _files = new();
+ private readonly List _files = [];
private readonly long _streamStartPosition;
///
diff --git a/AMWD.Common/Packing/Ar/ArWriter.cs b/src/AMWD.Common/Packing/Ar/ArWriter.cs
similarity index 92%
rename from AMWD.Common/Packing/Ar/ArWriter.cs
rename to src/AMWD.Common/Packing/Ar/ArWriter.cs
index fbb948f..f1c6563 100644
--- a/AMWD.Common/Packing/Ar/ArWriter.cs
+++ b/src/AMWD.Common/Packing/Ar/ArWriter.cs
@@ -64,7 +64,7 @@ namespace AMWD.Common.Packing.Ar
// Align to even offsets, pad with LF bytes
if ((_outStream.Position % 2) != 0)
{
- byte[] bytes = new byte[] { 0x0A };
+ byte[] bytes = [0x0A];
_outStream.Write(bytes, 0, 1);
}
}
@@ -124,12 +124,12 @@ namespace AMWD.Common.Packing.Ar
// File size in bytes
if (fileSize < 0 || 10000000000 <= fileSize)
- throw new ArgumentOutOfRangeException("Invalid file size."); // above 9.32 GB
+ throw new ArgumentOutOfRangeException(nameof(fileSize), "Invalid file size."); // above 9.32 GB
WriteAsciiString(fileSize.ToString().PadRight(10, ' '));
// File magic
- byte[] bytes = new byte[] { 0x60, 0x0A };
+ byte[] bytes = [0x60, 0x0A];
_outStream.Write(bytes, 0, 2);
}
diff --git a/AMWD.Common/Utilities/AsyncQueue.cs b/src/AMWD.Common/Utilities/AsyncQueue.cs
similarity index 100%
rename from AMWD.Common/Utilities/AsyncQueue.cs
rename to src/AMWD.Common/Utilities/AsyncQueue.cs
diff --git a/AMWD.Common/Utilities/CryptographyHelper.cs b/src/AMWD.Common/Utilities/CryptographyHelper.cs
similarity index 100%
rename from AMWD.Common/Utilities/CryptographyHelper.cs
rename to src/AMWD.Common/Utilities/CryptographyHelper.cs
diff --git a/AMWD.Common/Utilities/DelayedTask.cs b/src/AMWD.Common/Utilities/DelayedTask.cs
similarity index 100%
rename from AMWD.Common/Utilities/DelayedTask.cs
rename to src/AMWD.Common/Utilities/DelayedTask.cs
diff --git a/AMWD.Common/Utilities/NetworkHelper.cs b/src/AMWD.Common/Utilities/NetworkHelper.cs
similarity index 100%
rename from AMWD.Common/Utilities/NetworkHelper.cs
rename to src/AMWD.Common/Utilities/NetworkHelper.cs
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
new file mode 100644
index 0000000..21669d9
--- /dev/null
+++ b/src/Directory.Build.props
@@ -0,0 +1,48 @@
+
+
+ {semvertag:main}{!:-dev}
+ true
+
+ true
+ true
+ snupkg
+ false
+
+ git
+ https://git.am-wd.de/am-wd/common.git
+ true
+
+ icon.png
+ https://wiki.am-wd.de/libs/common
+ README.md
+ MIT
+
+ AM.WD
+ Andreas Müller
+ © {copyright:2020-} AM.WD
+ Library with classes and extensions used frequently on AM.WD projects.
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
diff --git a/test/AMWD.Common.AspNetCore.Tests/AMWD.Common.AspNetCore.Tests.csproj b/test/AMWD.Common.AspNetCore.Tests/AMWD.Common.AspNetCore.Tests.csproj
new file mode 100644
index 0000000..59f2c67
--- /dev/null
+++ b/test/AMWD.Common.AspNetCore.Tests/AMWD.Common.AspNetCore.Tests.csproj
@@ -0,0 +1,11 @@
+
+
+
+ net8.0
+
+
+
+
+
+
+
diff --git a/UnitTests/AspNetCore/Attributes/BasicAuthenticationAttributeTests.cs b/test/AMWD.Common.AspNetCore.Tests/Attributes/BasicAuthenticationAttributeTest.cs
similarity index 94%
rename from UnitTests/AspNetCore/Attributes/BasicAuthenticationAttributeTests.cs
rename to test/AMWD.Common.AspNetCore.Tests/Attributes/BasicAuthenticationAttributeTest.cs
index 0710f83..4c50ae3 100644
--- a/UnitTests/AspNetCore/Attributes/BasicAuthenticationAttributeTests.cs
+++ b/test/AMWD.Common.AspNetCore.Tests/Attributes/BasicAuthenticationAttributeTest.cs
@@ -13,14 +13,12 @@ using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Primitives;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
-namespace UnitTests.AspNetCore.Attributes
+namespace AMWD.Common.AspNetCore.Tests.Attributes
{
[TestClass]
- [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
- public class BasicAuthenticationAttributeTests
+ public class BasicAuthenticationAttributeTest
{
private Mock _requestHeaderMock;
private Mock _responseHeaderMock;
diff --git a/UnitTests/AspNetCore/Attributes/IPAllowListAttributeTests.cs b/test/AMWD.Common.AspNetCore.Tests/Attributes/IPAllowListAttributeTest.cs
similarity index 94%
rename from UnitTests/AspNetCore/Attributes/IPAllowListAttributeTests.cs
rename to test/AMWD.Common.AspNetCore.Tests/Attributes/IPAllowListAttributeTest.cs
index cca8600..0cf7f04 100644
--- a/UnitTests/AspNetCore/Attributes/IPAllowListAttributeTests.cs
+++ b/test/AMWD.Common.AspNetCore.Tests/Attributes/IPAllowListAttributeTest.cs
@@ -7,14 +7,12 @@ using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Configuration;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
-namespace UnitTests.AspNetCore.Attributes
+namespace AMWD.Common.AspNetCore.Tests.Attributes
{
[TestClass]
- [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
- public class IPAllowListAttributeTests
+ public class IPAllowListAttributeTest
{
private Dictionary _requestHeaders;
private Dictionary