From 867cdaf10b1268e627e57ae6ef4d202a8e1b17f3 Mon Sep 17 00:00:00 2001
From: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
Date: Thu, 21 Aug 2025 21:24:26 +0700
Subject: [PATCH] Upload files
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
---
.gitignore | 5 ++
App.config | 6 +++
DomainIpSplitter.csproj | 53 +++++++++++++++++++
DomainIpSplitter.sln | 25 +++++++++
Program.cs | 103 +++++++++++++++++++++++++++++++++++++
Properties/AssemblyInfo.cs | 33 ++++++++++++
6 files changed, 225 insertions(+)
create mode 100644 .gitignore
create mode 100644 App.config
create mode 100644 DomainIpSplitter.csproj
create mode 100644 DomainIpSplitter.sln
create mode 100644 Program.cs
create mode 100644 Properties/AssemblyInfo.cs
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..93621e5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+.vs
+bin/
+obj/
+packages/
+*.csproj.user
diff --git a/App.config b/App.config
new file mode 100644
index 0000000..193aecc
--- /dev/null
+++ b/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DomainIpSplitter.csproj b/DomainIpSplitter.csproj
new file mode 100644
index 0000000..05fedb0
--- /dev/null
+++ b/DomainIpSplitter.csproj
@@ -0,0 +1,53 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {244C4952-D786-464D-9786-8964E9F40714}
+ Exe
+ DomainIpSplitter
+ DomainIpSplitter
+ v4.8
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DomainIpSplitter.sln b/DomainIpSplitter.sln
new file mode 100644
index 0000000..3d3b27b
--- /dev/null
+++ b/DomainIpSplitter.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.14.36301.6 d17.14
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainIpSplitter", "DomainIpSplitter.csproj", "{244C4952-D786-464D-9786-8964E9F40714}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {244C4952-D786-464D-9786-8964E9F40714}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {244C4952-D786-464D-9786-8964E9F40714}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {244C4952-D786-464D-9786-8964E9F40714}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {244C4952-D786-464D-9786-8964E9F40714}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {D55F1EBB-3BA7-4D44-9670-03EBF3478AD9}
+ EndGlobalSection
+EndGlobal
diff --git a/Program.cs b/Program.cs
new file mode 100644
index 0000000..766de38
--- /dev/null
+++ b/Program.cs
@@ -0,0 +1,103 @@
+using System;
+using System.IO;
+using System.Text;
+
+namespace TextFileSplitter
+{
+ class Program
+ {
+ static void SplitFile(string inputFile, int maxLines = 1023, string neededExt = null)
+ {
+ // Читаем все строки исходного файла
+ string[] lines;
+ try
+ {
+ lines = File.ReadAllLines(inputFile, Encoding.UTF8);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Ошибка при чтении файла: {ex.Message}");
+ return;
+ }
+
+ // Если строк меньше или равно maxLines, ничего не делаем
+ if (lines.Length <= maxLines)
+ {
+ Console.WriteLine($"Файл содержит {lines.Length} строк (не больше {maxLines}), разделение не требуется.");
+ return;
+ }
+
+ // Определяем базовое имя и расширение файла
+ string baseName = Path.GetFileNameWithoutExtension(inputFile);
+ string directory = Path.GetDirectoryName(inputFile);
+ string ext = Path.GetExtension(inputFile);
+
+ if (!string.IsNullOrEmpty(neededExt))
+ {
+ ext = neededExt;
+ }
+
+ // Если файл находится в корне диска, directory может быть null
+ if (string.IsNullOrEmpty(directory))
+ {
+ directory = ".";
+ }
+
+ // Разделяем файл на части
+ int partNum = 1;
+ for (int i = 0; i < lines.Length; i += maxLines)
+ {
+ // Формируем имя нового файла
+ string outputFile = Path.Combine(directory, $"{baseName}_{partNum}{ext}");
+
+ // Определяем количество строк для текущей части
+ int linesToTake = Math.Min(maxLines, lines.Length - i);
+ string[] partLines = new string[linesToTake];
+ Array.Copy(lines, i, partLines, 0, linesToTake);
+
+ // Записываем часть строк в новый файл
+ try
+ {
+ File.WriteAllLines(outputFile, partLines, Encoding.UTF8);
+ Console.WriteLine($"Создан файл {outputFile} с {partLines.Length} строками");
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Ошибка при записи файла {outputFile}: {ex.Message}");
+ }
+
+ partNum++;
+ }
+ }
+
+ static void Main()
+ {
+ try
+ {
+ Console.Write("Введите путь к файлу для разделения: ");
+ string inputFile = Console.ReadLine();
+
+ if (string.IsNullOrEmpty(inputFile))
+ {
+ Console.WriteLine("Путь к файлу не может быть пустым.");
+ return;
+ }
+
+ if (!File.Exists(inputFile))
+ {
+ Console.WriteLine("Файл не существует.");
+ return;
+ }
+
+ SplitFile(inputFile, neededExt: ".bat");
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Произошла ошибка: {ex.Message}");
+ }
+
+ Console.WriteLine("Нажмите любую клавишу для выхода...");
+ Console.ReadKey();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..2fb04fc
--- /dev/null
+++ b/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Общие сведения об этой сборке предоставляются следующим набором
+// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
+// связанные с этой сборкой.
+[assembly: AssemblyTitle("DomainIpSplitter")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("DomainIpSplitter")]
+[assembly: AssemblyCopyright("Lev Rusanov © 2025")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
+// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
+// из модели COM задайте для атрибута ComVisible этого типа значение true.
+[assembly: ComVisible(false)]
+
+// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM
+[assembly: Guid("244c4952-d786-464d-9786-8964e9f40714")]
+
+// Сведения о версии сборки состоят из указанных ниже четырех значений:
+//
+// Основной номер версии
+// Дополнительный номер версии
+// Номер сборки
+// Номер редакции
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]