diff --git a/Lab 1/library.xml b/Lab 1/library.xml new file mode 100644 index 0000000..ce29f60 --- /dev/null +++ b/Lab 1/library.xml @@ -0,0 +1,34 @@ + + + + + War and Peace + Leo Tolstoy + Historical + 1869 + + + The Captain's Daughter + Alexander Pushkin + Novel + 1836 + + + Crime and Punishment + Fyodor Dostoevsky + Philosophical + 1866 + + + The Three Musketeers + Alexandre Dumas + Historical novel + 1844 + + + Fifteen-year-old captain + Jules Verne + Novel + 1878 + + diff --git a/Lab 1/library.xslt b/Lab 1/library.xslt new file mode 100644 index 0000000..1ee2a08 --- /dev/null +++ b/Lab 1/library.xslt @@ -0,0 +1,47 @@ + + + + + + + Library + + + +

Library Books

+ + + + + + + + + + + + + + + + +
TitleAuthorGenreYear
+ + +
+ +
\ No newline at end of file diff --git a/Lab 1/run.py b/Lab 1/run.py new file mode 100644 index 0000000..5755c63 --- /dev/null +++ b/Lab 1/run.py @@ -0,0 +1,14 @@ +import http.server +import socketserver + +PORT = 8000 +DIRECTORY = "." + +class Handler(http.server.SimpleHTTPRequestHandler): + def __init__(self, *args, **kwargs): + super().__init__(*args, directory=DIRECTORY, **kwargs) + +# Запуск сервера на порту 8000 +with socketserver.TCPServer(("", PORT), Handler) as httpd: + print(f"Serving at http://localhost:{PORT}") + httpd.serve_forever() \ No newline at end of file diff --git a/Lab 2/library.dtd b/Lab 2/library.dtd new file mode 100644 index 0000000..e316606 --- /dev/null +++ b/Lab 2/library.dtd @@ -0,0 +1,15 @@ + + + + + + + + + + + + +]> \ No newline at end of file diff --git a/Lab 2/library.xml b/Lab 2/library.xml new file mode 100644 index 0000000..8aafa2a --- /dev/null +++ b/Lab 2/library.xml @@ -0,0 +1,25 @@ + + + + + + + War and Peace + Leo Tolstoy + Historical + 1869 + + + The Captain's Daughter + Alexander Pushkin + Novel + 1836 + + + The Three Musketeers + Alexandre Dumas + Historical novel + 1844 + + + \ No newline at end of file diff --git a/Lab 2/library.xslt b/Lab 2/library.xslt new file mode 100644 index 0000000..2689d5d --- /dev/null +++ b/Lab 2/library.xslt @@ -0,0 +1,48 @@ + + + + + + + + Library + + + +

Library Books

+ + + + + + + + + + + + + + + + +
TitleAuthorGenreYear
+ + +
+ +
\ No newline at end of file diff --git a/Lab 3/library.dtd b/Lab 3/library.dtd new file mode 100644 index 0000000..e316606 --- /dev/null +++ b/Lab 3/library.dtd @@ -0,0 +1,15 @@ + + + + + + + + + + + + +]> \ No newline at end of file diff --git a/Lab 3/library.xml b/Lab 3/library.xml new file mode 100644 index 0000000..d69bf71 --- /dev/null +++ b/Lab 3/library.xml @@ -0,0 +1,23 @@ + + + + + + War and Peace + Leo Tolstoy + Historical + 1869 + + + The Captain's Daughter + Alexander Pushkin + Novel + 1836 + + + The Three Musketeers + Alexandre Dumas + Historical novel + 1844 + + \ No newline at end of file diff --git a/Lab 3/library.xsd b/Lab 3/library.xsd new file mode 100644 index 0000000..2cbae4d --- /dev/null +++ b/Lab 3/library.xsd @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Lab 3/library.xslt b/Lab 3/library.xslt new file mode 100644 index 0000000..2689d5d --- /dev/null +++ b/Lab 3/library.xslt @@ -0,0 +1,48 @@ + + + + + + + + Library + + + +

Library Books

+ + + + + + + + + + + + + + + + +
TitleAuthorGenreYear
+ + +
+ +
\ No newline at end of file diff --git a/Lab 4/ConvertData/App.config b/Lab 4/ConvertData/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/Lab 4/ConvertData/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Lab 4/ConvertData/ConvertData.csproj b/Lab 4/ConvertData/ConvertData.csproj new file mode 100644 index 0000000..c790833 --- /dev/null +++ b/Lab 4/ConvertData/ConvertData.csproj @@ -0,0 +1,83 @@ + + + + + Debug + AnyCPU + {D1288C6D-7E75-4808-ABC3-0CCCE4FD9C22} + WinExe + ConvertData + ConvertData + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + FormMain.cs + + + + + FormMain.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/Lab 4/ConvertData/ConvertData.sln b/Lab 4/ConvertData/ConvertData.sln new file mode 100644 index 0000000..86892fe --- /dev/null +++ b/Lab 4/ConvertData/ConvertData.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConvertData", "ConvertData.csproj", "{D1288C6D-7E75-4808-ABC3-0CCCE4FD9C22}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D1288C6D-7E75-4808-ABC3-0CCCE4FD9C22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D1288C6D-7E75-4808-ABC3-0CCCE4FD9C22}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D1288C6D-7E75-4808-ABC3-0CCCE4FD9C22}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D1288C6D-7E75-4808-ABC3-0CCCE4FD9C22}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A4F0853A-9C3C-4D61-B4A9-BA4A678CCECF} + EndGlobalSection +EndGlobal diff --git a/Lab 4/ConvertData/FormMain.Designer.cs b/Lab 4/ConvertData/FormMain.Designer.cs new file mode 100644 index 0000000..e3034c5 --- /dev/null +++ b/Lab 4/ConvertData/FormMain.Designer.cs @@ -0,0 +1,274 @@ +namespace ConvertData +{ + partial class Main + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором форм Windows + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + this.Close = new System.Windows.Forms.Button(); + this.Label_Date = new System.Windows.Forms.Label(); + this.comboBox_Date = new System.Windows.Forms.ComboBox(); + this.Label_FormatDate = new System.Windows.Forms.Label(); + this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker(); + this.button_res = new System.Windows.Forms.Button(); + this.comboBox_format = new System.Windows.Forms.ComboBox(); + this.numericUpDown_operations = new System.Windows.Forms.NumericUpDown(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.button_convertToString = new System.Windows.Forms.Button(); + this.textBox_string = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.button_converttodata = new System.Windows.Forms.Button(); + this.textBox_result = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_operations)).BeginInit(); + this.SuspendLayout(); + // + // Close + // + this.Close.Location = new System.Drawing.Point(951, 511); + this.Close.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Close.Name = "Close"; + this.Close.Size = new System.Drawing.Size(100, 28); + this.Close.TabIndex = 0; + this.Close.Text = "Закрыть"; + this.Close.UseVisualStyleBackColor = true; + this.Close.Click += new System.EventHandler(this.Close_Click); + // + // Label_Date + // + this.Label_Date.AutoSize = true; + this.Label_Date.Location = new System.Drawing.Point(16, 11); + this.Label_Date.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.Label_Date.Name = "Label_Date"; + this.Label_Date.Size = new System.Drawing.Size(42, 16); + this.Label_Date.TabIndex = 5; + this.Label_Date.Text = "Дата:"; + // + // comboBox_Date + // + this.comboBox_Date.FormattingEnabled = true; + this.comboBox_Date.Location = new System.Drawing.Point(16, 226); + this.comboBox_Date.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.comboBox_Date.Name = "comboBox_Date"; + this.comboBox_Date.Size = new System.Drawing.Size(265, 24); + this.comboBox_Date.TabIndex = 7; + this.comboBox_Date.SelectedIndexChanged += new System.EventHandler(this.comboBox_Date_SelectedIndexChanged); + // + // Label_FormatDate + // + this.Label_FormatDate.AutoSize = true; + this.Label_FormatDate.Location = new System.Drawing.Point(12, 207); + this.Label_FormatDate.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.Label_FormatDate.Name = "Label_FormatDate"; + this.Label_FormatDate.Size = new System.Drawing.Size(157, 16); + this.Label_FormatDate.TabIndex = 8; + this.Label_FormatDate.Text = "Форматироварие даты"; + // + // dateTimePicker1 + // + this.dateTimePicker1.Location = new System.Drawing.Point(16, 31); + this.dateTimePicker1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.dateTimePicker1.Name = "dateTimePicker1"; + this.dateTimePicker1.Size = new System.Drawing.Size(265, 22); + this.dateTimePicker1.TabIndex = 9; + // + // button_res + // + this.button_res.Location = new System.Drawing.Point(332, 63); + this.button_res.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.button_res.Name = "button_res"; + this.button_res.Size = new System.Drawing.Size(236, 28); + this.button_res.TabIndex = 12; + this.button_res.Text = "Изменить"; + this.button_res.UseVisualStyleBackColor = true; + this.button_res.Click += new System.EventHandler(this.button_plus_Click); + // + // comboBox_format + // + this.comboBox_format.FormattingEnabled = true; + this.comboBox_format.Location = new System.Drawing.Point(332, 98); + this.comboBox_format.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.comboBox_format.Name = "comboBox_format"; + this.comboBox_format.Size = new System.Drawing.Size(235, 24); + this.comboBox_format.TabIndex = 14; + // + // numericUpDown_operations + // + this.numericUpDown_operations.Location = new System.Drawing.Point(332, 31); + this.numericUpDown_operations.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.numericUpDown_operations.Minimum = new decimal(new int[] { + 100, + 0, + 0, + -2147483648}); + this.numericUpDown_operations.Name = "numericUpDown_operations"; + this.numericUpDown_operations.Size = new System.Drawing.Size(236, 22); + this.numericUpDown_operations.TabIndex = 15; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(332, 10); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(85, 16); + this.label1.TabIndex = 16; + this.label1.Text = "Изменение:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(608, 11); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(96, 16); + this.label2.TabIndex = 17; + this.label2.Text = "Конвертация:"; + // + // button_convertToString + // + this.button_convertToString.Location = new System.Drawing.Point(611, 33); + this.button_convertToString.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.button_convertToString.Name = "button_convertToString"; + this.button_convertToString.Size = new System.Drawing.Size(279, 28); + this.button_convertToString.TabIndex = 18; + this.button_convertToString.Text = "Конвертировать в строку"; + this.button_convertToString.UseVisualStyleBackColor = true; + this.button_convertToString.Click += new System.EventHandler(this.button_convertToString_Click); + // + // textBox_string + // + this.textBox_string.Location = new System.Drawing.Point(332, 228); + this.textBox_string.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.textBox_string.Name = "textBox_string"; + this.textBox_string.Size = new System.Drawing.Size(235, 22); + this.textBox_string.TabIndex = 19; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(328, 207); + this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(131, 16); + this.label3.TabIndex = 20; + this.label3.Text = "Строковые данные"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(605, 207); + this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(96, 16); + this.label4.TabIndex = 21; + this.label4.Text = "Конвертация:"; + // + // button_converttodata + // + this.button_converttodata.Location = new System.Drawing.Point(612, 228); + this.button_converttodata.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.button_converttodata.Name = "button_converttodata"; + this.button_converttodata.Size = new System.Drawing.Size(277, 28); + this.button_converttodata.TabIndex = 22; + this.button_converttodata.Text = "Конвертация в дату"; + this.button_converttodata.UseVisualStyleBackColor = true; + this.button_converttodata.Click += new System.EventHandler(this.button_converttodata_Click); + // + // textBox_result + // + this.textBox_result.Location = new System.Drawing.Point(16, 286); + this.textBox_result.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.textBox_result.Name = "textBox_result"; + this.textBox_result.Size = new System.Drawing.Size(265, 22); + this.textBox_result.TabIndex = 23; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(16, 266); + this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(194, 16); + this.label5.TabIndex = 24; + this.label5.Text = "Результат форматирования"; + // + // Main + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1067, 554); + this.Controls.Add(this.label5); + this.Controls.Add(this.textBox_result); + this.Controls.Add(this.button_converttodata); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.textBox_string); + this.Controls.Add(this.button_convertToString); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.numericUpDown_operations); + this.Controls.Add(this.comboBox_format); + this.Controls.Add(this.button_res); + this.Controls.Add(this.dateTimePicker1); + this.Controls.Add(this.Label_FormatDate); + this.Controls.Add(this.comboBox_Date); + this.Controls.Add(this.Label_Date); + this.Controls.Add(this.Close); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Name = "Main"; + this.Text = "Lab 4: Convert Data"; + this.Load += new System.EventHandler(this.Main_Load); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_operations)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button Close; + private System.Windows.Forms.Label Label_Date; + private System.Windows.Forms.ComboBox comboBox_Date; + private System.Windows.Forms.Label Label_FormatDate; + private System.Windows.Forms.DateTimePicker dateTimePicker1; + private System.Windows.Forms.Button button_res; + private System.Windows.Forms.ComboBox comboBox_format; + private System.Windows.Forms.NumericUpDown numericUpDown_operations; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button button_convertToString; + private System.Windows.Forms.TextBox textBox_string; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Button button_converttodata; + private System.Windows.Forms.TextBox textBox_result; + private System.Windows.Forms.Label label5; + } +} + diff --git a/Lab 4/ConvertData/FormMain.cs b/Lab 4/ConvertData/FormMain.cs new file mode 100644 index 0000000..f44ebd5 --- /dev/null +++ b/Lab 4/ConvertData/FormMain.cs @@ -0,0 +1,112 @@ +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; + +namespace ConvertData +{ + public partial class Main : Form + { + public Main() + { + InitializeComponent(); + } + + private void Close_Click(object sender, EventArgs e) + { + Application.Exit(); + } + + private void comboBox_Date_SelectedIndexChanged(object sender, EventArgs e) + { + if (comboBox_Date.Text == "День месяц и год") + { + textBox_result.Text = dateTimePicker1.Value.ToLongDateString(); + } + + if (comboBox_Date.Text == "День/Месяц/Год кратко") + { + textBox_result.Text = dateTimePicker1.Value.ToShortDateString(); + } + + if (comboBox_Date.Text == "Полная запись времени") + { + textBox_result.Text = dateTimePicker1.Value.ToLongTimeString(); + } + + if (comboBox_Date.Text == "Краткая запись времени") + { + textBox_result.Text = dateTimePicker1.Value.ToShortTimeString(); + } + } + + private void Main_Load(object sender, EventArgs e) + { + // dateTimePicker1.Value = DateTime.Now; + + dateTimePicker1.Format = DateTimePickerFormat.Custom; + dateTimePicker1.CustomFormat = "hh:mm:ss dd.MM.yyyy 'г.'"; + + // Добавление в ComboBox + comboBox_Date.Items.Add("День месяц и год"); + comboBox_Date.Items.Add("День/Месяц/Год кратко"); + comboBox_Date.Items.Add("Полная запись времени"); + comboBox_Date.Items.Add("Краткая запись времени"); + + comboBox_format.Items.Add("Год"); + comboBox_format.Items.Add("Месяц"); + comboBox_format.Items.Add("День"); + comboBox_format.Items.Add("Час"); + comboBox_format.Items.Add("Минуту"); + comboBox_format.Items.Add("Секунду"); + } + + private void button_plus_Click(object sender, EventArgs e) + { + if (comboBox_format.Text == "Год") + { + dateTimePicker1.Value = dateTimePicker1.Value.AddYears(Decimal.ToInt32((numericUpDown_operations.Value))); + } + + if (comboBox_format.Text == "Месяц") + { + dateTimePicker1.Value = dateTimePicker1.Value.AddMonths(Decimal.ToInt32((numericUpDown_operations.Value))); + } + + if (comboBox_format.Text == "День") + { + dateTimePicker1.Value = dateTimePicker1.Value.AddDays(Decimal.ToInt32((numericUpDown_operations.Value))); + } + + if (comboBox_format.Text == "Час") + { + dateTimePicker1.Value = dateTimePicker1.Value.AddHours(Decimal.ToInt32((numericUpDown_operations.Value))); + } + + if (comboBox_format.Text == "Минуту") + { + dateTimePicker1.Value = dateTimePicker1.Value.AddMinutes(Decimal.ToInt32((numericUpDown_operations.Value))); + } + + if (comboBox_format.Text == "Секунду") + { + dateTimePicker1.Value = dateTimePicker1.Value.AddSeconds(Decimal.ToInt32((numericUpDown_operations.Value))); + } + } + + private void button_convertToString_Click(object sender, EventArgs e) + { + textBox_string.Text = dateTimePicker1.Value.ToString(); + } + + private void button_converttodata_Click(object sender, EventArgs e) + { + dateTimePicker1.Value = DateTime.Parse(textBox_string.Text); + } + } +} diff --git a/Lab 4/ConvertData/FormMain.resx b/Lab 4/ConvertData/FormMain.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Lab 4/ConvertData/FormMain.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Lab 4/ConvertData/Program.cs b/Lab 4/ConvertData/Program.cs new file mode 100644 index 0000000..0eee3a3 --- /dev/null +++ b/Lab 4/ConvertData/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ConvertData +{ + internal static class Program + { + /// + /// Главная точка входа для приложения. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Main()); + } + } +} diff --git a/Lab 4/ConvertData/Properties/AssemblyInfo.cs b/Lab 4/ConvertData/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8df2b70 --- /dev/null +++ b/Lab 4/ConvertData/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Общие сведения об этой сборке предоставляются следующим набором +// набора атрибутов. Измените значения этих атрибутов для изменения сведений, +// связанных со сборкой. +[assembly: AssemblyTitle("ConvertData")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ConvertData")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми +// для компонентов COM. Если необходимо обратиться к типу в этой сборке через +// COM, следует установить атрибут ComVisible в TRUE для этого типа. +[assembly: ComVisible(false)] + +// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM +[assembly: Guid("d1288c6d-7e75-4808-abc3-0ccce4fd9c22")] + +// Сведения о версии сборки состоят из указанных ниже четырех значений: +// +// Основной номер версии +// Дополнительный номер версии +// Номер сборки +// Редакция +// +// Можно задать все значения или принять номера сборки и редакции по умолчанию +// используя "*", как показано ниже: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Lab 4/ConvertData/Properties/Resources.Designer.cs b/Lab 4/ConvertData/Properties/Resources.Designer.cs new file mode 100644 index 0000000..e212ecb --- /dev/null +++ b/Lab 4/ConvertData/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программным средством. +// Версия среды выполнения: 4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если +// код создан повторно. +// +//------------------------------------------------------------------------------ + +namespace ConvertData.Properties +{ + + + /// + /// Класс ресурсов со строгим типом для поиска локализованных строк и пр. + /// + // Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder + // класс с помощью таких средств, как ResGen или Visual Studio. + // Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen + // с параметром /str или заново постройте свой VS-проект. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Возврат кэшированного экземпляра ResourceManager, используемого этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ConvertData.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Переопределяет свойство CurrentUICulture текущего потока для всех + /// подстановки ресурсов с помощью этого класса ресурсов со строгим типом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Lab 4/ConvertData/Properties/Resources.resx b/Lab 4/ConvertData/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Lab 4/ConvertData/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Lab 4/ConvertData/Properties/Settings.Designer.cs b/Lab 4/ConvertData/Properties/Settings.Designer.cs new file mode 100644 index 0000000..185b872 --- /dev/null +++ b/Lab 4/ConvertData/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ConvertData.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Lab 4/ConvertData/Properties/Settings.settings b/Lab 4/ConvertData/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Lab 4/ConvertData/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Lab 4/DateTimeOperations.java b/Lab 4/DateTimeOperations.java new file mode 100644 index 0000000..4d77156 --- /dev/null +++ b/Lab 4/DateTimeOperations.java @@ -0,0 +1,154 @@ +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.util.Scanner; + +public class DateTimeOperations { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy"); + DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss"); + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss"); + + System.out.println("Выберите тип операции:"); + System.out.println("1. Прибавить дни/месяцы/часы/минуты"); + System.out.println("2. Вычесть дни/месяцы/часы/минуты"); + int operationType = scanner.nextInt(); + + System.out.println("Выберите объект для операции:"); + System.out.println("1. Дата"); + System.out.println("2. Время"); + System.out.println("3. Дата и время"); + int objectType = scanner.nextInt(); + + // Получаем текущую дату, время и дату-время + // LocalDate currentDate = LocalDate.now(); + // LocalTime currentTime = LocalTime.now(); + // LocalDateTime currentDateTime = LocalDateTime.now(); + + // System.out.println("Текущая дата: " + currentDate); + // System.out.println("Текущее время: " + currentTime); + // System.out.println("Текущее дата и время: " + currentDateTime); + + if (objectType == 1) { + // Операции с датой + LocalDate date = LocalDate.now(); + System.out.println("Текущая дата: " + date.format(dateFormatter)); + + if (operationType == 1) { + System.out.println("Введите количество дней для прибавления:"); + int days = scanner.nextInt(); + + System.out.println("Введите количество месяцев для прибавления:"); + int months = scanner.nextInt(); + + LocalDate newDate = date.plusDays(days).plusMonths(months); + System.out.println("Новая дата: " + newDate.format(dateFormatter)); + } else { + System.out.println("Введите количество дней для вычитания:"); + int days = scanner.nextInt(); + + System.out.println("Введите количество месяцев для вычитания:"); + int months = scanner.nextInt(); + + LocalDate newDate = date.minusDays(days).minusMonths(months); + System.out.println("Новая дата: " + newDate.format(dateFormatter)); + } + + } else if (objectType == 2) { + // Операции со временем + LocalTime time = LocalTime.now(); + System.out.println("Текущее время: " + time.format(timeFormatter)); + + if (operationType == 1) { + System.out.println("Введите количество часов для прибавления:"); + int hours = scanner.nextInt(); + + System.out.println("Введите количество минут для прибавления:"); + int minutes = scanner.nextInt(); + + LocalTime newTime = time.plusHours(hours).plusMinutes(minutes); + System.out.println("Новое время: " + newTime.format(timeFormatter)); + } else { + System.out.println("Введите количество часов для вычитания:"); + int hours = scanner.nextInt(); + + System.out.println("Введите количество минут для вычитания:"); + int minutes = scanner.nextInt(); + + LocalTime newTime = time.minusHours(hours).minusMinutes(minutes); + System.out.println("Новое время: " + newTime.format(timeFormatter)); + } + + } else if (objectType == 3) { + // Операции с датой и временем + LocalDateTime dateTime = LocalDateTime.now(); + System.out.println("Текущие дата и время: " + dateTime.format(dateTimeFormatter)); + + if (operationType == 1) { + System.out.println("Введите количество дней для прибавления:"); + int days = scanner.nextInt(); + + System.out.println("Введите количество месяцев для прибавления:"); + int months = scanner.nextInt(); + + System.out.println("Введите количество часов для прибавления:"); + int hours = scanner.nextInt(); + + System.out.println("Введите количество минут для прибавления:"); + int minutes = scanner.nextInt(); + + LocalDateTime newDateTime = dateTime.plusDays(days).plusMonths(months).plusHours(hours).plusMinutes(minutes); + System.out.println("Новые дата и время: " + newDateTime.format(dateTimeFormatter)); + } else { + System.out.println("Введите количество дней для вычитания:"); + int days = scanner.nextInt(); + + System.out.println("Введите количество месяцев для вычитания:"); + int months = scanner.nextInt(); + + System.out.println("Введите количество часов для вычитания:"); + int hours = scanner.nextInt(); + + System.out.println("Введите количество минут для вычитания:"); + int minutes = scanner.nextInt(); + + LocalDateTime newDateTime = dateTime.minusDays(days).minusMonths(months).minusHours(hours).minusMinutes(minutes); + System.out.println("Новые дата и время: " + newDateTime.format(dateTimeFormatter)); + } + } + + // Ввод и разбор даты + scanner.nextLine(); // consume the newline + System.out.println("Введите дату в формате 'dd-MM-yyyy':"); + String dateString = scanner.nextLine(); + if (dateString != null && !dateString.trim().isEmpty()) { + try { + LocalDate parsedDate = LocalDate.parse(dateString, dateFormatter); + System.out.println("Преобразованная дата: " + parsedDate); + } catch (Exception e) { + System.out.println("Ошибка: Некорректный формат даты."); + } + } else { + System.out.println("Ошибка: Дата не может быть пустой."); + } + + // Ввод и разбор даты и времени + System.out.println("Введите дату и время в формате 'dd-MM-yyyy HH:mm:ss':"); + String dateTimeString = scanner.nextLine(); + if (dateTimeString != null && !dateTimeString.trim().isEmpty()) { + try { + LocalDateTime parsedDateTime = LocalDateTime.parse(dateTimeString, dateTimeFormatter); + System.out.println("Преобразованные дата и время: " + parsedDateTime); + } catch (Exception e) { + System.out.println("Ошибка: Некорректный формат даты и времени."); + } + } else { + System.out.println("Ошибка: Дата и время не могут быть пустыми."); + } + + scanner.close(); + } +} \ No newline at end of file