added .NetFramework4.8 support
This commit is contained in:
parent
b89841e39a
commit
cacec5de4b
@ -1,12 +1,13 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFrameworks>net6.0;net48</TargetFrameworks>
|
||||||
<LangVersion>preview</LangVersion>
|
<LangVersion>preview</LangVersion>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<Nullable>disable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
|
<DebugType>embedded</DebugType>
|
||||||
<Configurations>Debug;Release</Configurations>
|
<Configurations>Debug;Release</Configurations>
|
||||||
<Platforms>AnyCPU;x64;x86;arm64</Platforms>
|
<Platforms>AnyCPU;x64;x86;arm64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFrameworks>net6.0;net48</TargetFrameworks>
|
||||||
<LangVersion>10</LangVersion>
|
<LangVersion>preview</LangVersion>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<Nullable>disable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
|
<DebugType>embedded</DebugType>
|
||||||
<Configurations>Debug;Release;Release-net48</Configurations>
|
<Configurations>Debug;Release;Release-net48</Configurations>
|
||||||
<Platforms>AnyCPU;x64;x86;arm64</Platforms>
|
<Platforms>AnyCPU;x64;x86;arm64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -18,7 +19,6 @@
|
|||||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
|
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
|
||||||
<Reference Include="System.Net" />
|
<Reference Include="System.Net" />
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Dynamic" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFrameworks>net6.0;net48</TargetFrameworks>
|
||||||
<LangVersion>10</LangVersion>
|
<LangVersion>10</LangVersion>
|
||||||
<ImplicitUsings>false</ImplicitUsings>
|
<ImplicitUsings>false</ImplicitUsings>
|
||||||
<Nullable>disable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<RootNamespace>DTLib.Tests</RootNamespace>
|
<DebugType>embedded</DebugType>
|
||||||
<Configurations>Debug;Release;Release-net48</Configurations>
|
<Configurations>Debug;Release;Release-net48</Configurations>
|
||||||
<Platforms>AnyCPU;x64;x86;arm64</Platforms>
|
<Platforms>AnyCPU;x64;x86;arm64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -30,9 +30,4 @@
|
|||||||
<None Update="Dtsod\TestResources\**\*" CopyToOutputDirectory="Always" />
|
<None Update="Dtsod\TestResources\**\*" CopyToOutputDirectory="Always" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
|
||||||
<Exec Command="rm -rf ../bin/" />
|
|
||||||
<Exec Command="cp -r bin/ ../bin/" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -59,6 +59,14 @@ public static class ColoredConsole
|
|||||||
else throw new Exception("ColoredConsole.Write() error: every text string must have color string before");
|
else throw new Exception("ColoredConsole.Write() error: every text string must have color string before");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void WriteLine() => Console.WriteLine();
|
||||||
|
|
||||||
|
public static void WriteLine(params string[] input)
|
||||||
|
{
|
||||||
|
Write(input);
|
||||||
|
WriteLine();
|
||||||
|
}
|
||||||
|
|
||||||
// ввод цветного текста
|
// ввод цветного текста
|
||||||
public static string Read(string color)
|
public static string Read(string color)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFrameworks>net6.0;net48</TargetFrameworks>
|
||||||
<LangVersion>preview</LangVersion>
|
<LangVersion>preview</LangVersion>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<Nullable>disable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
@ -8,6 +8,7 @@
|
|||||||
<!--xxhash uses arithmetic overflow-->
|
<!--xxhash uses arithmetic overflow-->
|
||||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DebugType>embedded</DebugType>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<Configurations>Debug;Release</Configurations>
|
<Configurations>Debug;Release</Configurations>
|
||||||
<Platforms>AnyCPU;x64;x86;arm64</Platforms>
|
<Platforms>AnyCPU;x64;x86;arm64</Platforms>
|
||||||
|
|||||||
@ -9,7 +9,7 @@ public static class DependencyResolver
|
|||||||
public static void CopyLibs()
|
public static void CopyLibs()
|
||||||
{
|
{
|
||||||
if(DepsCopied) return;
|
if(DepsCopied) return;
|
||||||
string depsdir = "Dependencies" + Путь.Разд;
|
string depsdir = $"Dependencies{Путь.Разд}";
|
||||||
depsdir += Environment.OSVersion.Platform switch
|
depsdir += Environment.OSVersion.Platform switch
|
||||||
{
|
{
|
||||||
PlatformID.Unix => "linux",
|
PlatformID.Unix => "linux",
|
||||||
|
|||||||
@ -38,7 +38,8 @@ namespace DTLib.Experimental
|
|||||||
}
|
}
|
||||||
Memory = listMem.ToArray();
|
Memory = listMem.ToArray();
|
||||||
Description = listDesc.ToArray();
|
Description = listDesc.ToArray();
|
||||||
ColoredConsole.Write("b", "listMem.Count: ", "c", listMem.Count.ToString(), "b", " listDesc.Count: ", "c", listDesc.Count + "\n");
|
ColoredConsole.Write("b", "listMem.Count: ", "c", listMem.Count.ToString(), "b", " listDesc.Count: ", "c",
|
||||||
|
$"{listDesc.Count}\n");
|
||||||
for (short i = 0; i < listDesc.Count; i++)
|
for (short i = 0; i < listDesc.Count; i++)
|
||||||
{
|
{
|
||||||
ColoredConsole.Write("y", $"{Description[i]}:{Memory[i]}\n");
|
ColoredConsole.Write("y", $"{Description[i]}:{Memory[i]}\n");
|
||||||
|
|||||||
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
public static class StringConverter
|
public static class StringConverter
|
||||||
{
|
{
|
||||||
|
public static ASCIIEncoding ASCII = new ASCIIEncoding();
|
||||||
public static Encoding UTF8 = new UTF8Encoding(false);
|
public static Encoding UTF8 = new UTF8Encoding(false);
|
||||||
|
public static Encoding UTF8BOM = new UTF8Encoding(true);
|
||||||
public static byte[] ToBytes(this string str) => UTF8.GetBytes(str);
|
public static byte[] ToBytes(this string str) => UTF8.GetBytes(str);
|
||||||
public static string BytesToString(this byte[] bytes) => UTF8.GetString(bytes);
|
public static string BytesToString(this byte[] bytes) => UTF8.GetString(bytes);
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ namespace DTLib.Extensions;
|
|||||||
|
|
||||||
public static class Unmanaged
|
public static class Unmanaged
|
||||||
{
|
{
|
||||||
public static unsafe IntPtr ToHGlobalUTF8(this string s)
|
public static unsafe IntPtr StringToHGlobalUTF8(this string s)
|
||||||
{
|
{
|
||||||
byte[] buf = s.ToBytes();
|
byte[] buf = s.ToBytes();
|
||||||
int bl = buf.Length;
|
int bl = buf.Length;
|
||||||
@ -15,5 +15,29 @@ public static class Unmanaged
|
|||||||
return (IntPtr) ptr;
|
return (IntPtr) ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ToStringUTF8(this IntPtr p) => Marshal.PtrToStringUTF8(p);
|
public static unsafe int ASCII_length(IntPtr asciiStr)
|
||||||
|
{
|
||||||
|
byte* str = (byte*)asciiStr;
|
||||||
|
while (*str != (byte)'\0')
|
||||||
|
str++;
|
||||||
|
long length = str - (byte*)asciiStr;
|
||||||
|
if (length > Int32.MaxValue)
|
||||||
|
throw new Exception($"ascii string length <{length}> > Int32.MaxValue");
|
||||||
|
return (int)length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static unsafe string HGlobalUTF8ToString(this IntPtr p)
|
||||||
|
{
|
||||||
|
return StringConverter.UTF8.GetString((byte*)p, ASCII_length(p));
|
||||||
|
/*if (p == IntPtr.Zero)
|
||||||
|
throw new Exception("string pointer is null");
|
||||||
|
int length = ASCII_length(p);
|
||||||
|
byte[] buf = new byte[length];
|
||||||
|
for (int i = 0; i < length; i++)
|
||||||
|
buf[i] = ((byte*)p)[i];
|
||||||
|
fixed(byte* bufptr=&buf[0])
|
||||||
|
{
|
||||||
|
return StringConverter.UTF8.GetString(bufptr, length);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -42,8 +42,12 @@ public class FileLogger : IDisposable
|
|||||||
|
|
||||||
public virtual void Dispose()
|
public virtual void Dispose()
|
||||||
{
|
{
|
||||||
LogfileStream?.Flush();
|
try
|
||||||
LogfileStream?.Close();
|
{
|
||||||
|
LogfileStream?.Flush();
|
||||||
|
LogfileStream?.Close();
|
||||||
|
}
|
||||||
|
catch (ObjectDisposedException) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
~FileLogger() => Dispose();
|
~FileLogger() => Dispose();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user