fixes for the previous commit
This commit is contained in:
parent
e9d490ebe3
commit
4ee8cd8d83
@ -36,7 +36,8 @@
|
|||||||
<Compile Include="DefaultLogger.cs" />
|
<Compile Include="DefaultLogger.cs" />
|
||||||
<Compile Include="Extensions\Collections.cs" />
|
<Compile Include="Extensions\Collections.cs" />
|
||||||
<Compile Include="Extensions\BaseConverter.cs" />
|
<Compile Include="Extensions\BaseConverter.cs" />
|
||||||
<Compile Include="Extensions\ToStringConverter.cs" />
|
<Compile Include="Extensions\IfMethod.cs" />
|
||||||
|
<Compile Include="Extensions\StringConverter.cs" />
|
||||||
<Compile Include="Filesystem\Symlink.cs" />
|
<Compile Include="Filesystem\Symlink.cs" />
|
||||||
<Compile Include="MyDict.cs" />
|
<Compile Include="MyDict.cs" />
|
||||||
<Compile Include="Dtsod\DtsodV21.cs" />
|
<Compile Include="Dtsod\DtsodV21.cs" />
|
||||||
|
|||||||
@ -400,7 +400,7 @@ namespace DTLib.Dtsod
|
|||||||
switch (value.Type)
|
switch (value.Type)
|
||||||
{
|
{
|
||||||
case ValueTypes.List:
|
case ValueTypes.List:
|
||||||
outBuilder.Append('[').Append(ToStringConverter.MergeToString((IEnumerable<object>)value.Value, ",")).Append(']');
|
outBuilder.Append('[').Append(StringConverter.MergeToString((IEnumerable<object>)value.Value, ",")).Append(']');
|
||||||
//outBuilder.Append("\"list deconstruction is'nt implemented yet\"");
|
//outBuilder.Append("\"list deconstruction is'nt implemented yet\"");
|
||||||
break;
|
break;
|
||||||
case ValueTypes.Complex:
|
case ValueTypes.Complex:
|
||||||
|
|||||||
24
Extensions/IfMethod.cs
Normal file
24
Extensions/IfMethod.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace DTLib.Extensions
|
||||||
|
{
|
||||||
|
public static class IfMethod
|
||||||
|
{
|
||||||
|
public static T If<T>(this T input, bool condition, Func<T, T> if_true, Func<T, T> if_false) =>
|
||||||
|
condition ? if_true(input) : if_false(input);
|
||||||
|
|
||||||
|
public static void If<T>(this T input, bool condition, Action<T> if_true, Action<T> if_false)
|
||||||
|
{
|
||||||
|
if (condition) if_true(input);
|
||||||
|
else if_false(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T If<T>(this T input, bool condition, Func<T, T> if_true) =>
|
||||||
|
condition ? if_true(input) : input;
|
||||||
|
|
||||||
|
public static void If<T>(this T input, bool condition, Action<T> if_true)
|
||||||
|
{
|
||||||
|
if (condition) if_true(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,7 +3,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace DTLib.Extensions
|
namespace DTLib.Extensions
|
||||||
{
|
{
|
||||||
public static class ToStringConverter
|
public static class StringConverter
|
||||||
{
|
{
|
||||||
public static Encoding UTF8 = new UTF8Encoding(false);
|
public static Encoding UTF8 = new UTF8Encoding(false);
|
||||||
public static byte[] ToBytes(this string str) => UTF8.GetBytes(str);
|
public static byte[] ToBytes(this string str) => UTF8.GetBytes(str);
|
||||||
@ -70,7 +70,7 @@ namespace DTLib.Network
|
|||||||
MainSocket.SendPackage("ready".ToBytes());
|
MainSocket.SendPackage("ready".ToBytes());
|
||||||
int packagesCount = 0;
|
int packagesCount = 0;
|
||||||
byte[] buffer = new byte[5120];
|
byte[] buffer = new byte[5120];
|
||||||
int fullPackagesCount = FrameworkFix.Truncate(Filesize / buffer.Length);
|
int fullPackagesCount = (Filesize / buffer.Length).Truncate();
|
||||||
// получение полных пакетов файла
|
// получение полных пакетов файла
|
||||||
for (byte n = 0; packagesCount < fullPackagesCount; packagesCount++)
|
for (byte n = 0; packagesCount < fullPackagesCount; packagesCount++)
|
||||||
{
|
{
|
||||||
@ -114,7 +114,7 @@ namespace DTLib.Network
|
|||||||
MainSocket.GetAnswer("ready");
|
MainSocket.GetAnswer("ready");
|
||||||
byte[] buffer = new byte[5120];
|
byte[] buffer = new byte[5120];
|
||||||
int packagesCount = 0;
|
int packagesCount = 0;
|
||||||
int fullPackagesCount = FrameworkFix.Truncate(Filesize / buffer.Length);
|
int fullPackagesCount = (Filesize / buffer.Length).Truncate();
|
||||||
// отправка полных пакетов файла
|
// отправка полных пакетов файла
|
||||||
for (; packagesCount < fullPackagesCount; packagesCount++)
|
for (; packagesCount < fullPackagesCount; packagesCount++)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user