diff --git a/AiSD Lab02/AiSD Lab02.sln b/AiSD Lab02/AiSD Lab02.sln
deleted file mode 100644
index a6557e6..0000000
--- a/AiSD Lab02/AiSD Lab02.sln
+++ /dev/null
@@ -1,25 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.7.34031.279
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AiSD_Lab02", "AiSD Lab02\AiSD_Lab02.csproj", "{FA17B31D-8779-415E-B3A9-140812864D38}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {FA17B31D-8779-415E-B3A9-140812864D38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FA17B31D-8779-415E-B3A9-140812864D38}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FA17B31D-8779-415E-B3A9-140812864D38}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FA17B31D-8779-415E-B3A9-140812864D38}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {268E47D2-9C2D-4863-BCE2-130796952BAF}
- EndGlobalSection
-EndGlobal
diff --git a/AiSD Lab02/AiSD Lab02/AiSD_Lab02.csproj b/AiSD Lab02/AiSD Lab02/AiSD_Lab02.csproj
deleted file mode 100644
index 548f22a..0000000
--- a/AiSD Lab02/AiSD Lab02/AiSD_Lab02.csproj
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {FA17B31D-8779-415E-B3A9-140812864D38}
- Exe
- AiSD_Lab02
- AiSD Lab02
- v4.7.2
- 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/AiSD Lab02/AiSD Lab02/App.config b/AiSD Lab02/AiSD Lab02/App.config
deleted file mode 100644
index 56efbc7..0000000
--- a/AiSD Lab02/AiSD Lab02/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AiSD Lab02/AiSD Lab02/EntityItem.cs b/AiSD Lab02/AiSD Lab02/EntityItem.cs
deleted file mode 100644
index 5697b6c..0000000
--- a/AiSD Lab02/AiSD Lab02/EntityItem.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace AiSD_Lab02;
-public class EntityItem
-{
- public int Weight { get; set; }
- public int Value { get; set; }
-
-}
diff --git a/AiSD Lab02/AiSD Lab02/FibNums.cs b/AiSD Lab02/AiSD Lab02/FibNums.cs
deleted file mode 100644
index 7e93c47..0000000
--- a/AiSD Lab02/AiSD Lab02/FibNums.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-namespace AiSD_Lab02;
-
-public class FibNums
-{
- public int Fib(int num)
- {
- if (num < 2) return 1;
- else return Fib(num - 1) + Fib(num - 2);
- }
-
- public void Merge(int[] array, int lowIndex, int middleIndex, int highIndex)
- {
- int left = lowIndex;
- int right = middleIndex + 1;
- int[] tempArray = new int[highIndex - lowIndex + 1];
- int index = 0;
-
- while ((left <= middleIndex) && (right <= highIndex))
- {
- if (array[left] < array[right])
- {
- tempArray[index] = array[left];
- left++;
- }
- else
- {
- tempArray[index] = array[right];
- right++;
- }
-
- index++;
- }
-
- for (int i = left; i <= middleIndex; i++)
- {
- tempArray[index] = array[i];
- index++;
- }
-
- for (int i = right; i <= highIndex; i++)
- {
- tempArray[index] = array[i];
- index++;
- }
-
- for (int i = 0; i < tempArray.Length; i++)
- {
- array[lowIndex + i] = tempArray[i];
- }
- }
-
- public int[] MergeSort(int[] array, int lowIndex, int highIndex)
- {
- if (lowIndex < highIndex)
- {
- int middleInd = (lowIndex + highIndex) / 2;
- MergeSort(array, lowIndex, middleInd);
- MergeSort(array, middleInd + 1, highIndex);
- Merge(array, lowIndex, middleInd, highIndex);
- }
-
- return array;
- }
-}
diff --git a/AiSD Lab02/AiSD Lab02/Program.cs b/AiSD Lab02/AiSD Lab02/Program.cs
deleted file mode 100644
index d11e476..0000000
--- a/AiSD Lab02/AiSD Lab02/Program.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System.Collections.Generic;
-using System;
-
-namespace AiSD_Lab02;
-public class Program
-{
- public static void Main(string[] args)
- {
- List items = new List()
- {
- new EntityItem { Weight = 2, Value = 10 },
- new EntityItem { Weight = 3, Value = 5 },
- new EntityItem { Weight = 5, Value = 15 },
- new EntityItem { Weight = 7, Value = 7 },
- new EntityItem { Weight = 1, Value = 6 }
- };
-
- int capacity = 10;
-
- for (int i = 0; i < items.Count - 1; i++)
- {
- for (int j = 0; j < items.Count - i - 1; j++)
- {
- double ratio1 = items[j].Value / (double)items[j].Weight;
- double ratio2 = items[j + 1].Value / (double)items[j + 1].Weight;
-
- if (ratio1 < ratio2)
- {
- EntityItem temp = items[j];
- items[j] = items[j + 1];
- items[j + 1] = temp;
- }
- }
- }
-
- int totalValue = 0;
- int totalWeight = 0;
-
- foreach (EntityItem item in items)
- {
- if (totalWeight + item.Weight <= capacity)
- {
- totalValue += item.Value;
- totalWeight += item.Weight;
- Console.WriteLine($"Предмет: вес={item.Weight}, значение={item.Value}");
- }
- }
-
- Console.WriteLine($"Суммарное значение: {totalValue}");
- Console.WriteLine($"Суммарный вес: {totalWeight}");
-
- FibNums fibNums = new FibNums();
- Console.WriteLine(fibNums.Fib(5));
- }
-
-}
diff --git a/AiSD Lab02/AiSD Lab02/Properties/AssemblyInfo.cs b/AiSD Lab02/AiSD Lab02/Properties/AssemblyInfo.cs
deleted file mode 100644
index dfbe217..0000000
--- a/AiSD Lab02/AiSD Lab02/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// Общие сведения об этой сборке предоставляются следующим набором
-// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
-// связанные с этой сборкой.
-[assembly: AssemblyTitle("AiSD Lab02")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("AiSD Lab02")]
-[assembly: AssemblyCopyright("Copyright © 2024")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
-// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
-// из модели COM задайте для атрибута ComVisible этого типа значение true.
-[assembly: ComVisible(false)]
-
-// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM
-[assembly: Guid("fa17b31d-8779-415e-b3a9-140812864d38")]
-
-// Сведения о версии сборки состоят из указанных ниже четырех значений:
-//
-// Основной номер версии
-// Дополнительный номер версии
-// Номер сборки
-// Номер редакции
-//
-// Можно задать все значения или принять номера сборки и редакции по умолчанию
-// используя "*", как показано ниже:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/AiSD_Lab/AiSD Lab02.sln b/AiSD_Lab/AiSD Lab02.sln
deleted file mode 100644
index 1db5ae1..0000000
--- a/AiSD_Lab/AiSD Lab02.sln
+++ /dev/null
@@ -1,25 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.7.34031.279
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AiSD Lab02", "AiSD Lab02\AiSD Lab02.csproj", "{FA17B31D-8779-415E-B3A9-140812864D38}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {FA17B31D-8779-415E-B3A9-140812864D38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FA17B31D-8779-415E-B3A9-140812864D38}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FA17B31D-8779-415E-B3A9-140812864D38}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FA17B31D-8779-415E-B3A9-140812864D38}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {268E47D2-9C2D-4863-BCE2-130796952BAF}
- EndGlobalSection
-EndGlobal
diff --git a/AiSD_Lab/AiSD Lab02/AiSD_Lab02.csproj b/AiSD_Lab/AiSD Lab02/AiSD_Lab02.csproj
deleted file mode 100644
index 5e6c43d..0000000
--- a/AiSD_Lab/AiSD Lab02/AiSD_Lab02.csproj
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {FA17B31D-8779-415E-B3A9-140812864D38}
- Exe
- AiSD_Lab02
- AiSD Lab02
- v4.7.2
- 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/AiSD_Lab/AiSD Lab02/App.config b/AiSD_Lab/AiSD Lab02/App.config
deleted file mode 100644
index 56efbc7..0000000
--- a/AiSD_Lab/AiSD Lab02/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AiSD_Lab/AiSD Lab02/EntityItem.cs b/AiSD_Lab/AiSD Lab02/EntityItem.cs
deleted file mode 100644
index 78144dd..0000000
--- a/AiSD_Lab/AiSD Lab02/EntityItem.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-public class EntityItem
-{
- public int Weight { get; set; }
- public int Value { get; set; }
-
- public EntityItem(int weight, int value)
- {
- Weight = weight;
- Value = value;
- }
-}
diff --git a/AiSD_Lab/AiSD Lab02/FibNums.cs b/AiSD_Lab/AiSD Lab02/FibNums.cs
deleted file mode 100644
index 49de6df..0000000
--- a/AiSD_Lab/AiSD Lab02/FibNums.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AiSD_Lab02
-{
- internal class FibNums
- {
- }
-}
diff --git a/AiSD_Lab/AiSD Lab02/Program.cs b/AiSD_Lab/AiSD Lab02/Program.cs
deleted file mode 100644
index b1dc6b2..0000000
--- a/AiSD_Lab/AiSD Lab02/Program.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System.Collections.Generic;
-using System;
-
-public class Program
-{
- public static void Main(string[] args)
- {
- List items = new List()
- {
- new EntityItem(2, 10),
- new EntityItem(3, 5),
- new EntityItem(5, 15),
- new EntityItem(7, 7),
- new EntityItem(1, 6)
- };
-
- int capacity = 10;
-
- List result = FillKnapsack(items, capacity);
-
- Console.WriteLine("Предмет в рюкзаке:");
- foreach (EntityItem item in result)
- {
- Console.WriteLine($"Вес: {item.Weight}, Стоимость: {item.Value}");
- }
- }
-}
-}
diff --git a/AiSD_Lab/AiSD Lab02/Properties/AssemblyInfo.cs b/AiSD_Lab/AiSD Lab02/Properties/AssemblyInfo.cs
deleted file mode 100644
index dfbe217..0000000
--- a/AiSD_Lab/AiSD Lab02/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// Общие сведения об этой сборке предоставляются следующим набором
-// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
-// связанные с этой сборкой.
-[assembly: AssemblyTitle("AiSD Lab02")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("AiSD Lab02")]
-[assembly: AssemblyCopyright("Copyright © 2024")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
-// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
-// из модели COM задайте для атрибута ComVisible этого типа значение true.
-[assembly: ComVisible(false)]
-
-// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM
-[assembly: Guid("fa17b31d-8779-415e-b3a9-140812864d38")]
-
-// Сведения о версии сборки состоят из указанных ниже четырех значений:
-//
-// Основной номер версии
-// Дополнительный номер версии
-// Номер сборки
-// Номер редакции
-//
-// Можно задать все значения или принять номера сборки и редакции по умолчанию
-// используя "*", как показано ниже:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/AiSD_Lab/AiSD_Lab1.sln b/AiSD_Lab/AiSD_Lab1.sln
deleted file mode 100644
index 5d14592..0000000
--- a/AiSD_Lab/AiSD_Lab1.sln
+++ /dev/null
@@ -1,25 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.7.34031.279
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AiSD_Lab1", "AiSD_Lab1\AiSD_Lab1.csproj", "{9015CE0F-B12D-4C87-9827-75FBDDB6AE48}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {9015CE0F-B12D-4C87-9827-75FBDDB6AE48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9015CE0F-B12D-4C87-9827-75FBDDB6AE48}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9015CE0F-B12D-4C87-9827-75FBDDB6AE48}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9015CE0F-B12D-4C87-9827-75FBDDB6AE48}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {F9A02028-472E-4A74-938E-A366C44E2A55}
- EndGlobalSection
-EndGlobal
diff --git a/AiSD_Lab/AiSD_Lab1/AiSD_Lab1.csproj b/AiSD_Lab/AiSD_Lab1/AiSD_Lab1.csproj
deleted file mode 100644
index f02677b..0000000
--- a/AiSD_Lab/AiSD_Lab1/AiSD_Lab1.csproj
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- Exe
- net7.0
- enable
- enable
-
-
-
diff --git a/AiSD_Lab/AiSD_Lab1/Deque.cs b/AiSD_Lab/AiSD_Lab1/Deque.cs
deleted file mode 100644
index fa3275e..0000000
--- a/AiSD_Lab/AiSD_Lab1/Deque.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using static System.Runtime.InteropServices.JavaScript.JSType;
-
-namespace AiSD_Lab1;
-
-public class Deque
-{
- Landmark first;
-
- public Deque(string data)
- {
- Landmark newEl = new Landmark(data);
- first = newEl;
- }
-
- public void AddFirst(string data)
- {
- Landmark newEl = new Landmark(data);
- newEl.next = first;
- first = newEl;
- }
-
-
- public Landmark RemoveFirst()
- {
- Landmark delEl = first;
- first = delEl.next;
- delEl.next = null;
- return delEl;
- }
-
- public void RemoveLast()
- {
- Landmark delEl = first;
- while (delEl.next.next != null)
- {
- delEl = delEl.next;
- }
- delEl.next = null;
- }
-
- public void AddLast(string data)
- {
- Landmark newEl = first;
- while (newEl.next != null)
- {
- newEl = newEl.next;
- }
- newEl.next = new Landmark(data);
- }
-
- public string GetAll()
- {
- string Deque = "";
-
- Landmark curr = first;
-
- while (curr.next != null)
- {
- Deque += " " + curr.data;
- curr = curr.next;
- }
- Deque += " " + curr.data;
-
- return Deque;
- }
-
-}
\ No newline at end of file
diff --git a/AiSD_Lab/AiSD_Lab1/Landmark.cs b/AiSD_Lab/AiSD_Lab1/Landmark.cs
deleted file mode 100644
index a2a31d0..0000000
--- a/AiSD_Lab/AiSD_Lab1/Landmark.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace AiSD_Lab1;
-
-public class Landmark
-{
- public String data;
- public Landmark next;
-
- public Landmark(String _data)
- {
- data = _data;
- }
-}
\ No newline at end of file
diff --git a/AiSD_Lab/AiSD_Lab1/Program.cs b/AiSD_Lab/AiSD_Lab1/Program.cs
deleted file mode 100644
index 7456df6..0000000
--- a/AiSD_Lab/AiSD_Lab1/Program.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-
-namespace AiSD_Lab1;
-
-public class Program
-{
- public static void Main(String[] args)
- {
- Console.WriteLine("Сортировка слиянием");
- Sort sort = new Sort();
- sort.RandomArr();
- sort.PrintArr();
- sort.MergeSort(sort.arr, 0, sort.arr.Length - 1);
- sort.PrintArr();
-
- Deque deque = new Deque("Статуя свободы");
- Console.WriteLine(deque.GetAll());
- deque.AddFirst("Успенский собор");
- Console.WriteLine(deque.GetAll());
- deque.AddLast("Эйфелева башня");
- Console.WriteLine(deque.GetAll());
- deque.RemoveLast();
- Console.WriteLine(deque.GetAll());
- deque.RemoveFirst();
- Console.WriteLine(deque.GetAll());
- }
-}
diff --git a/AiSD_Lab/AiSD_Lab1/Sort.cs b/AiSD_Lab/AiSD_Lab1/Sort.cs
deleted file mode 100644
index dd04baf..0000000
--- a/AiSD_Lab/AiSD_Lab1/Sort.cs
+++ /dev/null
@@ -1,150 +0,0 @@
-using System;
-
-namespace AiSD_Lab1;
-
-public class Sort
-{
- public int[] arr = new int[5];
-
-
- ///
- /// Заполняет массив рандомными значениями
- ///
- public void RandomArr()
- {
- for (int i = 0; i < arr.Length; i++)
- {
- Random random = new Random();
- arr[i] = random.Next(-100, 100);
- }
- }
-
- ///
- /// Вывод массива в консоль
- ///
- public void PrintArr()
- {
- Console.WriteLine("Array:");
- for (int i = 0; i < arr.Length; i++)
- {
- Console.WriteLine("[" + i + "]: " + arr[i]);
- }
- }
-
- ///
- /// Проверяет, отсортирован ли массив по возрастанию
- ///
- public void IsSortedUp()
- {
- for (int i = 0; i < arr.Length - 1; i++)
- {
- if (arr[i] > arr[i + 1])
- {
- Console.WriteLine("Массив НЕ отсортирован по возрастанию");
- return;
- }
- }
- Console.WriteLine("Массив отсортирован по возрастанию");
- }
-
- ///
- /// Проверяет, отсортирован ли массив по убыванию
- ///
- public void IsSortedDown()
- {
- for (int i = 1; i < arr.Length; i++)
- {
- if (arr[i - 1] < arr[i])
- {
- Console.WriteLine("Массив НЕ отсортирован по убыванию");
- return;
- }
- }
- Console.WriteLine("Массив отсортирован по убыванию");
- }
-
- ///
- /// Сортировка выбором
- ///
- public void Choise()
- {
- for(int i = 0; i < arr.Length; i++)
- {
- int min = i;
- for(int j = i + 1; j < arr.Length; j++)
- {
- if (arr[j] < arr[min])
- {
- min = j;
- }
- int temp = arr[min];
- arr[min] = arr[i];
- arr[i] = temp;
- }
- }
- }
-
- ///
- /// Метод для слияния массивов
- ///
- public void Merge(int[] array, int lowIndex, int middleIndex, int highIndex)
- {
- // Индекс первого элемента левой части массива
- int left = lowIndex;
- // Индекс первого элемента правой части массива
- int right = middleIndex + 1;
- // Массив для слияния
- int[] tempArray = new int[highIndex - lowIndex + 1];
- int index = 0;
-
- // Проходимся по левой и правой половине массива
- while ((left <= middleIndex) && (right <= highIndex))
- {
- if (array[left] < array[right])
- {
- tempArray[index] = array[left];
- left++;
- }
- else
- {
- tempArray[index] = array[right];
- right++;
- }
-
- index++;
- }
-
- for (int i = left; i <= middleIndex; i++)
- {
- tempArray[index] = array[i];
- index++;
- }
-
- for (int i = right; i <= highIndex; i++)
- {
- tempArray[index] = array[i];
- index++;
- }
-
- // Вносим в массив отсортированные элементы
- for (int i = 0; i < tempArray.Length; i++)
- {
- array[lowIndex + i] = tempArray[i];
- }
- }
-
- // Сортировка слиянием
- public int[] MergeSort(int[] array, int lowIndex, int highIndex)
- {
- if (lowIndex < highIndex)
- {
- // Индекс середины массива
- int middleInd = (lowIndex + highIndex) / 2;
- MergeSort(array, lowIndex, middleInd);
- MergeSort(array, middleInd + 1, highIndex);
- Merge(array, lowIndex, middleInd, highIndex);
- }
-
- return array;
- }
-}
diff --git a/ProjectPlane/ProjectPlane/CollectionGenericObjects/AbstractCompany.cs b/ProjectPlane/ProjectPlane/CollectionGenericObjects/AbstractCompany.cs
index 1bf1bd0..bce7e9c 100644
--- a/ProjectPlane/ProjectPlane/CollectionGenericObjects/AbstractCompany.cs
+++ b/ProjectPlane/ProjectPlane/CollectionGenericObjects/AbstractCompany.cs
@@ -21,7 +21,7 @@ public abstract class AbstractCompany
_pictureWidth = picWidth;
_pictureHeight = picHeight;
_collection = collection;
- _collection.SetMaxCount = GetMaxCount;
+ _collection.MaxCount = GetMaxCount;
}
public static int operator +(AbstractCompany company, DrawningShip ship)
diff --git a/ProjectPlane/ProjectPlane/CollectionGenericObjects/ICollectionGenericObjects.cs b/ProjectPlane/ProjectPlane/CollectionGenericObjects/ICollectionGenericObjects.cs
index 4a6e5b7..eae1769 100644
--- a/ProjectPlane/ProjectPlane/CollectionGenericObjects/ICollectionGenericObjects.cs
+++ b/ProjectPlane/ProjectPlane/CollectionGenericObjects/ICollectionGenericObjects.cs
@@ -1,12 +1,11 @@
-
-namespace ProjectPlane.CollectionGenericObjects;
+namespace ProjectPlane.CollectionGenericObjects;
public interface ICollectionGenericObjects
where T : class
{
int Count { get; }
- int SetMaxCount { set; }
+ int MaxCount { get; set; }
int Insert(T obj);
@@ -15,5 +14,10 @@ public interface ICollectionGenericObjects
T? Remove(int position);
T? Get(int position);
+
+ CollectionType GetCollectionType { get; }
+
+ IEnumerable GetItems();
+
}
diff --git a/ProjectPlane/ProjectPlane/CollectionGenericObjects/ListGenericObjects.cs b/ProjectPlane/ProjectPlane/CollectionGenericObjects/ListGenericObjects.cs
index 4f8bb5f..83b9eaa 100644
--- a/ProjectPlane/ProjectPlane/CollectionGenericObjects/ListGenericObjects.cs
+++ b/ProjectPlane/ProjectPlane/CollectionGenericObjects/ListGenericObjects.cs
@@ -11,7 +11,9 @@ public class ListGenericObjects : ICollectionGenericObjects
public int Count => _collection.Count;
- public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } }
+ public int MaxCount { get { return _collection.Count; } set { if (value > 0) { _maxCount = value; } } }
+
+ public CollectionType GetCollectionType => CollectionType.List;
public ListGenericObjects()
{
@@ -62,4 +64,12 @@ public class ListGenericObjects : ICollectionGenericObjects
return obj;
}
+
+ public IEnumerable GetItems()
+ {
+ for (int i = 0; i < Count; ++i)
+ {
+ yield return _collection[i];
+ }
+ }
}
diff --git a/ProjectPlane/ProjectPlane/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectPlane/ProjectPlane/CollectionGenericObjects/MassiveGenericObjects.cs
index 5419199..f41acc3 100644
--- a/ProjectPlane/ProjectPlane/CollectionGenericObjects/MassiveGenericObjects.cs
+++ b/ProjectPlane/ProjectPlane/CollectionGenericObjects/MassiveGenericObjects.cs
@@ -5,8 +5,12 @@ public class MassiveGenericObjects : ICollectionGenericObjects
{
private T?[] _collection;
public int Count => _collection.Length;
- public int SetMaxCount
+ public int MaxCount
{
+ get
+ {
+ return _collection.Length;
+ }
set
{
if (value > 0)
@@ -23,10 +27,13 @@ public class MassiveGenericObjects : ICollectionGenericObjects
}
}
+ public CollectionType GetCollectionType => CollectionType.Massive;
+
public MassiveGenericObjects()
{
_collection = Array.Empty();
}
+
public T? Get(int position)
{
if (position < 0 || position > Count)
@@ -48,6 +55,7 @@ public class MassiveGenericObjects : ICollectionGenericObjects
}
return -1;
}
+
public int Insert(T obj, int position)
{
if (position < 0 || position > Count)
@@ -81,6 +89,7 @@ public class MassiveGenericObjects : ICollectionGenericObjects
return -1;
}
+
public T? Remove(int position)
{
if (position < 0 || position > Count || _collection[position] == null)
@@ -93,4 +102,12 @@ public class MassiveGenericObjects : ICollectionGenericObjects
return obj;
}
+ public IEnumerable GetItems()
+ {
+ for (int i = 0; i < _collection.Length; ++i)
+ {
+ yield return _collection[i];
+ }
+ }
+
}
diff --git a/ProjectPlane/ProjectPlane/CollectionGenericObjects/StorageCollection.cs b/ProjectPlane/ProjectPlane/CollectionGenericObjects/StorageCollection.cs
index d00b567..9a6d871 100644
--- a/ProjectPlane/ProjectPlane/CollectionGenericObjects/StorageCollection.cs
+++ b/ProjectPlane/ProjectPlane/CollectionGenericObjects/StorageCollection.cs
@@ -1,12 +1,18 @@
using ProjectPlane.Drawnings;
-using ProjectPlane.CollectionGenericObjects;
-using System.Xml.Linq;
+using System.Text;
namespace ProjectPlane.CollectionGenericObjects;
public class StorageCollection
- where T : class
+ where T : DrawningShip
{
+ private readonly string _collectionKey = "CollectionsStorage";
+
+ private readonly string _separatorForKeyValue = "|";
+
+ private readonly string _separatorItems = ";";
+
+
private Dictionary> _storages;
public List Keys => _storages.Keys.ToList();
@@ -56,11 +62,117 @@ public class StorageCollection
_storages.Remove(name);
}
- ///
- /// Доступ к коллекции
- ///
- /// Название коллекции
- ///
+ public bool SaveData(string filename)
+ {
+ if (_storages.Count == 0)
+ {
+ return false;
+ }
+ if (File.Exists(filename))
+ {
+ File.Delete(filename);
+ }
+
+ StringBuilder sb = new();
+
+ sb.Append(_collectionKey);
+ foreach (KeyValuePair> value in
+ _storages)
+ {
+ sb.Append(Environment.NewLine);
+ // не сохраняем пустые коллекции
+ if (value.Value.Count == 0)
+ {
+ continue;
+ }
+
+ sb.Append(value.Key);
+ sb.Append(_separatorForKeyValue);
+ sb.Append(value.Value.GetCollectionType);
+ sb.Append(_separatorForKeyValue);
+ sb.Append(value.Value.MaxCount);
+ sb.Append(_separatorForKeyValue);
+
+ foreach (T? item in value.Value.GetItems())
+ {
+ string data = item?.GetDataForSave() ?? string.Empty;
+ if (string.IsNullOrEmpty(data))
+ {
+ continue;
+ }
+ sb.Append(data);
+ sb.Append(_separatorItems);
+ }
+ }
+ using FileStream fs = new(filename, FileMode.Create);
+ byte[] info = new UTF8Encoding(true).GetBytes(sb.ToString());
+ fs.Write(info, 0, info.Length);
+ return true;
+ }
+
+ public bool LoadData(string filename)
+ {
+ if (!File.Exists(filename))
+ {
+ return false;
+ }
+ string bufferTextFromFile = "";
+ using (FileStream fs = new(filename, FileMode.Open))
+ {
+ byte[] b = new byte[fs.Length];
+ UTF8Encoding temp = new(true);
+ while (fs.Read(b, 0, b.Length) > 0)
+ {
+ bufferTextFromFile += temp.GetString(b);
+ }
+ }
+ string[] strs = bufferTextFromFile.Split(new char[] { '\n', '\r' },
+ StringSplitOptions.RemoveEmptyEntries);
+ if (strs == null || strs.Length == 0)
+ {
+ return false;
+ }
+ if (!strs[0].Equals(_collectionKey))
+ {
+ //если нет такой записи, то это не те данные
+ return false;
+ }
+ _storages.Clear();
+
+ foreach (string data in strs)
+ {
+ string[] record = data.Split(_separatorForKeyValue,
+ StringSplitOptions.RemoveEmptyEntries);
+ if (record.Length != 4)
+ {
+ continue;
+ }
+ CollectionType collectionType =
+ (CollectionType)Enum.Parse(typeof(CollectionType), record[1]);
+ ICollectionGenericObjects? collection =
+ StorageCollection.CreateCollection(collectionType);
+ if (collection == null)
+ {
+ return false;
+ }
+ collection.MaxCount = Convert.ToInt32(record[2]);
+ string[] set = record[3].Split(_separatorItems,
+ StringSplitOptions.RemoveEmptyEntries);
+ foreach (string elem in set)
+ {
+ if (elem?.CreateDrawningShip() is T ship)
+ {
+ if (collection.Insert(ship) == -1)
+ {
+ return false;
+ }
+ }
+ }
+ _storages.Add(record[0], collection);
+ }
+ return true;
+ }
+
public ICollectionGenericObjects? this[string name]
{
get
@@ -73,4 +185,14 @@ public class StorageCollection
return null;
}
}
+
+ private static ICollectionGenericObjects? CreateCollection(CollectionType collectionType)
+ {
+ return collectionType switch
+ {
+ CollectionType.Massive => new MassiveGenericObjects(),
+ CollectionType.List => new ListGenericObjects(),
+ _ => null,
+ };
+ }
}
diff --git a/ProjectPlane/ProjectPlane/Drawnings/ExtentionDrawningShip.cs b/ProjectPlane/ProjectPlane/Drawnings/ExtentionDrawningShip.cs
new file mode 100644
index 0000000..b5f0d7c
--- /dev/null
+++ b/ProjectPlane/ProjectPlane/Drawnings/ExtentionDrawningShip.cs
@@ -0,0 +1,36 @@
+using ProjectPlane.Entities;
+using ProjectPlane.Drawnings;
+
+namespace ProjectPlane.Drawnings;
+
+public static class ExtentionDrawningShip
+{
+ private static readonly string _separatorForObject = ":";
+
+ public static DrawningShip? CreateDrawningShip(this string info)
+ {
+ string[] strs = info.Split(_separatorForObject);
+ EntityShip? ship = EntityContainer.CreateEntityContainer(strs);
+ if (ship != null)
+ {
+ return new DrawCont(ship.Speed, ship.Weight, ship.ShipColor, (ship as EntityContainer).ContainerColor, (ship as EntityContainer).Container, (ship as EntityContainer).Crane);
+ }
+ ship = EntityShip.CreateEntityShip(strs);
+ if (ship != null)
+ {
+ return new DrawningShip(ship.Speed, ship.Weight, ship.ShipColor);
+ }
+ return null;
+ }
+
+ public static string GetDataForSave(this DrawningShip drawningShip)
+ {
+ string[]? array = drawningShip?.EntityShip?.GetStringRepresentation();
+ if (array == null)
+ {
+ return string.Empty;
+ }
+ return string.Join(_separatorForObject, array);
+ }
+
+}
diff --git a/ProjectPlane/ProjectPlane/Entities/EntityContainer.cs b/ProjectPlane/ProjectPlane/Entities/EntityContainer.cs
index 09f6381..36a3686 100644
--- a/ProjectPlane/ProjectPlane/Entities/EntityContainer.cs
+++ b/ProjectPlane/ProjectPlane/Entities/EntityContainer.cs
@@ -30,4 +30,20 @@ public class EntityContainer : EntityShip
{
ContainerColor = newColor;
}
+
+ public override string[] GetStringRepresentation()
+ {
+ return new[] { nameof(EntityContainer), Speed.ToString(), Weight.ToString(), ShipColor.Name, ContainerColor.Name, Container.ToString(), Crane.ToString()};
+ }
+
+ public static EntityContainer? CreateEntityContainer(string[] strs)
+ {
+ if (strs.Length != 7 || strs[0] != nameof(EntityContainer))
+ {
+ return null;
+ }
+
+ return new EntityContainer(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]), Color.FromName(strs[4]), Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6]));
+ }
+
}
diff --git a/ProjectPlane/ProjectPlane/Entities/EntityShip.cs b/ProjectPlane/ProjectPlane/Entities/EntityShip.cs
index 26a5dd7..43e7f70 100644
--- a/ProjectPlane/ProjectPlane/Entities/EntityShip.cs
+++ b/ProjectPlane/ProjectPlane/Entities/EntityShip.cs
@@ -26,4 +26,20 @@ public class EntityShip
{
ShipColor = newColor;
}
+
+ public virtual string[] GetStringRepresentation()
+ {
+ return new[] { nameof(EntityShip), Speed.ToString(), Weight.ToString(), ShipColor.Name };
+ }
+
+
+ public static EntityShip? CreateEntityShip(string[] strs)
+ {
+ if (strs.Length != 4 || strs[0] != nameof(EntityShip))
+ {
+ return null;
+ }
+ return new EntityShip(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]));
+ }
+
}
\ No newline at end of file
diff --git a/ProjectPlane/ProjectPlane/FormShipCollection.Designer.cs b/ProjectPlane/ProjectPlane/FormShipCollection.Designer.cs
index d31cda8..b9c59ee 100644
--- a/ProjectPlane/ProjectPlane/FormShipCollection.Designer.cs
+++ b/ProjectPlane/ProjectPlane/FormShipCollection.Designer.cs
@@ -46,10 +46,17 @@
labelCollectionName = new Label();
ComboBoxSelectorCompany = new ComboBox();
pictureBox = new PictureBox();
+ menuStrip = new MenuStrip();
+ файлToolStripMenuItem = new ToolStripMenuItem();
+ saveToolStripMenuItem = new ToolStripMenuItem();
+ loadToolStripMenuItem = new ToolStripMenuItem();
+ saveFileDialog = new SaveFileDialog();
+ openFileDialog = new OpenFileDialog();
groupBoxTools.SuspendLayout();
panelCompanyTools.SuspendLayout();
panelStorage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
+ menuStrip.SuspendLayout();
SuspendLayout();
//
// groupBoxTools
@@ -59,9 +66,9 @@
groupBoxTools.Controls.Add(panelStorage);
groupBoxTools.Controls.Add(ComboBoxSelectorCompany);
groupBoxTools.Dock = DockStyle.Right;
- groupBoxTools.Location = new Point(785, 0);
+ groupBoxTools.Location = new Point(785, 24);
groupBoxTools.Name = "groupBoxTools";
- groupBoxTools.Size = new Size(200, 696);
+ groupBoxTools.Size = new Size(200, 672);
groupBoxTools.TabIndex = 0;
groupBoxTools.TabStop = false;
groupBoxTools.Text = "Инструменты";
@@ -239,12 +246,44 @@
// pictureBox
//
pictureBox.Dock = DockStyle.Fill;
- pictureBox.Location = new Point(0, 0);
+ pictureBox.Location = new Point(0, 24);
pictureBox.Name = "pictureBox";
- pictureBox.Size = new Size(785, 696);
+ pictureBox.Size = new Size(785, 672);
pictureBox.TabIndex = 1;
pictureBox.TabStop = false;
//
+ // menuStrip
+ //
+ menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem });
+ menuStrip.Location = new Point(0, 0);
+ menuStrip.Name = "menuStrip";
+ menuStrip.Size = new Size(985, 24);
+ menuStrip.TabIndex = 2;
+ menuStrip.Text = "menuStrip";
+ //
+ // файлToolStripMenuItem
+ //
+ файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { saveToolStripMenuItem, loadToolStripMenuItem });
+ файлToolStripMenuItem.Name = "файлToolStripMenuItem";
+ файлToolStripMenuItem.Size = new Size(48, 20);
+ файлToolStripMenuItem.Text = "Файл";
+ //
+ // saveToolStripMenuItem
+ //
+ saveToolStripMenuItem.Name = "saveToolStripMenuItem";
+ saveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
+ saveToolStripMenuItem.Size = new Size(181, 22);
+ saveToolStripMenuItem.Text = "Сохранение";
+ saveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
+ //
+ // loadToolStripMenuItem
+ //
+ loadToolStripMenuItem.Name = "loadToolStripMenuItem";
+ loadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L;
+ loadToolStripMenuItem.Size = new Size(181, 22);
+ loadToolStripMenuItem.Text = "Загрузка";
+ loadToolStripMenuItem.Click += LoadToolStripMenuItem_Click;
+ //
// FormShipCollection
//
AutoScaleDimensions = new SizeF(7F, 15F);
@@ -252,6 +291,8 @@
ClientSize = new Size(985, 696);
Controls.Add(pictureBox);
Controls.Add(groupBoxTools);
+ Controls.Add(menuStrip);
+ MainMenuStrip = menuStrip;
Name = "FormShipCollection";
Text = "Коллекция кораблей";
groupBoxTools.ResumeLayout(false);
@@ -260,7 +301,10 @@
panelStorage.ResumeLayout(false);
panelStorage.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
+ menuStrip.ResumeLayout(false);
+ menuStrip.PerformLayout();
ResumeLayout(false);
+ PerformLayout();
}
#endregion
@@ -283,5 +327,11 @@
private ListBox listBoxCollection;
private RadioButton radioButtonMassive;
private Panel panelCompanyTools;
+ private MenuStrip menuStrip;
+ private ToolStripMenuItem файлToolStripMenuItem;
+ private ToolStripMenuItem saveToolStripMenuItem;
+ private ToolStripMenuItem loadToolStripMenuItem;
+ private SaveFileDialog saveFileDialog;
+ private OpenFileDialog openFileDialog;
}
}
\ No newline at end of file
diff --git a/ProjectPlane/ProjectPlane/FormShipCollection.cs b/ProjectPlane/ProjectPlane/FormShipCollection.cs
index 0e3b4fb..1c82939 100644
--- a/ProjectPlane/ProjectPlane/FormShipCollection.cs
+++ b/ProjectPlane/ProjectPlane/FormShipCollection.cs
@@ -20,7 +20,7 @@ public partial class FormShipCollection : Form
panelCompanyTools.Enabled = false;
}
- private void ButtonAddShip_Click(object sender, EventArgs e)
+ private void ButtonAddShip_Click(object sender, EventArgs e)
{
FormShipConfig form = new();
form.AddEvent(SetShip);
@@ -187,4 +187,39 @@ public partial class FormShipCollection : Form
panelCompanyTools.Enabled = true;
RerfreshListBoxItems();
}
+
+ private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (saveFileDialog.ShowDialog() == DialogResult.OK)
+ {
+ if (_storageCollection.SaveData(saveFileDialog.FileName))
+ {
+ MessageBox.Show("Сохранение прошло успешно",
+ "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ else
+ {
+ MessageBox.Show("Не сохранилось", "Результат",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+
+ private void LoadToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (openFileDialog.ShowDialog() == DialogResult.OK)
+ {
+ if (_storageCollection.LoadData(openFileDialog.FileName))
+ {
+ MessageBox.Show("Загрузка прошла успешно",
+ "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ RerfreshListBoxItems();
+ }
+ else
+ {
+ MessageBox.Show("Не загрузилось", "Результат",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
}
diff --git a/ProjectPlane/ProjectPlane/FormShipCollection.resx b/ProjectPlane/ProjectPlane/FormShipCollection.resx
index af32865..8b1dfa1 100644
--- a/ProjectPlane/ProjectPlane/FormShipCollection.resx
+++ b/ProjectPlane/ProjectPlane/FormShipCollection.resx
@@ -117,4 +117,13 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
+
+ 126, 17
+
+
+ 261, 17
+
\ No newline at end of file