commit 4871be6ec11dddb9f0d57956f35b99018d9beb20 Author: Student Date: Mon Dec 1 16:59:25 2025 +0400 first commit diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..848ea48 --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,11 @@ +{ + "ExpandedNodes": [ + "", + "\\calculator", + "\\calculator\\calculator", + "\\calculator\\calculator\\bin", + "\\calculator\\calculator\\bin\\Debug" + ], + "SelectedNode": "\\calculator\\calculator\\bin\\Debug\\calculator.exe", + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/new/FileContentIndex/39adbeaa-1321-4fcb-9714-dcf7989e2ace.vsidx b/.vs/new/FileContentIndex/39adbeaa-1321-4fcb-9714-dcf7989e2ace.vsidx new file mode 100644 index 0000000..ce9d12e Binary files /dev/null and b/.vs/new/FileContentIndex/39adbeaa-1321-4fcb-9714-dcf7989e2ace.vsidx differ diff --git a/.vs/new/v17/.wsuo b/.vs/new/v17/.wsuo new file mode 100644 index 0000000..8884bd4 Binary files /dev/null and b/.vs/new/v17/.wsuo differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000..19315ff Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/AnalaizerClass.dll b/AnalaizerClass.dll new file mode 100644 index 0000000..9644b50 Binary files /dev/null and b/AnalaizerClass.dll differ diff --git a/CalcClass.dll b/CalcClass.dll new file mode 100644 index 0000000..272e88f Binary files /dev/null and b/CalcClass.dll differ diff --git a/Form1.Designer.cs b/Form1.Designer.cs new file mode 100644 index 0000000..11c9dbf --- /dev/null +++ b/Form1.Designer.cs @@ -0,0 +1,480 @@ +namespace calculator +{ + 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.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.button6 = new System.Windows.Forms.Button(); + this.button7 = new System.Windows.Forms.Button(); + this.button8 = new System.Windows.Forms.Button(); + this.button9 = new System.Windows.Forms.Button(); + this.button10 = new System.Windows.Forms.Button(); + this.button11 = new System.Windows.Forms.Button(); + this.button12 = new System.Windows.Forms.Button(); + this.button13 = new System.Windows.Forms.Button(); + this.button14 = new System.Windows.Forms.Button(); + this.button15 = new System.Windows.Forms.Button(); + this.button16 = new System.Windows.Forms.Button(); + this.button17 = new System.Windows.Forms.Button(); + this.button18 = new System.Windows.Forms.Button(); + this.button19 = new System.Windows.Forms.Button(); + this.button20 = new System.Windows.Forms.Button(); + this.button21 = new System.Windows.Forms.Button(); + this.button22 = new System.Windows.Forms.Button(); + this.button23 = new System.Windows.Forms.Button(); + this.button24 = new System.Windows.Forms.Button(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.button25 = new System.Windows.Forms.Button(); + this.button26 = new System.Windows.Forms.Button(); + this.button27 = new System.Windows.Forms.Button(); + this.button28 = new System.Windows.Forms.Button(); + this.button29 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(19, 58); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(59, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Результат"; + this.label1.Click += new System.EventHandler(this.label1_Click); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(94, 25); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(202, 20); + this.textBox1.TabIndex = 1; + this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); + // + // button1 + // + this.button1.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button1.Location = new System.Drawing.Point(246, 247); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(50, 37); + this.button1.TabIndex = 2; + this.button1.Text = "M+"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button2.Location = new System.Drawing.Point(246, 204); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(50, 37); + this.button2.TabIndex = 3; + this.button2.Text = "MR"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click_1); + // + // button3 + // + this.button3.Location = new System.Drawing.Point(22, 98); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(50, 37); + this.button3.TabIndex = 4; + this.button3.Text = "("; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 + // + this.button4.Location = new System.Drawing.Point(78, 98); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(50, 37); + this.button4.TabIndex = 5; + this.button4.Text = ")"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // button5 + // + this.button5.Location = new System.Drawing.Point(134, 98); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(79, 37); + this.button5.TabIndex = 6; + this.button5.Text = "Сброс"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // button6 + // + this.button6.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button6.Location = new System.Drawing.Point(246, 290); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(50, 37); + this.button6.TabIndex = 7; + this.button6.Text = "MC"; + this.button6.UseVisualStyleBackColor = true; + this.button6.Click += new System.EventHandler(this.button6_Click); + // + // button7 + // + this.button7.Location = new System.Drawing.Point(219, 98); + this.button7.Name = "button7"; + this.button7.Size = new System.Drawing.Size(77, 37); + this.button7.TabIndex = 8; + this.button7.Text = "<-x"; + this.button7.UseVisualStyleBackColor = true; + this.button7.Click += new System.EventHandler(this.button7_Click); + // + // button8 + // + this.button8.Location = new System.Drawing.Point(190, 204); + this.button8.Name = "button8"; + this.button8.Size = new System.Drawing.Size(50, 37); + this.button8.TabIndex = 9; + this.button8.Text = "/"; + this.button8.UseVisualStyleBackColor = true; + this.button8.Click += new System.EventHandler(this.button8_Click); + // + // button9 + // + this.button9.Location = new System.Drawing.Point(22, 204); + this.button9.Name = "button9"; + this.button9.Size = new System.Drawing.Size(50, 37); + this.button9.TabIndex = 10; + this.button9.Text = "1"; + this.button9.UseVisualStyleBackColor = true; + this.button9.Click += new System.EventHandler(this.button9_Click); + // + // button10 + // + this.button10.Location = new System.Drawing.Point(78, 204); + this.button10.Name = "button10"; + this.button10.Size = new System.Drawing.Size(50, 37); + this.button10.TabIndex = 11; + this.button10.Text = "2"; + this.button10.UseVisualStyleBackColor = true; + this.button10.Click += new System.EventHandler(this.button10_Click); + // + // button11 + // + this.button11.Location = new System.Drawing.Point(134, 204); + this.button11.Name = "button11"; + this.button11.Size = new System.Drawing.Size(50, 37); + this.button11.TabIndex = 12; + this.button11.Text = "3"; + this.button11.UseVisualStyleBackColor = true; + this.button11.Click += new System.EventHandler(this.button11_Click); + // + // button12 + // + this.button12.Location = new System.Drawing.Point(190, 247); + this.button12.Name = "button12"; + this.button12.Size = new System.Drawing.Size(50, 37); + this.button12.TabIndex = 13; + this.button12.Text = "*"; + this.button12.UseVisualStyleBackColor = true; + this.button12.Click += new System.EventHandler(this.button12_Click); + // + // button13 + // + this.button13.Location = new System.Drawing.Point(22, 247); + this.button13.Name = "button13"; + this.button13.Size = new System.Drawing.Size(50, 37); + this.button13.TabIndex = 14; + this.button13.Text = "4"; + this.button13.UseVisualStyleBackColor = true; + this.button13.Click += new System.EventHandler(this.button13_Click); + // + // button14 + // + this.button14.Location = new System.Drawing.Point(78, 247); + this.button14.Name = "button14"; + this.button14.Size = new System.Drawing.Size(50, 37); + this.button14.TabIndex = 15; + this.button14.Text = "5"; + this.button14.UseVisualStyleBackColor = true; + this.button14.Click += new System.EventHandler(this.button14_Click); + // + // button15 + // + this.button15.Location = new System.Drawing.Point(134, 247); + this.button15.Name = "button15"; + this.button15.Size = new System.Drawing.Size(50, 37); + this.button15.TabIndex = 16; + this.button15.Text = "6"; + this.button15.UseVisualStyleBackColor = true; + this.button15.Click += new System.EventHandler(this.button15_Click); + // + // button16 + // + this.button16.Location = new System.Drawing.Point(190, 290); + this.button16.Name = "button16"; + this.button16.Size = new System.Drawing.Size(50, 37); + this.button16.TabIndex = 17; + this.button16.Text = "-"; + this.button16.UseVisualStyleBackColor = true; + this.button16.Click += new System.EventHandler(this.button16_Click); + // + // button17 + // + this.button17.Location = new System.Drawing.Point(22, 290); + this.button17.Name = "button17"; + this.button17.Size = new System.Drawing.Size(50, 37); + this.button17.TabIndex = 18; + this.button17.Text = "7"; + this.button17.UseVisualStyleBackColor = true; + this.button17.Click += new System.EventHandler(this.button17_Click); + // + // button18 + // + this.button18.Location = new System.Drawing.Point(78, 290); + this.button18.Name = "button18"; + this.button18.Size = new System.Drawing.Size(50, 37); + this.button18.TabIndex = 19; + this.button18.Text = "8"; + this.button18.UseVisualStyleBackColor = true; + this.button18.Click += new System.EventHandler(this.button18_Click); + // + // button19 + // + this.button19.Location = new System.Drawing.Point(134, 290); + this.button19.Name = "button19"; + this.button19.Size = new System.Drawing.Size(50, 37); + this.button19.TabIndex = 20; + this.button19.Text = "9"; + this.button19.UseVisualStyleBackColor = true; + this.button19.Click += new System.EventHandler(this.button19_Click); + // + // button20 + // + this.button20.Location = new System.Drawing.Point(190, 333); + this.button20.Name = "button20"; + this.button20.Size = new System.Drawing.Size(50, 37); + this.button20.TabIndex = 21; + this.button20.Text = "+"; + this.button20.UseVisualStyleBackColor = true; + this.button20.Click += new System.EventHandler(this.button20_Click); + // + // button21 + // + this.button21.Location = new System.Drawing.Point(246, 333); + this.button21.Name = "button21"; + this.button21.Size = new System.Drawing.Size(50, 37); + this.button21.TabIndex = 25; + this.button21.Text = "="; + this.button21.UseVisualStyleBackColor = true; + this.button21.Click += new System.EventHandler(this.button21_Click); + // + // button22 + // + this.button22.Location = new System.Drawing.Point(246, 161); + this.button22.Name = "button22"; + this.button22.Size = new System.Drawing.Size(50, 37); + this.button22.TabIndex = 24; + this.button22.Text = "%"; + this.button22.UseVisualStyleBackColor = true; + this.button22.Click += new System.EventHandler(this.button22_Click); + // + // button23 + // + this.button23.Location = new System.Drawing.Point(22, 333); + this.button23.Name = "button23"; + this.button23.Size = new System.Drawing.Size(50, 37); + this.button23.TabIndex = 23; + this.button23.Text = "+/-"; + this.button23.UseVisualStyleBackColor = true; + this.button23.Click += new System.EventHandler(this.button23_Click); + // + // button24 + // + this.button24.Location = new System.Drawing.Point(78, 333); + this.button24.Name = "button24"; + this.button24.Size = new System.Drawing.Size(50, 37); + this.button24.TabIndex = 22; + this.button24.Text = "0"; + this.button24.UseVisualStyleBackColor = true; + this.button24.Click += new System.EventHandler(this.button24_Click); + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(94, 55); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(202, 20); + this.textBox2.TabIndex = 26; + this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(19, 28); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(66, 13); + this.label2.TabIndex = 27; + this.label2.Text = "Выражение"; + this.label2.Click += new System.EventHandler(this.label2_Click); + // + // button25 + // + this.button25.Location = new System.Drawing.Point(134, 161); + this.button25.Name = "button25"; + this.button25.Size = new System.Drawing.Size(50, 37); + this.button25.TabIndex = 32; + this.button25.Text = "x2"; + this.button25.UseVisualStyleBackColor = true; + this.button25.Click += new System.EventHandler(this.button25_Click); + // + // button26 + // + this.button26.Location = new System.Drawing.Point(78, 161); + this.button26.Name = "button26"; + this.button26.Size = new System.Drawing.Size(50, 37); + this.button26.TabIndex = 31; + this.button26.Text = "cos"; + this.button26.UseVisualStyleBackColor = true; + this.button26.Click += new System.EventHandler(this.button26_Click); + // + // button27 + // + this.button27.Location = new System.Drawing.Point(22, 161); + this.button27.Name = "button27"; + this.button27.Size = new System.Drawing.Size(50, 37); + this.button27.TabIndex = 30; + this.button27.Text = "sin"; + this.button27.UseVisualStyleBackColor = true; + this.button27.Click += new System.EventHandler(this.button27_Click); + // + // button28 + // + this.button28.Location = new System.Drawing.Point(190, 161); + this.button28.Name = "button28"; + this.button28.Size = new System.Drawing.Size(50, 37); + this.button28.TabIndex = 29; + this.button28.Text = "x3"; + this.button28.UseVisualStyleBackColor = true; + this.button28.Click += new System.EventHandler(this.button28_Click); + // + // button29 + // + this.button29.ForeColor = System.Drawing.SystemColors.ActiveCaption; + this.button29.Location = new System.Drawing.Point(134, 333); + this.button29.Name = "button29"; + this.button29.Size = new System.Drawing.Size(50, 37); + this.button29.TabIndex = 28; + this.button29.Text = "."; + this.button29.UseVisualStyleBackColor = true; + this.button29.Click += new System.EventHandler(this.button29_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(316, 395); + this.Controls.Add(this.button25); + this.Controls.Add(this.button26); + this.Controls.Add(this.button27); + this.Controls.Add(this.button28); + this.Controls.Add(this.button29); + this.Controls.Add(this.label2); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.button21); + this.Controls.Add(this.button22); + this.Controls.Add(this.button23); + this.Controls.Add(this.button24); + this.Controls.Add(this.button20); + this.Controls.Add(this.button19); + this.Controls.Add(this.button18); + this.Controls.Add(this.button17); + this.Controls.Add(this.button16); + this.Controls.Add(this.button15); + this.Controls.Add(this.button14); + this.Controls.Add(this.button13); + this.Controls.Add(this.button12); + this.Controls.Add(this.button11); + this.Controls.Add(this.button10); + this.Controls.Add(this.button9); + this.Controls.Add(this.button8); + this.Controls.Add(this.button7); + this.Controls.Add(this.button6); + this.Controls.Add(this.button5); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; + this.Name = "Form1"; + this.Text = "Калькулятор"; + this.TransparencyKey = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button button6; + private System.Windows.Forms.Button button7; + private System.Windows.Forms.Button button8; + private System.Windows.Forms.Button button9; + private System.Windows.Forms.Button button10; + private System.Windows.Forms.Button button11; + private System.Windows.Forms.Button button12; + private System.Windows.Forms.Button button13; + private System.Windows.Forms.Button button14; + private System.Windows.Forms.Button button15; + private System.Windows.Forms.Button button16; + private System.Windows.Forms.Button button17; + private System.Windows.Forms.Button button18; + private System.Windows.Forms.Button button19; + private System.Windows.Forms.Button button20; + private System.Windows.Forms.Button button21; + private System.Windows.Forms.Button button22; + private System.Windows.Forms.Button button23; + private System.Windows.Forms.Button button24; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button button25; + private System.Windows.Forms.Button button26; + private System.Windows.Forms.Button button27; + private System.Windows.Forms.Button button28; + private System.Windows.Forms.Button button29; + } +} + diff --git a/Form1.cs b/Form1.cs new file mode 100644 index 0000000..b2c30b1 --- /dev/null +++ b/Form1.cs @@ -0,0 +1,269 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace calculator +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void label1_Click(object sender, EventArgs e) + { + + } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + + } + + private void button19_Click(object sender, EventArgs e) + { + textBox1.Text += "9"; + } + + private void button1_Click(object sender, EventArgs e) + { + textBox1.Text += "%"; + } + + private void button2_Click_1(object sender, EventArgs e) + { + textBox1.Text += ""; + } + + private void button3_Click(object sender, EventArgs e) + { + textBox1.Text += "("; + } + + private void button4_Click(object sender, EventArgs e) + { + textBox1.Text += ")"; + } + + private void button5_Click(object sender, EventArgs e) + { + textBox1.Text = ""; + textBox2.Text = ""; + textBox1.Focus(); + } + + private void button6_Click(object sender, EventArgs e) + { + + } + + private void button7_Click(object sender, EventArgs e) + { + if (textBox1.Text.Length > 0) + { + string text = textBox1.Text; + textBox1.Text = text.Remove(text.Length - 1, 1); + } + } + + private void textBox2_TextChanged(object sender, EventArgs e) + { + + } + + private void button9_Click(object sender, EventArgs e) + { + textBox1.Text += "1"; + } + + private void button10_Click(object sender, EventArgs e) + { + textBox1.Text += "2"; + } + + private void button11_Click(object sender, EventArgs e) + { + textBox1.Text += "3"; + } + + private void button13_Click(object sender, EventArgs e) + { + textBox1.Text += "4"; + } + + private void button14_Click(object sender, EventArgs e) + { + textBox1.Text += "5"; + } + + private void button15_Click(object sender, EventArgs e) + { + textBox1.Text += "6"; + } + + private void button17_Click(object sender, EventArgs e) + { + textBox1.Text += "7"; + } + + private void button18_Click(object sender, EventArgs e) + { + textBox1.Text += "8"; + } + + private void button19_Click_1(object sender, EventArgs e) + { + textBox1.Text += "9"; + } + + private void button24_Click(object sender, EventArgs e) + { + textBox1.Text += "0"; + } + + private void button23_Click(object sender, EventArgs e) + { + textBox1.Text = CalcClass.ToggleSign(textBox1.Text); + } + + private void button22_Click(object sender, EventArgs e) + { + textBox1.Text += "%"; + } + + private void button8_Click(object sender, EventArgs e) + { + textBox1.Text += "/"; + } + + private void button12_Click(object sender, EventArgs e) + { + textBox1.Text += "*"; + } + + private void button16_Click(object sender, EventArgs e) + { + textBox1.Text += "-"; + } + + private void button20_Click(object sender, EventArgs e) + { + textBox1.Text += "+"; + } + + private void button21_Click(object sender, EventArgs e) + { + string expression = textBox1.Text; + try + { + object result = CalcClass.EvaluateExpression(expression); + textBox2.Text = Convert.ToString(result); + } + catch (Exception ex) + { + textBox2.Text = "Error"; + MessageBox.Show("Invalid expression: " + ex.Message, "будет реализовано позже", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void label2_Click(object sender, EventArgs e) + { + + } + + private void button27_Click(object sender, EventArgs e) + { + textBox1.Text += "sin("; + } + + private void button26_Click(object sender, EventArgs e) + { + textBox1.Text += "cos("; + } + + private void button25_Click(object sender, EventArgs e) + { + textBox1.Text += "square("; + } + + private void button28_Click(object sender, EventArgs e) + { + textBox1.Text += "cube("; + } + + private void button29_Click(object sender, EventArgs e) + { + textBox1.Text += "."; + } + } + + public class CalcClass + { + public static object EvaluateExpression(string expression) + { + //square(), cube(), sin(), cos() + expression = Regex.Replace(expression, @"(sin|cos|square|cube)\(([^)]+)\)", match => { + string functionName = match.Groups[1].Value; + string argumentStr = match.Groups[2].Value; + + object argumentValObj = EvaluateExpression(argumentStr); + double argumentVal = Convert.ToDouble(argumentValObj); + + double result = 0; + + switch (functionName) + { + case "sin": + result = Math.Sin(argumentVal); + break; + case "cos": + result = Math.Cos(argumentVal); + break; + case "square": + result = argumentVal * argumentVal; + break; + case "cube": + result = argumentVal * argumentVal * argumentVal; + break; + } + + return result.ToString(CultureInfo.InvariantCulture); + }); + + //для базовых операций (+, -, *, /, %) + DataTable dt = new DataTable(); + dt.Locale = CultureInfo.InvariantCulture; + + return dt.Compute(expression, null); + } + + public static long Mod(long a, long b) + { + return a % b; + } + + public static string ToggleSign(string currentValue) + { + if (string.IsNullOrEmpty(currentValue)) + { + return "0"; + } + + if (double.TryParse(currentValue, NumberStyles.Any, CultureInfo.InvariantCulture, out double number)) + { + return (-number).ToString(CultureInfo.InvariantCulture); + } + + return currentValue; + } + } +} \ No newline at end of file diff --git a/Form1.resx b/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Form1.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/calculator/.vs/calculator/FileContentIndex/033c0375-3c56-4c53-8ce6-bf5e8c895882.vsidx b/calculator/.vs/calculator/FileContentIndex/033c0375-3c56-4c53-8ce6-bf5e8c895882.vsidx new file mode 100644 index 0000000..70aef67 Binary files /dev/null and b/calculator/.vs/calculator/FileContentIndex/033c0375-3c56-4c53-8ce6-bf5e8c895882.vsidx differ diff --git a/calculator/.vs/calculator/FileContentIndex/3545fc7d-77d0-4e38-a172-750400693693.vsidx b/calculator/.vs/calculator/FileContentIndex/3545fc7d-77d0-4e38-a172-750400693693.vsidx new file mode 100644 index 0000000..2918701 Binary files /dev/null and b/calculator/.vs/calculator/FileContentIndex/3545fc7d-77d0-4e38-a172-750400693693.vsidx differ diff --git a/calculator/.vs/calculator/FileContentIndex/44163988-f519-4921-a707-c5f2076c6626.vsidx b/calculator/.vs/calculator/FileContentIndex/44163988-f519-4921-a707-c5f2076c6626.vsidx new file mode 100644 index 0000000..70aef67 Binary files /dev/null and b/calculator/.vs/calculator/FileContentIndex/44163988-f519-4921-a707-c5f2076c6626.vsidx differ diff --git a/calculator/.vs/calculator/FileContentIndex/cfca31c6-e270-427c-a87d-629cff4088ed.vsidx b/calculator/.vs/calculator/FileContentIndex/cfca31c6-e270-427c-a87d-629cff4088ed.vsidx new file mode 100644 index 0000000..70aef67 Binary files /dev/null and b/calculator/.vs/calculator/FileContentIndex/cfca31c6-e270-427c-a87d-629cff4088ed.vsidx differ diff --git a/calculator/.vs/calculator/v17/.suo b/calculator/.vs/calculator/v17/.suo new file mode 100644 index 0000000..2ce243e Binary files /dev/null and b/calculator/.vs/calculator/v17/.suo differ diff --git a/calculator/calculator.sln b/calculator/calculator.sln new file mode 100644 index 0000000..194e4ec --- /dev/null +++ b/calculator/calculator.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}") = "calculator", "calculator\calculator.csproj", "{AE0E32D3-F62C-4DB6-9792-33CFEB5E995A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AE0E32D3-F62C-4DB6-9792-33CFEB5E995A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AE0E32D3-F62C-4DB6-9792-33CFEB5E995A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AE0E32D3-F62C-4DB6-9792-33CFEB5E995A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AE0E32D3-F62C-4DB6-9792-33CFEB5E995A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BBC7C084-6F94-4D12-AC2D-DE4705D4692A} + EndGlobalSection +EndGlobal diff --git a/calculator/calculator/App.config b/calculator/calculator/App.config new file mode 100644 index 0000000..193aecc --- /dev/null +++ b/calculator/calculator/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/calculator/calculator/Form1.Designer.cs b/calculator/calculator/Form1.Designer.cs new file mode 100644 index 0000000..4883114 --- /dev/null +++ b/calculator/calculator/Form1.Designer.cs @@ -0,0 +1,363 @@ +namespace calculator +{ + 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.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.button6 = new System.Windows.Forms.Button(); + this.button7 = new System.Windows.Forms.Button(); + this.button8 = new System.Windows.Forms.Button(); + this.button9 = new System.Windows.Forms.Button(); + this.button10 = new System.Windows.Forms.Button(); + this.button11 = new System.Windows.Forms.Button(); + this.button12 = new System.Windows.Forms.Button(); + this.button13 = new System.Windows.Forms.Button(); + this.button14 = new System.Windows.Forms.Button(); + this.button15 = new System.Windows.Forms.Button(); + this.button16 = new System.Windows.Forms.Button(); + this.button17 = new System.Windows.Forms.Button(); + this.button18 = new System.Windows.Forms.Button(); + this.button19 = new System.Windows.Forms.Button(); + this.button20 = new System.Windows.Forms.Button(); + this.button21 = new System.Windows.Forms.Button(); + this.button22 = new System.Windows.Forms.Button(); + this.button23 = new System.Windows.Forms.Button(); + this.button24 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(84, 21); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(72, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Калькулятор"; + this.label1.Click += new System.EventHandler(this.label1_Click); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(12, 60); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(218, 20); + this.textBox1.TabIndex = 1; + this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(12, 99); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(50, 37); + this.button1.TabIndex = 2; + this.button1.Text = "%"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(68, 99); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(50, 37); + this.button2.TabIndex = 3; + this.button2.Text = "^"; + this.button2.UseVisualStyleBackColor = true; + // + // button3 + // + this.button3.Location = new System.Drawing.Point(124, 99); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(50, 37); + this.button3.TabIndex = 4; + this.button3.Text = "("; + this.button3.UseVisualStyleBackColor = true; + // + // button4 + // + this.button4.Location = new System.Drawing.Point(180, 99); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(50, 37); + this.button4.TabIndex = 5; + this.button4.Text = ")"; + this.button4.UseVisualStyleBackColor = true; + // + // button5 + // + this.button5.Location = new System.Drawing.Point(12, 142); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(50, 37); + this.button5.TabIndex = 6; + this.button5.Text = "C"; + this.button5.UseVisualStyleBackColor = true; + // + // button6 + // + this.button6.Location = new System.Drawing.Point(68, 142); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(50, 37); + this.button6.TabIndex = 7; + this.button6.Text = "CE"; + this.button6.UseVisualStyleBackColor = true; + // + // button7 + // + this.button7.Location = new System.Drawing.Point(124, 142); + this.button7.Name = "button7"; + this.button7.Size = new System.Drawing.Size(50, 37); + this.button7.TabIndex = 8; + this.button7.Text = "<-x"; + this.button7.UseVisualStyleBackColor = true; + // + // button8 + // + this.button8.Location = new System.Drawing.Point(180, 142); + this.button8.Name = "button8"; + this.button8.Size = new System.Drawing.Size(50, 37); + this.button8.TabIndex = 9; + this.button8.Text = "/"; + this.button8.UseVisualStyleBackColor = true; + // + // button9 + // + this.button9.Location = new System.Drawing.Point(12, 185); + this.button9.Name = "button9"; + this.button9.Size = new System.Drawing.Size(50, 37); + this.button9.TabIndex = 10; + this.button9.Text = "1"; + this.button9.UseVisualStyleBackColor = true; + // + // button10 + // + this.button10.Location = new System.Drawing.Point(68, 185); + this.button10.Name = "button10"; + this.button10.Size = new System.Drawing.Size(50, 37); + this.button10.TabIndex = 11; + this.button10.Text = "2"; + this.button10.UseVisualStyleBackColor = true; + // + // button11 + // + this.button11.Location = new System.Drawing.Point(124, 185); + this.button11.Name = "button11"; + this.button11.Size = new System.Drawing.Size(50, 37); + this.button11.TabIndex = 12; + this.button11.Text = "3"; + this.button11.UseVisualStyleBackColor = true; + // + // button12 + // + this.button12.Location = new System.Drawing.Point(180, 185); + this.button12.Name = "button12"; + this.button12.Size = new System.Drawing.Size(50, 37); + this.button12.TabIndex = 13; + this.button12.Text = "*"; + this.button12.UseVisualStyleBackColor = true; + // + // button13 + // + this.button13.Location = new System.Drawing.Point(12, 228); + this.button13.Name = "button13"; + this.button13.Size = new System.Drawing.Size(50, 37); + this.button13.TabIndex = 14; + this.button13.Text = "4"; + this.button13.UseVisualStyleBackColor = true; + // + // button14 + // + this.button14.Location = new System.Drawing.Point(68, 228); + this.button14.Name = "button14"; + this.button14.Size = new System.Drawing.Size(50, 37); + this.button14.TabIndex = 15; + this.button14.Text = "5"; + this.button14.UseVisualStyleBackColor = true; + // + // button15 + // + this.button15.Location = new System.Drawing.Point(124, 228); + this.button15.Name = "button15"; + this.button15.Size = new System.Drawing.Size(50, 37); + this.button15.TabIndex = 16; + this.button15.Text = "6"; + this.button15.UseVisualStyleBackColor = true; + // + // button16 + // + this.button16.Location = new System.Drawing.Point(180, 228); + this.button16.Name = "button16"; + this.button16.Size = new System.Drawing.Size(50, 37); + this.button16.TabIndex = 17; + this.button16.Text = "-"; + this.button16.UseVisualStyleBackColor = true; + // + // button17 + // + this.button17.Location = new System.Drawing.Point(12, 271); + this.button17.Name = "button17"; + this.button17.Size = new System.Drawing.Size(50, 37); + this.button17.TabIndex = 18; + this.button17.Text = "7"; + this.button17.UseVisualStyleBackColor = true; + // + // button18 + // + this.button18.Location = new System.Drawing.Point(68, 271); + this.button18.Name = "button18"; + this.button18.Size = new System.Drawing.Size(50, 37); + this.button18.TabIndex = 19; + this.button18.Text = "8"; + this.button18.UseVisualStyleBackColor = true; + // + // button19 + // + this.button19.Location = new System.Drawing.Point(124, 271); + this.button19.Name = "button19"; + this.button19.Size = new System.Drawing.Size(50, 37); + this.button19.TabIndex = 20; + this.button19.Text = "9"; + this.button19.UseVisualStyleBackColor = true; + this.button19.Click += new System.EventHandler(this.button19_Click); + // + // button20 + // + this.button20.Location = new System.Drawing.Point(180, 271); + this.button20.Name = "button20"; + this.button20.Size = new System.Drawing.Size(50, 37); + this.button20.TabIndex = 21; + this.button20.Text = "+"; + this.button20.UseVisualStyleBackColor = true; + // + // button21 + // + this.button21.Location = new System.Drawing.Point(180, 314); + this.button21.Name = "button21"; + this.button21.Size = new System.Drawing.Size(50, 37); + this.button21.TabIndex = 25; + this.button21.Text = "="; + this.button21.UseVisualStyleBackColor = true; + // + // button22 + // + this.button22.Location = new System.Drawing.Point(124, 314); + this.button22.Name = "button22"; + this.button22.Size = new System.Drawing.Size(50, 37); + this.button22.TabIndex = 24; + this.button22.Text = "."; + this.button22.UseVisualStyleBackColor = true; + // + // button23 + // + this.button23.Location = new System.Drawing.Point(68, 314); + this.button23.Name = "button23"; + this.button23.Size = new System.Drawing.Size(50, 37); + this.button23.TabIndex = 23; + this.button23.Text = "00 "; + this.button23.UseVisualStyleBackColor = true; + // + // button24 + // + this.button24.Location = new System.Drawing.Point(12, 314); + this.button24.Name = "button24"; + this.button24.Size = new System.Drawing.Size(50, 37); + this.button24.TabIndex = 22; + this.button24.Text = "0"; + this.button24.UseVisualStyleBackColor = true; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(248, 389); + this.Controls.Add(this.button21); + this.Controls.Add(this.button22); + this.Controls.Add(this.button23); + this.Controls.Add(this.button24); + this.Controls.Add(this.button20); + this.Controls.Add(this.button19); + this.Controls.Add(this.button18); + this.Controls.Add(this.button17); + this.Controls.Add(this.button16); + this.Controls.Add(this.button15); + this.Controls.Add(this.button14); + this.Controls.Add(this.button13); + this.Controls.Add(this.button12); + this.Controls.Add(this.button11); + this.Controls.Add(this.button10); + this.Controls.Add(this.button9); + this.Controls.Add(this.button8); + this.Controls.Add(this.button7); + this.Controls.Add(this.button6); + this.Controls.Add(this.button5); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button button6; + private System.Windows.Forms.Button button7; + private System.Windows.Forms.Button button8; + private System.Windows.Forms.Button button9; + private System.Windows.Forms.Button button10; + private System.Windows.Forms.Button button11; + private System.Windows.Forms.Button button12; + private System.Windows.Forms.Button button13; + private System.Windows.Forms.Button button14; + private System.Windows.Forms.Button button15; + private System.Windows.Forms.Button button16; + private System.Windows.Forms.Button button17; + private System.Windows.Forms.Button button18; + private System.Windows.Forms.Button button19; + private System.Windows.Forms.Button button20; + private System.Windows.Forms.Button button21; + private System.Windows.Forms.Button button22; + private System.Windows.Forms.Button button23; + private System.Windows.Forms.Button button24; + } +} + diff --git a/calculator/calculator/Form1.cs b/calculator/calculator/Form1.cs new file mode 100644 index 0000000..190e051 --- /dev/null +++ b/calculator/calculator/Form1.cs @@ -0,0 +1,45 @@ +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 calculator +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void label1_Click(object sender, EventArgs e) + { + + } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + + } + + private void button19_Click(object sender, EventArgs e) + { + textBox1.Text += "9"; + } + + private void button1_Click(object sender, EventArgs e) + { + textBox1.Text += "%"; + } + private void button2_Click(object sender, EventArgs e) + { + textBox1.Text += "^"; + } + + } +} diff --git a/calculator/calculator/Form1.resx b/calculator/calculator/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/calculator/calculator/Form1.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/calculator/calculator/Program.cs b/calculator/calculator/Program.cs new file mode 100644 index 0000000..5377607 --- /dev/null +++ b/calculator/calculator/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace calculator +{ + internal static class Program + { + /// + /// Главная точка входа для приложения. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/calculator/calculator/Properties/AssemblyInfo.cs b/calculator/calculator/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0b250f4 --- /dev/null +++ b/calculator/calculator/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Общие сведения об этой сборке предоставляются следующим набором +// набора атрибутов. Измените значения этих атрибутов для изменения сведений, +// связанных со сборкой. +[assembly: AssemblyTitle("calculator")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("calculator")] +[assembly: AssemblyCopyright("Copyright © 2025")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми +// для компонентов COM. Если необходимо обратиться к типу в этой сборке через +// COM, следует установить атрибут ComVisible в TRUE для этого типа. +[assembly: ComVisible(false)] + +// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM +[assembly: Guid("ae0e32d3-f62c-4db6-9792-33cfeb5e995a")] + +// Сведения о версии сборки состоят из указанных ниже четырех значений: +// +// Основной номер версии +// Дополнительный номер версии +// Номер сборки +// Редакция +// +// Можно задать все значения или принять номера сборки и редакции по умолчанию +// используя "*", как показано ниже: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/calculator/calculator/Properties/Resources.Designer.cs b/calculator/calculator/Properties/Resources.Designer.cs new file mode 100644 index 0000000..4d077e9 --- /dev/null +++ b/calculator/calculator/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программным средством. +// Версия среды выполнения: 4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если +// код создан повторно. +// +//------------------------------------------------------------------------------ + +namespace calculator.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("calculator.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/calculator/calculator/Properties/Resources.resx b/calculator/calculator/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/calculator/calculator/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/calculator/calculator/Properties/Settings.Designer.cs b/calculator/calculator/Properties/Settings.Designer.cs new file mode 100644 index 0000000..3a849d6 --- /dev/null +++ b/calculator/calculator/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 calculator.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/calculator/calculator/Properties/Settings.settings b/calculator/calculator/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/calculator/calculator/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/calculator/calculator/bin/Debug/5968350.ico b/calculator/calculator/bin/Debug/5968350.ico new file mode 100644 index 0000000..a29196d Binary files /dev/null and b/calculator/calculator/bin/Debug/5968350.ico differ diff --git a/calculator/calculator/bin/Debug/calculator.exe b/calculator/calculator/bin/Debug/calculator.exe new file mode 100644 index 0000000..ef28f44 Binary files /dev/null and b/calculator/calculator/bin/Debug/calculator.exe differ diff --git a/calculator/calculator/bin/Debug/calculator.exe.config b/calculator/calculator/bin/Debug/calculator.exe.config new file mode 100644 index 0000000..193aecc --- /dev/null +++ b/calculator/calculator/bin/Debug/calculator.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/calculator/calculator/bin/Debug/calculator.pdb b/calculator/calculator/bin/Debug/calculator.pdb new file mode 100644 index 0000000..9602dbe Binary files /dev/null and b/calculator/calculator/bin/Debug/calculator.pdb differ diff --git a/calculator/calculator/bin/Debug/Спецификация.doc b/calculator/calculator/bin/Debug/Спецификация.doc new file mode 100644 index 0000000..9c04666 Binary files /dev/null and b/calculator/calculator/bin/Debug/Спецификация.doc differ diff --git a/calculator/calculator/calculator.csproj b/calculator/calculator/calculator.csproj new file mode 100644 index 0000000..39b46ba --- /dev/null +++ b/calculator/calculator/calculator.csproj @@ -0,0 +1,86 @@ + + + + + Debug + AnyCPU + {AE0E32D3-F62C-4DB6-9792-33CFEB5E995A} + WinExe + calculator + calculator + v4.8 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + Form1.cs + + + Form1.cs + Form1.Designer.cs + + + + + Form1.cs + Form1.resx + + + 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/calculator/calculator/obj/Debug/.NETFramework,Version=v4.8.AssemblyAttributes.cs b/calculator/calculator/obj/Debug/.NETFramework,Version=v4.8.AssemblyAttributes.cs new file mode 100644 index 0000000..15efebf --- /dev/null +++ b/calculator/calculator/obj/Debug/.NETFramework,Version=v4.8.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] diff --git a/calculator/calculator/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/calculator/calculator/obj/Debug/DesignTimeResolveAssemblyReferences.cache new file mode 100644 index 0000000..5d25611 Binary files /dev/null and b/calculator/calculator/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/calculator/calculator/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/calculator/calculator/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..1e88cc7 Binary files /dev/null and b/calculator/calculator/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/calculator/calculator/obj/Debug/calculator.Form1.resources b/calculator/calculator/obj/Debug/calculator.Form1.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/calculator/calculator/obj/Debug/calculator.Form1.resources differ diff --git a/calculator/calculator/obj/Debug/calculator.Properties.Resources.resources b/calculator/calculator/obj/Debug/calculator.Properties.Resources.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/calculator/calculator/obj/Debug/calculator.Properties.Resources.resources differ diff --git a/calculator/calculator/obj/Debug/calculator.csproj.AssemblyReference.cache b/calculator/calculator/obj/Debug/calculator.csproj.AssemblyReference.cache new file mode 100644 index 0000000..43b09ba Binary files /dev/null and b/calculator/calculator/obj/Debug/calculator.csproj.AssemblyReference.cache differ diff --git a/calculator/calculator/obj/Debug/calculator.csproj.CoreCompileInputs.cache b/calculator/calculator/obj/Debug/calculator.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..997860e --- /dev/null +++ b/calculator/calculator/obj/Debug/calculator.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +0677eb292676b0d9e744478dd1f5d79da3b415878a6aead887592c308f35ac0e diff --git a/calculator/calculator/obj/Debug/calculator.csproj.FileListAbsolute.txt b/calculator/calculator/obj/Debug/calculator.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..920294a --- /dev/null +++ b/calculator/calculator/obj/Debug/calculator.csproj.FileListAbsolute.txt @@ -0,0 +1,20 @@ +C:\Users\Student\Documents\Новая папка (2)\calculator\calculator\bin\Debug\calculator.exe.config +C:\Users\Student\Documents\Новая папка (2)\calculator\calculator\bin\Debug\calculator.exe +C:\Users\Student\Documents\Новая папка (2)\calculator\calculator\bin\Debug\calculator.pdb +C:\Users\Student\Documents\Новая папка (2)\calculator\calculator\obj\Debug\calculator.csproj.AssemblyReference.cache +C:\Users\Student\Documents\Новая папка (2)\calculator\calculator\obj\Debug\calculator.Form1.resources +C:\Users\Student\Documents\Новая папка (2)\calculator\calculator\obj\Debug\calculator.Properties.Resources.resources +C:\Users\Student\Documents\Новая папка (2)\calculator\calculator\obj\Debug\calculator.csproj.GenerateResource.cache +C:\Users\Student\Documents\Новая папка (2)\calculator\calculator\obj\Debug\calculator.csproj.CoreCompileInputs.cache +C:\Users\Student\Documents\Новая папка (2)\calculator\calculator\obj\Debug\calculator.exe +C:\Users\Student\Documents\Новая папка (2)\calculator\calculator\obj\Debug\calculator.pdb +C:\Users\Student\Documents\new\calculator\calculator\bin\Debug\calculator.exe.config +C:\Users\Student\Documents\new\calculator\calculator\bin\Debug\calculator.exe +C:\Users\Student\Documents\new\calculator\calculator\bin\Debug\calculator.pdb +C:\Users\Student\Documents\new\calculator\calculator\obj\Debug\calculator.csproj.AssemblyReference.cache +C:\Users\Student\Documents\new\calculator\calculator\obj\Debug\calculator.Form1.resources +C:\Users\Student\Documents\new\calculator\calculator\obj\Debug\calculator.Properties.Resources.resources +C:\Users\Student\Documents\new\calculator\calculator\obj\Debug\calculator.csproj.GenerateResource.cache +C:\Users\Student\Documents\new\calculator\calculator\obj\Debug\calculator.csproj.CoreCompileInputs.cache +C:\Users\Student\Documents\new\calculator\calculator\obj\Debug\calculator.exe +C:\Users\Student\Documents\new\calculator\calculator\obj\Debug\calculator.pdb diff --git a/calculator/calculator/obj/Debug/calculator.csproj.GenerateResource.cache b/calculator/calculator/obj/Debug/calculator.csproj.GenerateResource.cache new file mode 100644 index 0000000..20c15f0 Binary files /dev/null and b/calculator/calculator/obj/Debug/calculator.csproj.GenerateResource.cache differ diff --git a/calculator/calculator/obj/Debug/calculator.exe b/calculator/calculator/obj/Debug/calculator.exe new file mode 100644 index 0000000..ef28f44 Binary files /dev/null and b/calculator/calculator/obj/Debug/calculator.exe differ diff --git a/calculator/calculator/obj/Debug/calculator.pdb b/calculator/calculator/obj/Debug/calculator.pdb new file mode 100644 index 0000000..9602dbe Binary files /dev/null and b/calculator/calculator/obj/Debug/calculator.pdb differ diff --git a/calculator/calculator/obj/Release/.NETFramework,Version=v4.8.AssemblyAttributes.cs b/calculator/calculator/obj/Release/.NETFramework,Version=v4.8.AssemblyAttributes.cs new file mode 100644 index 0000000..15efebf --- /dev/null +++ b/calculator/calculator/obj/Release/.NETFramework,Version=v4.8.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] diff --git a/calculator/calculator/obj/Release/calculator.csproj.AssemblyReference.cache b/calculator/calculator/obj/Release/calculator.csproj.AssemblyReference.cache new file mode 100644 index 0000000..43b09ba Binary files /dev/null and b/calculator/calculator/obj/Release/calculator.csproj.AssemblyReference.cache differ diff --git a/Спецификация.doc b/Спецификация.doc new file mode 100644 index 0000000..9c04666 Binary files /dev/null and b/Спецификация.doc differ diff --git a/скрипт/DeleteGitCreads.ps1 b/скрипт/DeleteGitCreads.ps1 new file mode 100644 index 0000000..4085243 --- /dev/null +++ b/скрипт/DeleteGitCreads.ps1 @@ -0,0 +1,39 @@ +[System.Console]::OutputEncoding = [System.Text.Encoding]::UTF8 + +# Устанавливаем политику выполнения +Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force + +# Получаем список всех сохраненных учетных данных +$credList = cmdkey /list + +# Задаем имя цели для поиска +$targetName = "git.pgk.alspio.com" + +# Ищем в списке строку, содержащую нужное имя цели +$credentialToDelete = $credList | Where-Object { $_ -like "*Target:*" -and $_ -like "*$targetName*" } + +# Проверяем, были ли найдены учетные данные +if ($credentialToDelete) { + # Извлекаем точное имя цели из найденной строки + # Строка имеет формат " Target: git:https://git.pgk.alspio.com" + # Убираем " Target: " из начала строки + $exactTarget = ($credentialToDelete -split 'Target: ')[1].Trim() + + Write-Host "Найдены учетные данные для удаления: $exactTarget" -ForegroundColor Yellow + + # Запускаем команду для удаления учетных данных + try { + cmdkey /delete:$exactTarget + Write-Host "Учетные данные '$exactTarget' успешно удалены." -ForegroundColor Green + } + catch { + Write-Host "Произошла ошибка при удалении учетных данных." -ForegroundColor Red + Write-Host $_.Exception.Message + } +} +else { + Write-Host "Учетные данные, содержащие '$targetName', не найдены." -ForegroundColor Cyan +} + +# Пауза, чтобы пользователь мог увидеть результат +Read-Host "Нажмите Enter для завершения..." \ No newline at end of file diff --git a/скрипт/RunScript.bat b/скрипт/RunScript.bat new file mode 100644 index 0000000..2b54cdd --- /dev/null +++ b/скрипт/RunScript.bat @@ -0,0 +1,3 @@ +@echo off +powershell -ExecutionPolicy Bypass -File "%~dp0DeleteGitCreads.ps1" +pause \ No newline at end of file