diff --git a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/.vs/WindowsFormsApp1/FileContentIndex/1dfd4a73-6002-4513-88fb-34873ea2e25c.vsidx b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/.vs/WindowsFormsApp1/FileContentIndex/1dfd4a73-6002-4513-88fb-34873ea2e25c.vsidx new file mode 100644 index 0000000..dce5682 Binary files /dev/null and b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/.vs/WindowsFormsApp1/FileContentIndex/1dfd4a73-6002-4513-88fb-34873ea2e25c.vsidx differ diff --git a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/.vs/WindowsFormsApp1/FileContentIndex/bb55e6c0-a94c-4d98-b610-cf2ad8ab3342.vsidx b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/.vs/WindowsFormsApp1/FileContentIndex/bb55e6c0-a94c-4d98-b610-cf2ad8ab3342.vsidx deleted file mode 100644 index aea9170..0000000 Binary files a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/.vs/WindowsFormsApp1/FileContentIndex/bb55e6c0-a94c-4d98-b610-cf2ad8ab3342.vsidx and /dev/null differ diff --git a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/.vs/WindowsFormsApp1/v17/.suo b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/.vs/WindowsFormsApp1/v17/.suo index 07ab9bc..eb7e5ea 100644 Binary files a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/.vs/WindowsFormsApp1/v17/.suo and b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/.vs/WindowsFormsApp1/v17/.suo differ diff --git a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/Form1.cs b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/Form1.cs index 1ddb9b9..8ccf64e 100644 --- a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/Form1.cs +++ b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/Form1.cs @@ -1,142 +1,159 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using static System.Windows.Forms.VisualStyles.VisualStyleElement; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.ToolBar; -using TextBox = System.Windows.Forms.TextBox; -using System.Text.RegularExpressions; - -namespace WindowsFormsApp1 -{ - public partial class Form1 : Form - { - private TextBox[] textBoxes; - public Form1() - { - InitializeComponent(); - textBoxes = new TextBox[] { onePointX1, onePointX2, onePointY1, onePointY2, - secondPointX1, secondPointX2, secondPointY1, secondPointY2 }; - - this.ActiveControl = onePointX1; //курсор в первом тектовом поле при инициализации - - CheckIfTextAndLockButton(); - - foreach (TextBox textBox in textBoxes) - { - textBox.TextChanged += TextBox_TextChanged; - } - } - - - private void TextBox_TextChanged(object sender, EventArgs e) - { - CheckIfTextAndLockButton(); - } - private void CheckIfTextAndLockButton() - { - startCalculateButton.Enabled = !textBoxes.Any(textBox => IsTextBoxEmpty(textBox)); - } - private bool IsTextBoxEmpty(TextBox textBox) - { - return string.IsNullOrEmpty(textBox.Text); - } - - - /// - /// Просто тупо очищает все поля TextBox циклом foreach - /// - private void ClearTextBoxes() - { - foreach (TextBox textBox in textBoxes) - { - textBox.Clear(); - } - } - private void ClearButton_Click(object sender, EventArgs e) - { - ClearTextBoxes(); - } - - /// - /// Проверяет, что все текстовые поля содержат целочисленные значения. - /// Если хотя бы одно поле не содержит целочисленный тип, выводит сообщение об ошибке и прерывает выполнения вычислений в startCalculateButton_Click(). - /// - private bool CheckIfAllTextFieldsAreNumbers() - { - foreach (TextBox textBox in textBoxes) - { - if (!double.TryParse(textBox.Text, out _) && !int.TryParse(textBox.Text, out _)) - { - MessageBox.Show("Пожалуйста, введите числовое значение во все поля!", "Error!!!"); - return false; - - } - } - - return true; - } - - - public void FieldIntersectionPoint(double x1, double x2, double x3, double x4, - double y1, double y2, double y3, double y4) - { - //Уравнение прямой в общем виде имеет вид y = mx + b, где m - это коэффициент наклона прямой, а b - это коэффициент сдвига по оси y. - //Для каждой из прямых мы можем найти значения коэффициентов m и b по формулам: - // Для первой прямой: - // m1 = (y2 - y1) / (x2 - x1) - // b1 = y1 - m1 * x1 - // Для второй прямой: - // m2 = (y4 - y3) / (x4 - x3) - // b2 = y3 - m2 * x3 - - //Теперь у нас есть уравнения двух прямых в виде y = m1 * x + b1 и y = m2 * x + b2. - //Для нахождения точки пересечения этих прямых, нужно решить систему уравнений: - // m1 * x + b1 = m2 * x + b2 - // m1 * x + b1 = m2 * x + b2 - - double m1 = (y2 - y1) / (x2 - x1); - if (x2 == x1) m1 = 1100000000000000; - double b1 = y1 - m1 * x1; - - double m2 = (y4 - y3) / (x4 - x3); - if (x4 == x3) m2 = 1100000000000000; - double b2 = y3 - m2 * x3; - - if (m1 == m2) - { - MessageBox.Show("Прямые параллельны, нет точки пересечения."); - } - else - { - double x = (b2 - b1) / (m1 - m2); - double y = m1 * x + b1; - - MessageBox.Show($"Точка пересечения: ({x} | {y})"); - } - } - - private void startCalculateButton_Click(object sender, EventArgs e) - { - if (CheckIfAllTextFieldsAreNumbers()) - { - double x1 = Double.Parse(onePointX1.Text); - double x2 = Double.Parse(onePointX2.Text); - double y1 = Double.Parse(onePointY1.Text); - double y2 = Double.Parse(onePointY2.Text); - - double x3 = Double.Parse(secondPointX1.Text); - double x4 = Double.Parse(secondPointX2.Text); - double y3 = Double.Parse(secondPointY1.Text); - double y4 = Double.Parse(secondPointY2.Text); - - FieldIntersectionPoint(x1, x2, x3, x4, y1, y2, y3, y4); - } - } - } -} +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.ToolBar; +using TextBox = System.Windows.Forms.TextBox; +using System.Text.RegularExpressions; + +namespace WindowsFormsApp1 +{ + public partial class Form1 : Form + { + private TextBox[] textBoxes; + public Form1() + { + InitializeComponent(); + textBoxes = new TextBox[] { onePointX1, onePointX2, onePointY1, onePointY2, + secondPointX1, secondPointX2, secondPointY1, secondPointY2 }; + + this.ActiveControl = onePointX1; //курсор в первом тектовом поле при инициализации + + CheckIfTextAndLockButton(); + + foreach (TextBox textBox in textBoxes) + { + textBox.TextChanged += TextBox_TextChanged; + } + } + + + private void TextBox_TextChanged(object sender, EventArgs e) + { + CheckIfTextAndLockButton(); + } + private void CheckIfTextAndLockButton() + { + startCalculateButton.Enabled = !textBoxes.Any(textBox => IsTextBoxEmpty(textBox)); + } + private bool IsTextBoxEmpty(TextBox textBox) + { + return string.IsNullOrEmpty(textBox.Text); + } + + + /// + /// Просто тупо очищает все поля TextBox циклом foreach + /// + private void ClearTextBoxes() + { + foreach (TextBox textBox in textBoxes) + { + textBox.Clear(); + } + } + private void ClearButton_Click(object sender, EventArgs e) + { + ClearTextBoxes(); + } + + /// + /// Проверяет, что все текстовые поля содержат целочисленные значения. + /// Если хотя бы одно поле не содержит целочисленный тип, выводит сообщение об ошибке и прерывает выполнения вычислений в startCalculateButton_Click(). + /// + private bool CheckIfAllTextFieldsAreNumbers() + { + foreach (TextBox textBox in textBoxes) + { + if (!double.TryParse(textBox.Text, out _) && !int.TryParse(textBox.Text, out _)) + { + MessageBox.Show("Пожалуйста, введите числовое значение во все поля!", "Error!!!"); + return false; + + } + } + + return true; + } + + + public void FieldIntersectionPoint(double x1, double x2, double x3, double x4, + double y1, double y2, double y3, double y4) + { + //Уравнение прямой в общем виде имеет вид y = mx + b, где m - это коэффициент наклона прямой, а b - это коэффициент сдвига по оси y. + //Для каждой из прямых мы можем найти значения коэффициентов m и b по формулам: + // Для первой прямой: + // m1 = (y2 - y1) / (x2 - x1) + // b1 = y1 - m1 * x1 + // Для второй прямой: + // m2 = (y4 - y3) / (x4 - x3) + // b2 = y3 - m2 * x3 + + //Теперь у нас есть уравнения двух прямых в виде y = m1 * x + b1 и y = m2 * x + b2. + //Для нахождения точки пересечения этих прямых, нужно решить систему уравнений: + // m1 * x + b1 = m2 * x + b2 + // m1 * x + b1 = m2 * x + b2 + + double m1 = (y2 - y1) / (x2 - x1); + if (x2 == x1) m1 = 1100000000000000; + double b1 = y1 - m1 * x1; + + double m2 = (y4 - y3) / (x4 - x3); + if (x4 == x3) m2 = 1100000000000000; + double b2 = y3 - m2 * x3; + + if (m1 == m2) + { + MessageBox.Show("Прямые параллельны, нет точки пересечения."); + } + else + { + double x = (b2 - b1) / (m1 - m2); + double y = m1 * x + b1; + + MessageBox.Show($"Точка пересечения: ({x} | {y})"); + } + } + + //public void FieldIntersectionPoint(double x1, double x2, double x3, double x4, double y1, double y2, double y3, double y4) + //{ + // double[,] A = { { (y2 - y1), -(x2 - x1) }, { (y4 - y3), -(x4 - x3) } }; + // double[] b = { y1 * (x2 - x1) - x1 * (y2 - y1), y3 * (x4 - x3) - x3 * (y4 - y3) }; + + // double detA = A[0, 0] * A[1, 1] - A[0, 1] * A[1, 0]; + // if (detA == 0) + // { + // MessageBox.Show("Прямые параллельны, нет точки пересечения."); + // } + // else + // { + // double[] intersection = { (b[0] * A[1, 1] - b[1] * A[0, 1]) / detA, (A[0, 0] * b[1] - A[1, 0] * b[0]) / detA }; + // MessageBox.Show($"Точка пересечения: ({intersection[0]} | {intersection[1]})"); + // } + //} + + private void startCalculateButton_Click(object sender, EventArgs e) + { + if (CheckIfAllTextFieldsAreNumbers()) + { + double x1 = Double.Parse(onePointX1.Text); + double x2 = Double.Parse(onePointX2.Text); + double y1 = Double.Parse(onePointY1.Text); + double y2 = Double.Parse(onePointY2.Text); + + double x3 = Double.Parse(secondPointX1.Text); + double x4 = Double.Parse(secondPointX2.Text); + double y3 = Double.Parse(secondPointY1.Text); + double y4 = Double.Parse(secondPointY2.Text); + + FieldIntersectionPoint(x1, x2, x3, x4, y1, y2, y3, y4); + } + } + } +} diff --git a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/bin/Debug/WindowsFormsApp1.exe b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/bin/Debug/WindowsFormsApp1.exe index 205b6b3..2541053 100644 Binary files a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/bin/Debug/WindowsFormsApp1.exe and b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/bin/Debug/WindowsFormsApp1.exe differ diff --git a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/bin/Debug/WindowsFormsApp1.pdb b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/bin/Debug/WindowsFormsApp1.pdb index db070fa..6db0400 100644 Binary files a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/bin/Debug/WindowsFormsApp1.pdb and b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/bin/Debug/WindowsFormsApp1.pdb differ diff --git a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.csproj.AssemblyReference.cache b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.csproj.AssemblyReference.cache index 7917645..414338b 100644 Binary files a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.csproj.AssemblyReference.cache and b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.csproj.AssemblyReference.cache differ diff --git a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.csproj.CoreCompileInputs.cache b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.csproj.CoreCompileInputs.cache index 5ff91bb..9eaf8f7 100644 --- a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.csproj.CoreCompileInputs.cache +++ b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -b6e6829fa35494b13dcc33ed034b3903ddf36ef4d4148df0d76a8508d97f740a +b6e6829fa35494b13dcc33ed034b3903ddf36ef4d4148df0d76a8508d97f740a diff --git a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.csproj.FileListAbsolute.txt b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.csproj.FileListAbsolute.txt index f72a9f6..e8adfbd 100644 --- a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.csproj.FileListAbsolute.txt +++ b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.csproj.FileListAbsolute.txt @@ -1,20 +1,20 @@ -C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe.config -C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe -C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.pdb -C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.AssemblyReference.cache -C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.Form1.resources -C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.Properties.Resources.resources -C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.GenerateResource.cache -C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.CoreCompileInputs.cache -C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.exe -C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.pdb -C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\bin\Debug\WindowsFormsApp1.exe.config -C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\bin\Debug\WindowsFormsApp1.exe -C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\bin\Debug\WindowsFormsApp1.pdb -C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\obj\Debug\WindowsFormsApp1.csproj.AssemblyReference.cache -C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\obj\Debug\WindowsFormsApp1.Form1.resources -C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\obj\Debug\WindowsFormsApp1.Properties.Resources.resources -C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\obj\Debug\WindowsFormsApp1.csproj.GenerateResource.cache -C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\obj\Debug\WindowsFormsApp1.csproj.CoreCompileInputs.cache -C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\obj\Debug\WindowsFormsApp1.exe -C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\obj\Debug\WindowsFormsApp1.pdb +C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe.config +C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe +C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.pdb +C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.AssemblyReference.cache +C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.Form1.resources +C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.Properties.Resources.resources +C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.GenerateResource.cache +C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.CoreCompileInputs.cache +C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.exe +C:\Users\Admin\Desktop\С++\2kurs\Basalova\7 Блабра_16\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.pdb +C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\bin\Debug\WindowsFormsApp1.exe.config +C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\bin\Debug\WindowsFormsApp1.exe +C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\bin\Debug\WindowsFormsApp1.pdb +C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\obj\Debug\WindowsFormsApp1.csproj.AssemblyReference.cache +C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\obj\Debug\WindowsFormsApp1.Form1.resources +C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\obj\Debug\WindowsFormsApp1.Properties.Resources.resources +C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\obj\Debug\WindowsFormsApp1.csproj.GenerateResource.cache +C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\obj\Debug\WindowsFormsApp1.csproj.CoreCompileInputs.cache +C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\obj\Debug\WindowsFormsApp1.exe +C:\Lesson\app_WindowsForm\WindowsFormsAppFieldIntersectionPoint\obj\Debug\WindowsFormsApp1.pdb diff --git a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.exe b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.exe index 205b6b3..2541053 100644 Binary files a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.exe and b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.exe differ diff --git a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.pdb b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.pdb index db070fa..6db0400 100644 Binary files a/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.pdb and b/app_WindowsForm/WindowsFormsAppFieldIntersectionPoint/obj/Debug/WindowsFormsApp1.pdb differ diff --git a/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/FileContentIndex/144a9045-6ac5-41b0-b34c-f533b48ae8a8.vsidx b/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/FileContentIndex/144a9045-6ac5-41b0-b34c-f533b48ae8a8.vsidx new file mode 100644 index 0000000..676b3ff Binary files /dev/null and b/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/FileContentIndex/144a9045-6ac5-41b0-b34c-f533b48ae8a8.vsidx differ diff --git a/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/FileContentIndex/8c97be44-5972-4a98-8622-cd0d136e9fcc.vsidx b/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/FileContentIndex/8c97be44-5972-4a98-8622-cd0d136e9fcc.vsidx new file mode 100644 index 0000000..73a32fc Binary files /dev/null and b/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/FileContentIndex/8c97be44-5972-4a98-8622-cd0d136e9fcc.vsidx differ diff --git a/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/FileContentIndex/b21eda87-bb32-4c2b-9a90-35f21f31b575.vsidx b/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/FileContentIndex/b21eda87-bb32-4c2b-9a90-35f21f31b575.vsidx deleted file mode 100644 index bb10b92..0000000 Binary files a/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/FileContentIndex/b21eda87-bb32-4c2b-9a90-35f21f31b575.vsidx and /dev/null differ diff --git a/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/FileContentIndex/d85ef442-d3b1-4bc0-beda-6fc94728f0aa.vsidx b/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/FileContentIndex/d85ef442-d3b1-4bc0-beda-6fc94728f0aa.vsidx deleted file mode 100644 index 9ddaa07..0000000 Binary files a/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/FileContentIndex/d85ef442-d3b1-4bc0-beda-6fc94728f0aa.vsidx and /dev/null differ diff --git a/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/v17/.suo b/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/v17/.suo index 158438a..99f6888 100644 Binary files a/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/v17/.suo and b/app_WindowsForm/WindowsFormsAppLab7_2/.vs/WindowsFormsAppLab7_2/v17/.suo differ diff --git a/app_cpp/StrTP_cpp/.vs/Project1/FileContentIndex/4081a9fb-073e-4a01-a621-40b099d92ec3.vsidx b/app_cpp/StrTP_cpp/.vs/Project1/FileContentIndex/4081a9fb-073e-4a01-a621-40b099d92ec3.vsidx new file mode 100644 index 0000000..0ccf9a8 Binary files /dev/null and b/app_cpp/StrTP_cpp/.vs/Project1/FileContentIndex/4081a9fb-073e-4a01-a621-40b099d92ec3.vsidx differ diff --git a/app_cpp/StrTP_cpp/.vs/Project1/v17/.suo b/app_cpp/StrTP_cpp/.vs/Project1/v17/.suo new file mode 100644 index 0000000..0efa625 Binary files /dev/null and b/app_cpp/StrTP_cpp/.vs/Project1/v17/.suo differ diff --git a/app_cpp/StrTP_cpp/.vs/Project1/v17/Browse.VC.db b/app_cpp/StrTP_cpp/.vs/Project1/v17/Browse.VC.db new file mode 100644 index 0000000..0c52b7c Binary files /dev/null and b/app_cpp/StrTP_cpp/.vs/Project1/v17/Browse.VC.db differ diff --git a/app_cpp/StrTP_cpp/.vs/Project1/v17/Solution.VC.db b/app_cpp/StrTP_cpp/.vs/Project1/v17/Solution.VC.db new file mode 100644 index 0000000..2a127cb Binary files /dev/null and b/app_cpp/StrTP_cpp/.vs/Project1/v17/Solution.VC.db differ diff --git a/app_cpp/StrTP_cpp/.vs/Project1/v17/ipch/AutoPCH/19ea98810843a4c2/SOURCE.ipch b/app_cpp/StrTP_cpp/.vs/Project1/v17/ipch/AutoPCH/19ea98810843a4c2/SOURCE.ipch new file mode 100644 index 0000000..32f7c7b Binary files /dev/null and b/app_cpp/StrTP_cpp/.vs/Project1/v17/ipch/AutoPCH/19ea98810843a4c2/SOURCE.ipch differ diff --git a/app_cpp/StrTP_cpp/Project1/Source.cpp b/app_cpp/StrTP_cpp/Project1/Source.cpp index 8219a24..5cc5898 100644 --- a/app_cpp/StrTP_cpp/Project1/Source.cpp +++ b/app_cpp/StrTP_cpp/Project1/Source.cpp @@ -1,233 +1,233 @@ -#include -#include -#include - -using namespace std; - -class StringTP { -public: - static const int MAX_SIZE = 255; - char data[MAX_SIZE]; // - StringTP() // - { - data[0] = 0; - }; - // - int length() const; // - int findSubstring(const char* substring) const; // - void removeSubstring(const char* substring); // - void insertSubstring(const char* substring, int position); // - void concatenate(const StringTP& other); // - void display() const; // - - friend istream& operator>>(std::istream& is, StringTP& str); // - friend ostream& operator<<(std::ostream& os, const StringTP& str); // - - - StringTP& operator=(const StringTP& other) - { - if (this != &other) // - { - int len = other.length(); // - if (len <= MAX_SIZE - 1) - { - memcpy(data, other.data, len + 1); // , - } - else - { - memcpy(data, other.data, MAX_SIZE - 1); // , MAX_SIZE - 1 - data[MAX_SIZE - 1] = '\0'; // - } - } - return *this; - } - - StringTP operator+(const StringTP& other) - { - StringTP result = *this; // - result.concatenate(other); // concatenate - return result; - } - - ~StringTP() - { - // data - } - -}; - -//StringTP::StringTP() { -// data[0] = 0; // 0 -//} - -int StringTP::length() const { - return static_cast(data[0]); // ( ) -} - -int StringTP::findSubstring(const char* substring) const { - const char* result = strstr(data + 1, substring); // , - if (result == nullptr) { - return -1; // - } - return static_cast(result - data); // -} - -void StringTP::removeSubstring(const char* substring) { - int index = findSubstring(substring); // - if (index != -1) { - int substringLength = static_cast(strlen(substring)); - memmove(data + index, data + index + substringLength, MAX_SIZE - index - substringLength); // - data[0] -= substringLength; // - } -} - -void StringTP::insertSubstring(const char* substring, int position) { - int substringLength = static_cast(strlen(substring)); - if (position >= 0 && position <= length() && length() + substringLength <= MAX_SIZE) { - memmove(data + position + substringLength, data + position, MAX_SIZE - position - substringLength); // - memcpy(data + position, substring, substringLength); - data[0] += substringLength; // - } -} - -void StringTP::concatenate(const StringTP& other) { - int totalLength = length() + other.length(); - if (totalLength <= MAX_SIZE) { - memcpy(data + length() + 1, other.data + 1, other.length()); // - data[0] = totalLength; // - } -} - -void StringTP::display() const { - for (int i = 1; i <= length(); ++i) { - cout << data[i]; // - } - cout << endl; -} - -istream& operator>>(std::istream& is, StringTP& str) { - char buffer[StringTP::MAX_SIZE]; - is.ignore(); // - is.getline(buffer, StringTP::MAX_SIZE); - int length = static_cast(strlen(buffer)); - if (length <= StringTP::MAX_SIZE - 1) { - memcpy(str.data + 1, buffer, length); - str.data[0] = static_cast(length); - } - return is; -} - -ostream& operator<<(std::ostream& os, const StringTP& str) -{ - for (int i = 1; i <= str.data[0]; ++i) { - os << str.data[i]; // StringTP os - } - return os; -} - - -int main() -{ - setlocale(LC_ALL, "Russian"); - system("Title String Turbo Pascal"); // - - StringTP myString, str2; - cout << "myString = "; - cin >> myString; - str2 = myString; - cout << "str2 = " << str2 << endl; - cout << "myString = " << myString << endl; - str2.insertSubstring("abc", 2); - cout << "myString = " << myString << endl; - cout << "str2 = " << str2 << endl; - StringTP str3; - StringTP str4; - cin >> str3; - cin >> str4; - cout << "str3 = " << str3 << endl; - cout << "str4 = " << str4 << endl; - StringTP result = str3 + str4; - cout << "str3 + str4 = " << result << endl; - result.display(); - - int choice; - //do { - // cout << "\n1. \n"; - // cout << "2. \n"; - // cout << "3. \n"; - // cout << "4. \n"; - // cout << "5. \n"; - // cout << "6. \n"; - // cout << "7. \n"; - // cout << "0. \n"; - // cout << " : "; - // cin >> choice; - - // switch (choice) { - // case 1: - // cout << " : " << myString.length() << endl; - // break; - // case 2: - // { - // char substring[StringTP::MAX_SIZE]; - // cout << " : "; - // cin >> substring; - // int index = myString.findSubstring(substring); - // if (index != -1) { - // cout << " : " << index << endl; - // } - // else { - // cout << " \n"; - // } - // } - // break; - // case 3: - // { - // char substring[StringTP::MAX_SIZE]; - // cout << " : "; - // cin >> substring; - // myString.removeSubstring(substring); - // cout << " \n"; - // } - // break; - // case 4: - // { - // char substring[StringTP::MAX_SIZE]; - // int position; - // cout << " : "; - // cin >> substring; - // cout << " : "; - // cin >> position; - // myString.insertSubstring(substring, position); - // cout << " \n"; - // } - // break; - // case 5: - // { - // StringTP otherString; - // cout << " : "; - // cin >> otherString; - // myString.concatenate(otherString); - // cout << " \n"; - // } - // break; - // case 6: - // cout << " : "; - // myString.display(); - // break; - // case 7: - // cout << " : "; - // cin >> myString; - // cout << " \n"; - // break; - // case 0: - // cout << "...\n"; - // break; - // default: - // cout << " \n"; - // } - - //} while (choice != 0); - - return 0; +#include +#include +#include + +using namespace std; + +class StringTP { +public: + static const int MAX_SIZE = 255; + char data[MAX_SIZE]; // + StringTP() // + { + data[0] = 0; + }; + // + int length() const; // + int findSubstring(const char* substring) const; // + void removeSubstring(const char* substring); // + void insertSubstring(const char* substring, int position); // + void concatenate(const StringTP& other); // + void display() const; // + + friend istream& operator>>(std::istream& is, StringTP& str); // + friend ostream& operator<<(std::ostream& os, const StringTP& str); // + + + StringTP& operator=(const StringTP& other) + { + if (this != &other) // + { + int len = other.length(); // + if (len <= MAX_SIZE - 1) + { + memcpy(data, other.data, len + 1); // , + } + else + { + memcpy(data, other.data, MAX_SIZE - 1); // , MAX_SIZE - 1 + data[MAX_SIZE - 1] = '\0'; // + } + } + return *this; + } + + StringTP operator+(const StringTP& other) + { + StringTP result = *this; // + result.concatenate(other); // concatenate + return result; + } + + ~StringTP() + { + // data + } + +}; + +//StringTP::StringTP() { +// data[0] = 0; // 0 +//} + +int StringTP::length() const { + return static_cast(data[0]); // ( ) +} + +int StringTP::findSubstring(const char* substring) const { + const char* result = strstr(data + 1, substring); // , + if (result == nullptr) { + return -1; // + } + return static_cast(result - data); // +} + +void StringTP::removeSubstring(const char* substring) { + int index = findSubstring(substring); // + if (index != -1) { + int substringLength = static_cast(strlen(substring)); + memmove(data + index, data + index + substringLength, MAX_SIZE - index - substringLength); // + data[0] -= substringLength; // + } +} + +void StringTP::insertSubstring(const char* substring, int position) { + int substringLength = static_cast(strlen(substring)); + if (position >= 0 && position <= length() && length() + substringLength <= MAX_SIZE) { + memmove(data + position + substringLength, data + position, MAX_SIZE - position - substringLength); // + memcpy(data + position, substring, substringLength); + data[0] += substringLength; // + } +} + +void StringTP::concatenate(const StringTP& other) { + int totalLength = length() + other.length(); + if (totalLength <= MAX_SIZE) { + memcpy(data + length() + 1, other.data + 1, other.length()); // + data[0] = totalLength; // + } +} + +void StringTP::display() const { + for (int i = 1; i <= length(); ++i) { + cout << data[i]; // + } + cout << endl; +} + +istream& operator>>(std::istream& is, StringTP& str) { + char buffer[StringTP::MAX_SIZE]; + is.ignore(); // + is.getline(buffer, StringTP::MAX_SIZE); + int length = static_cast(strlen(buffer)); + if (length <= StringTP::MAX_SIZE - 1) { + memcpy(str.data + 1, buffer, length); + str.data[0] = static_cast(length); + } + return is; +} + +ostream& operator<<(std::ostream& os, const StringTP& str) +{ + for (int i = 1; i <= str.data[0]; ++i) { + os << str.data[i]; // StringTP os + } + return os; +} + + +int main() +{ + setlocale(LC_ALL, "Russian"); + system("Title String Turbo Pascal"); // + + StringTP myString, str2; + //cout << "myString = "; + //cin >> myString; + //str2 = myString; + //cout << "str2 = " << str2 << endl; + //cout << "myString = " << myString << endl; + //str2.insertSubstring("abc", 2); + //cout << "myString = " << myString << endl; + //cout << "str2 = " << str2 << endl; + //StringTP str3; + //StringTP str4; + //cin >> str3; + //cin >> str4; + //cout << "str3 = " << str3 << endl; + //cout << "str4 = " << str4 << endl; + //StringTP result = str3 + str4; + //cout << "str3 + str4 = " << result << endl; + //result.display(); + + int choice; + do { + cout << "\n1. \n"; + cout << "2. \n"; + cout << "3. \n"; + cout << "4. \n"; + cout << "5. \n"; + cout << "6. \n"; + cout << "7. \n"; + cout << "0. \n"; + cout << " : "; + cin >> choice; + + switch (choice) { + case 1: + cout << " : " << myString.length() << endl; + break; + case 2: + { + char substring[StringTP::MAX_SIZE]; + cout << " : "; + cin >> substring; + int index = myString.findSubstring(substring); + if (index != -1) { + cout << " : " << index << endl; + } + else { + cout << " \n"; + } + } + break; + case 3: + { + char substring[StringTP::MAX_SIZE]; + cout << " : "; + cin >> substring; + myString.removeSubstring(substring); + cout << " \n"; + } + break; + case 4: + { + char substring[StringTP::MAX_SIZE]; + int position; + cout << " : "; + cin >> substring; + cout << " : "; + cin >> position; + myString.insertSubstring(substring, position); + cout << " \n"; + } + break; + case 5: + { + StringTP otherString; + cout << " : "; + cin >> otherString; + myString.concatenate(otherString); + cout << " \n"; + } + break; + case 6: + cout << " : "; + myString.display(); + break; + case 7: + cout << " : "; + cin >> myString; + cout << " \n"; + break; + case 0: + cout << "...\n"; + break; + default: + cout << " \n"; + } + + } while (choice != 0); + + return 0; } \ No newline at end of file diff --git a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.exe.recipe b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.exe.recipe index 5bad019..8a5579d 100644 --- a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.exe.recipe +++ b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.exe.recipe @@ -1,11 +1,11 @@ - - - - - C:\Users\Admin\Desktop\С++\2kurs\Basalova\3 Блабра_22\Project1\x64\Debug\Project1.exe - - - - - + + + + + C:\Lesson\app_cpp\StrTP_cpp\x64\Debug\Project1.exe + + + + + \ No newline at end of file diff --git a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.ilk b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.ilk index c545b3d..2d6be19 100644 Binary files a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.ilk and b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.ilk differ diff --git a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.log b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.log index 21f7ef5..568153c 100644 --- a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.log +++ b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.log @@ -1,5 +1,3 @@ - Source.cpp -C:\Users\Admin\Desktop\С++\2kurs\Basalova\3 Блабра_22\Project1\Project1\Source.cpp(54,9): warning C4156: удаление массива без использования формы оператора "delete", предусмотренной для массива; подставлена предусмотренная форма оператора -C:\Users\Admin\Desktop\С++\2kurs\Basalova\3 Блабра_22\Project1\Project1\Source.cpp(54,9): warning C4154: удаление массива; выполнено преобразование к указателю -C:\Users\Admin\Desktop\С++\2kurs\Basalova\3 Блабра_22\Project1\Project1\Source.cpp(153,9): warning C4101: choice: неиспользованная локальная переменная - Project1.vcxproj -> C:\Users\Admin\Desktop\С++\2kurs\Basalova\3 Блабра_22\Project1\x64\Debug\Project1.exe + Source.cpp + LINK : не найден или не выполнена сборка C:\Lesson\app_cpp\StrTP_cpp\x64\Debug\Project1.exe при последней инкрементной компоновке; выполняется полная компоновка + Project1.vcxproj -> C:\Lesson\app_cpp\StrTP_cpp\x64\Debug\Project1.exe diff --git a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/CL.command.1.tlog b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/CL.command.1.tlog index f400b77..b63f1dd 100644 Binary files a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/CL.command.1.tlog and b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/CL.command.1.tlog differ diff --git a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/CL.read.1.tlog b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/CL.read.1.tlog index 4b0cf9f..e20916c 100644 Binary files a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/CL.read.1.tlog and b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/CL.read.1.tlog differ diff --git a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/CL.write.1.tlog b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/CL.write.1.tlog index fb4dccf..255ca96 100644 Binary files a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/CL.write.1.tlog and b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/CL.write.1.tlog differ diff --git a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/Cl.items.tlog b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/Cl.items.tlog index 6ecbfed..4f90b34 100644 --- a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/Cl.items.tlog +++ b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/Cl.items.tlog @@ -1 +1 @@ -C:\Users\Admin\Desktop\С++\2kurs\Basalova\3 Блабра_22\Project1\Project1\Source.cpp;C:\Users\Admin\Desktop\С++\2kurs\Basalova\3 Блабра_22\Project1\Project1\x64\Debug\Source.obj +C:\Lesson\app_cpp\StrTP_cpp\Project1\Source.cpp;C:\Lesson\app_cpp\StrTP_cpp\Project1\x64\Debug\Source.obj diff --git a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/Project1.lastbuildstate b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/Project1.lastbuildstate index 556a21f..801908c 100644 --- a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/Project1.lastbuildstate +++ b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/Project1.lastbuildstate @@ -1,2 +1,2 @@ -PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.38.33130:TargetPlatformVersion=10.0.19041.0: -Debug|x64|C:\Users\Admin\Desktop\С++\2kurs\Basalova\3 Блабра_22\Project1\| +PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.38.33130:TargetPlatformVersion=10.0.19041.0: +Debug|x64|C:\Lesson\app_cpp\StrTP_cpp\| diff --git a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/link.command.1.tlog b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/link.command.1.tlog index 2b8273c..707c1a8 100644 Binary files a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/link.command.1.tlog and b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/link.command.1.tlog differ diff --git a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/link.read.1.tlog b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/link.read.1.tlog index 4e69012..1e612cd 100644 Binary files a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/link.read.1.tlog and b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/link.read.1.tlog differ diff --git a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/link.write.1.tlog b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/link.write.1.tlog index a31539c..d738083 100644 Binary files a/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/link.write.1.tlog and b/app_cpp/StrTP_cpp/Project1/x64/Debug/Project1.tlog/link.write.1.tlog differ diff --git a/app_cpp/StrTP_cpp/Project1/x64/Debug/Source.obj b/app_cpp/StrTP_cpp/Project1/x64/Debug/Source.obj index 3c581c9..6c8bf9d 100644 Binary files a/app_cpp/StrTP_cpp/Project1/x64/Debug/Source.obj and b/app_cpp/StrTP_cpp/Project1/x64/Debug/Source.obj differ diff --git a/app_cpp/StrTP_cpp/Project1/x64/Debug/vc143.idb b/app_cpp/StrTP_cpp/Project1/x64/Debug/vc143.idb index 08859d8..ce540c8 100644 Binary files a/app_cpp/StrTP_cpp/Project1/x64/Debug/vc143.idb and b/app_cpp/StrTP_cpp/Project1/x64/Debug/vc143.idb differ diff --git a/app_cpp/StrTP_cpp/Project1/x64/Debug/vc143.pdb b/app_cpp/StrTP_cpp/Project1/x64/Debug/vc143.pdb index 17038e8..ddfefff 100644 Binary files a/app_cpp/StrTP_cpp/Project1/x64/Debug/vc143.pdb and b/app_cpp/StrTP_cpp/Project1/x64/Debug/vc143.pdb differ diff --git a/app_cpp/StrTP_cpp/x64/Debug/Project1.exe b/app_cpp/StrTP_cpp/x64/Debug/Project1.exe index 23d7f8e..9fdfaac 100644 Binary files a/app_cpp/StrTP_cpp/x64/Debug/Project1.exe and b/app_cpp/StrTP_cpp/x64/Debug/Project1.exe differ diff --git a/app_cpp/StrTP_cpp/x64/Debug/Project1.pdb b/app_cpp/StrTP_cpp/x64/Debug/Project1.pdb index 857ecc6..d67a4c9 100644 Binary files a/app_cpp/StrTP_cpp/x64/Debug/Project1.pdb and b/app_cpp/StrTP_cpp/x64/Debug/Project1.pdb differ diff --git a/app_cpp/test_spp/Programm.cs b/app_cpp/test_spp/Programm.cs new file mode 100644 index 0000000..ab95a53 --- /dev/null +++ b/app_cpp/test_spp/Programm.cs @@ -0,0 +1,32 @@ +namespace ConsoleBanApp +{ + internal class Program + { + static void Main(string[] args) + { + Console.Title = "Generation Ban List"; + List nicknames = new List(); + string nickname; + + Console.WriteLine("Введите никнеймы. Когда закончите, введите 'Ex':"); + + while (true) + { + nickname = Console.ReadLine(); + if (nickname == "Ex") + { + break; + } + nicknames.Add(nickname); + } + + foreach (var name in nicknames) + { + Console.WriteLine("ban " + name + " Набегатор 0"); + } + + Console.WriteLine("Для продолжения нажмите любую клавишу . . ."); + Console.ReadKey(); // Для остановки консоли после вывода сообщений + } + } +} \ No newline at end of file diff --git a/app_cpp/test_spp/sorce.cpp b/app_cpp/test_spp/sorce.cpp new file mode 100644 index 0000000..e1e1040 --- /dev/null +++ b/app_cpp/test_spp/sorce.cpp @@ -0,0 +1,31 @@ +#include +#include +#include +#include +using namespace std; + +int main() +{ + setlocale(LC_ALL, "ru"); + + std::vector nicknames; + std::string nickname; + + std::cout << "Введите никнеймы. Когда закончите, введите 'Ex':" << std::endl; + + while (true) { + std::cin >> nickname; + if (nickname == "Ex") { + break; + } + nicknames.push_back(nickname); + } + + for (const auto& name : nicknames) { + std::cout << "ban " << name << " Набегатор 0" << std::endl; + } + + std::cout << "Для продолжения нажмите любую клавишу . . ." << std::endl; + std::cin.get(); // Для остановки консоли после вывода сообщений + return 0; +} \ No newline at end of file diff --git a/app_cs/ConsoleBanApp/.vs/ConsoleBanApp/DesignTimeBuild/.dtbcache.v2 b/app_cs/ConsoleBanApp/.vs/ConsoleBanApp/DesignTimeBuild/.dtbcache.v2 new file mode 100644 index 0000000..410ba15 Binary files /dev/null and b/app_cs/ConsoleBanApp/.vs/ConsoleBanApp/DesignTimeBuild/.dtbcache.v2 differ diff --git a/app_cs/ConsoleBanApp/.vs/ConsoleBanApp/FileContentIndex/5951399d-8478-4eb6-8146-ed772da66a26.vsidx b/app_cs/ConsoleBanApp/.vs/ConsoleBanApp/FileContentIndex/5951399d-8478-4eb6-8146-ed772da66a26.vsidx new file mode 100644 index 0000000..6800808 Binary files /dev/null and b/app_cs/ConsoleBanApp/.vs/ConsoleBanApp/FileContentIndex/5951399d-8478-4eb6-8146-ed772da66a26.vsidx differ diff --git a/app_cs/ConsoleBanApp/.vs/ConsoleBanApp/v17/.futdcache.v2 b/app_cs/ConsoleBanApp/.vs/ConsoleBanApp/v17/.futdcache.v2 new file mode 100644 index 0000000..8eba2b7 Binary files /dev/null and b/app_cs/ConsoleBanApp/.vs/ConsoleBanApp/v17/.futdcache.v2 differ diff --git a/app_cs/ConsoleBanApp/.vs/ConsoleBanApp/v17/.suo b/app_cs/ConsoleBanApp/.vs/ConsoleBanApp/v17/.suo new file mode 100644 index 0000000..cbeb597 Binary files /dev/null and b/app_cs/ConsoleBanApp/.vs/ConsoleBanApp/v17/.suo differ diff --git a/app_cs/ConsoleBanApp/.vs/ProjectEvaluation/consolebanapp.metadata.v7.bin b/app_cs/ConsoleBanApp/.vs/ProjectEvaluation/consolebanapp.metadata.v7.bin new file mode 100644 index 0000000..e11d652 Binary files /dev/null and b/app_cs/ConsoleBanApp/.vs/ProjectEvaluation/consolebanapp.metadata.v7.bin differ diff --git a/app_cs/ConsoleBanApp/.vs/ProjectEvaluation/consolebanapp.projects.v7.bin b/app_cs/ConsoleBanApp/.vs/ProjectEvaluation/consolebanapp.projects.v7.bin new file mode 100644 index 0000000..ba605b3 Binary files /dev/null and b/app_cs/ConsoleBanApp/.vs/ProjectEvaluation/consolebanapp.projects.v7.bin differ diff --git a/app_cs/ConsoleBanApp/ConsoleBanApp.csproj b/app_cs/ConsoleBanApp/ConsoleBanApp.csproj new file mode 100644 index 0000000..206b89a --- /dev/null +++ b/app_cs/ConsoleBanApp/ConsoleBanApp.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/app_cs/ConsoleBanApp/ConsoleBanApp.sln b/app_cs/ConsoleBanApp/ConsoleBanApp.sln new file mode 100644 index 0000000..bbb43ea --- /dev/null +++ b/app_cs/ConsoleBanApp/ConsoleBanApp.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleBanApp", "ConsoleBanApp.csproj", "{44FF6A3B-755C-4E07-BDFA-83D8C0593448}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {44FF6A3B-755C-4E07-BDFA-83D8C0593448}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {44FF6A3B-755C-4E07-BDFA-83D8C0593448}.Debug|Any CPU.Build.0 = Debug|Any CPU + {44FF6A3B-755C-4E07-BDFA-83D8C0593448}.Release|Any CPU.ActiveCfg = Release|Any CPU + {44FF6A3B-755C-4E07-BDFA-83D8C0593448}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {AE6FBB1D-CD6C-4004-BB60-FB903F5C865C} + EndGlobalSection +EndGlobal diff --git a/app_cs/ConsoleBanApp/Program.cs b/app_cs/ConsoleBanApp/Program.cs new file mode 100644 index 0000000..fcc7a01 --- /dev/null +++ b/app_cs/ConsoleBanApp/Program.cs @@ -0,0 +1,65 @@ +namespace ConsoleBanApp +{ + internal class Program + { + static void Main(string[] args) + { + Console.Title = "Generation Ban List"; + List nicknames = new List(); + string nickname; + + Console.WriteLine("Введите никнеймы. Когда закончите, введите 'Ex':"); + + while (true) + { + nickname = Console.ReadLine(); + if (nickname == "Ex") + { + break; + } + nicknames.Add(nickname); + } + + foreach (var name in nicknames) + { + Console.WriteLine("ban " + name + " Набегатор 0"); + } + + Console.WriteLine("Для продолжения нажмите любую клавишу . . ."); + Console.ReadKey(); // Для остановки консоли после вывода сообщений + } + } +} + + +//using System; +//using System.Collections.Generic; + +//class Program +//{ +// static void Main() +// { +// List nicknames = new List(); +// string nickname; + +// Console.WriteLine("Введите никнеймы. Когда закончите, введите 'Ex':"); + +// while (true) +// { +// nickname = Console.ReadLine(); +// if (nickname == "Ex") +// { +// break; +// } +// nicknames.Add(nickname); +// } + +// foreach (var name in nicknames) +// { +// Console.WriteLine("ban " + name + " Набегатор 0"); +// } + +// Console.WriteLine("Для продолжения нажмите любую клавишу . . ."); +// Console.ReadKey(); // Для остановки консоли после вывода сообщений +// } +//} \ No newline at end of file diff --git a/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp.rar b/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp.rar new file mode 100644 index 0000000..9b7d1d4 Binary files /dev/null and b/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp.rar differ diff --git a/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.deps.json b/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.deps.json new file mode 100644 index 0000000..2f9e122 --- /dev/null +++ b/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v8.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v8.0": { + "ConsoleBanApp/1.0.0": { + "runtime": { + "ConsoleBanApp.dll": {} + } + } + } + }, + "libraries": { + "ConsoleBanApp/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.dll b/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.dll new file mode 100644 index 0000000..71d011d Binary files /dev/null and b/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.dll differ diff --git a/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.exe b/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.exe new file mode 100644 index 0000000..05e1112 Binary files /dev/null and b/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.exe differ diff --git a/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.pdb b/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.pdb new file mode 100644 index 0000000..b948780 Binary files /dev/null and b/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.pdb differ diff --git a/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.runtimeconfig.json b/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.runtimeconfig.json new file mode 100644 index 0000000..1de3a5d --- /dev/null +++ b/app_cs/ConsoleBanApp/bin/Debug/net8.0/BanListApp/ConsoleBanApp.runtimeconfig.json @@ -0,0 +1,12 @@ +{ + "runtimeOptions": { + "tfm": "net8.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "8.0.0" + }, + "configProperties": { + "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false + } + } +} \ No newline at end of file diff --git a/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.deps.json b/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.deps.json new file mode 100644 index 0000000..2f9e122 --- /dev/null +++ b/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v8.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v8.0": { + "ConsoleBanApp/1.0.0": { + "runtime": { + "ConsoleBanApp.dll": {} + } + } + } + }, + "libraries": { + "ConsoleBanApp/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.dll b/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.dll new file mode 100644 index 0000000..71d011d Binary files /dev/null and b/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.dll differ diff --git a/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.exe b/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.exe new file mode 100644 index 0000000..05e1112 Binary files /dev/null and b/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.exe differ diff --git a/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.pdb b/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.pdb new file mode 100644 index 0000000..b948780 Binary files /dev/null and b/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.pdb differ diff --git a/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.runtimeconfig.json b/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.runtimeconfig.json new file mode 100644 index 0000000..1de3a5d --- /dev/null +++ b/app_cs/ConsoleBanApp/bin/Debug/net8.0/ConsoleBanApp.runtimeconfig.json @@ -0,0 +1,12 @@ +{ + "runtimeOptions": { + "tfm": "net8.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "8.0.0" + }, + "configProperties": { + "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false + } + } +} \ No newline at end of file diff --git a/app_cs/ConsoleBanApp/obj/ConsoleBanApp.csproj.nuget.dgspec.json b/app_cs/ConsoleBanApp/obj/ConsoleBanApp.csproj.nuget.dgspec.json new file mode 100644 index 0000000..27254c8 --- /dev/null +++ b/app_cs/ConsoleBanApp/obj/ConsoleBanApp.csproj.nuget.dgspec.json @@ -0,0 +1,63 @@ +{ + "format": 1, + "restore": { + "C:\\Lesson\\app_cs\\ConsoleBanApp\\ConsoleBanApp.csproj": {} + }, + "projects": { + "C:\\Lesson\\app_cs\\ConsoleBanApp\\ConsoleBanApp.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Lesson\\app_cs\\ConsoleBanApp\\ConsoleBanApp.csproj", + "projectName": "ConsoleBanApp", + "projectPath": "C:\\Lesson\\app_cs\\ConsoleBanApp\\ConsoleBanApp.csproj", + "packagesPath": "C:\\Users\\Admin\\.nuget\\packages\\", + "outputPath": "C:\\Lesson\\app_cs\\ConsoleBanApp\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Admin\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net8.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/app_cs/ConsoleBanApp/obj/ConsoleBanApp.csproj.nuget.g.props b/app_cs/ConsoleBanApp/obj/ConsoleBanApp.csproj.nuget.g.props new file mode 100644 index 0000000..c1f499a --- /dev/null +++ b/app_cs/ConsoleBanApp/obj/ConsoleBanApp.csproj.nuget.g.props @@ -0,0 +1,15 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\Admin\.nuget\packages\ + PackageReference + 6.8.0 + + + + + \ No newline at end of file diff --git a/app_cs/ConsoleBanApp/obj/ConsoleBanApp.csproj.nuget.g.targets b/app_cs/ConsoleBanApp/obj/ConsoleBanApp.csproj.nuget.g.targets new file mode 100644 index 0000000..35a7576 --- /dev/null +++ b/app_cs/ConsoleBanApp/obj/ConsoleBanApp.csproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs b/app_cs/ConsoleBanApp/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs new file mode 100644 index 0000000..678fc5f --- /dev/null +++ b/app_cs/ConsoleBanApp/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")] diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.AssemblyInfo.cs b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.AssemblyInfo.cs new file mode 100644 index 0000000..8dc238f --- /dev/null +++ b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("ConsoleBanApp")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0229ea28f27dae07a23a72e5ab837aad4308359c")] +[assembly: System.Reflection.AssemblyProductAttribute("ConsoleBanApp")] +[assembly: System.Reflection.AssemblyTitleAttribute("ConsoleBanApp")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Создано классом WriteCodeFragment MSBuild. + diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.AssemblyInfoInputs.cache b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.AssemblyInfoInputs.cache new file mode 100644 index 0000000..5224bb3 --- /dev/null +++ b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +f66dab724329c096e903280aec455967adc3cc3d5d91ec725324b27361d2f6e1 diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.GeneratedMSBuildEditorConfig.editorconfig b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..77b2cce --- /dev/null +++ b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,13 @@ +is_global = true +build_property.TargetFramework = net8.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = ConsoleBanApp +build_property.ProjectDir = C:\Lesson\app_cs\ConsoleBanApp\ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.GlobalUsings.g.cs b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.GlobalUsings.g.cs new file mode 100644 index 0000000..ac22929 --- /dev/null +++ b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.GlobalUsings.g.cs @@ -0,0 +1,8 @@ +// +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.assets.cache b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.assets.cache new file mode 100644 index 0000000..e0fb27d Binary files /dev/null and b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.assets.cache differ diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.csproj.BuildWithSkipAnalyzers b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.csproj.BuildWithSkipAnalyzers new file mode 100644 index 0000000..e69de29 diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.csproj.CoreCompileInputs.cache b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..06f8b5d --- /dev/null +++ b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +5cd1822637abae5427bbffe5a01e3b8b98d3aec56d921d0136d01f734eb6efc6 diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.csproj.FileListAbsolute.txt b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..2ff4482 --- /dev/null +++ b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.csproj.FileListAbsolute.txt @@ -0,0 +1,15 @@ +C:\Lesson\app_cs\ConsoleBanApp\obj\Debug\net8.0\ConsoleBanApp.GeneratedMSBuildEditorConfig.editorconfig +C:\Lesson\app_cs\ConsoleBanApp\obj\Debug\net8.0\ConsoleBanApp.AssemblyInfoInputs.cache +C:\Lesson\app_cs\ConsoleBanApp\obj\Debug\net8.0\ConsoleBanApp.AssemblyInfo.cs +C:\Lesson\app_cs\ConsoleBanApp\obj\Debug\net8.0\ConsoleBanApp.csproj.CoreCompileInputs.cache +C:\Lesson\app_cs\ConsoleBanApp\obj\Debug\net8.0\ConsoleBanApp.sourcelink.json +C:\Lesson\app_cs\ConsoleBanApp\bin\Debug\net8.0\ConsoleBanApp.exe +C:\Lesson\app_cs\ConsoleBanApp\bin\Debug\net8.0\ConsoleBanApp.deps.json +C:\Lesson\app_cs\ConsoleBanApp\bin\Debug\net8.0\ConsoleBanApp.runtimeconfig.json +C:\Lesson\app_cs\ConsoleBanApp\bin\Debug\net8.0\ConsoleBanApp.dll +C:\Lesson\app_cs\ConsoleBanApp\bin\Debug\net8.0\ConsoleBanApp.pdb +C:\Lesson\app_cs\ConsoleBanApp\obj\Debug\net8.0\ConsoleBanApp.dll +C:\Lesson\app_cs\ConsoleBanApp\obj\Debug\net8.0\refint\ConsoleBanApp.dll +C:\Lesson\app_cs\ConsoleBanApp\obj\Debug\net8.0\ConsoleBanApp.pdb +C:\Lesson\app_cs\ConsoleBanApp\obj\Debug\net8.0\ConsoleBanApp.genruntimeconfig.cache +C:\Lesson\app_cs\ConsoleBanApp\obj\Debug\net8.0\ref\ConsoleBanApp.dll diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.dll b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.dll new file mode 100644 index 0000000..71d011d Binary files /dev/null and b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.dll differ diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.genruntimeconfig.cache b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.genruntimeconfig.cache new file mode 100644 index 0000000..061b7fe --- /dev/null +++ b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.genruntimeconfig.cache @@ -0,0 +1 @@ +d1d6ab8de0a05b0320a8b11e1ed003e4e0a486bde82a01403d917de4785a9da8 diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.pdb b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.pdb new file mode 100644 index 0000000..b948780 Binary files /dev/null and b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.pdb differ diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.sourcelink.json b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.sourcelink.json new file mode 100644 index 0000000..abbcf2c --- /dev/null +++ b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ConsoleBanApp.sourcelink.json @@ -0,0 +1 @@ +{"documents":{"C:\\Lesson\\*":"https://raw.githubusercontent.com/Schrodinger71/Lesson/0229ea28f27dae07a23a72e5ab837aad4308359c/*"}} \ No newline at end of file diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/apphost.exe b/app_cs/ConsoleBanApp/obj/Debug/net8.0/apphost.exe new file mode 100644 index 0000000..05e1112 Binary files /dev/null and b/app_cs/ConsoleBanApp/obj/Debug/net8.0/apphost.exe differ diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/ref/ConsoleBanApp.dll b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ref/ConsoleBanApp.dll new file mode 100644 index 0000000..2752d31 Binary files /dev/null and b/app_cs/ConsoleBanApp/obj/Debug/net8.0/ref/ConsoleBanApp.dll differ diff --git a/app_cs/ConsoleBanApp/obj/Debug/net8.0/refint/ConsoleBanApp.dll b/app_cs/ConsoleBanApp/obj/Debug/net8.0/refint/ConsoleBanApp.dll new file mode 100644 index 0000000..2752d31 Binary files /dev/null and b/app_cs/ConsoleBanApp/obj/Debug/net8.0/refint/ConsoleBanApp.dll differ diff --git a/app_cs/ConsoleBanApp/obj/project.assets.json b/app_cs/ConsoleBanApp/obj/project.assets.json new file mode 100644 index 0000000..d99ff2e --- /dev/null +++ b/app_cs/ConsoleBanApp/obj/project.assets.json @@ -0,0 +1,68 @@ +{ + "version": 3, + "targets": { + "net8.0": {} + }, + "libraries": {}, + "projectFileDependencyGroups": { + "net8.0": [] + }, + "packageFolders": { + "C:\\Users\\Admin\\.nuget\\packages\\": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Lesson\\app_cs\\ConsoleBanApp\\ConsoleBanApp.csproj", + "projectName": "ConsoleBanApp", + "projectPath": "C:\\Lesson\\app_cs\\ConsoleBanApp\\ConsoleBanApp.csproj", + "packagesPath": "C:\\Users\\Admin\\.nuget\\packages\\", + "outputPath": "C:\\Lesson\\app_cs\\ConsoleBanApp\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Admin\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net8.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/app_cs/ConsoleBanApp/obj/project.nuget.cache b/app_cs/ConsoleBanApp/obj/project.nuget.cache new file mode 100644 index 0000000..1665bfd --- /dev/null +++ b/app_cs/ConsoleBanApp/obj/project.nuget.cache @@ -0,0 +1,8 @@ +{ + "version": 2, + "dgSpecHash": "ALHY2lmWaWxp4SrHzkaRjmuSjav83yZzUqWf8OU2wC6orPEnjuOf+n980s9mpfYt+YmWVeI9xhaIiOb9Cobl0Q==", + "success": true, + "projectFilePath": "C:\\Lesson\\app_cs\\ConsoleBanApp\\ConsoleBanApp.csproj", + "expectedPackageFiles": [], + "logs": [] +} \ No newline at end of file diff --git a/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/DesignTimeBuild/.dtbcache.v2 b/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/DesignTimeBuild/.dtbcache.v2 new file mode 100644 index 0000000..b8bb324 Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/DesignTimeBuild/.dtbcache.v2 differ diff --git a/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/FileContentIndex/5314405d-edc1-4fda-9240-eb53956846b4.vsidx b/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/FileContentIndex/5314405d-edc1-4fda-9240-eb53956846b4.vsidx new file mode 100644 index 0000000..e7feba3 Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/FileContentIndex/5314405d-edc1-4fda-9240-eb53956846b4.vsidx differ diff --git a/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/FileContentIndex/7b7e95c0-8105-4fda-9b67-3f81e32eb218.vsidx b/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/FileContentIndex/7b7e95c0-8105-4fda-9b67-3f81e32eb218.vsidx new file mode 100644 index 0000000..7b532bb Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/FileContentIndex/7b7e95c0-8105-4fda-9b67-3f81e32eb218.vsidx differ diff --git a/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/v17/.futdcache.v2 b/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/v17/.futdcache.v2 new file mode 100644 index 0000000..8b2de04 Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/v17/.futdcache.v2 differ diff --git a/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/v17/.suo b/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/v17/.suo new file mode 100644 index 0000000..3a8553f Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/.vs/ConsoleGameLifeApp/v17/.suo differ diff --git a/app_cs/ConsoleGameLifeApp/.vs/ProjectEvaluation/consolegamelifeapp.metadata.v7.bin b/app_cs/ConsoleGameLifeApp/.vs/ProjectEvaluation/consolegamelifeapp.metadata.v7.bin new file mode 100644 index 0000000..771d55e Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/.vs/ProjectEvaluation/consolegamelifeapp.metadata.v7.bin differ diff --git a/app_cs/ConsoleGameLifeApp/.vs/ProjectEvaluation/consolegamelifeapp.projects.v7.bin b/app_cs/ConsoleGameLifeApp/.vs/ProjectEvaluation/consolegamelifeapp.projects.v7.bin new file mode 100644 index 0000000..a15691a Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/.vs/ProjectEvaluation/consolegamelifeapp.projects.v7.bin differ diff --git a/app_cs/ConsoleGameLifeApp/ConsoleGameLifeApp.csproj b/app_cs/ConsoleGameLifeApp/ConsoleGameLifeApp.csproj new file mode 100644 index 0000000..206b89a --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/ConsoleGameLifeApp.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/app_cs/ConsoleGameLifeApp/ConsoleGameLifeApp.sln b/app_cs/ConsoleGameLifeApp/ConsoleGameLifeApp.sln new file mode 100644 index 0000000..c4c2503 --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/ConsoleGameLifeApp.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleGameLifeApp", "ConsoleGameLifeApp.csproj", "{8DB99D0E-020B-47EB-9AEE-AC02BF4936AB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8DB99D0E-020B-47EB-9AEE-AC02BF4936AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8DB99D0E-020B-47EB-9AEE-AC02BF4936AB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8DB99D0E-020B-47EB-9AEE-AC02BF4936AB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8DB99D0E-020B-47EB-9AEE-AC02BF4936AB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {80C5F2F5-50CD-47F1-A7A6-9FE7FAF82AE5} + EndGlobalSection +EndGlobal diff --git a/app_cs/ConsoleGameLifeApp/GameLifeEngine.cs b/app_cs/ConsoleGameLifeApp/GameLifeEngine.cs new file mode 100644 index 0000000..4e4b733 --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/GameLifeEngine.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleGameLifeApp +{ + internal class GameLifeEngine + { + + public uint currentGeneration { get; private set; } + //private int currentGeneration = 0; + private bool[,] field; + private readonly int rows; + private readonly int cols; + + + + public GameLifeEngine(int rows, int cols, int density) + { + + this.rows = rows; + this.cols = cols; + field = new bool[cols, rows]; + + Random random = new Random(); + for (int x = 0; x < cols; x++) + { + for (int y = 0; y < rows; y++) + { + field[x, y] = random.Next(density) == 0; + } + } + + } + + public void NextGeneration() + { + //graphics.Clear(Color.Black); + + var newField = new bool[cols, rows]; + + for (int x = 0; x < cols; x++) + { + for (int y = 0; y < rows; y++) + { + var neighboursCount = CountNeigbours(x, y); + var hasLife = field[x, y]; + + if (!hasLife && neighboursCount == 3) + newField[x, y] = true; + else if (hasLife && (neighboursCount < 2 || neighboursCount > 3)) + newField[x, y] = false; + else + newField[x, y] = field[x, y]; + + + //if (hasLife) + //graphics.FillRectangle(Brushes.Crimson, x * resolution, y * resolution, resolution - 1, resolution - 1); + + } + } + field = newField; + currentGeneration++; + //pictureBox1.Refresh(); + //textBoxGeneration.Text = $"{++currentGeneration}"; + } + + public bool[,] GetCurrentGeneration() + { + var result = new bool[cols, rows]; + + for (int x = 0; x < cols; x++) + { + for (int y = 0; y < rows; y++) + { + result[x, y] = field[x, y]; + } + } + return field; + } + + private int CountNeigbours(int x, int y) + { + + int count = 0; + + for (int i = -1; i < 2; i++) + { + for (int j = -1; j < 2; j++) + { + var col = (x + i + cols) % cols; + var row = (y + j + rows) % rows; + + + bool isSelfChecking = col == x && row == y; + var hasLife = field[col, row]; + + + if (hasLife && !isSelfChecking) + count++; + } + } + + return count; + } + + private bool ValidateCellPosition(int x, int y) + { + return x >= 0 && y >= 0 && x < cols && y < rows; + } + + private void UpdateCell(int x, int y, bool state) + { + if (ValidateCellPosition(x, y)) + field[x, y] = state; + + } + + public void AddCell(int x, int y) + { + UpdateCell(x, y, true); + } + + public void RemoveCell(int x, int y) + { + UpdateCell(x, y, false); + } + } +} diff --git a/app_cs/ConsoleGameLifeApp/Program.cs b/app_cs/ConsoleGameLifeApp/Program.cs new file mode 100644 index 0000000..3e8a972 --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/Program.cs @@ -0,0 +1,53 @@ +using System.Data; +using System.Data.Common; + +namespace ConsoleGameLifeApp +{ + internal class Program + { + static void Main(string[] args) + { + + + + Console.CursorVisible = false; + Console.SetCursorPosition(0, 0); + Console.ReadKey(); + + var gameEngine = new GameLifeEngine + ( + rows: 50, + cols: 50, + density: 2 + ); + + while(true) + { + Console.Title = gameEngine.currentGeneration.ToString(); + Console.CursorVisible = false; + + var field = gameEngine.GetCurrentGeneration(); + + for (int i = 0; i < field.GetLength(1); i++) + { + var str = new char[field.GetLength(0)]; + for(int x = 0; x < field.GetLength(0); x++) + { + if (field[x, i]) + str[x] = '#'; + else + str[x] = ' '; + } + Console.WriteLine(str); + } + + Console.SetCursorPosition(0, 0); + + gameEngine.NextGeneration(); + } + + + //GameLifeEngine + } + } +} diff --git a/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ClassLibraryGameEngineLife.dll b/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ClassLibraryGameEngineLife.dll new file mode 100644 index 0000000..0ba36e1 Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ClassLibraryGameEngineLife.dll differ diff --git a/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGame.rar b/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGame.rar new file mode 100644 index 0000000..9990897 Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGame.rar differ diff --git a/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.deps.json b/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.deps.json new file mode 100644 index 0000000..6f7700f --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v8.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v8.0": { + "ConsoleGameLifeApp/1.0.0": { + "runtime": { + "ConsoleGameLifeApp.dll": {} + } + } + } + }, + "libraries": { + "ConsoleGameLifeApp/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.dll b/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.dll new file mode 100644 index 0000000..50a15b1 Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.dll differ diff --git a/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.exe b/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.exe new file mode 100644 index 0000000..06134f4 Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.exe differ diff --git a/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.pdb b/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.pdb new file mode 100644 index 0000000..b2b69c8 Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.pdb differ diff --git a/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.runtimeconfig.json b/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.runtimeconfig.json new file mode 100644 index 0000000..1de3a5d --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/bin/Debug/net8.0/ConsoleGameLifeApp.runtimeconfig.json @@ -0,0 +1,12 @@ +{ + "runtimeOptions": { + "tfm": "net8.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "8.0.0" + }, + "configProperties": { + "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false + } + } +} \ No newline at end of file diff --git a/app_cs/ConsoleGameLifeApp/obj/ConsoleGameLifeApp.csproj.nuget.dgspec.json b/app_cs/ConsoleGameLifeApp/obj/ConsoleGameLifeApp.csproj.nuget.dgspec.json new file mode 100644 index 0000000..a747ad4 --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/obj/ConsoleGameLifeApp.csproj.nuget.dgspec.json @@ -0,0 +1,63 @@ +{ + "format": 1, + "restore": { + "C:\\Lesson\\app_cs\\ConsoleGameLifeApp\\ConsoleGameLifeApp.csproj": {} + }, + "projects": { + "C:\\Lesson\\app_cs\\ConsoleGameLifeApp\\ConsoleGameLifeApp.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Lesson\\app_cs\\ConsoleGameLifeApp\\ConsoleGameLifeApp.csproj", + "projectName": "ConsoleGameLifeApp", + "projectPath": "C:\\Lesson\\app_cs\\ConsoleGameLifeApp\\ConsoleGameLifeApp.csproj", + "packagesPath": "C:\\Users\\Admin\\.nuget\\packages\\", + "outputPath": "C:\\Lesson\\app_cs\\ConsoleGameLifeApp\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Admin\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net8.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/app_cs/ConsoleGameLifeApp/obj/ConsoleGameLifeApp.csproj.nuget.g.props b/app_cs/ConsoleGameLifeApp/obj/ConsoleGameLifeApp.csproj.nuget.g.props new file mode 100644 index 0000000..c1f499a --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/obj/ConsoleGameLifeApp.csproj.nuget.g.props @@ -0,0 +1,15 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\Admin\.nuget\packages\ + PackageReference + 6.8.0 + + + + + \ No newline at end of file diff --git a/app_cs/ConsoleGameLifeApp/obj/ConsoleGameLifeApp.csproj.nuget.g.targets b/app_cs/ConsoleGameLifeApp/obj/ConsoleGameLifeApp.csproj.nuget.g.targets new file mode 100644 index 0000000..35a7576 --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/obj/ConsoleGameLifeApp.csproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs new file mode 100644 index 0000000..678fc5f --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")] diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.AssemblyInfo.cs b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.AssemblyInfo.cs new file mode 100644 index 0000000..debd122 --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("ConsoleGameLifeApp")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0229ea28f27dae07a23a72e5ab837aad4308359c")] +[assembly: System.Reflection.AssemblyProductAttribute("ConsoleGameLifeApp")] +[assembly: System.Reflection.AssemblyTitleAttribute("ConsoleGameLifeApp")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Создано классом WriteCodeFragment MSBuild. + diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.AssemblyInfoInputs.cache b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.AssemblyInfoInputs.cache new file mode 100644 index 0000000..2ba7005 --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +75c1e53d125db6752a6ce48a80ea42884d4030d318ecc891ac258cc215cbbb6d diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.GeneratedMSBuildEditorConfig.editorconfig b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..bf01389 --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,13 @@ +is_global = true +build_property.TargetFramework = net8.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = ConsoleGameLifeApp +build_property.ProjectDir = C:\Lesson\app_cs\ConsoleGameLifeApp\ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.GlobalUsings.g.cs b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.GlobalUsings.g.cs new file mode 100644 index 0000000..ac22929 --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.GlobalUsings.g.cs @@ -0,0 +1,8 @@ +// +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.assets.cache b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.assets.cache new file mode 100644 index 0000000..5611f5d Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.assets.cache differ diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.csproj.BuildWithSkipAnalyzers b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.csproj.BuildWithSkipAnalyzers new file mode 100644 index 0000000..e69de29 diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.csproj.CoreCompileInputs.cache b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..e462f9a --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +c656ef4789108cf10dac79da8f25acbed1134d51767e6041088a5ca3adec1dcf diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.csproj.FileListAbsolute.txt b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..ab7e30a --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.csproj.FileListAbsolute.txt @@ -0,0 +1,15 @@ +C:\Lesson\app_cs\ConsoleGameLifeApp\bin\Debug\net8.0\ConsoleGameLifeApp.exe +C:\Lesson\app_cs\ConsoleGameLifeApp\bin\Debug\net8.0\ConsoleGameLifeApp.deps.json +C:\Lesson\app_cs\ConsoleGameLifeApp\bin\Debug\net8.0\ConsoleGameLifeApp.runtimeconfig.json +C:\Lesson\app_cs\ConsoleGameLifeApp\bin\Debug\net8.0\ConsoleGameLifeApp.dll +C:\Lesson\app_cs\ConsoleGameLifeApp\bin\Debug\net8.0\ConsoleGameLifeApp.pdb +C:\Lesson\app_cs\ConsoleGameLifeApp\obj\Debug\net8.0\ConsoleGameLifeApp.GeneratedMSBuildEditorConfig.editorconfig +C:\Lesson\app_cs\ConsoleGameLifeApp\obj\Debug\net8.0\ConsoleGameLifeApp.AssemblyInfoInputs.cache +C:\Lesson\app_cs\ConsoleGameLifeApp\obj\Debug\net8.0\ConsoleGameLifeApp.AssemblyInfo.cs +C:\Lesson\app_cs\ConsoleGameLifeApp\obj\Debug\net8.0\ConsoleGameLifeApp.csproj.CoreCompileInputs.cache +C:\Lesson\app_cs\ConsoleGameLifeApp\obj\Debug\net8.0\ConsoleGameLifeApp.sourcelink.json +C:\Lesson\app_cs\ConsoleGameLifeApp\obj\Debug\net8.0\ConsoleGameLifeApp.dll +C:\Lesson\app_cs\ConsoleGameLifeApp\obj\Debug\net8.0\refint\ConsoleGameLifeApp.dll +C:\Lesson\app_cs\ConsoleGameLifeApp\obj\Debug\net8.0\ConsoleGameLifeApp.pdb +C:\Lesson\app_cs\ConsoleGameLifeApp\obj\Debug\net8.0\ConsoleGameLifeApp.genruntimeconfig.cache +C:\Lesson\app_cs\ConsoleGameLifeApp\obj\Debug\net8.0\ref\ConsoleGameLifeApp.dll diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.dll b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.dll new file mode 100644 index 0000000..50a15b1 Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.dll differ diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.genruntimeconfig.cache b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.genruntimeconfig.cache new file mode 100644 index 0000000..4b0751f --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.genruntimeconfig.cache @@ -0,0 +1 @@ +ee5be60eafe7090998624c99ea71e83e5543d765aac75c5ae27dfb275d209ed8 diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.pdb b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.pdb new file mode 100644 index 0000000..b2b69c8 Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.pdb differ diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.sourcelink.json b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.sourcelink.json new file mode 100644 index 0000000..abbcf2c --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ConsoleGameLifeApp.sourcelink.json @@ -0,0 +1 @@ +{"documents":{"C:\\Lesson\\*":"https://raw.githubusercontent.com/Schrodinger71/Lesson/0229ea28f27dae07a23a72e5ab837aad4308359c/*"}} \ No newline at end of file diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/apphost.exe b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/apphost.exe new file mode 100644 index 0000000..06134f4 Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/apphost.exe differ diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ref/ConsoleGameLifeApp.dll b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ref/ConsoleGameLifeApp.dll new file mode 100644 index 0000000..dd7cd64 Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/ref/ConsoleGameLifeApp.dll differ diff --git a/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/refint/ConsoleGameLifeApp.dll b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/refint/ConsoleGameLifeApp.dll new file mode 100644 index 0000000..dd7cd64 Binary files /dev/null and b/app_cs/ConsoleGameLifeApp/obj/Debug/net8.0/refint/ConsoleGameLifeApp.dll differ diff --git a/app_cs/ConsoleGameLifeApp/obj/project.assets.json b/app_cs/ConsoleGameLifeApp/obj/project.assets.json new file mode 100644 index 0000000..6f9374a --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/obj/project.assets.json @@ -0,0 +1,68 @@ +{ + "version": 3, + "targets": { + "net8.0": {} + }, + "libraries": {}, + "projectFileDependencyGroups": { + "net8.0": [] + }, + "packageFolders": { + "C:\\Users\\Admin\\.nuget\\packages\\": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Lesson\\app_cs\\ConsoleGameLifeApp\\ConsoleGameLifeApp.csproj", + "projectName": "ConsoleGameLifeApp", + "projectPath": "C:\\Lesson\\app_cs\\ConsoleGameLifeApp\\ConsoleGameLifeApp.csproj", + "packagesPath": "C:\\Users\\Admin\\.nuget\\packages\\", + "outputPath": "C:\\Lesson\\app_cs\\ConsoleGameLifeApp\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Admin\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net8.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/app_cs/ConsoleGameLifeApp/obj/project.nuget.cache b/app_cs/ConsoleGameLifeApp/obj/project.nuget.cache new file mode 100644 index 0000000..c1b2d82 --- /dev/null +++ b/app_cs/ConsoleGameLifeApp/obj/project.nuget.cache @@ -0,0 +1,8 @@ +{ + "version": 2, + "dgSpecHash": "u9D6x71BbOpTX9bga7qW+uhPLHD9vS+IQNTZwAD1A1cHigumDS/vh/HjUyj0DzUD0FSn0seSeydY3FqwTePa4w==", + "success": true, + "projectFilePath": "C:\\Lesson\\app_cs\\ConsoleGameLifeApp\\ConsoleGameLifeApp.csproj", + "expectedPackageFiles": [], + "logs": [] +} \ No newline at end of file diff --git a/app_cs/ConsoleRedactionChangLogTextApp/.vs/ConsoleRedactionChangLogTextApp/DesignTimeBuild/.dtbcache.v2 b/app_cs/ConsoleRedactionChangLogTextApp/.vs/ConsoleRedactionChangLogTextApp/DesignTimeBuild/.dtbcache.v2 new file mode 100644 index 0000000..10ee925 Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/.vs/ConsoleRedactionChangLogTextApp/DesignTimeBuild/.dtbcache.v2 differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/.vs/ConsoleRedactionChangLogTextApp/FileContentIndex/2feb5c16-5280-41bd-9a3b-68b4d3d12581.vsidx b/app_cs/ConsoleRedactionChangLogTextApp/.vs/ConsoleRedactionChangLogTextApp/FileContentIndex/2feb5c16-5280-41bd-9a3b-68b4d3d12581.vsidx new file mode 100644 index 0000000..7469cf4 Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/.vs/ConsoleRedactionChangLogTextApp/FileContentIndex/2feb5c16-5280-41bd-9a3b-68b4d3d12581.vsidx differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/.vs/ConsoleRedactionChangLogTextApp/v17/.futdcache.v2 b/app_cs/ConsoleRedactionChangLogTextApp/.vs/ConsoleRedactionChangLogTextApp/v17/.futdcache.v2 new file mode 100644 index 0000000..2c1c590 Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/.vs/ConsoleRedactionChangLogTextApp/v17/.futdcache.v2 differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/.vs/ConsoleRedactionChangLogTextApp/v17/.suo b/app_cs/ConsoleRedactionChangLogTextApp/.vs/ConsoleRedactionChangLogTextApp/v17/.suo new file mode 100644 index 0000000..80f9193 Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/.vs/ConsoleRedactionChangLogTextApp/v17/.suo differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/.vs/ProjectEvaluation/consoleredactionchanglogtextapp.metadata.v7.bin b/app_cs/ConsoleRedactionChangLogTextApp/.vs/ProjectEvaluation/consoleredactionchanglogtextapp.metadata.v7.bin new file mode 100644 index 0000000..483a75f Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/.vs/ProjectEvaluation/consoleredactionchanglogtextapp.metadata.v7.bin differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/.vs/ProjectEvaluation/consoleredactionchanglogtextapp.projects.v7.bin b/app_cs/ConsoleRedactionChangLogTextApp/.vs/ProjectEvaluation/consoleredactionchanglogtextapp.projects.v7.bin new file mode 100644 index 0000000..37e7d71 Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/.vs/ProjectEvaluation/consoleredactionchanglogtextapp.projects.v7.bin differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/ConsoleRedactionChangLogTextApp.csproj b/app_cs/ConsoleRedactionChangLogTextApp/ConsoleRedactionChangLogTextApp.csproj new file mode 100644 index 0000000..206b89a --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/ConsoleRedactionChangLogTextApp.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/app_cs/ConsoleRedactionChangLogTextApp/ConsoleRedactionChangLogTextApp.sln b/app_cs/ConsoleRedactionChangLogTextApp/ConsoleRedactionChangLogTextApp.sln new file mode 100644 index 0000000..cf76b45 --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/ConsoleRedactionChangLogTextApp.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleRedactionChangLogTextApp", "ConsoleRedactionChangLogTextApp.csproj", "{1B963B5A-DCF0-4900-A1A0-6FB452562394}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1B963B5A-DCF0-4900-A1A0-6FB452562394}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1B963B5A-DCF0-4900-A1A0-6FB452562394}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1B963B5A-DCF0-4900-A1A0-6FB452562394}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1B963B5A-DCF0-4900-A1A0-6FB452562394}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EBA2B8CA-432A-44D2-97F7-A0C051C55023} + EndGlobalSection +EndGlobal diff --git a/app_cs/ConsoleRedactionChangLogTextApp/Program.cs b/app_cs/ConsoleRedactionChangLogTextApp/Program.cs new file mode 100644 index 0000000..fe05f5f --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/Program.cs @@ -0,0 +1,84 @@ +using System.ComponentModel; + +namespace ConsoleRedactionChangLogTextApp +{ + internal class Program + { + + static void F() + { + Console.Write("Введите ваш никнейм: "); + var Name = Console.ReadLine(); + Console.WriteLine("Введите ваши изменения: "); + Console.WriteLine("Введите ваши изменения (для завершения ввода нажмите Enter дважды): "); + List lines = new List(); // Используем List для динамического добавления строк + + while (true) + { + string line = Console.ReadLine(); // Считываем введенную строку + if (string.IsNullOrEmpty(line)) // Если строка пустая, завершаем ввод + break; + lines.Add(line); // Добавляем строку в список + } + + string[] arr_str = lines.ToArray(); // Преобразуем список в массив + + // Получаем текущее время в UTC + DateTime timeUtc = DateTime.UtcNow; + + // Преобразуем время в часовой пояс UTC+3 + DateTime timeUtc3 = timeUtc.AddHours(3); + + + while (true) + { + Console.WriteLine($"- author: {Name}\n changes:"); + foreach( string line in arr_str ) + { + Console.WriteLine($" - {{ message: \"{line}\", type: Add}}"); + } + Console.WriteLine($" id: 55710"); + Console.WriteLine($" time: '{timeUtc3.ToString("yyyy-MM-ddTHH:mm:ss.fffffffK")}'"); + break; + } + + } + + static void Main(string[] args) + { + Console.Title = "Changelog"; + var fl = true; + + do + { + Console.Write("Введите 1 для начала программы или 0, чтобы выйти из неё: "); + var number = Console.ReadLine(); + + switch (number) + { + case "1": + F(); + Console.WriteLine(); + break; + case "2": + Console.WriteLine("case 3"); + break; + case "3": + Console.WriteLine("case 5"); + break; + case "0": + fl = false; + break; + default: + Console.WriteLine("default"); + break; + } + + } while (fl); + + + + Console.ReadKey(); + } + } +} diff --git a/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.deps.json b/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.deps.json new file mode 100644 index 0000000..b49a80a --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v8.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v8.0": { + "ConsoleRedactionChangLogTextApp/1.0.0": { + "runtime": { + "ConsoleRedactionChangLogTextApp.dll": {} + } + } + } + }, + "libraries": { + "ConsoleRedactionChangLogTextApp/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.dll b/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.dll new file mode 100644 index 0000000..becef08 Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.dll differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.exe b/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.exe new file mode 100644 index 0000000..6e7bb43 Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.exe differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.pdb b/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.pdb new file mode 100644 index 0000000..2b3fafc Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.pdb differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.runtimeconfig.json b/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.runtimeconfig.json new file mode 100644 index 0000000..1de3a5d --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/bin/Debug/net8.0/ConsoleRedactionChangLogTextApp.runtimeconfig.json @@ -0,0 +1,12 @@ +{ + "runtimeOptions": { + "tfm": "net8.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "8.0.0" + }, + "configProperties": { + "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false + } + } +} \ No newline at end of file diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/ConsoleRedactionChangLogTextApp.csproj.nuget.dgspec.json b/app_cs/ConsoleRedactionChangLogTextApp/obj/ConsoleRedactionChangLogTextApp.csproj.nuget.dgspec.json new file mode 100644 index 0000000..377d378 --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/obj/ConsoleRedactionChangLogTextApp.csproj.nuget.dgspec.json @@ -0,0 +1,63 @@ +{ + "format": 1, + "restore": { + "C:\\Lesson\\app_cs\\ConsoleRedactionChangLogTextApp\\ConsoleRedactionChangLogTextApp.csproj": {} + }, + "projects": { + "C:\\Lesson\\app_cs\\ConsoleRedactionChangLogTextApp\\ConsoleRedactionChangLogTextApp.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Lesson\\app_cs\\ConsoleRedactionChangLogTextApp\\ConsoleRedactionChangLogTextApp.csproj", + "projectName": "ConsoleRedactionChangLogTextApp", + "projectPath": "C:\\Lesson\\app_cs\\ConsoleRedactionChangLogTextApp\\ConsoleRedactionChangLogTextApp.csproj", + "packagesPath": "C:\\Users\\Admin\\.nuget\\packages\\", + "outputPath": "C:\\Lesson\\app_cs\\ConsoleRedactionChangLogTextApp\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Admin\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net8.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/ConsoleRedactionChangLogTextApp.csproj.nuget.g.props b/app_cs/ConsoleRedactionChangLogTextApp/obj/ConsoleRedactionChangLogTextApp.csproj.nuget.g.props new file mode 100644 index 0000000..c1f499a --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/obj/ConsoleRedactionChangLogTextApp.csproj.nuget.g.props @@ -0,0 +1,15 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\Admin\.nuget\packages\ + PackageReference + 6.8.0 + + + + + \ No newline at end of file diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/ConsoleRedactionChangLogTextApp.csproj.nuget.g.targets b/app_cs/ConsoleRedactionChangLogTextApp/obj/ConsoleRedactionChangLogTextApp.csproj.nuget.g.targets new file mode 100644 index 0000000..35a7576 --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/obj/ConsoleRedactionChangLogTextApp.csproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs new file mode 100644 index 0000000..678fc5f --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")] diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.AssemblyInfo.cs b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.AssemblyInfo.cs new file mode 100644 index 0000000..097d2cd --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("ConsoleRedactionChangLogTextApp")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0229ea28f27dae07a23a72e5ab837aad4308359c")] +[assembly: System.Reflection.AssemblyProductAttribute("ConsoleRedactionChangLogTextApp")] +[assembly: System.Reflection.AssemblyTitleAttribute("ConsoleRedactionChangLogTextApp")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Создано классом WriteCodeFragment MSBuild. + diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.AssemblyInfoInputs.cache b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.AssemblyInfoInputs.cache new file mode 100644 index 0000000..ca762c8 --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +5706c4e0f46f4273ef6bab90f19de79ddb17bd2af3a768354fe70c7d4fe5e9ca diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.GeneratedMSBuildEditorConfig.editorconfig b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..da13f60 --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,13 @@ +is_global = true +build_property.TargetFramework = net8.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = ConsoleRedactionChangLogTextApp +build_property.ProjectDir = C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.GlobalUsings.g.cs b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.GlobalUsings.g.cs new file mode 100644 index 0000000..ac22929 --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.GlobalUsings.g.cs @@ -0,0 +1,8 @@ +// +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.assets.cache b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.assets.cache new file mode 100644 index 0000000..74ba9ed Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.assets.cache differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.csproj.BuildWithSkipAnalyzers b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.csproj.BuildWithSkipAnalyzers new file mode 100644 index 0000000..e69de29 diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.csproj.CoreCompileInputs.cache b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..bc81f0d --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +87d2e0e0ff9a256d0f6f9b7a6ac862e88f63a293cd7958b0670520ec1e25b32c diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.csproj.FileListAbsolute.txt b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..6d88091 --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.csproj.FileListAbsolute.txt @@ -0,0 +1,15 @@ +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\obj\Debug\net8.0\ConsoleRedactionChangLogTextApp.GeneratedMSBuildEditorConfig.editorconfig +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\obj\Debug\net8.0\ConsoleRedactionChangLogTextApp.AssemblyInfoInputs.cache +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\obj\Debug\net8.0\ConsoleRedactionChangLogTextApp.AssemblyInfo.cs +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\obj\Debug\net8.0\ConsoleRedactionChangLogTextApp.csproj.CoreCompileInputs.cache +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\obj\Debug\net8.0\ConsoleRedactionChangLogTextApp.sourcelink.json +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\bin\Debug\net8.0\ConsoleRedactionChangLogTextApp.exe +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\bin\Debug\net8.0\ConsoleRedactionChangLogTextApp.deps.json +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\bin\Debug\net8.0\ConsoleRedactionChangLogTextApp.runtimeconfig.json +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\bin\Debug\net8.0\ConsoleRedactionChangLogTextApp.dll +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\bin\Debug\net8.0\ConsoleRedactionChangLogTextApp.pdb +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\obj\Debug\net8.0\ConsoleRedactionChangLogTextApp.dll +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\obj\Debug\net8.0\refint\ConsoleRedactionChangLogTextApp.dll +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\obj\Debug\net8.0\ConsoleRedactionChangLogTextApp.pdb +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\obj\Debug\net8.0\ConsoleRedactionChangLogTextApp.genruntimeconfig.cache +C:\Lesson\app_cs\ConsoleRedactionChangLogTextApp\obj\Debug\net8.0\ref\ConsoleRedactionChangLogTextApp.dll diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.dll b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.dll new file mode 100644 index 0000000..becef08 Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.dll differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.genruntimeconfig.cache b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.genruntimeconfig.cache new file mode 100644 index 0000000..85472ea --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.genruntimeconfig.cache @@ -0,0 +1 @@ +3bf3804b5a45839f3bb4b2bdc0a7a0cb84e0e01ba5421892884d945293bec0f6 diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.pdb b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.pdb new file mode 100644 index 0000000..2b3fafc Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.pdb differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.sourcelink.json b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.sourcelink.json new file mode 100644 index 0000000..abbcf2c --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ConsoleRedactionChangLogTextApp.sourcelink.json @@ -0,0 +1 @@ +{"documents":{"C:\\Lesson\\*":"https://raw.githubusercontent.com/Schrodinger71/Lesson/0229ea28f27dae07a23a72e5ab837aad4308359c/*"}} \ No newline at end of file diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/apphost.exe b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/apphost.exe new file mode 100644 index 0000000..6e7bb43 Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/apphost.exe differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ref/ConsoleRedactionChangLogTextApp.dll b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ref/ConsoleRedactionChangLogTextApp.dll new file mode 100644 index 0000000..0f147ec Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/ref/ConsoleRedactionChangLogTextApp.dll differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/refint/ConsoleRedactionChangLogTextApp.dll b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/refint/ConsoleRedactionChangLogTextApp.dll new file mode 100644 index 0000000..0f147ec Binary files /dev/null and b/app_cs/ConsoleRedactionChangLogTextApp/obj/Debug/net8.0/refint/ConsoleRedactionChangLogTextApp.dll differ diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/project.assets.json b/app_cs/ConsoleRedactionChangLogTextApp/obj/project.assets.json new file mode 100644 index 0000000..1753bf5 --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/obj/project.assets.json @@ -0,0 +1,68 @@ +{ + "version": 3, + "targets": { + "net8.0": {} + }, + "libraries": {}, + "projectFileDependencyGroups": { + "net8.0": [] + }, + "packageFolders": { + "C:\\Users\\Admin\\.nuget\\packages\\": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Lesson\\app_cs\\ConsoleRedactionChangLogTextApp\\ConsoleRedactionChangLogTextApp.csproj", + "projectName": "ConsoleRedactionChangLogTextApp", + "projectPath": "C:\\Lesson\\app_cs\\ConsoleRedactionChangLogTextApp\\ConsoleRedactionChangLogTextApp.csproj", + "packagesPath": "C:\\Users\\Admin\\.nuget\\packages\\", + "outputPath": "C:\\Lesson\\app_cs\\ConsoleRedactionChangLogTextApp\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Admin\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net8.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/app_cs/ConsoleRedactionChangLogTextApp/obj/project.nuget.cache b/app_cs/ConsoleRedactionChangLogTextApp/obj/project.nuget.cache new file mode 100644 index 0000000..d9071c0 --- /dev/null +++ b/app_cs/ConsoleRedactionChangLogTextApp/obj/project.nuget.cache @@ -0,0 +1,8 @@ +{ + "version": 2, + "dgSpecHash": "99nHq5gDjB4kWz6bhcePbF/DpZBS/sO9UdTJqJUQtqAVuVct0F0YjtZ5ApYEISmP+87B+98M8KBg0nJqEOZvPg==", + "success": true, + "projectFilePath": "C:\\Lesson\\app_cs\\ConsoleRedactionChangLogTextApp\\ConsoleRedactionChangLogTextApp.csproj", + "expectedPackageFiles": [], + "logs": [] +} \ No newline at end of file diff --git a/app_py/Python-Snake-Game b/app_py/Python-Snake-Game new file mode 160000 index 0000000..813685b --- /dev/null +++ b/app_py/Python-Snake-Game @@ -0,0 +1 @@ +Subproject commit 813685b69e44c8d68ded7543e3e8af1e874b5b03 diff --git a/app_py/SnakeGame/main.py b/app_py/SnakeGame/main.py new file mode 100644 index 0000000..06db5a8 --- /dev/null +++ b/app_py/SnakeGame/main.py @@ -0,0 +1,127 @@ +import pygame +import time +import random + +pygame.init() + +white = (255, 255, 255) +yellow = (255, 255, 102) +black = (0, 0, 0) +red = (213, 50, 80) +green = (0, 255, 0) +blue = (50, 153, 213) + +dis_width = 600 +dis_height = 400 + +dis = pygame.display.set_mode((dis_width, dis_height)) +pygame.display.set_caption('Snake Game by Pythonist') + +clock = pygame.time.Clock() + +snake_block = 10 +snake_speed = 5 + +font_style = pygame.font.SysFont("bahnschrift", 25) +score_font = pygame.font.SysFont("comicsansms", 35) + + +def Your_score(score): + value = score_font.render("Your Score: " + str(score), True, yellow) + dis.blit(value, [0, 0]) + + + +def our_snake(snake_block, snake_list): + for x in snake_list: + pygame.draw.rect(dis, black, [x[0], x[1], snake_block, snake_block]) + + +def message(msg, color): + mesg = font_style.render(msg, True, color) + dis.blit(mesg, [dis_width / 6, dis_height / 3]) + + +def gameLoop(): + game_over = False + game_close = False + + x1 = dis_width / 2 + y1 = dis_height / 2 + + x1_change = 0 + y1_change = 0 + + snake_List = [] + Length_of_snake = 1 + + foodx = round(random.randrange(0, dis_width - snake_block) / 10.0) * 10.0 + foody = round(random.randrange(0, dis_height - snake_block) / 10.0) * 10.0 + + while not game_over: + + while game_close == True: + dis.fill(blue) + message("You Lost! Press C-Play Again or Q-Quit", red) + Your_score(Length_of_snake - 1) + pygame.display.update() + + for event in pygame.event.get(): + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_q: + game_over = True + game_close = False + if event.key == pygame.K_c: + gameLoop() + + for event in pygame.event.get(): + if event.type == pygame.QUIT: + game_over = True + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_LEFT: + x1_change = -snake_block + y1_change = 0 + elif event.key == pygame.K_RIGHT: + x1_change = snake_block + y1_change = 0 + elif event.key == pygame.K_UP: + y1_change = -snake_block + x1_change = 0 + elif event.key == pygame.K_DOWN: + y1_change = snake_block + x1_change = 0 + + if x1 >= dis_width or x1 < 0 or y1 >= dis_height or y1 < 0: + game_close = True + x1 += x1_change + y1 += y1_change + dis.fill(blue) + pygame.draw.rect(dis, green, [foodx, foody, snake_block, snake_block]) + snake_Head = [] + snake_Head.append(x1) + snake_Head.append(y1) + snake_List.append(snake_Head) + if len(snake_List) > Length_of_snake: + del snake_List[0] + + for x in snake_List[:-1]: + if x == snake_Head: + game_close = True + + our_snake(snake_block, snake_List) + Your_score(Length_of_snake - 1) + + pygame.display.update() + + if x1 == foodx and y1 == foody: + foodx = round(random.randrange(0, dis_width - snake_block) / 10.0) * 10.0 + foody = round(random.randrange(0, dis_height - snake_block) / 10.0) * 10.0 + Length_of_snake += 1 + + clock.tick(snake_speed) + + pygame.quit() + quit() + + +gameLoop() diff --git a/app_py/SnakeGame/requirements.txt b/app_py/SnakeGame/requirements.txt new file mode 100644 index 0000000..5d32ad9 --- /dev/null +++ b/app_py/SnakeGame/requirements.txt @@ -0,0 +1,3 @@ +pygame + +pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org \ No newline at end of file diff --git a/app_py/test.py b/app_py/test.py index c0ae62c..facd43d 100644 --- a/app_py/test.py +++ b/app_py/test.py @@ -1 +1,2 @@ -#test \ No newline at end of file +#test +print("Hello World!") \ No newline at end of file diff --git a/other/ClassLibraryGameEngineLife/.vs/ClassLibraryGameEngineLife/DesignTimeBuild/.dtbcache.v2 b/other/ClassLibraryGameEngineLife/.vs/ClassLibraryGameEngineLife/DesignTimeBuild/.dtbcache.v2 new file mode 100644 index 0000000..19d372c Binary files /dev/null and b/other/ClassLibraryGameEngineLife/.vs/ClassLibraryGameEngineLife/DesignTimeBuild/.dtbcache.v2 differ diff --git a/other/ClassLibraryGameEngineLife/.vs/ClassLibraryGameEngineLife/FileContentIndex/c4afc3fd-c385-493c-97c1-5d0153b4dfed.vsidx b/other/ClassLibraryGameEngineLife/.vs/ClassLibraryGameEngineLife/FileContentIndex/c4afc3fd-c385-493c-97c1-5d0153b4dfed.vsidx new file mode 100644 index 0000000..9e27871 Binary files /dev/null and b/other/ClassLibraryGameEngineLife/.vs/ClassLibraryGameEngineLife/FileContentIndex/c4afc3fd-c385-493c-97c1-5d0153b4dfed.vsidx differ diff --git a/other/ClassLibraryGameEngineLife/.vs/ClassLibraryGameEngineLife/v17/.futdcache.v2 b/other/ClassLibraryGameEngineLife/.vs/ClassLibraryGameEngineLife/v17/.futdcache.v2 new file mode 100644 index 0000000..6ddf2af Binary files /dev/null and b/other/ClassLibraryGameEngineLife/.vs/ClassLibraryGameEngineLife/v17/.futdcache.v2 differ diff --git a/other/ClassLibraryGameEngineLife/.vs/ClassLibraryGameEngineLife/v17/.suo b/other/ClassLibraryGameEngineLife/.vs/ClassLibraryGameEngineLife/v17/.suo new file mode 100644 index 0000000..268fd0e Binary files /dev/null and b/other/ClassLibraryGameEngineLife/.vs/ClassLibraryGameEngineLife/v17/.suo differ diff --git a/other/ClassLibraryGameEngineLife/.vs/ProjectEvaluation/classlibrarygameenginelife.metadata.v7.bin b/other/ClassLibraryGameEngineLife/.vs/ProjectEvaluation/classlibrarygameenginelife.metadata.v7.bin new file mode 100644 index 0000000..5cb10fc Binary files /dev/null and b/other/ClassLibraryGameEngineLife/.vs/ProjectEvaluation/classlibrarygameenginelife.metadata.v7.bin differ diff --git a/other/ClassLibraryGameEngineLife/.vs/ProjectEvaluation/classlibrarygameenginelife.projects.v7.bin b/other/ClassLibraryGameEngineLife/.vs/ProjectEvaluation/classlibrarygameenginelife.projects.v7.bin new file mode 100644 index 0000000..e067b08 Binary files /dev/null and b/other/ClassLibraryGameEngineLife/.vs/ProjectEvaluation/classlibrarygameenginelife.projects.v7.bin differ diff --git a/other/ClassLibraryGameEngineLife/Class1.cs b/other/ClassLibraryGameEngineLife/Class1.cs new file mode 100644 index 0000000..828f1e9 --- /dev/null +++ b/other/ClassLibraryGameEngineLife/Class1.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; + +namespace GameLifeEngine +{ + public class GameLifeEngine + { + public uint currentGeneration { get; private set; } + //private int currentGeneration = 0; + private bool[,] field; + private readonly int rows; + private readonly int cols; + + + + public GameLifeEngine(int rows, int cols, int density) + { + + this.rows = rows; + this.cols = cols; + field = new bool[cols, rows]; + + Random random = new Random(); + for (int x = 0; x < cols; x++) + { + for (int y = 0; y < rows; y++) + { + field[x, y] = random.Next(density) == 0; + } + } + + } + + public void NextGeneration() + { + //graphics.Clear(Color.Black); + + var newField = new bool[cols, rows]; + + for (int x = 0; x < cols; x++) + { + for (int y = 0; y < rows; y++) + { + var neighboursCount = CountNeigbours(x, y); + var hasLife = field[x, y]; + + if (!hasLife && neighboursCount == 3) + newField[x, y] = true; + else if (hasLife && (neighboursCount < 2 || neighboursCount > 3)) + newField[x, y] = false; + else + newField[x, y] = field[x, y]; + + + //if (hasLife) + //graphics.FillRectangle(Brushes.Crimson, x * resolution, y * resolution, resolution - 1, resolution - 1); + + } + } + field = newField; + currentGeneration++; + //pictureBox1.Refresh(); + //textBoxGeneration.Text = $"{++currentGeneration}"; + } + + public bool[,] GetCurrentGeneration() + { + var result = new bool[cols, rows]; + + for (int x = 0; x < cols; x++) + { + for (int y = 0; y < rows; y++) + { + result[x, y] = field[x, y]; + } + } + return field; + } + + private int CountNeigbours(int x, int y) + { + + int count = 0; + + for (int i = -1; i < 2; i++) + { + for (int j = -1; j < 2; j++) + { + var col = (x + i + cols) % cols; + var row = (y + j + rows) % rows; + + + bool isSelfChecking = col == x && row == y; + var hasLife = field[col, row]; + + + if (hasLife && !isSelfChecking) + count++; + } + } + + return count; + } + + private bool ValidateCellPosition(int x, int y) + { + return x >= 0 && y >= 0 && x < cols && y < rows; + } + + private void UpdateCell(int x, int y, bool state) + { + if (ValidateCellPosition(x, y)) + field[x, y] = state; + + } + + public void AddCell(int x, int y) + { + UpdateCell(x, y, true); + } + + public void RemoveCell(int x, int y) + { + UpdateCell(x, y, false); + } + + } + + +} diff --git a/other/ClassLibraryGameEngineLife/ClassLibraryGameEngineLife.csproj b/other/ClassLibraryGameEngineLife/ClassLibraryGameEngineLife.csproj new file mode 100644 index 0000000..bb23fb7 --- /dev/null +++ b/other/ClassLibraryGameEngineLife/ClassLibraryGameEngineLife.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/other/ClassLibraryGameEngineLife/ClassLibraryGameEngineLife.sln b/other/ClassLibraryGameEngineLife/ClassLibraryGameEngineLife.sln new file mode 100644 index 0000000..b483c0a --- /dev/null +++ b/other/ClassLibraryGameEngineLife/ClassLibraryGameEngineLife.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibraryGameEngineLife", "ClassLibraryGameEngineLife.csproj", "{F1F61CEC-3801-4F84-976C-54C40CF8B67D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F1F61CEC-3801-4F84-976C-54C40CF8B67D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1F61CEC-3801-4F84-976C-54C40CF8B67D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1F61CEC-3801-4F84-976C-54C40CF8B67D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1F61CEC-3801-4F84-976C-54C40CF8B67D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3FA03B7D-597B-4995-9924-4D54C53C02B9} + EndGlobalSection +EndGlobal diff --git a/other/ClassLibraryGameEngineLife/bin/Debug/net8.0/ClassLibraryGameEngineLife.deps.json b/other/ClassLibraryGameEngineLife/bin/Debug/net8.0/ClassLibraryGameEngineLife.deps.json new file mode 100644 index 0000000..4d9e70a --- /dev/null +++ b/other/ClassLibraryGameEngineLife/bin/Debug/net8.0/ClassLibraryGameEngineLife.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v8.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v8.0": { + "ClassLibraryGameEngineLife/1.0.0": { + "runtime": { + "ClassLibraryGameEngineLife.dll": {} + } + } + } + }, + "libraries": { + "ClassLibraryGameEngineLife/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/other/ClassLibraryGameEngineLife/bin/Debug/net8.0/ClassLibraryGameEngineLife.dll b/other/ClassLibraryGameEngineLife/bin/Debug/net8.0/ClassLibraryGameEngineLife.dll new file mode 100644 index 0000000..0ba36e1 Binary files /dev/null and b/other/ClassLibraryGameEngineLife/bin/Debug/net8.0/ClassLibraryGameEngineLife.dll differ diff --git a/other/ClassLibraryGameEngineLife/bin/Debug/net8.0/ClassLibraryGameEngineLife.pdb b/other/ClassLibraryGameEngineLife/bin/Debug/net8.0/ClassLibraryGameEngineLife.pdb new file mode 100644 index 0000000..045805c Binary files /dev/null and b/other/ClassLibraryGameEngineLife/bin/Debug/net8.0/ClassLibraryGameEngineLife.pdb differ diff --git a/other/ClassLibraryGameEngineLife/obj/ClassLibraryGameEngineLife.csproj.nuget.dgspec.json b/other/ClassLibraryGameEngineLife/obj/ClassLibraryGameEngineLife.csproj.nuget.dgspec.json new file mode 100644 index 0000000..91537a4 --- /dev/null +++ b/other/ClassLibraryGameEngineLife/obj/ClassLibraryGameEngineLife.csproj.nuget.dgspec.json @@ -0,0 +1,63 @@ +{ + "format": 1, + "restore": { + "C:\\Lesson\\other\\ClassLibraryGameEngineLife\\ClassLibraryGameEngineLife.csproj": {} + }, + "projects": { + "C:\\Lesson\\other\\ClassLibraryGameEngineLife\\ClassLibraryGameEngineLife.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Lesson\\other\\ClassLibraryGameEngineLife\\ClassLibraryGameEngineLife.csproj", + "projectName": "ClassLibraryGameEngineLife", + "projectPath": "C:\\Lesson\\other\\ClassLibraryGameEngineLife\\ClassLibraryGameEngineLife.csproj", + "packagesPath": "C:\\Users\\Admin\\.nuget\\packages\\", + "outputPath": "C:\\Lesson\\other\\ClassLibraryGameEngineLife\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Admin\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net8.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/other/ClassLibraryGameEngineLife/obj/ClassLibraryGameEngineLife.csproj.nuget.g.props b/other/ClassLibraryGameEngineLife/obj/ClassLibraryGameEngineLife.csproj.nuget.g.props new file mode 100644 index 0000000..c1f499a --- /dev/null +++ b/other/ClassLibraryGameEngineLife/obj/ClassLibraryGameEngineLife.csproj.nuget.g.props @@ -0,0 +1,15 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\Admin\.nuget\packages\ + PackageReference + 6.8.0 + + + + + \ No newline at end of file diff --git a/other/ClassLibraryGameEngineLife/obj/ClassLibraryGameEngineLife.csproj.nuget.g.targets b/other/ClassLibraryGameEngineLife/obj/ClassLibraryGameEngineLife.csproj.nuget.g.targets new file mode 100644 index 0000000..35a7576 --- /dev/null +++ b/other/ClassLibraryGameEngineLife/obj/ClassLibraryGameEngineLife.csproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs new file mode 100644 index 0000000..678fc5f --- /dev/null +++ b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")] diff --git a/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.AssemblyInfo.cs b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.AssemblyInfo.cs new file mode 100644 index 0000000..d10af43 --- /dev/null +++ b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("ClassLibraryGameEngineLife")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0229ea28f27dae07a23a72e5ab837aad4308359c")] +[assembly: System.Reflection.AssemblyProductAttribute("ClassLibraryGameEngineLife")] +[assembly: System.Reflection.AssemblyTitleAttribute("ClassLibraryGameEngineLife")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Создано классом WriteCodeFragment MSBuild. + diff --git a/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.AssemblyInfoInputs.cache b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.AssemblyInfoInputs.cache new file mode 100644 index 0000000..acc25f5 --- /dev/null +++ b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +abae872d5c66697c95de024bd955a70a452743af6725de3045e1473b5dad7eeb diff --git a/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.GeneratedMSBuildEditorConfig.editorconfig b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..8a9f03f --- /dev/null +++ b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,13 @@ +is_global = true +build_property.TargetFramework = net8.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = ClassLibraryGameEngineLife +build_property.ProjectDir = C:\Lesson\other\ClassLibraryGameEngineLife\ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = diff --git a/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.GlobalUsings.g.cs b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.GlobalUsings.g.cs new file mode 100644 index 0000000..ac22929 --- /dev/null +++ b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.GlobalUsings.g.cs @@ -0,0 +1,8 @@ +// +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.assets.cache b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.assets.cache new file mode 100644 index 0000000..827f63b Binary files /dev/null and b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.assets.cache differ diff --git a/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.csproj.CoreCompileInputs.cache b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..12d2edf --- /dev/null +++ b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +07c954332f6294f649e6c6d21b131d782988dd4e9755fe49bbe7ed14c9f72ad7 diff --git a/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.csproj.FileListAbsolute.txt b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..a46d687 --- /dev/null +++ b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.csproj.FileListAbsolute.txt @@ -0,0 +1,12 @@ +C:\Lesson\other\ClassLibraryGameEngineLife\bin\Debug\net8.0\ClassLibraryGameEngineLife.deps.json +C:\Lesson\other\ClassLibraryGameEngineLife\bin\Debug\net8.0\ClassLibraryGameEngineLife.dll +C:\Lesson\other\ClassLibraryGameEngineLife\bin\Debug\net8.0\ClassLibraryGameEngineLife.pdb +C:\Lesson\other\ClassLibraryGameEngineLife\obj\Debug\net8.0\ClassLibraryGameEngineLife.GeneratedMSBuildEditorConfig.editorconfig +C:\Lesson\other\ClassLibraryGameEngineLife\obj\Debug\net8.0\ClassLibraryGameEngineLife.AssemblyInfoInputs.cache +C:\Lesson\other\ClassLibraryGameEngineLife\obj\Debug\net8.0\ClassLibraryGameEngineLife.AssemblyInfo.cs +C:\Lesson\other\ClassLibraryGameEngineLife\obj\Debug\net8.0\ClassLibraryGameEngineLife.csproj.CoreCompileInputs.cache +C:\Lesson\other\ClassLibraryGameEngineLife\obj\Debug\net8.0\ClassLibraryGameEngineLife.sourcelink.json +C:\Lesson\other\ClassLibraryGameEngineLife\obj\Debug\net8.0\ClassLibraryGameEngineLife.dll +C:\Lesson\other\ClassLibraryGameEngineLife\obj\Debug\net8.0\refint\ClassLibraryGameEngineLife.dll +C:\Lesson\other\ClassLibraryGameEngineLife\obj\Debug\net8.0\ClassLibraryGameEngineLife.pdb +C:\Lesson\other\ClassLibraryGameEngineLife\obj\Debug\net8.0\ref\ClassLibraryGameEngineLife.dll diff --git a/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.dll b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.dll new file mode 100644 index 0000000..0ba36e1 Binary files /dev/null and b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.dll differ diff --git a/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.pdb b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.pdb new file mode 100644 index 0000000..045805c Binary files /dev/null and b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.pdb differ diff --git a/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.sourcelink.json b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.sourcelink.json new file mode 100644 index 0000000..abbcf2c --- /dev/null +++ b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ClassLibraryGameEngineLife.sourcelink.json @@ -0,0 +1 @@ +{"documents":{"C:\\Lesson\\*":"https://raw.githubusercontent.com/Schrodinger71/Lesson/0229ea28f27dae07a23a72e5ab837aad4308359c/*"}} \ No newline at end of file diff --git a/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ref/ClassLibraryGameEngineLife.dll b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ref/ClassLibraryGameEngineLife.dll new file mode 100644 index 0000000..e6ba9c4 Binary files /dev/null and b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/ref/ClassLibraryGameEngineLife.dll differ diff --git a/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/refint/ClassLibraryGameEngineLife.dll b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/refint/ClassLibraryGameEngineLife.dll new file mode 100644 index 0000000..e6ba9c4 Binary files /dev/null and b/other/ClassLibraryGameEngineLife/obj/Debug/net8.0/refint/ClassLibraryGameEngineLife.dll differ diff --git a/other/ClassLibraryGameEngineLife/obj/project.assets.json b/other/ClassLibraryGameEngineLife/obj/project.assets.json new file mode 100644 index 0000000..ae3b147 --- /dev/null +++ b/other/ClassLibraryGameEngineLife/obj/project.assets.json @@ -0,0 +1,68 @@ +{ + "version": 3, + "targets": { + "net8.0": {} + }, + "libraries": {}, + "projectFileDependencyGroups": { + "net8.0": [] + }, + "packageFolders": { + "C:\\Users\\Admin\\.nuget\\packages\\": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Lesson\\other\\ClassLibraryGameEngineLife\\ClassLibraryGameEngineLife.csproj", + "projectName": "ClassLibraryGameEngineLife", + "projectPath": "C:\\Lesson\\other\\ClassLibraryGameEngineLife\\ClassLibraryGameEngineLife.csproj", + "packagesPath": "C:\\Users\\Admin\\.nuget\\packages\\", + "outputPath": "C:\\Lesson\\other\\ClassLibraryGameEngineLife\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Admin\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net8.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/other/ClassLibraryGameEngineLife/obj/project.nuget.cache b/other/ClassLibraryGameEngineLife/obj/project.nuget.cache new file mode 100644 index 0000000..44a1eec --- /dev/null +++ b/other/ClassLibraryGameEngineLife/obj/project.nuget.cache @@ -0,0 +1,8 @@ +{ + "version": 2, + "dgSpecHash": "EYSKZxj9QYHw+cyOZz24oGWf1psOG9bFxo3PLLU4EscYw/cyMq8nWLb9jCDFmHeaU1VYvXt/Et3iJF2UKvOCyg==", + "success": true, + "projectFilePath": "C:\\Lesson\\other\\ClassLibraryGameEngineLife\\ClassLibraryGameEngineLife.csproj", + "expectedPackageFiles": [], + "logs": [] +} \ No newline at end of file diff --git a/other/test1.cs b/other/test1.cs new file mode 100644 index 0000000..bb278e3 --- /dev/null +++ b/other/test1.cs @@ -0,0 +1,1294 @@ +// Single-line comments start with // + +/* +Multi-line comments look like this +*/ + +/// +/// This is an XML documentation comment which can be used to generate external +/// documentation or provide context help within an IDE +/// +/// This is some parameter documentation for firstParam +/// Information on the returned value of a function +public void MethodOrClassOrOtherWithParsableHelp(string firstParam) { } + +// Specify the namespaces this source code will be using +// The namespaces below are all part of the standard .NET Framework Class Library +using System; +using System.Collections.Generic; +using System.Dynamic; +using System.Linq; +using System.Net; +using System.Threading.Tasks; +using System.IO; + +// But this one is not: +using System.Data.Entity; +// In order to be able to use it, you need to add a dll reference +// This can be done with the NuGet package manager: `Install-Package EntityFramework` + +// Namespaces define scope to organize code into "packages" or "modules" +// Using this code from another source file: using Learning.CSharp; + +// You can also do this in C# 10, it is called file-scoped namespaces. +// namespace Learning.CSharp; + +namespace Learning.CSharp +{ + // Each .cs file should at least contain a class with the same name as the file. + // You're allowed to do otherwise, but shouldn't for sanity. + public class LearnCSharp + { + // BASIC SYNTAX - skip to INTERESTING FEATURES if you have used Java or C++ before + public static void Syntax() + { + // Use Console.WriteLine to print lines + Console.WriteLine("Hello World"); + Console.WriteLine( + "Integer: " + 10 + + " Double: " + 3.14 + + " Boolean: " + true); + + // To print without a new line, use Console.Write + Console.Write("Hello "); + Console.Write("World"); + + /////////////////////////////////////////////////// + // Types & Variables + // + // Declare a variable using + /////////////////////////////////////////////////// + + // Sbyte - Signed 8-bit integer + // (-128 <= sbyte <= 127) + sbyte fooSbyte = 100; + + // Byte - Unsigned 8-bit integer + // (0 <= byte <= 255) + byte fooByte = 100; + + // Short - 16-bit integer + // Signed - (-32,768 <= short <= 32,767) + // Unsigned - (0 <= ushort <= 65,535) + short fooShort = 10000; + ushort fooUshort = 10000; + + // Integer - 32-bit integer + int fooInt = 1; // (-2,147,483,648 <= int <= 2,147,483,647) + uint fooUint = 1; // (0 <= uint <= 4,294,967,295) + + // Long - 64-bit integer + long fooLong = 100000L; // (-9,223,372,036,854,775,808 <= long <= 9,223,372,036,854,775,807) + ulong fooUlong = 100000L; // (0 <= ulong <= 18,446,744,073,709,551,615) + // Numbers default to being int or uint depending on size. + // L is used to denote that this variable value is of type long or ulong + + // Double - Double-precision 64-bit IEEE 754 Floating Point + double fooDouble = 123.4; // Precision: 15-16 digits + + // Float - Single-precision 32-bit IEEE 754 Floating Point + float fooFloat = 234.5f; // Precision: 7 digits + // f is used to denote that this variable value is of type float + + // Decimal - a 128-bits data type, with more precision than other floating-point types, + // suited for financial and monetary calculations + decimal fooDecimal = 150.3m; + + // Boolean - true & false + bool fooBoolean = true; // or false + + // Char - A single 16-bit Unicode character + char fooChar = 'A'; + + // Strings -- unlike the previous base types which are all value types, + // a string is a reference type. That is, you can set it to null + string fooString = "\"escape\" quotes and add \n (new lines) and \t (tabs)"; + Console.WriteLine(fooString); + + // You can access each character of the string with an indexer: + char charFromString = fooString[1]; // => 'e' + // Strings are immutable: you can't do fooString[1] = 'X'; + + // Compare strings with current culture, ignoring case + string.Compare(fooString, "x", StringComparison.CurrentCultureIgnoreCase); + + // Formatting, based on sprintf + string fooFs = string.Format("Check Check, {0} {1}, {0} {1:0.0}", 1, 2); + + // Dates & Formatting + DateTime fooDate = DateTime.Now; + Console.WriteLine(fooDate.ToString("hh:mm, dd MMM yyyy")); + + // Verbatim String + // You can use the @ symbol before a string literal to escape all characters in the string + string path = "C:\\Users\\User\\Desktop"; + string verbatimPath = @"C:\Users\User\Desktop"; + Console.WriteLine(path == verbatimPath); // => true + + // You can split a string over two lines with the @ symbol. To escape " use "" + string bazString = @"Here's some stuff +on a new line! ""Wow!"", the masses cried"; + + // Use const or read-only to make a variable immutable + // const values are calculated at compile time + const int HoursWorkPerWeek = 9001; + + /////////////////////////////////////////////////// + // Data Structures + /////////////////////////////////////////////////// + + // Arrays - zero indexed + // The array size must be decided upon declaration + // The format for declaring an array is + // [] = new []; + int[] intArray = new int[10]; + + // Another way to declare & initialize an array + int[] y = { 9000, 1000, 1337 }; + + // Indexing an array - Accessing an element + Console.WriteLine("intArray @ 0: " + intArray[0]); + // Arrays are mutable. + intArray[1] = 1; + + // Lists + // Lists are used more frequently than arrays as they are more flexible + // The format for declaring a list is + // List = new List(); + List intList = new List(); + List stringList = new List(); + List z = new List { 9000, 1000, 1337 }; // initialize + // The <> are for generics - Check out the cool stuff section + + // Lists don't default to a value; + // A value must be added before accessing the index + intList.Add(1); + Console.WriteLine("intList at 0: " + intList[0]); + + // Other data structures to check out: + // Stack/Queue + // Dictionary (an implementation of a hash map) + // HashSet + // Read-only Collections + // Tuple (.NET 4+) + + /////////////////////////////////////// + // Operators + /////////////////////////////////////// + Console.WriteLine("\n->Operators"); + + int i1 = 1, i2 = 2; // Shorthand for multiple declarations + + // Arithmetic is straightforward + Console.WriteLine(i1 + i2 - i1 * 3 / 7); // => 3 + + // Modulo + Console.WriteLine("11%3 = " + (11 % 3)); // => 2 + + // Comparison operators + Console.WriteLine("3 == 2? " + (3 == 2)); // => false + Console.WriteLine("3 != 2? " + (3 != 2)); // => true + Console.WriteLine("3 > 2? " + (3 > 2)); // => true + Console.WriteLine("3 < 2? " + (3 < 2)); // => false + Console.WriteLine("2 <= 2? " + (2 <= 2)); // => true + Console.WriteLine("2 >= 2? " + (2 >= 2)); // => true + + // Bitwise operators! + /* + ~ Unary bitwise complement + << Signed left shift + >> Signed right shift + & Bitwise AND + ^ Bitwise exclusive OR + | Bitwise inclusive OR + */ + + // Incrementing + int i = 0; + Console.WriteLine("\n->Inc/Dec-rement"); + Console.WriteLine(i++); //Prints "0", i = 1. Post-Increment + Console.WriteLine(++i); //Prints "2", i = 2. Pre-Increment + Console.WriteLine(i--); //Prints "2", i = 1. Post-Decrement + Console.WriteLine(--i); //Prints "0", i = 0. Pre-Decrement + + /////////////////////////////////////// + // Control Structures + /////////////////////////////////////// + Console.WriteLine("\n->Control Structures"); + + // If statements are C-like + int j = 10; + if (j == 10) + { + Console.WriteLine("I get printed"); + } + else if (j > 10) + { + Console.WriteLine("I don't"); + } + else + { + Console.WriteLine("I also don't"); + } + + // Ternary operators + // A simple if/else can be written as follows + // ? : + int toCompare = 17; + string isTrue = toCompare == 17 ? "True" : "False"; + + // While loop + int fooWhile = 0; + while (fooWhile < 100) + { + // Iterated 100 times, fooWhile 0->99 + fooWhile++; + } + + // Do While Loop + int fooDoWhile = 0; + do + { + // Start iteration 100 times, fooDoWhile 0->99 + if (false) + continue; // skip the current iteration + + fooDoWhile++; + + if (fooDoWhile == 50) + break; // breaks from the loop completely + + } while (fooDoWhile < 100); + + // for loop structure => for(; ; ) + for (int fooFor = 0; fooFor < 10; fooFor++) + { + // Iterated 10 times, fooFor 0->9 + } + + // For Each Loop + // foreach loop structure => foreach( in ) + // The foreach loop loops over any object implementing IEnumerable or IEnumerable + // All the collection types (Array, List, Dictionary...) in the .NET framework + // implement one or both of these interfaces. + // (The ToCharArray() could be removed, because a string also implements IEnumerable) + foreach (char character in "Hello World".ToCharArray()) + { + // Iterated over all the characters in the string + } + + // Switch Case + // A switch works with byte, short, char, and int data types. + // It also works with enumerated types (discussed in Enum Types), + // the String class, and a few special classes that wrap + // primitive types: Character, Byte, Short, and Integer. + int month = 3; + string monthString; + switch (month) + { + case 1: + monthString = "January"; + break; + case 2: + monthString = "February"; + break; + case 3: + monthString = "March"; + break; + // You can assign more than one case to an action + // But you can't add an action without a break before another case + // (if you want to do this, you would have to explicitly add a goto case x) + case 6: + case 7: + case 8: + monthString = "Summer time!!"; + break; + default: + monthString = "Some other month"; + break; + } + + /////////////////////////////////////// + // Converting Data Types And Typecasting + /////////////////////////////////////// + + // Converting data + + // Convert String To Integer + // this will throw a FormatException on failure + int.Parse("123"); // returns an integer version of "123" + + // TryParse will default to the type's default value on failure + // in this case 0 + int tryInt; + if (int.TryParse("123", out tryInt)) // Function is boolean + Console.WriteLine(tryInt); // 123 + + // Convert Integer To String + // The Convert class has a number of methods to facilitate conversions + + // String to int + + // Better + bool result = int.TryParse(string, out var integer) + int.Parse(string); + + // Not recommended + Convert.ToString(123); + + // Int to string + tryInt.ToString(); + + // Casting + // Cast decimal 15 to an int + // and then implicitly cast to long + long x = (int) 15M; + } + + /////////////////////////////////////// + // CLASSES - see definitions at end of file + /////////////////////////////////////// + public static void Classes() + { + // See Declaration of objects at end of file + + // Use new to instantiate a class + Bicycle trek = new Bicycle(); + + // Call object methods + trek.SpeedUp(3); // You should always use setter and getter methods + trek.Cadence = 100; + + // ToString is a convention to display the value of this Object. + Console.WriteLine("trek info: " + trek.Info()); + + // Instantiate a new Penny Farthing + PennyFarthing funbike = new PennyFarthing(1, 10); + Console.WriteLine("funbike info: " + funbike.Info()); + + Console.Read(); + } // End main method + + // Available in C# 9 and later, this is basically syntactic sugar for a class. Records are immutable*. + public record ARecord(string Csharp); + + // CONSOLE ENTRY - A console application must have a main method as an entry point + public static void Main(string[] args) + { + OtherInterestingFeatures(); + } + + // + // INTERESTING FEATURES + // + + // DEFAULT METHOD SIGNATURES + + public // Visibility + static // Allows for direct call on class without object + int // Return Type, + MethodSignatures( + int maxCount, // First variable, expects an int + int count = 0, // will default the value to 0 if not passed in + int another = 3, + params string[] otherParams // captures all other parameters passed to method + ) + { + return -1; + } + + // Methods can have the same name, as long as the signature is unique + // A method that differs only in return type is not unique + public static void MethodSignatures( + ref int maxCount, // Pass by reference + out int count) + { + // the argument passed in as 'count' will hold the value of 15 outside of this function + count = 15; // out param must be assigned before control leaves the method + } + + // GENERICS + // The classes for TKey and TValue is specified by the user calling this function. + // This method emulates Python's dict.setdefault() + public static TValue SetDefault( + IDictionary dictionary, + TKey key, + TValue defaultItem) + { + TValue result; + if (!dictionary.TryGetValue(key, out result)) + return dictionary[key] = defaultItem; + return result; + } + + // You can narrow down the objects that are passed in + public static void IterateAndPrint(T toPrint) where T: IEnumerable + { + // We can iterate, since T is a IEnumerable + foreach (var item in toPrint) + // Item is an int + Console.WriteLine(item.ToString()); + } + + // YIELD + // Usage of the "yield" keyword indicates that the method it appears in is an Iterator + // (this means you can use it in a foreach loop) + public static IEnumerable YieldCounter(int limit = 10) + { + for (var i = 0; i < limit; i++) + yield return i; + } + + // which you would call like this : + public static void PrintYieldCounterToConsole() + { + foreach (var counter in YieldCounter()) + Console.WriteLine(counter); + } + + // you can use more than one "yield return" in a method + public static IEnumerable ManyYieldCounter() + { + yield return 0; + yield return 1; + yield return 2; + yield return 3; + } + + // you can also use "yield break" to stop the Iterator + // this method would only return half of the values from 0 to limit. + public static IEnumerable YieldCounterWithBreak(int limit = 10) + { + for (var i = 0; i < limit; i++) + { + if (i > limit/2) yield break; + yield return i; + } + } + + public static void OtherInterestingFeatures() + { + // OPTIONAL PARAMETERS + MethodSignatures(3, 1, 3, "Some", "Extra", "Strings"); + MethodSignatures(3, another: 3); // explicitly set a parameter, skipping optional ones + + // BY REF AND OUT PARAMETERS + int maxCount = 0, count; // ref params must have value + MethodSignatures(ref maxCount, out count); + + // EXTENSION METHODS + int i = 3; + i.Print(); // Defined below + + // NULLABLE TYPES - great for database interaction / return values + // any value type (i.e. not a class) can be made nullable by suffixing a ? + // ? = + int? nullable = null; // short hand for Nullable + Console.WriteLine("Nullable variable: " + nullable); + bool hasValue = nullable.HasValue; // true if not null + + // ?? is syntactic sugar for specifying default value (coalesce) + // in case variable is null + int notNullable = nullable ?? 0; // 0 + + // ?. is an operator for null-propagation - a shorthand way of checking for null + nullable?.Print(); // Use the Print() extension method if nullable isn't null + + // IMPLICITLY TYPED VARIABLES - you can let the compiler work out what the type is: + var magic = "magic is a string, at compile time, so you still get type safety"; + // magic = 9; will not work as magic is a string, not an int + + // GENERICS + // + var phonebook = new Dictionary() { + {"Sarah", "212 555 5555"} // Add some entries to the phone book + }; + + // Calling SETDEFAULT defined as a generic above + Console.WriteLine(SetDefault(phonebook, "Shaun", "No Phone")); // No Phone + // nb, you don't need to specify the TKey and TValue since they can be + // derived implicitly + Console.WriteLine(SetDefault(phonebook, "Sarah", "No Phone")); // 212 555 5555 + + // LAMBDA EXPRESSIONS - allow you to write code in line + Func square = (x) => x * x; // Last T item is the return value + Console.WriteLine(square(3)); // 9 + + // ERROR HANDLING - coping with an uncertain world + try + { + var funBike = PennyFarthing.CreateWithGears(6); + + // will no longer execute because CreateWithGears throws an exception + string some = ""; + if (true) some = null; + some.ToLower(); // throws a NullReferenceException + } + catch (NotSupportedException) + { + Console.WriteLine("Not so much fun now!"); + } + catch (Exception ex) // catch all other exceptions + { + throw new ApplicationException("It hit the fan", ex); + // throw; // A rethrow that preserves the callstack + } + // catch { } // catch-all without capturing the Exception + finally + { + // executes after try or catch + } + + // DISPOSABLE RESOURCES MANAGEMENT - let you handle unmanaged resources easily. + // Most of objects that access unmanaged resources (file handle, device contexts, etc.) + // implement the IDisposable interface. The using statement takes care of + // cleaning those IDisposable objects for you. + using (StreamWriter writer = new StreamWriter("log.txt")) + { + writer.WriteLine("Nothing suspicious here"); + // At the end of scope, resources will be released. + // Even if an exception is thrown. + } + + // PARALLEL FRAMEWORK + // https://devblogs.microsoft.com/csharpfaq/parallel-programming-in-net-framework-4-getting-started/ + + var words = new List {"dog", "cat", "horse", "pony"}; + + Parallel.ForEach(words, + new ParallelOptions() { MaxDegreeOfParallelism = 4 }, + word => + { + Console.WriteLine(word); + } + ); + + // Running this will produce different outputs + // since each thread finishes at different times. + // Some example outputs are: + // cat dog horse pony + // dog horse pony cat + + // DYNAMIC OBJECTS (great for working with other languages) + dynamic student = new ExpandoObject(); + student.FirstName = "First Name"; // No need to define class first! + + // You can even add methods (returns a string, and takes in a string) + student.Introduce = new Func( + (introduceTo) => string.Format("Hey {0}, this is {1}", student.FirstName, introduceTo)); + Console.WriteLine(student.Introduce("Beth")); + + // IQUERYABLE - almost all collections implement this, which gives you a lot of + // very useful Map / Filter / Reduce style methods + var bikes = new List(); + bikes.Sort(); // Sorts the array + bikes.Sort((b1, b2) => b1.Wheels.CompareTo(b2.Wheels)); // Sorts based on wheels + var result = bikes + .Where(b => b.Wheels > 3) // Filters - chainable (returns IQueryable of previous type) + .Where(b => b.IsBroken && b.HasTassles) + .Select(b => b.ToString()); // Map - we only this selects, so result is a IQueryable + + var sum = bikes.Sum(b => b.Wheels); // Reduce - sums all the wheels in the collection + + // Create a list of IMPLICIT objects based on some parameters of the bike + var bikeSummaries = bikes.Select(b=>new { Name = b.Name, IsAwesome = !b.IsBroken && b.HasTassles }); + // Hard to show here, but you get type ahead completion since the compiler can implicitly work + // out the types above! + foreach (var bikeSummary in bikeSummaries.Where(b => b.IsAwesome)) + Console.WriteLine(bikeSummary.Name); + + // ASPARALLEL + // And this is where things get wicked - combine linq and parallel operations + var threeWheelers = bikes.AsParallel().Where(b => b.Wheels == 3).Select(b => b.Name); + // this will happen in parallel! Threads will automagically be spun up and the + // results divvied amongst them! Amazing for large datasets when you have lots of + // cores + + // LINQ - maps a store to IQueryable objects, with delayed execution + // e.g. LinqToSql - maps to a database, LinqToXml maps to an xml document + var db = new BikeRepository(); + + // execution is delayed, which is great when querying a database + var filter = db.Bikes.Where(b => b.HasTassles); // no query run + if (42 > 6) // You can keep adding filters, even conditionally - great for "advanced search" functionality + filter = filter.Where(b => b.IsBroken); // no query run + + var query = filter + .OrderBy(b => b.Wheels) + .ThenBy(b => b.Name) + .Select(b => b.Name); // still no query run + + // Now the query runs, but opens a reader, so only populates as you iterate through + foreach (string bike in query) + Console.WriteLine(result); + + + + } + + } // End LearnCSharp class + + // You can include other classes in a .cs file + + public static class Extensions + { + // EXTENSION METHODS + public static void Print(this object obj) + { + Console.WriteLine(obj.ToString()); + } + } + + + // DELEGATES AND EVENTS + public class DelegateTest + { + public static int count = 0; + public static int Increment() + { + // increment count then return it + return ++count; + } + + // A delegate is a reference to a method. + // To reference the Increment method, + // first declare a delegate with the same signature, + // i.e. takes no arguments and returns an int + public delegate int IncrementDelegate(); + + // An event can also be used to trigger delegates + // Create an event with the delegate type + public static event IncrementDelegate MyEvent; + + static void Main(string[] args) + { + // Refer to the Increment method by instantiating the delegate + // and passing the method itself in as an argument + IncrementDelegate inc = new IncrementDelegate(Increment); + Console.WriteLine(inc()); // => 1 + + // Delegates can be composed with the + operator + IncrementDelegate composedInc = inc; + composedInc += inc; + composedInc += inc; + + // composedInc will run Increment 3 times + Console.WriteLine(composedInc()); // => 4 + + + // Subscribe to the event with the delegate + MyEvent += new IncrementDelegate(Increment); + MyEvent += new IncrementDelegate(Increment); + + // Trigger the event + // ie. run all delegates subscribed to this event + Console.WriteLine(MyEvent()); // => 6 + } + } + + + // Class Declaration Syntax: + // class { + // //data fields, constructors, functions all inside. + // //functions are called as methods in Java. + // } + + public class Bicycle + { + // Bicycle's Fields/Variables + public int Cadence // Public: Can be accessed from anywhere + { + get // get - define a method to retrieve the property + { + return _cadence; + } + set // set - define a method to set a property + { + _cadence = value; // Value is the value passed in to the setter + } + } + private int _cadence; + + protected virtual int Gear // Protected: Accessible from the class and subclasses + { + get; // creates an auto property so you don't need a member field + set; + } + + internal int Wheels // Internal: Accessible from within the assembly + { + get; + private set; // You can set modifiers on the get/set methods + } + + int _speed; // Everything is private by default: Only accessible from within this class. + // can also use keyword private + public string Name { get; set; } + + // Properties also have a special syntax for when you want a readonly property + // that simply returns the result of an expression + public string LongName => Name + " " + _speed + " speed"; + + // Enum is a value type that consists of a set of named constants + // It is really just mapping a name to a value (an int, unless specified otherwise). + // The approved types for an enum are byte, sbyte, short, ushort, int, uint, long, or ulong. + // An enum can't contain the same value twice. + public enum BikeBrand + { + AIST, + BMC, + Electra = 42, //you can explicitly set a value to a name + Gitane // 43 + } + // We defined this type inside a Bicycle class, so it is a nested type + // Code outside of this class should reference this type as Bicycle.BikeBrand + + public BikeBrand Brand; // After declaring an enum type, we can declare the field of this type + + // Decorate an enum with the FlagsAttribute to indicate that multiple values can be switched on + // Any class derived from Attribute can be used to decorate types, methods, parameters etc + // Bitwise operators & and | can be used to perform and/or operations + + [Flags] + public enum BikeAccessories + { + None = 0, + Bell = 1, + MudGuards = 2, // need to set the values manually! + Racks = 4, + Lights = 8, + FullPackage = Bell | MudGuards | Racks | Lights + } + + // Usage: aBike.Accessories.HasFlag(Bicycle.BikeAccessories.Bell) + // Before .NET 4: (aBike.Accessories & Bicycle.BikeAccessories.Bell) == Bicycle.BikeAccessories.Bell + public BikeAccessories Accessories { get; set; } + + // Static members belong to the type itself rather than specific object. + // You can access them without a reference to any object: + // Console.WriteLine("Bicycles created: " + Bicycle.bicyclesCreated); + public static int BicyclesCreated { get; set; } + + // readonly values are set at run time + // they can only be assigned upon declaration or in a constructor + readonly bool _hasCardsInSpokes = false; // read-only private + + // Constructors are a way of creating classes + // This is a default constructor + public Bicycle() + { + this.Gear = 1; // you can access members of the object with the keyword this + Cadence = 50; // but you don't always need it + _speed = 5; + Name = "Bontrager"; + Brand = BikeBrand.AIST; + BicyclesCreated++; + } + + // This is a specified constructor (it contains arguments) + public Bicycle(int startCadence, int startSpeed, int startGear, + string name, bool hasCardsInSpokes, BikeBrand brand) + : base() // calls base first + { + Gear = startGear; + Cadence = startCadence; + _speed = startSpeed; + Name = name; + _hasCardsInSpokes = hasCardsInSpokes; + Brand = brand; + } + + // Constructors can be chained + public Bicycle(int startCadence, int startSpeed, BikeBrand brand) : + this(startCadence, startSpeed, 0, "big wheels", true, brand) + { + } + + // Function Syntax: + // () + + // classes can implement getters and setters for their fields + // or they can implement properties (this is the preferred way in C#) + + // Method parameters can have default values. + // In this case, methods can be called with these parameters omitted + public void SpeedUp(int increment = 1) + { + _speed += increment; + } + + public void SlowDown(int decrement = 1) + { + _speed -= decrement; + } + + // properties get/set values + // when only data needs to be accessed, consider using properties. + // properties may have either get or set, or both + private bool _hasTassles; // private variable + public bool HasTassles // public accessor + { + get { return _hasTassles; } + set { _hasTassles = value; } + } + + // You can also define an automatic property in one line + // this syntax will create a backing field automatically. + // You can set an access modifier on either the getter or the setter (or both) + // to restrict its access: + public bool IsBroken { get; private set; } + + // Properties can be auto-implemented + public int FrameSize + { + get; + // you are able to specify access modifiers for either get or set + // this means only Bicycle class can call set on Framesize + private set; + } + + // It's also possible to define custom Indexers on objects. + // All though this is not entirely useful in this example, you + // could do bicycle[0] which returns "chris" to get the first passenger or + // bicycle[1] = "lisa" to set the passenger. (of this apparent quattrocycle) + private string[] passengers = { "chris", "phil", "darren", "regina" }; + + public string this[int i] + { + get { + return passengers[i]; + } + + set { + passengers[i] = value; + } + } + + // Method to display the attribute values of this Object. + public virtual string Info() + { + return "Gear: " + Gear + + " Cadence: " + Cadence + + " Speed: " + _speed + + " Name: " + Name + + " Cards in Spokes: " + (_hasCardsInSpokes ? "yes" : "no") + + "\n------------------------------\n" + ; + } + + // Methods can also be static. It can be useful for helper methods + public static bool DidWeCreateEnoughBicycles() + { + // Within a static method, we only can reference static class members + return BicyclesCreated > 9000; + } // If your class only needs static members, consider marking the class itself as static. + + + } // end class Bicycle + + // PennyFarthing is a subclass of Bicycle + class PennyFarthing : Bicycle + { + // (Penny Farthings are those bicycles with the big front wheel. + // They have no gears.) + + // calling parent constructor + public PennyFarthing(int startCadence, int startSpeed) : + base(startCadence, startSpeed, 0, "PennyFarthing", true, BikeBrand.Electra) + { + } + + protected override int Gear + { + get + { + return 0; + } + set + { + throw new InvalidOperationException("You can't change gears on a PennyFarthing"); + } + } + + public static PennyFarthing CreateWithGears(int gears) + { + var penny = new PennyFarthing(1, 1); + penny.Gear = gears; // Oops, can't do this! + return penny; + } + + public override string Info() + { + string result = "PennyFarthing bicycle "; + result += base.ToString(); // Calling the base version of the method + return result; + } + } + + // Interfaces only contain signatures of the members, without the implementation. + interface IJumpable + { + void Jump(int meters); // all interface members are implicitly public + } + + interface IBreakable + { + bool Broken { get; } // interfaces can contain properties as well as methods & events + } + + // Classes can inherit only one other class, but can implement any amount of interfaces, + // however the base class name must be the first in the list and all interfaces follow + class MountainBike : Bicycle, IJumpable, IBreakable + { + int damage = 0; + + public void Jump(int meters) + { + damage += meters; + } + + public bool Broken + { + get + { + return damage > 100; + } + } + } + + /// + /// Used to connect to DB for LinqToSql example. + /// EntityFramework Code First is awesome (similar to Ruby's ActiveRecord, but bidirectional) + /// https://docs.microsoft.com/ef/ef6/modeling/code-first/workflows/new-database + /// + public class BikeRepository : DbContext + { + public BikeRepository() + : base() + { + } + + public DbSet Bikes { get; set; } + } + + // Classes can be split across multiple .cs files + // A1.cs + public partial class A + { + public static void A1() + { + Console.WriteLine("Method A1 in class A"); + } + } + + // A2.cs + public partial class A + { + public static void A2() + { + Console.WriteLine("Method A2 in class A"); + } + } + + // Program using the partial class "A" + public class Program + { + static void Main() + { + A.A1(); + A.A2(); + } + } + + // String interpolation by prefixing the string with $ + // and wrapping the expression you want to interpolate with { braces } + // You can also combine both interpolated and verbatim strings with $@ + public class Rectangle + { + public int Length { get; set; } + public int Width { get; set; } + } + + class Program + { + static void Main(string[] args) + { + Rectangle rect = new Rectangle { Length = 5, Width = 3 }; + Console.WriteLine($"The length is {rect.Length} and the width is {rect.Width}"); + + string username = "User"; + Console.WriteLine($@"C:\Users\{username}\Desktop"); + } + } + + // New C# 6 features + class GlassBall : IJumpable, IBreakable + { + // Autoproperty initializers + public int Damage { get; private set; } = 0; + + // Autoproperty initializers on getter-only properties + public string Name { get; } = "Glass ball"; + + // Getter-only autoproperty that is initialized in constructor + public string GenieName { get; } + + public GlassBall(string genieName = null) + { + GenieName = genieName; + } + + public void Jump(int meters) + { + if (meters < 0) + // New nameof() expression; compiler will check that the identifier exists + // nameof(x) == "x" + // Prevents e.g. parameter names changing but not updated in error messages + throw new ArgumentException("Cannot jump negative amount!", nameof(meters)); + + Damage += meters; + } + + // Expression-bodied properties ... + public bool Broken + => Damage > 100; + + // ... and methods + public override string ToString() + // Interpolated string + => $"{Name}. Damage taken: {Damage}"; + + public string SummonGenie() + // Null-conditional operators + // x?.y will return null immediately if x is null; y is not evaluated + => GenieName?.ToUpper(); + } + + static class MagicService + { + private static bool LogException(Exception ex) + { + // log exception somewhere + return false; + } + + public static bool CastSpell(string spell) + { + try + { + // Pretend we call API here + throw new MagicServiceException("Spell failed", 42); + + // Spell succeeded + return true; + } + // Only catch if Code is 42 i.e. spell failed + catch(MagicServiceException ex) when (ex.Code == 42) + { + // Spell failed + return false; + } + // Other exceptions, or MagicServiceException where Code is not 42 + catch(Exception ex) when (LogException(ex)) + { + // Execution never reaches this block + // The stack is not unwound + } + return false; + // Note that catching a MagicServiceException and rethrowing if Code + // is not 42 or 117 is different, as then the final catch-all block + // will not catch the rethrown exception + } + } + + public class MagicServiceException : Exception + { + public int Code { get; } + + public MagicServiceException(string message, int code) : base(message) + { + Code = code; + } + } + + public static class PragmaWarning { + // Obsolete attribute + [Obsolete("Use NewMethod instead", false)] + public static void ObsoleteMethod() + { + // obsolete code + } + + public static void NewMethod() + { + // new code + } + + public static void Main() + { + ObsoleteMethod(); // CS0618: 'ObsoleteMethod is obsolete: Use NewMethod instead' +#pragma warning disable CS0618 + ObsoleteMethod(); // no warning +#pragma warning restore CS0618 + ObsoleteMethod(); // CS0618: 'ObsoleteMethod is obsolete: Use NewMethod instead' + } + } +} // End Namespace + +using System; +// C# 6, static using +using static System.Math; + +namespace Learning.More.CSharp +{ + class StaticUsing + { + static void Main() + { + // Without a static using statement.. + Console.WriteLine("The square root of 4 is {}.", Math.Sqrt(4)); + // With one + Console.WriteLine("The square root of 4 is {}.", Sqrt(4)); + } + } +} + +// New C# 7 Feature +// Install Microsoft.Net.Compilers Latest from Nuget +// Install System.ValueTuple Latest from Nuget +using System; +namespace Csharp7 +{ + // TUPLES, DECONSTRUCTION AND DISCARDS + class TuplesTest + { + public (string, string) GetName() + { + // Fields in tuples are by default named Item1, Item2... + var names1 = ("Peter", "Parker"); + Console.WriteLine(names1.Item2); // => Parker + + // Fields can instead be explicitly named + // Type 1 Declaration + (string FirstName, string LastName) names2 = ("Peter", "Parker"); + + // Type 2 Declaration + var names3 = (First:"Peter", Last:"Parker"); + + Console.WriteLine(names2.FirstName); // => Peter + Console.WriteLine(names3.Last); // => Parker + + return names3; + } + + public string GetLastName() { + var fullName = GetName(); + + // Tuples can be deconstructed + (string firstName, string lastName) = fullName; + + // Fields in a deconstructed tuple can be discarded by using _ + var (_, last) = fullName; + return last; + } + + // Any type can be deconstructed in the same way by + // specifying a Deconstruct method + public int randomNumber = 4; + public int anotherRandomNumber = 10; + + public void Deconstruct(out int randomNumber, out int anotherRandomNumber) + { + randomNumber = this.randomNumber; + anotherRandomNumber = this.anotherRandomNumber; + } + + static void Main(string[] args) + { + var tt = new TuplesTest(); + (int num1, int num2) = tt; + Console.WriteLine($"num1: {num1}, num2: {num2}"); // => num1: 4, num2: 10 + + Console.WriteLine(tt.GetLastName()); + } + } + + // PATTERN MATCHING + class PatternMatchingTest + { + public static (string, int)? CreateLogMessage(object data) + { + switch(data) + { + // Additional filtering using when + case System.Net.Http.HttpRequestException h when h.Message.Contains("404"): + return (h.Message, 404); + case System.Net.Http.HttpRequestException h when h.Message.Contains("400"): + return (h.Message, 400); + case Exception e: + return (e.Message, 500); + case string s: + return (s, s.Contains("Error") ? 500 : 200); + case null: + return null; + default: + return (data.ToString(), 500); + } + } + } + + // REFERENCE LOCALS + // Allow you to return a reference to an object instead of just its value + class RefLocalsTest + { + // note ref in return + public static ref string FindItem(string[] arr, string el) + { + for(int i=0; i apple + } + } + + // LOCAL FUNCTIONS + class LocalFunctionTest + { + private static int _id = 0; + public int id; + public LocalFunctionTest() + { + id = generateId(); + + // This local function can only be accessed in this scope + int generateId() + { + return _id++; + } + } + + public static void AnotherMethod() + { + var lf1 = new LocalFunctionTest(); + var lf2 = new LocalFunctionTest(); + Console.WriteLine($"{lf1.id}, {lf2.id}"); // => 0, 1 + + int id = generateId(); + // error CS0103: The name 'generateId' does not exist in the current context + } + } +} \ No newline at end of file