From 4ce2f8f672e65bcd5f52023a7a689d4c37a4e13b Mon Sep 17 00:00:00 2001 From: goodboyalex Date: Wed, 7 Jul 2021 07:14:41 +0300 Subject: [PATCH] 20210706 --- anbs_cp/LikeDelphi.cs | 23 +++++++++++++++ {delphi2csharp => anbs_cp}/TStringList.cs | 9 ++++-- anbs_cp/TypeConverter.cs | 26 +++++++++++++++++ .../anbs_cp.csproj | 0 ...harp.sln => anbsoftware.componentspack.sln | 10 +++---- delphi2csharp/TStringListType.cs | 13 --------- delphi2csharp/delphimethods.cs | 29 ------------------- 7 files changed, 61 insertions(+), 49 deletions(-) create mode 100644 anbs_cp/LikeDelphi.cs rename {delphi2csharp => anbs_cp}/TStringList.cs (91%) create mode 100644 anbs_cp/TypeConverter.cs rename delphi2csharp/delphi2csharp.csproj => anbs_cp/anbs_cp.csproj (100%) rename delphi2csharp.sln => anbsoftware.componentspack.sln (63%) delete mode 100644 delphi2csharp/TStringListType.cs delete mode 100644 delphi2csharp/delphimethods.cs diff --git a/anbs_cp/LikeDelphi.cs b/anbs_cp/LikeDelphi.cs new file mode 100644 index 0000000..9103027 --- /dev/null +++ b/anbs_cp/LikeDelphi.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace anbs_cp +{ + public class LikeDelphi + { + /* + * Аналог функции "IncludeTrailingBackslash + */ + public static string IncludeTrailingBackslash(string Path) + { + string result = Path; + int Index = Path.Length - 1; + if (Path[Index] != '\\') + { + result = $"{Path}\\"; + } + return result; + } + } +} diff --git a/delphi2csharp/TStringList.cs b/anbs_cp/TStringList.cs similarity index 91% rename from delphi2csharp/TStringList.cs rename to anbs_cp/TStringList.cs index 8630ffa..596556d 100644 --- a/delphi2csharp/TStringList.cs +++ b/anbs_cp/TStringList.cs @@ -1,10 +1,15 @@ using System; using System.Collections.Generic; using System.IO; -using System.Text; -namespace delphi2csharp +namespace anbs_componentspack { + public enum TStringListType + { + sltStringsOnly, //Только строки -- сортировка по строкам включена, имеющиеся объекты удалит + sltObjectsOnly, //Только объекты -- сортировка по объектам включена + sltBoth //И строки, и объекты -- сортировка отключена + } public class TStringList { private List FLines; diff --git a/anbs_cp/TypeConverter.cs b/anbs_cp/TypeConverter.cs new file mode 100644 index 0000000..a765c2d --- /dev/null +++ b/anbs_cp/TypeConverter.cs @@ -0,0 +1,26 @@ +using System; + +namespace anbs_componentspack +{ + public static class TypeConverter + { + public static string IntToStr(int AInt) => AInt.ToString(); + public static string IntToStr(long AInt) => AInt.ToString(); + public static int StrToInt(string AStr) + { + if (!int.TryParse(AStr, out int result)) + { + result = 0; + } + return result; + } + public static long StrToInt64(string AStr) + { + if (!long.TryParse(AStr, out long result)) + { + result = 0; + } + return result; + } + } +} diff --git a/delphi2csharp/delphi2csharp.csproj b/anbs_cp/anbs_cp.csproj similarity index 100% rename from delphi2csharp/delphi2csharp.csproj rename to anbs_cp/anbs_cp.csproj diff --git a/delphi2csharp.sln b/anbsoftware.componentspack.sln similarity index 63% rename from delphi2csharp.sln rename to anbsoftware.componentspack.sln index 7873bb9..4570fac 100644 --- a/delphi2csharp.sln +++ b/anbsoftware.componentspack.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31424.327 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "delphi2csharp", "delphi2csharp\delphi2csharp.csproj", "{D722F27B-693F-471A-8166-8A7912531A4F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "anbs_cp", "anbs_cp\anbs_cp.csproj", "{442A56CC-1061-4EB5-8B67-3E3D997976D7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D722F27B-693F-471A-8166-8A7912531A4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D722F27B-693F-471A-8166-8A7912531A4F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D722F27B-693F-471A-8166-8A7912531A4F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D722F27B-693F-471A-8166-8A7912531A4F}.Release|Any CPU.Build.0 = Release|Any CPU + {442A56CC-1061-4EB5-8B67-3E3D997976D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {442A56CC-1061-4EB5-8B67-3E3D997976D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {442A56CC-1061-4EB5-8B67-3E3D997976D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {442A56CC-1061-4EB5-8B67-3E3D997976D7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/delphi2csharp/TStringListType.cs b/delphi2csharp/TStringListType.cs deleted file mode 100644 index 1c0c648..0000000 --- a/delphi2csharp/TStringListType.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace delphi2csharp -{ - public enum TStringListType - { - sltStringsOnly, //Только строки -- сортировка по строкам включена, имеющиеся объекты удалит - sltObjectsOnly, //Только объекты -- сортировка по объектам включена - sltBoth //И строки, и объекты -- сортировка отключена - } -} diff --git a/delphi2csharp/delphimethods.cs b/delphi2csharp/delphimethods.cs deleted file mode 100644 index 0eeb9c2..0000000 --- a/delphi2csharp/delphimethods.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; - -namespace delphi2csharp -{ - static public class delphi - { - public static string IncludeTrailingBackslash(string Path) - { - string result = Path; - int Index = Path.Length - 1; - if (Path[Index] != '\\') - { - result = $"{Path}\\"; - } - return result; - } - public static string IntToStr(int AInt) => AInt.ToString(); - public static string IntToStr(long AInt) => AInt.ToString(); - public static long StrToInt(string AStr) - { - long result; - if (!long.TryParse(AStr, out result)) - { - result = 0; - } - return result; - } - } -}