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