20211113 C#10 Update
This commit is contained in:
parent
438c123876
commit
869dc25fb4
@ -1,5 +1,5 @@
|
|||||||
namespace anbs_cp
|
namespace anbs_cp;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Форматирует число элементов в понятную строку
|
/// Форматирует число элементов в понятную строку
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -31,4 +31,3 @@
|
|||||||
public long[] MaxSizes { get => Delimeters; set => Delimeters = value; }
|
public long[] MaxSizes { get => Delimeters; set => Delimeters = value; }
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
namespace anbs_cp
|
namespace anbs_cp;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Форматирует размер файла/папки в понятную строку
|
/// Форматирует размер файла/папки в понятную строку
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -53,4 +53,3 @@
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
namespace anbs_cp
|
namespace anbs_cp;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Форматирует размерности в понятную строку
|
/// Форматирует размерности в понятную строку
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -36,15 +36,9 @@
|
|||||||
|
|
||||||
for (int i = 0; i <= MaxSizes.Length; i++)
|
for (int i = 0; i <= MaxSizes.Length; i++)
|
||||||
{
|
{
|
||||||
if (i == 0)
|
leftnum = i == 0 ? 0 : MaxSizes[i - 1];
|
||||||
leftnum = 0;
|
|
||||||
else
|
|
||||||
leftnum = MaxSizes[i - 1];
|
|
||||||
|
|
||||||
if (i == MaxSizes.Length)
|
rightnum = i == MaxSizes.Length ? long.MaxValue : MaxSizes[i];
|
||||||
rightnum = long.MaxValue;
|
|
||||||
else
|
|
||||||
rightnum = MaxSizes[i];
|
|
||||||
|
|
||||||
if ((value >= leftnum) && (value < rightnum))
|
if ((value >= leftnum) && (value < rightnum))
|
||||||
return $"{FormatValue(value, leftnum)} {ValueNames[i]}";
|
return $"{FormatValue(value, leftnum)} {ValueNames[i]}";
|
||||||
@ -79,4 +73,3 @@
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
namespace anbs_cp;
|
||||||
namespace anbs_cp
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс, добавляющий реализацию некоторых методов Delphi, которые упрощают работу в C#.
|
/// Класс, добавляющий реализацию некоторых методов Delphi, которые упрощают работу в C#.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -45,4 +44,3 @@ namespace anbs_cp
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
namespace anbs_cp
|
namespace anbs_cp;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конвертер типов на манер Delphi
|
/// Конвертер типов на манер Delphi
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -111,4 +111,3 @@
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Version>1.20211111.0</Version>
|
<Version>1.2021.1113</Version>
|
||||||
<Authors>Alexander Babaev</Authors>
|
<Authors>Alexander Babaev</Authors>
|
||||||
<Product>ANB Software Components Pack</Product>
|
<Product>ANB Software Components Pack</Product>
|
||||||
<Description>Library of some useful functions in C# language.</Description>
|
<Description>Library of some useful functions in C# language.</Description>
|
||||||
@ -15,8 +15,8 @@
|
|||||||
<SignAssembly>False</SignAssembly>
|
<SignAssembly>False</SignAssembly>
|
||||||
<PackageProjectUrl>https://github.com/GoodBoyAlex/anbsoftware_componentspack</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/GoodBoyAlex/anbsoftware_componentspack</PackageProjectUrl>
|
||||||
<RepositoryUrl>https://github.com/GoodBoyAlex/anbsoftware_componentspack</RepositoryUrl>
|
<RepositoryUrl>https://github.com/GoodBoyAlex/anbsoftware_componentspack</RepositoryUrl>
|
||||||
<AssemblyVersion>1.2021.1111</AssemblyVersion>
|
<AssemblyVersion>1.2021.1113</AssemblyVersion>
|
||||||
<FileVersion>1.2021.1111</FileVersion>
|
<FileVersion>1.2021.1113</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
5
demo/CountValueTest.Designer.cs
generated
5
demo/CountValueTest.Designer.cs
generated
@ -1,5 +1,5 @@
|
|||||||
namespace demo
|
namespace demo;
|
||||||
{
|
|
||||||
partial class CountValueTest
|
partial class CountValueTest
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -131,4 +131,3 @@
|
|||||||
private Label SelectFormatterLabel;
|
private Label SelectFormatterLabel;
|
||||||
private ComboBox SelectFormatterBox;
|
private ComboBox SelectFormatterBox;
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,6 +1,7 @@
|
|||||||
using anbs_cp;
|
using anbs_cp;
|
||||||
namespace demo
|
|
||||||
{
|
namespace demo;
|
||||||
|
|
||||||
public partial class CountValueTest: Form
|
public partial class CountValueTest: Form
|
||||||
{
|
{
|
||||||
public CountValueTest ()
|
public CountValueTest ()
|
||||||
@ -14,23 +15,13 @@ namespace demo
|
|||||||
if (string.IsNullOrEmpty(InsertDataBox.Text))
|
if (string.IsNullOrEmpty(InsertDataBox.Text))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IValueFormatter formatter;
|
|
||||||
|
|
||||||
long value = TypeConverter.StrToInt64(InsertDataBox.Text);
|
long value = TypeConverter.StrToInt64(InsertDataBox.Text);
|
||||||
|
IValueFormatter formatter = SelectFormatterBox.SelectedIndex switch
|
||||||
switch (SelectFormatterBox.SelectedIndex)
|
|
||||||
{
|
{
|
||||||
case 0:
|
0 => new CountFormatter(),
|
||||||
formatter = new CountFormatter();
|
1 => new FileSizeFormatter(),
|
||||||
break;
|
_ => new CountFormatter(),
|
||||||
case 1:
|
};
|
||||||
formatter = new FileSizeFormatter();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
formatter = new CountFormatter();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ResultLabel.Text = formatter.Format(value);
|
ResultLabel.Text = formatter.Format(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,4 +30,3 @@ namespace demo
|
|||||||
SelectFormatterBox.SelectedIndex = 0;
|
SelectFormatterBox.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
namespace demo
|
namespace demo;
|
||||||
{
|
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -12,4 +12,3 @@ namespace demo
|
|||||||
Application.Run(new CountValueTest());
|
Application.Run(new CountValueTest());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user