diff --git a/App.config b/App.config new file mode 100644 index 0000000..abb8196 --- /dev/null +++ b/App.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AutoMaster.csproj b/AutoMaster.csproj new file mode 100644 index 0000000..3f4967c --- /dev/null +++ b/AutoMaster.csproj @@ -0,0 +1,146 @@ + + + + + Debug + AnyCPU + {F97C7EAD-CBAE-43B4-B265-2C021081E835} + WinExe + AutoMaster + AutoMaster + v4.8 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + packages\BouncyCastle.Cryptography.2.5.1\lib\net461\BouncyCastle.Cryptography.dll + + + packages\Google.Protobuf.3.30.0\lib\net45\Google.Protobuf.dll + + + packages\K4os.Compression.LZ4.1.3.8\lib\net462\K4os.Compression.LZ4.dll + + + packages\K4os.Compression.LZ4.Streams.1.3.8\lib\net462\K4os.Compression.LZ4.Streams.dll + + + packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll + + + packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll + + + packages\MySql.Data.9.3.0\lib\net48\MySql.Data.dll + + + + packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + + packages\System.Configuration.ConfigurationManager.8.0.0\lib\net462\System.Configuration.ConfigurationManager.dll + + + + packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll + + + packages\System.IO.Pipelines.5.0.2\lib\net461\System.IO.Pipelines.dll + + + + packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + + + + packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + + + + + + + + + + + packages\ZstdSharp.Port.0.8.5\lib\net462\ZstdSharp.dll + + + + + + Form + + + Form1.cs + + + Form + + + MainForm.cs + + + + + Form1.cs + + + MainForm.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/AutoMaster.sln b/AutoMaster.sln new file mode 100644 index 0000000..618f125 --- /dev/null +++ b/AutoMaster.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34511.84 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoMaster", "AutoMaster.csproj", "{F97C7EAD-CBAE-43B4-B265-2C021081E835}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F97C7EAD-CBAE-43B4-B265-2C021081E835}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F97C7EAD-CBAE-43B4-B265-2C021081E835}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F97C7EAD-CBAE-43B4-B265-2C021081E835}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F97C7EAD-CBAE-43B4-B265-2C021081E835}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2A676F69-37BD-40C5-AA1D-AD17EB6D9ADA} + EndGlobalSection +EndGlobal diff --git a/Database.cs b/Database.cs new file mode 100644 index 0000000..9fed073 --- /dev/null +++ b/Database.cs @@ -0,0 +1,90 @@ +using System; +using System.Data; +using MySql.Data.MySqlClient; + +public class Database +{ + private string connectionString = "server=80.90.179.235;database=pozorisp_GorbachevAV;user=pozorisp;password=pozorisp;"; + + public MySqlConnection GetConnection() + { + return new MySqlConnection(connectionString); + } + + public bool AuthenticateUser(string username, string password) + { + using (var connection = GetConnection()) + { + connection.Open(); + string query = "SELECT COUNT(*) FROM users WHERE username = @username AND password = @password"; + using (var cmd = new MySqlCommand(query, connection)) + { + cmd.Parameters.AddWithValue("@username", username); + cmd.Parameters.AddWithValue("@password", password); + return Convert.ToInt32(cmd.ExecuteScalar()) > 0; + } + } + } + + public DataTable GetUsers() + { + using (var connection = GetConnection()) + { + connection.Open(); + string query = "SELECT id, username, email FROM users"; + using (var cmd = new MySqlCommand(query, connection)) + using (var adapter = new MySqlDataAdapter(cmd)) + { + DataTable dt = new DataTable(); + adapter.Fill(dt); + return dt; + } + } + } + + public void AddUser(string username, string password, string email) + { + using (var connection = GetConnection()) + { + connection.Open(); + string query = "INSERT INTO users (username, password, email) VALUES (@username, @password, @email)"; + using (var cmd = new MySqlCommand(query, connection)) + { + cmd.Parameters.AddWithValue("@username", username); + cmd.Parameters.AddWithValue("@password", password); + cmd.Parameters.AddWithValue("@email", email); + cmd.ExecuteNonQuery(); + } + } + } + + public void UpdateUser(int id, string username, string email) + { + using (var connection = GetConnection()) + { + connection.Open(); + string query = "UPDATE users SET username = @username, email = @email WHERE id = @id"; + using (var cmd = new MySqlCommand(query, connection)) + { + cmd.Parameters.AddWithValue("@id", id); + cmd.Parameters.AddWithValue("@username", username); + cmd.Parameters.AddWithValue("@email", email); + cmd.ExecuteNonQuery(); + } + } + } + + public void DeleteUser(int id) + { + using (var connection = GetConnection()) + { + connection.Open(); + string query = "DELETE FROM users WHERE id = @id"; + using (var cmd = new MySqlCommand(query, connection)) + { + cmd.Parameters.AddWithValue("@id", id); + cmd.ExecuteNonQuery(); + } + } + } +} diff --git a/Form1.Designer.cs b/Form1.Designer.cs new file mode 100644 index 0000000..c786cb5 --- /dev/null +++ b/Form1.Designer.cs @@ -0,0 +1,113 @@ +namespace AutoMaster +{ + partial class Form1 + { + /// + /// Обязательная переменная конструктора. + /// + 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.components = new System.ComponentModel.Container(); + this.btnLogin = new System.Windows.Forms.Button(); + this.txtPassword = new System.Windows.Forms.TextBox(); + this.txtUsername = new System.Windows.Forms.TextBox(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.imageList1 = new System.Windows.Forms.ImageList(this.components); + this.imageList2 = new System.Windows.Forms.ImageList(this.components); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // btnLogin + // + this.btnLogin.Location = new System.Drawing.Point(356, 314); + this.btnLogin.Name = "btnLogin"; + this.btnLogin.Size = new System.Drawing.Size(129, 23); + this.btnLogin.TabIndex = 0; + this.btnLogin.Text = "Авторизоваться"; + this.btnLogin.UseVisualStyleBackColor = true; + // + // txtPassword + // + this.txtPassword.Location = new System.Drawing.Point(356, 231); + this.txtPassword.Name = "txtPassword"; + this.txtPassword.Size = new System.Drawing.Size(125, 20); + this.txtPassword.TabIndex = 1; + // + // txtUsername + // + this.txtUsername.Location = new System.Drawing.Point(356, 159); + this.txtUsername.Name = "txtUsername"; + this.txtUsername.Size = new System.Drawing.Size(125, 20); + this.txtUsername.TabIndex = 2; + // + // pictureBox1 + // + this.pictureBox1.BackColor = System.Drawing.SystemColors.ControlDark; + this.pictureBox1.Location = new System.Drawing.Point(12, 12); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(100, 50); + this.pictureBox1.TabIndex = 3; + this.pictureBox1.TabStop = false; + this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click_1); + // + // imageList1 + // + this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; + this.imageList1.ImageSize = new System.Drawing.Size(16, 16); + this.imageList1.TransparentColor = System.Drawing.Color.Transparent; + // + // imageList2 + // + this.imageList2.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; + this.imageList2.ImageSize = new System.Drawing.Size(16, 16); + this.imageList2.TransparentColor = System.Drawing.Color.Transparent; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.txtUsername); + this.Controls.Add(this.txtPassword); + this.Controls.Add(this.btnLogin); + this.Name = "Form1"; + this.Text = "Form1"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button btnLogin; + private System.Windows.Forms.TextBox txtPassword; + private System.Windows.Forms.TextBox txtUsername; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.ImageList imageList1; + private System.Windows.Forms.ImageList imageList2; + } +} + diff --git a/Form1.cs b/Form1.cs new file mode 100644 index 0000000..10a46c5 --- /dev/null +++ b/Form1.cs @@ -0,0 +1,50 @@ +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 AutoMaster +{ + public partial class Form1 : Form + { + private Database db = new Database(); + + public Form1() + { + InitializeComponent(); + } + + private void btnLogin_Click(object sender, EventArgs e) + { + string username = txtUsername.Text; + string password = txtPassword.Text; + + if (db.AuthenticateUser(username, password)) + { + MessageBox.Show("Успешный вход!"); + this.Hide(); + MainForm mainForm = new MainForm(); + mainForm.Show(); + } + else + { + MessageBox.Show("Неправильный логин или пароль."); + } + } + + private void pictureBox1_Click(object sender, EventArgs e) + { + + } + + private void pictureBox1_Click_1(object sender, EventArgs e) + { + + } + } +} diff --git a/Form1.resx b/Form1.resx new file mode 100644 index 0000000..84c6e6f --- /dev/null +++ b/Form1.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 17, 17 + + + 128, 17 + + \ No newline at end of file diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs new file mode 100644 index 0000000..b755264 --- /dev/null +++ b/MainForm.Designer.cs @@ -0,0 +1,83 @@ +namespace AutoMaster +{ + partial class MainForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(106, 337); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 0; + this.button1.Text = "button1"; + this.button1.UseVisualStyleBackColor = true; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(248, 337); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 1; + this.button2.Text = "button2"; + this.button2.UseVisualStyleBackColor = true; + // + // button3 + // + this.button3.Location = new System.Drawing.Point(383, 337); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(75, 23); + this.button3.TabIndex = 2; + this.button3.Text = "button3"; + this.button3.UseVisualStyleBackColor = true; + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Name = "MainForm"; + this.Text = "MainForm"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + } +} \ No newline at end of file diff --git a/MainForm.cs b/MainForm.cs new file mode 100644 index 0000000..0e70677 --- /dev/null +++ b/MainForm.cs @@ -0,0 +1,20 @@ +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 AutoMaster +{ + public partial class MainForm : Form + { + public MainForm() + { + InitializeComponent(); + } + } +} diff --git a/MainForm.resx b/MainForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/MainForm.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/Program.cs b/Program.cs new file mode 100644 index 0000000..1cfd7f7 --- /dev/null +++ b/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AutoMaster +{ + internal static class Program + { + /// + /// Главная точка входа для приложения. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c88b0a2 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Общие сведения об этой сборке предоставляются следующим набором +// набора атрибутов. Измените значения этих атрибутов для изменения сведений, +// связанных со сборкой. +[assembly: AssemblyTitle("AutoMaster")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AutoMaster")] +[assembly: AssemblyCopyright("Copyright © 2025")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми +// для компонентов COM. Если необходимо обратиться к типу в этой сборке через +// COM, следует установить атрибут ComVisible в TRUE для этого типа. +[assembly: ComVisible(false)] + +// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM +[assembly: Guid("f97c7ead-cbae-43b4-b265-2c021081e835")] + +// Сведения о версии сборки состоят из указанных ниже четырех значений: +// +// Основной номер версии +// Дополнительный номер версии +// Номер сборки +// Редакция +// +// Можно задать все значения или принять номера сборки и редакции по умолчанию +// используя "*", как показано ниже: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..ccc4a30 --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программным средством. +// Версия среды выполнения: 4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если +// код создан повторно. +// +//------------------------------------------------------------------------------ + +namespace AutoMaster.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("AutoMaster.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/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/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/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs new file mode 100644 index 0000000..58832f9 --- /dev/null +++ b/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 AutoMaster.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/Properties/Settings.settings b/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/icon.ico b/icon.ico new file mode 100644 index 0000000..1ea94a9 Binary files /dev/null and b/icon.ico differ diff --git a/packages.config b/packages.config new file mode 100644 index 0000000..9777fd7 --- /dev/null +++ b/packages.config @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file