From 091d5b00dc122bf9a0beb319df6eb03e76cf64bb Mon Sep 17 00:00:00 2001 From: FeLL1kS Date: Sat, 2 Mar 2019 13:44:36 +0300 Subject: [PATCH 01/13] Date --- CourseApp/GetAge.cs | 31 +++++++++++++++++++++++++++++++ CourseApp/Program.cs | 2 ++ 2 files changed, 33 insertions(+) create mode 100644 CourseApp/GetAge.cs diff --git a/CourseApp/GetAge.cs b/CourseApp/GetAge.cs new file mode 100644 index 0000000..78271f1 --- /dev/null +++ b/CourseApp/GetAge.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public class GetAge + { + public void GetInfo() + { + DateTime date = new DateTime(2000, 03, 25); + DateTime result = DateTime.Today; + + result = result.AddYears(-date.Year); + result = result.AddDays(-date.Day); + result = result.AddMonths(-date.Month); + + int days = DateTime.Today.Subtract(date).Days; + int years = days / 365; + int months = 0; + while (date.AddMonths(1) <= DateTime.Today) + { + date = date.AddMonths(1); + months++; + } + + Console.WriteLine($"{years}, { days}, {months}"); + Console.WriteLine($"{result.Year}, {result.Day}, {result.Month}"); + } + } +} diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index d29bb4c..c086cb9 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -39,6 +39,8 @@ private static void Main() i.GetInfo(); } + GetAge getAge = new GetAge(); + getAge.GetInfo(); Console.ReadKey(); } } From ca5a3a83467012900d66ca7d5357be004494f1b8 Mon Sep 17 00:00:00 2001 From: FeLL1kS Date: Sun, 3 Mar 2019 00:46:42 +0300 Subject: [PATCH 02/13] Date 2 --- CourseApp.Tests/UnitTest5.cs | 36 ++++++++++++++++++++++++++++++++++++ CourseApp/GetAge.cs | 17 +++-------------- CourseApp/Program.cs | 2 +- 3 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 CourseApp.Tests/UnitTest5.cs diff --git a/CourseApp.Tests/UnitTest5.cs b/CourseApp.Tests/UnitTest5.cs new file mode 100644 index 0000000..01d5d98 --- /dev/null +++ b/CourseApp.Tests/UnitTest5.cs @@ -0,0 +1,36 @@ +using System; +using CourseApp; +using Xunit; + +namespace CourseApp.Tests +{ + public class UnitTest5 + { + [Fact] + public void DateTest1() + { + GetAge newAge = new GetAge(); + Assert.Equal(18, newAge.GetInfo(25, 03, 2000).Year); + Assert.Equal(11, newAge.GetInfo(25, 03, 2000).Month); + Assert.Equal(6, newAge.GetInfo(25, 03, 2000).Day); + } + + [Fact] + public void DateTest2() + { + GetAge newAge = new GetAge(); + Assert.Equal(43, newAge.GetInfo(30, 10, 1975).Year); + Assert.Equal(4, newAge.GetInfo(30, 10, 1975).Month); + Assert.Equal(2, newAge.GetInfo(30, 10, 1975).Day); + } + + [Fact] + public void DateTest3() + { + GetAge newAge = new GetAge(); + Assert.Equal(40, newAge.GetInfo(30, 09, 1978).Year); + Assert.Equal(5, newAge.GetInfo(30, 09, 1978).Month); + Assert.Equal(1, newAge.GetInfo(30, 09, 1978).Day); + } + } +} diff --git a/CourseApp/GetAge.cs b/CourseApp/GetAge.cs index 78271f1..415f5a0 100644 --- a/CourseApp/GetAge.cs +++ b/CourseApp/GetAge.cs @@ -6,26 +6,15 @@ namespace CourseApp { public class GetAge { - public void GetInfo() + public DateTime GetInfo(int dd, int mm, int yyyy) { - DateTime date = new DateTime(2000, 03, 25); + DateTime date = new DateTime(yyyy, mm, dd); DateTime result = DateTime.Today; - result = result.AddYears(-date.Year); result = result.AddDays(-date.Day); result = result.AddMonths(-date.Month); - - int days = DateTime.Today.Subtract(date).Days; - int years = days / 365; - int months = 0; - while (date.AddMonths(1) <= DateTime.Today) - { - date = date.AddMonths(1); - months++; - } - - Console.WriteLine($"{years}, { days}, {months}"); Console.WriteLine($"{result.Year}, {result.Day}, {result.Month}"); + return result; } } } diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index c086cb9..7dfb5e2 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -40,7 +40,7 @@ private static void Main() } GetAge getAge = new GetAge(); - getAge.GetInfo(); + getAge.GetInfo(30, 09, 1978); Console.ReadKey(); } } From 7cd33e1fce127b01c2a984014dadb10426718d2e Mon Sep 17 00:00:00 2001 From: FeLL1kS Date: Mon, 11 Mar 2019 14:11:11 +0300 Subject: [PATCH 03/13] New Lab --- CourseApp.Tests/UnitTest5.cs | 21 ++++++--------------- CourseApp/GetAge.cs | 14 ++++++-------- CourseApp/Program.cs | 4 +++- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/CourseApp.Tests/UnitTest5.cs b/CourseApp.Tests/UnitTest5.cs index 01d5d98..a645076 100644 --- a/CourseApp.Tests/UnitTest5.cs +++ b/CourseApp.Tests/UnitTest5.cs @@ -6,31 +6,22 @@ namespace CourseApp.Tests { public class UnitTest5 { - [Fact] - public void DateTest1() - { - GetAge newAge = new GetAge(); - Assert.Equal(18, newAge.GetInfo(25, 03, 2000).Year); - Assert.Equal(11, newAge.GetInfo(25, 03, 2000).Month); - Assert.Equal(6, newAge.GetInfo(25, 03, 2000).Day); - } - [Fact] public void DateTest2() { GetAge newAge = new GetAge(); - Assert.Equal(43, newAge.GetInfo(30, 10, 1975).Year); - Assert.Equal(4, newAge.GetInfo(30, 10, 1975).Month); - Assert.Equal(2, newAge.GetInfo(30, 10, 1975).Day); + DateTime birthDate = new DateTime(1975, 10, 30); + DateTime nowDate = new DateTime(2019, 03, 06); + Assert.Equal("43, 4, 6", newAge.GetInfo(birthDate, nowDate)); } [Fact] public void DateTest3() { GetAge newAge = new GetAge(); - Assert.Equal(40, newAge.GetInfo(30, 09, 1978).Year); - Assert.Equal(5, newAge.GetInfo(30, 09, 1978).Month); - Assert.Equal(1, newAge.GetInfo(30, 09, 1978).Day); + DateTime birthDate = new DateTime(1978, 09, 30); + DateTime nowDate = new DateTime(2019, 03, 06); + Assert.Equal("40, 5, 7", newAge.GetInfo(birthDate, nowDate)); } } } diff --git a/CourseApp/GetAge.cs b/CourseApp/GetAge.cs index 415f5a0..020e9ef 100644 --- a/CourseApp/GetAge.cs +++ b/CourseApp/GetAge.cs @@ -6,15 +6,13 @@ namespace CourseApp { public class GetAge { - public DateTime GetInfo(int dd, int mm, int yyyy) + public string GetInfo(DateTime birthDate, DateTime nowDate) { - DateTime date = new DateTime(yyyy, mm, dd); - DateTime result = DateTime.Today; - result = result.AddYears(-date.Year); - result = result.AddDays(-date.Day); - result = result.AddMonths(-date.Month); - Console.WriteLine($"{result.Year}, {result.Day}, {result.Month}"); - return result; + nowDate = nowDate.AddYears(-birthDate.Year); + nowDate = nowDate.AddMonths(-birthDate.Month); + nowDate = nowDate.AddDays(-birthDate.Day); + + return $"{nowDate.Year}, {nowDate.Month}, {nowDate.Day}"; } } } diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index 7dfb5e2..b00a4cf 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -40,7 +40,9 @@ private static void Main() } GetAge getAge = new GetAge(); - getAge.GetInfo(30, 09, 1978); + DateTime birthDate = new DateTime(1975, 10, 30); + DateTime nowDate = new DateTime(2019, 03, 11); + Console.WriteLine(getAge.GetInfo(birthDate, nowDate)); Console.ReadKey(); } } From b876b84494840addf728fd5703cbdbbfad2ef72d Mon Sep 17 00:00:00 2001 From: User of A309 Date: Sat, 20 Apr 2019 09:31:38 +0400 Subject: [PATCH 04/13] Initial commit of A# --- ASharp/ASharp.csproj | 8 ++++++++ ASharp/ActionRead.cs | 14 ++++++++++++++ ASharp/CodeParser.cs | 25 +++++++++++++++++++++++++ ASharp/CodeReader.cs | 18 ++++++++++++++++++ ASharp/Program.cs | 29 +++++++++++++++++++++++++++++ ASharp/code.txt | 2 ++ CourseApp/Appliances.cs | 2 +- CourseApp/IStatus.cs | 7 +++++++ 8 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 ASharp/ASharp.csproj create mode 100644 ASharp/ActionRead.cs create mode 100644 ASharp/CodeParser.cs create mode 100644 ASharp/CodeReader.cs create mode 100644 ASharp/Program.cs create mode 100644 ASharp/code.txt create mode 100644 CourseApp/IStatus.cs diff --git a/ASharp/ASharp.csproj b/ASharp/ASharp.csproj new file mode 100644 index 0000000..ce1697a --- /dev/null +++ b/ASharp/ASharp.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.0 + + + diff --git a/ASharp/ActionRead.cs b/ASharp/ActionRead.cs new file mode 100644 index 0000000..8181d91 --- /dev/null +++ b/ASharp/ActionRead.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ASharp +{ + class ActionRead + { + public ActionRead(string action) + { + + } + } +} diff --git a/ASharp/CodeParser.cs b/ASharp/CodeParser.cs new file mode 100644 index 0000000..72978c6 --- /dev/null +++ b/ASharp/CodeParser.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ASharp +{ + class CodeParser + { + public string Parse(string[] code) + { + foreach(string i in code) + { + switch (i) + { + case "read": + return ""; + case "print": + return ""; + } + } + + return ""; + } + } +} diff --git a/ASharp/CodeReader.cs b/ASharp/CodeReader.cs new file mode 100644 index 0000000..e1ccebf --- /dev/null +++ b/ASharp/CodeReader.cs @@ -0,0 +1,18 @@ +using System.IO; + +namespace ASharp +{ + class CodeReader + { + public static string[] ReadFile(string path) + { + if (Path.HasExtension(path)) + { + string[] code = File.ReadAllLines(path); + return code; + } + + return null; + } + } +} diff --git a/ASharp/Program.cs b/ASharp/Program.cs new file mode 100644 index 0000000..142c914 --- /dev/null +++ b/ASharp/Program.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +namespace ASharp +{ + class Program + { + public static Dictionary Variables = new Dictionary(); + + public static void SetVariables(string key, int value) + { + if(!Program.Variables.ContainsKey(key)) + { + Program.Variables.Add(key, value); + } + } + + static void Main(string[] args) + { + + + string path = "D:/ASharp/code.txt"; + + string[] code = CodeReader.ReadFile(path); + + Console.ReadKey(); + } + } +} diff --git a/ASharp/code.txt b/ASharp/code.txt new file mode 100644 index 0000000..af278c4 --- /dev/null +++ b/ASharp/code.txt @@ -0,0 +1,2 @@ +read i +print i \ No newline at end of file diff --git a/CourseApp/Appliances.cs b/CourseApp/Appliances.cs index 89c5a62..afc6279 100644 --- a/CourseApp/Appliances.cs +++ b/CourseApp/Appliances.cs @@ -4,7 +4,7 @@ namespace CourseApp { - public abstract class Appliances + public abstract class Appliances : IStatus { private int model; private int age; diff --git a/CourseApp/IStatus.cs b/CourseApp/IStatus.cs new file mode 100644 index 0000000..d2063fa --- /dev/null +++ b/CourseApp/IStatus.cs @@ -0,0 +1,7 @@ +namespace CourseApp +{ + public interface IStatus + { + bool Status(); + } +} \ No newline at end of file From b56f05df36fc804cd56feb3433a1bbde673497ab Mon Sep 17 00:00:00 2001 From: User of A309 Date: Wed, 24 Apr 2019 14:42:24 +0400 Subject: [PATCH 05/13] Add regex --- ASharp/ActionRead.cs | 4 ++-- ASharp/CodeParser.cs | 20 ++++++++++++-------- ASharp/Program.cs | 4 +--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ASharp/ActionRead.cs b/ASharp/ActionRead.cs index 8181d91..a524240 100644 --- a/ASharp/ActionRead.cs +++ b/ASharp/ActionRead.cs @@ -6,9 +6,9 @@ namespace ASharp { class ActionRead { - public ActionRead(string action) + public static void Read(string action) { - + } } } diff --git a/ASharp/CodeParser.cs b/ASharp/CodeParser.cs index 72978c6..2f5c2b5 100644 --- a/ASharp/CodeParser.cs +++ b/ASharp/CodeParser.cs @@ -1,6 +1,5 @@ using System; -using System.Collections.Generic; -using System.Text; +using System.Text.RegularExpressions; namespace ASharp { @@ -8,15 +7,20 @@ class CodeParser { public string Parse(string[] code) { - foreach(string i in code) + string pattern = @"([a-z]+)\s([a-z]+)"; + foreach (string line in code) { - switch (i) + foreach(Match i in Regex.Matches(line, pattern)) { - case "read": - return ""; - case "print": - return ""; + switch (i.Groups[0].Value) + { + case "read": + ActionRead.Read(i.Groups[1].Value); + case "print": + return ""; + } } + } return ""; diff --git a/ASharp/Program.cs b/ASharp/Program.cs index 142c914..25e8f1b 100644 --- a/ASharp/Program.cs +++ b/ASharp/Program.cs @@ -7,7 +7,7 @@ class Program { public static Dictionary Variables = new Dictionary(); - public static void SetVariables(string key, int value) + public static void SetVariable(string key, int value) { if(!Program.Variables.ContainsKey(key)) { @@ -17,8 +17,6 @@ public static void SetVariables(string key, int value) static void Main(string[] args) { - - string path = "D:/ASharp/code.txt"; string[] code = CodeReader.ReadFile(path); From be80cf69d79a89785bf02d21c061aee87ba576df Mon Sep 17 00:00:00 2001 From: User of A309 Date: Wed, 24 Apr 2019 14:43:11 +0400 Subject: [PATCH 06/13] Add regex --- ASharp/CodeParser.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/ASharp/CodeParser.cs b/ASharp/CodeParser.cs index 2f5c2b5..dfa13c1 100644 --- a/ASharp/CodeParser.cs +++ b/ASharp/CodeParser.cs @@ -16,6 +16,7 @@ public string Parse(string[] code) { case "read": ActionRead.Read(i.Groups[1].Value); + break; case "print": return ""; } From d96e5c15f5fbed11cd0e042233ce72ad64e26e2c Mon Sep 17 00:00:00 2001 From: FeLL1kS Date: Fri, 3 May 2019 19:08:40 +0300 Subject: [PATCH 07/13] Added some new features --- ASharp/ActionPrint.cs | 18 ++++++++++++++++++ ASharp/ActionRead.cs | 4 +++- ASharp/CodeParser.cs | 31 +++++++++++++++---------------- ASharp/CodeParser_Default | 33 +++++++++++++++++++++++++++++++++ ASharp/Conditions.cs | 9 +++++++++ ASharp/Math.cs | 31 +++++++++++++++++++++++++++++++ ASharp/Program.cs | 4 +++- ASharp/code.txt | 4 +++- 8 files changed, 115 insertions(+), 19 deletions(-) create mode 100644 ASharp/ActionPrint.cs create mode 100644 ASharp/CodeParser_Default create mode 100644 ASharp/Conditions.cs create mode 100644 ASharp/Math.cs diff --git a/ASharp/ActionPrint.cs b/ASharp/ActionPrint.cs new file mode 100644 index 0000000..a4ac63d --- /dev/null +++ b/ASharp/ActionPrint.cs @@ -0,0 +1,18 @@ +using System; +using System.IO; +using System.Collections.Generic; + +namespace ASharp +{ + class ActionPrint + { + public static void Print(string action) + { + if(Program.Variables.ContainsKey(action)) + { + Console.WriteLine(Program.Variables[action]); + } + else Console.WriteLine($"Переменной {action} не существует"); + } + } +} \ No newline at end of file diff --git a/ASharp/ActionRead.cs b/ASharp/ActionRead.cs index a524240..7233ed8 100644 --- a/ASharp/ActionRead.cs +++ b/ASharp/ActionRead.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using System.IO; namespace ASharp { @@ -8,7 +9,8 @@ class ActionRead { public static void Read(string action) { - + int number = Convert.ToInt32(Console.ReadLine()); + Program.SetVariable(action, number); } } } diff --git a/ASharp/CodeParser.cs b/ASharp/CodeParser.cs index dfa13c1..ae4134b 100644 --- a/ASharp/CodeParser.cs +++ b/ASharp/CodeParser.cs @@ -5,26 +5,25 @@ namespace ASharp { class CodeParser { - public string Parse(string[] code) + public void Parse(string[] code) { - string pattern = @"([a-z]+)\s([a-z]+)"; - foreach (string line in code) + for(int i = 0; i <= code.Length - 1; i++) { - foreach(Match i in Regex.Matches(line, pattern)) - { - switch (i.Groups[0].Value) - { - case "read": - ActionRead.Read(i.Groups[1].Value); - break; - case "print": - return ""; - } - } + string[] splitedString = code[i].Split(' '); + switch (splitedString[0]) + { + case "read": + ActionRead.Read(splitedString[1]); + break; + case "print": + ActionPrint.Print(splitedString[1]); + break; + default: + Math.MathParser(code[i]); + break; + } } - - return ""; } } } diff --git a/ASharp/CodeParser_Default b/ASharp/CodeParser_Default new file mode 100644 index 0000000..9b9b567 --- /dev/null +++ b/ASharp/CodeParser_Default @@ -0,0 +1,33 @@ +using System; +using System.Text.RegularExpressions; + +namespace ASharp +{ + class CodeParser + { + public string Parse(string[] code) + { + string pattern = @"([a-z]+)\s(\w+)"; + foreach (string line in code) + { + foreach(Match i in Regex.Matches(line, pattern)) + { + switch (i.Groups[1].Value) + { + case "read": + ActionRead.Read(i.Groups[2].Value); + break; + case "print": + ActionPrint.Print(i.Groups[2].Value); + break; + default: + break; + } + } + + } + + return ""; + } + } +} diff --git a/ASharp/Conditions.cs b/ASharp/Conditions.cs new file mode 100644 index 0000000..b6aae93 --- /dev/null +++ b/ASharp/Conditions.cs @@ -0,0 +1,9 @@ +using System; + +namespace ASharp +{ + class Conditions + { + + } +} \ No newline at end of file diff --git a/ASharp/Math.cs b/ASharp/Math.cs new file mode 100644 index 0000000..dc97fb7 --- /dev/null +++ b/ASharp/Math.cs @@ -0,0 +1,31 @@ +using System; +using System.Text.RegularExpressions; + +namespace ASharp +{ + class Math + { + public static void MathParser(string code) + { + string pattern = @"([0-9]+)\s*([\/\+\-\*]+)\s*([0-9]+)"; + Match i = Regex.Match(code, pattern); + switch (i.Groups[2].Value) + { + case "+": + Console.WriteLine(Convert.ToInt32(i.Groups[1].Value) + Convert.ToInt32(i.Groups[3].Value)); + break; + case "-": + Console.WriteLine(Convert.ToInt32(i.Groups[1].Value) - Convert.ToInt32(i.Groups[3].Value)); + break; + case "*": + Console.WriteLine(Convert.ToInt32(i.Groups[1].Value) * Convert.ToInt32(i.Groups[3].Value)); + break; + case "/": + Console.WriteLine(Convert.ToInt32(i.Groups[1].Value) / Convert.ToInt32(i.Groups[3].Value)); + break; + default: + break; + } + } + } +} \ No newline at end of file diff --git a/ASharp/Program.cs b/ASharp/Program.cs index 25e8f1b..239be2e 100644 --- a/ASharp/Program.cs +++ b/ASharp/Program.cs @@ -17,9 +17,11 @@ public static void SetVariable(string key, int value) static void Main(string[] args) { - string path = "D:/ASharp/code.txt"; + string path = "./code.txt"; string[] code = CodeReader.ReadFile(path); + CodeParser parser = new CodeParser(); + parser.Parse(code); Console.ReadKey(); } diff --git a/ASharp/code.txt b/ASharp/code.txt index af278c4..fc69f57 100644 --- a/ASharp/code.txt +++ b/ASharp/code.txt @@ -1,2 +1,4 @@ read i -print i \ No newline at end of file +3 * 3 +print i +5 * 5 \ No newline at end of file From c49a3182273202316f9697e232d2cd33bec02c26 Mon Sep 17 00:00:00 2001 From: FeLL1kS Date: Sat, 4 May 2019 01:50:26 +0300 Subject: [PATCH 08/13] Math works --- ASharp/Math.cs | 70 ++++++++++++++++++++++++++++++++++++++++++----- ASharp/Program.cs | 4 +-- ASharp/code.txt | 7 +++-- 3 files changed, 69 insertions(+), 12 deletions(-) diff --git a/ASharp/Math.cs b/ASharp/Math.cs index dc97fb7..2a96068 100644 --- a/ASharp/Math.cs +++ b/ASharp/Math.cs @@ -5,26 +5,82 @@ namespace ASharp { class Math { + public static int Converter(string line) + { + int res; + if(Program.Variables.ContainsKey(line)) + { + res = Program.Variables[line]; + return res; + } + else if(Int32.TryParse(line, out res)) + { + return res; + } + else + { + Console.WriteLine("Error"); + return 0; + } + } + public static void MathParser(string code) { - string pattern = @"([0-9]+)\s*([\/\+\-\*]+)\s*([0-9]+)"; + string pattern = @"(\w+)\s*(=)\s*(\w+)\s*([\/\+\-\*]+)\s*(\w+)"; Match i = Regex.Match(code, pattern); - switch (i.Groups[2].Value) + switch (i.Groups[4].Value) { case "+": - Console.WriteLine(Convert.ToInt32(i.Groups[1].Value) + Convert.ToInt32(i.Groups[3].Value)); + if (Program.Variables.ContainsKey(i.Groups[1].Value)) + { + Program.Variables[i.Groups[1].Value] = Converter(i.Groups[3].Value) + Converter(i.Groups[5].Value); + } + else + { + Program.Variables.Add(i.Groups[1].Value, Converter(i.Groups[3].Value) + Converter(i.Groups[5].Value)); + } break; case "-": - Console.WriteLine(Convert.ToInt32(i.Groups[1].Value) - Convert.ToInt32(i.Groups[3].Value)); + if (Program.Variables.ContainsKey(i.Groups[1].Value)) + { + Program.Variables[i.Groups[1].Value] = Converter(i.Groups[3].Value) - Converter(i.Groups[5].Value); + } + else + { + Program.Variables.Add(i.Groups[1].Value, Converter(i.Groups[3].Value) - Converter(i.Groups[5].Value)); + } break; case "*": - Console.WriteLine(Convert.ToInt32(i.Groups[1].Value) * Convert.ToInt32(i.Groups[3].Value)); + if (Program.Variables.ContainsKey(i.Groups[1].Value)) + { + Program.Variables[i.Groups[1].Value] = Converter(i.Groups[3].Value) * Converter(i.Groups[5].Value); + } + else + { + Program.Variables.Add(i.Groups[1].Value, Converter(i.Groups[3].Value) * Converter(i.Groups[5].Value)); + } break; case "/": - Console.WriteLine(Convert.ToInt32(i.Groups[1].Value) / Convert.ToInt32(i.Groups[3].Value)); + if (Program.Variables.ContainsKey(i.Groups[1].Value)) + { + Program.Variables[i.Groups[1].Value] = Converter(i.Groups[3].Value) / Converter(i.Groups[5].Value); + } + else + { + Program.Variables.Add(i.Groups[1].Value, Converter(i.Groups[3].Value) / Converter(i.Groups[5].Value)); + } break; default: - break; + string[] splitedString = code.Split(' '); + if (Program.Variables.ContainsKey(splitedString[0])) + { + Program.Variables[splitedString[0]] = Converter(splitedString[2]); + } + else + { + Program.Variables.Add(splitedString[0], Converter(splitedString[2])); + } + break; } } } diff --git a/ASharp/Program.cs b/ASharp/Program.cs index 239be2e..83180a9 100644 --- a/ASharp/Program.cs +++ b/ASharp/Program.cs @@ -9,9 +9,9 @@ class Program public static void SetVariable(string key, int value) { - if(!Program.Variables.ContainsKey(key)) + if(!Variables.ContainsKey(key)) { - Program.Variables.Add(key, value); + Variables.Add(key, value); } } diff --git a/ASharp/code.txt b/ASharp/code.txt index fc69f57..6846b8f 100644 --- a/ASharp/code.txt +++ b/ASharp/code.txt @@ -1,4 +1,5 @@ read i -3 * 3 -print i -5 * 5 \ No newline at end of file +s = i +i = i * 2 +print s +print i \ No newline at end of file From f5b357a59fb60ab83899b812a5dba33bbc1e1607 Mon Sep 17 00:00:00 2001 From: FeLL1kS Date: Sat, 4 May 2019 19:58:51 +0300 Subject: [PATCH 09/13] A# completed --- ASharp/ActionMark.cs | 12 +++++ ASharp/CodeParser.cs | 20 +++++++- ASharp/Conditions.cs | 67 ++++++++++++++++++++++++- ASharp/Math.cs | 113 ++++++++++++++++++++++--------------------- ASharp/Program.cs | 9 ++++ ASharp/code.txt | 12 +++-- ASharp/readme.md | 1 + 7 files changed, 171 insertions(+), 63 deletions(-) create mode 100644 ASharp/ActionMark.cs create mode 100644 ASharp/readme.md diff --git a/ASharp/ActionMark.cs b/ASharp/ActionMark.cs new file mode 100644 index 0000000..0514910 --- /dev/null +++ b/ASharp/ActionMark.cs @@ -0,0 +1,12 @@ +using System; + +namespace ASharp +{ + class ActionMark + { + public static void Mark(string mark) + { + int line = Program.Marks[mark]; + } + } +} \ No newline at end of file diff --git a/ASharp/CodeParser.cs b/ASharp/CodeParser.cs index ae4134b..325ae90 100644 --- a/ASharp/CodeParser.cs +++ b/ASharp/CodeParser.cs @@ -7,8 +7,12 @@ class CodeParser { public void Parse(string[] code) { + int stringCounter = -1; + for(int i = 0; i <= code.Length - 1; i++) { + stringCounter++; + string[] splitedString = code[i].Split(' '); switch (splitedString[0]) @@ -20,9 +24,23 @@ public void Parse(string[] code) ActionPrint.Print(splitedString[1]); break; default: - Math.MathParser(code[i]); break; } + + if(code[i].Contains("+") || code[i].Contains("-") || code[i].Contains("*") || code[i].Contains("/") || code[i].Contains("=")) + { + Math.MathParser(code[i]); + } + else if(code[i].Contains("if")) + { + i = Conditions.ParseConditions(code[i], stringCounter); + stringCounter = i; + } + else if(code[i].Contains(":")) + { + string[] mark = code[i].Split(':'); + Program.SetMark(mark[0], stringCounter); + } } } } diff --git a/ASharp/Conditions.cs b/ASharp/Conditions.cs index b6aae93..f997007 100644 --- a/ASharp/Conditions.cs +++ b/ASharp/Conditions.cs @@ -1,9 +1,74 @@ using System; +using System.Text.RegularExpressions; namespace ASharp { class Conditions { - + public static int ParseConditions(string code, int counter) + { + string pattern = @"([if]+)\s([\w]+)\s([\>": + if(Math.Converter(i.Groups[2].Value) > Math.Converter(i.Groups[4].Value)) + { + return Program.Marks[i.Groups[6].Value] - 1; + } + else + { + return counter; + } + case ">=": + if(Math.Converter(i.Groups[2].Value) >= Math.Converter(i.Groups[4].Value)) + { + return Program.Marks[i.Groups[6].Value] - 1; + } + else + { + return counter; + } + case "<": + if(Math.Converter(i.Groups[2].Value) < Math.Converter(i.Groups[4].Value)) + { + return Program.Marks[i.Groups[6].Value] - 1; + } + else + { + return counter; + } + case "<=": + if(Math.Converter(i.Groups[2].Value) <= Math.Converter(i.Groups[4].Value)) + { + return Program.Marks[i.Groups[6].Value] - 1; + } + else + { + return counter; + } + case "==": + if(Math.Converter(i.Groups[2].Value) == Math.Converter(i.Groups[4].Value)) + { + return Program.Marks[i.Groups[6].Value] - 1; + } + else + { + return counter; + } + case "!=": + if(Math.Converter(i.Groups[2].Value) != Math.Converter(i.Groups[4].Value)) + { + return Program.Marks[i.Groups[6].Value] - 1; + } + else + { + return counter; + } + default: + return 0; + } + } } } \ No newline at end of file diff --git a/ASharp/Math.cs b/ASharp/Math.cs index 2a96068..ddcf099 100644 --- a/ASharp/Math.cs +++ b/ASharp/Math.cs @@ -10,8 +10,7 @@ public static int Converter(string line) int res; if(Program.Variables.ContainsKey(line)) { - res = Program.Variables[line]; - return res; + return Program.Variables[line]; } else if(Int32.TryParse(line, out res)) { @@ -19,69 +18,71 @@ public static int Converter(string line) } else { - Console.WriteLine("Error"); - return 0; + Console.WriteLine($"Переменной {line} не сушествует"); + return 0; } } public static void MathParser(string code) { string pattern = @"(\w+)\s*(=)\s*(\w+)\s*([\/\+\-\*]+)\s*(\w+)"; - Match i = Regex.Match(code, pattern); - switch (i.Groups[4].Value) + + Match i = Regex.Match(code, pattern); + + switch (i.Groups[4].Value) + { + case "+": + if (Program.Variables.ContainsKey(i.Groups[1].Value)) + { + Program.Variables[i.Groups[1].Value] = Converter(i.Groups[3].Value) + Converter(i.Groups[5].Value); + } + else + { + Program.Variables.Add(i.Groups[1].Value, Converter(i.Groups[3].Value) + Converter(i.Groups[5].Value)); + } + break; + case "-": + if (Program.Variables.ContainsKey(i.Groups[1].Value)) + { + Program.Variables[i.Groups[1].Value] = Converter(i.Groups[3].Value) - Converter(i.Groups[5].Value); + } + else + { + Program.Variables.Add(i.Groups[1].Value, Converter(i.Groups[3].Value) - Converter(i.Groups[5].Value)); + } + break; + case "*": + if (Program.Variables.ContainsKey(i.Groups[1].Value)) { - case "+": - if (Program.Variables.ContainsKey(i.Groups[1].Value)) - { - Program.Variables[i.Groups[1].Value] = Converter(i.Groups[3].Value) + Converter(i.Groups[5].Value); - } - else - { - Program.Variables.Add(i.Groups[1].Value, Converter(i.Groups[3].Value) + Converter(i.Groups[5].Value)); - } - break; - case "-": - if (Program.Variables.ContainsKey(i.Groups[1].Value)) - { - Program.Variables[i.Groups[1].Value] = Converter(i.Groups[3].Value) - Converter(i.Groups[5].Value); - } - else - { - Program.Variables.Add(i.Groups[1].Value, Converter(i.Groups[3].Value) - Converter(i.Groups[5].Value)); - } - break; - case "*": - if (Program.Variables.ContainsKey(i.Groups[1].Value)) - { - Program.Variables[i.Groups[1].Value] = Converter(i.Groups[3].Value) * Converter(i.Groups[5].Value); - } - else - { - Program.Variables.Add(i.Groups[1].Value, Converter(i.Groups[3].Value) * Converter(i.Groups[5].Value)); - } - break; - case "/": - if (Program.Variables.ContainsKey(i.Groups[1].Value)) - { - Program.Variables[i.Groups[1].Value] = Converter(i.Groups[3].Value) / Converter(i.Groups[5].Value); - } - else - { - Program.Variables.Add(i.Groups[1].Value, Converter(i.Groups[3].Value) / Converter(i.Groups[5].Value)); - } - break; - default: - string[] splitedString = code.Split(' '); - if (Program.Variables.ContainsKey(splitedString[0])) - { - Program.Variables[splitedString[0]] = Converter(splitedString[2]); - } - else - { - Program.Variables.Add(splitedString[0], Converter(splitedString[2])); - } + Program.Variables[i.Groups[1].Value] = Converter(i.Groups[3].Value) * Converter(i.Groups[5].Value); + } + else + { + Program.Variables.Add(i.Groups[1].Value, Converter(i.Groups[3].Value) * Converter(i.Groups[5].Value)); + } break; + case "/": + if (Program.Variables.ContainsKey(i.Groups[1].Value)) + { + Program.Variables[i.Groups[1].Value] = Converter(i.Groups[3].Value) / Converter(i.Groups[5].Value); + } + else + { + Program.Variables.Add(i.Groups[1].Value, Converter(i.Groups[3].Value) / Converter(i.Groups[5].Value)); + } + break; + default: + string[] splitedString = code.Split(' '); + if (Program.Variables.ContainsKey(splitedString[0])) + { + Program.Variables[splitedString[0]] = Converter(splitedString[2]); } + else + { + Program.Variables.Add(splitedString[0], Converter(splitedString[2])); + } + break; + } } } } \ No newline at end of file diff --git a/ASharp/Program.cs b/ASharp/Program.cs index 83180a9..bc1ff16 100644 --- a/ASharp/Program.cs +++ b/ASharp/Program.cs @@ -6,6 +6,7 @@ namespace ASharp class Program { public static Dictionary Variables = new Dictionary(); + public static Dictionary Marks = new Dictionary(); public static void SetVariable(string key, int value) { @@ -15,6 +16,14 @@ public static void SetVariable(string key, int value) } } + public static void SetMark(string key, int value) + { + if(!Marks.ContainsKey(key)) + { + Marks.Add(key, value); + } + } + static void Main(string[] args) { string path = "./code.txt"; diff --git a/ASharp/code.txt b/ASharp/code.txt index 6846b8f..f3cc6da 100644 --- a/ASharp/code.txt +++ b/ASharp/code.txt @@ -1,5 +1,7 @@ -read i -s = i -i = i * 2 -print s -print i \ No newline at end of file +read N +R = 1 +step: + R = R * N + N = N - 1 +if N > 1 goto step +print R \ No newline at end of file diff --git a/ASharp/readme.md b/ASharp/readme.md new file mode 100644 index 0000000..d920343 --- /dev/null +++ b/ASharp/readme.md @@ -0,0 +1 @@ +"if goto" worked only like repeat \ No newline at end of file From 38e94680be450fa9d602246dad77ced7169ef2c8 Mon Sep 17 00:00:00 2001 From: FeLL1kS Date: Sat, 4 May 2019 20:14:50 +0300 Subject: [PATCH 10/13] Little fix --- ASharp/ActionPrint.cs | 2 +- ASharp/ActionRead.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ASharp/ActionPrint.cs b/ASharp/ActionPrint.cs index a4ac63d..4eae68c 100644 --- a/ASharp/ActionPrint.cs +++ b/ASharp/ActionPrint.cs @@ -10,7 +10,7 @@ public static void Print(string action) { if(Program.Variables.ContainsKey(action)) { - Console.WriteLine(Program.Variables[action]); + Console.WriteLine($"{action} = {Program.Variables[action]}"); } else Console.WriteLine($"Переменной {action} не существует"); } diff --git a/ASharp/ActionRead.cs b/ASharp/ActionRead.cs index 7233ed8..762432b 100644 --- a/ASharp/ActionRead.cs +++ b/ASharp/ActionRead.cs @@ -9,6 +9,7 @@ class ActionRead { public static void Read(string action) { + Console.Write($"{action} = "); int number = Convert.ToInt32(Console.ReadLine()); Program.SetVariable(action, number); } From 16f5b248534d0eb250577b984c7714eeced8a7f9 Mon Sep 17 00:00:00 2001 From: FeLL1kS Date: Thu, 6 Jun 2019 21:49:29 +0300 Subject: [PATCH 11/13] First version of Web --- WebApplication/Controllers/HomeController.cs | 97 ++++++++++++++++++ WebApplication/Models/ErrorViewModel.cs | 11 ++ WebApplication/Models/Television.cs | 18 ++++ WebApplication/Models/TelevisionContext.cs | 18 ++++ WebApplication/Program.cs | 24 +++++ WebApplication/Startup.cs | 73 +++++++++++++ WebApplication/Views/Home/Create.cshtml | 21 ++++ WebApplication/Views/Home/Delete.cshtml | 31 ++++++ WebApplication/Views/Home/Edit.cshtml | 22 ++++ WebApplication/Views/Home/Index.cshtml | 21 ++++ WebApplication/Views/Shared/Error.cshtml | 25 +++++ .../Views/Shared/_CookieConsentPartial.cshtml | 25 +++++ WebApplication/Views/Shared/_Layout.cshtml | 65 ++++++++++++ .../Shared/_ValidationScriptsPartial.cshtml | 18 ++++ WebApplication/Views/_ViewImports.cshtml | 3 + WebApplication/Views/_ViewStart.cshtml | 3 + WebApplication/WebApplication.csproj | 21 ++++ WebApplication/WebApplication.sln | 25 +++++ WebApplication/appsettings.Development.json | 9 ++ WebApplication/appsettings.json | 11 ++ WebApplication/wwwroot/css/site.css | 56 ++++++++++ WebApplication/wwwroot/favicon.ico | Bin 0 -> 32038 bytes WebApplication/wwwroot/js/site.js | 4 + 23 files changed, 601 insertions(+) create mode 100644 WebApplication/Controllers/HomeController.cs create mode 100644 WebApplication/Models/ErrorViewModel.cs create mode 100644 WebApplication/Models/Television.cs create mode 100644 WebApplication/Models/TelevisionContext.cs create mode 100644 WebApplication/Program.cs create mode 100644 WebApplication/Startup.cs create mode 100644 WebApplication/Views/Home/Create.cshtml create mode 100644 WebApplication/Views/Home/Delete.cshtml create mode 100644 WebApplication/Views/Home/Edit.cshtml create mode 100644 WebApplication/Views/Home/Index.cshtml create mode 100644 WebApplication/Views/Shared/Error.cshtml create mode 100644 WebApplication/Views/Shared/_CookieConsentPartial.cshtml create mode 100644 WebApplication/Views/Shared/_Layout.cshtml create mode 100644 WebApplication/Views/Shared/_ValidationScriptsPartial.cshtml create mode 100644 WebApplication/Views/_ViewImports.cshtml create mode 100644 WebApplication/Views/_ViewStart.cshtml create mode 100644 WebApplication/WebApplication.csproj create mode 100644 WebApplication/WebApplication.sln create mode 100644 WebApplication/appsettings.Development.json create mode 100644 WebApplication/appsettings.json create mode 100644 WebApplication/wwwroot/css/site.css create mode 100644 WebApplication/wwwroot/favicon.ico create mode 100644 WebApplication/wwwroot/js/site.js diff --git a/WebApplication/Controllers/HomeController.cs b/WebApplication/Controllers/HomeController.cs new file mode 100644 index 0000000..e00b407 --- /dev/null +++ b/WebApplication/Controllers/HomeController.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using WebApplication.Models; + +namespace WebApplication.Controllers +{ + public class HomeController : Controller + { + private TelevisionContext db; + + public HomeController(TelevisionContext context) + { + db = context; + } + + public async Task Index() + { + return View(await db.Televisions.ToListAsync()); + } + + public IActionResult Create() + { + return View(); + } + + [HttpPost] + public async Task Create(Television television) + { + db.Televisions.Add(television); + await db.SaveChangesAsync(); + return RedirectToAction("Index"); + } + + public async Task Edit(int? id) + { + if(id != null) + { + Television television = await db.Televisions.FirstOrDefaultAsync(p => p.Id == id); + + if (television != null) + return View(television); + + } + return NotFound(); + } + + [HttpPost] + public async Task Edit(Television television) + { + db.Televisions.Update(television); + await db.SaveChangesAsync(); + return RedirectToAction("Index"); + } + + [HttpGet] + [ActionName("Delete")] + public async Task ConfirmDelete(int? id) + { + if (id != null) + { + Television television = await db.Televisions.FirstOrDefaultAsync(p => p.Id == id); + if (television != null) + return View(television); + } + + return NotFound(); + } + + [HttpPost] + public async Task Delete(int? id) + { + if (id != null) + { + Television television = await db.Televisions.FirstOrDefaultAsync(p => p.Id == id); + if (television != null) + { + db.Televisions.Remove(television); + await db.SaveChangesAsync(); + return RedirectToAction("Index"); + } + } + + return NotFound(); + } + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} diff --git a/WebApplication/Models/ErrorViewModel.cs b/WebApplication/Models/ErrorViewModel.cs new file mode 100644 index 0000000..81a8d29 --- /dev/null +++ b/WebApplication/Models/ErrorViewModel.cs @@ -0,0 +1,11 @@ +using System; + +namespace WebApplication.Models +{ + public class ErrorViewModel + { + public string RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + } +} \ No newline at end of file diff --git a/WebApplication/Models/Television.cs b/WebApplication/Models/Television.cs new file mode 100644 index 0000000..54579b1 --- /dev/null +++ b/WebApplication/Models/Television.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace WebApplication.Models +{ + public class Television + { + public int Id { get; set; } + + public string Name { get; set; } + + public int Age { get; set; } + + public int Price { get; set; } + } +} diff --git a/WebApplication/Models/TelevisionContext.cs b/WebApplication/Models/TelevisionContext.cs new file mode 100644 index 0000000..91821ee --- /dev/null +++ b/WebApplication/Models/TelevisionContext.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; + +namespace WebApplication.Models +{ + public class TelevisionContext : DbContext + { + public DbSet Televisions { get; set; } + public TelevisionContext(DbContextOptions options) + : base(options) + { + Database.EnsureCreated(); + } + } +} diff --git a/WebApplication/Program.cs b/WebApplication/Program.cs new file mode 100644 index 0000000..94c7324 --- /dev/null +++ b/WebApplication/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + +namespace WebApplication +{ + public class Program + { + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup(); + } +} diff --git a/WebApplication/Startup.cs b/WebApplication/Startup.cs new file mode 100644 index 0000000..4c7dcfc --- /dev/null +++ b/WebApplication/Startup.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.HttpsPolicy; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using WebApplication.Models; + +namespace WebApplication +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + // получаем строку подключения из файла конфигурации + string connection = Configuration.GetConnectionString("DefaultConnection"); + // добавляем контекст MobileContext в качестве сервиса в приложение + services.AddDbContext(options => + options.UseSqlServer(connection)); + services.AddMvc(); + + services.Configure(options => + { + // This lambda determines whether user consent for non-essential cookies is needed for a given request. + options.CheckConsentNeeded = context => true; + options.MinimumSameSitePolicy = SameSiteMode.None; + }); + + + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseExceptionHandler("/Home/Error"); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); + } + + app.UseHttpsRedirection(); + app.UseStaticFiles(); + app.UseCookiePolicy(); + + app.UseMvc(routes => + { + routes.MapRoute( + name: "default", + template: "{controller=Home}/{action=Index}/{id?}"); + }); + } + } +} diff --git a/WebApplication/Views/Home/Create.cshtml b/WebApplication/Views/Home/Create.cshtml new file mode 100644 index 0000000..638f822 --- /dev/null +++ b/WebApplication/Views/Home/Create.cshtml @@ -0,0 +1,21 @@ +@model WebApplication.Models.Television +@{ + ViewBag.Title = "Добавление Телевизора"; +} +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
\ No newline at end of file diff --git a/WebApplication/Views/Home/Delete.cshtml b/WebApplication/Views/Home/Delete.cshtml new file mode 100644 index 0000000..d076f88 --- /dev/null +++ b/WebApplication/Views/Home/Delete.cshtml @@ -0,0 +1,31 @@ +@model WebApplication.Models.Television +@{ +     ViewBag.Title = "Удаление телевизора"; +} + +
+
+
Название
+
+ @Html.DisplayFor(model => model.Name) +
+ +
Возраст
+
+ @Html.DisplayFor(model => model.Age) +
+ +
Цена
+
+ @Html.DisplayFor(model => model.Price) +
+
+ +
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/WebApplication/Views/Home/Edit.cshtml b/WebApplication/Views/Home/Edit.cshtml new file mode 100644 index 0000000..aaa170a --- /dev/null +++ b/WebApplication/Views/Home/Edit.cshtml @@ -0,0 +1,22 @@ +@model WebApplication.Models.Television +@{ + ViewBag.Title = $"Редактирование модели {Model.Name}"; +} + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
\ No newline at end of file diff --git a/WebApplication/Views/Home/Index.cshtml b/WebApplication/Views/Home/Index.cshtml new file mode 100644 index 0000000..bc7ca97 --- /dev/null +++ b/WebApplication/Views/Home/Index.cshtml @@ -0,0 +1,21 @@ +@model IEnumerable +@{ + ViewBag.Title = "Все смартфоны"; +} +Добавить модель телевизора + + + @foreach (var item in Model) + { + + + + + + + } +
МодельВозрастЦена
@item.Name@item.Age@item.Price + Изменить | + Удалить +
+ diff --git a/WebApplication/Views/Shared/Error.cshtml b/WebApplication/Views/Shared/Error.cshtml new file mode 100644 index 0000000..a1e0478 --- /dev/null +++ b/WebApplication/Views/Shared/Error.cshtml @@ -0,0 +1,25 @@ +@model ErrorViewModel +@{ + ViewData["Title"] = "Error"; +} + +

Error.

+

An error occurred while processing your request.

+ +@if (Model.ShowRequestId) +{ +

+ Request ID: @Model.RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

diff --git a/WebApplication/Views/Shared/_CookieConsentPartial.cshtml b/WebApplication/Views/Shared/_CookieConsentPartial.cshtml new file mode 100644 index 0000000..a535ea4 --- /dev/null +++ b/WebApplication/Views/Shared/_CookieConsentPartial.cshtml @@ -0,0 +1,25 @@ +@using Microsoft.AspNetCore.Http.Features + +@{ + var consentFeature = Context.Features.Get(); + var showBanner = !consentFeature?.CanTrack ?? false; + var cookieString = consentFeature?.CreateConsentCookie(); +} + +@if (showBanner) +{ + + +} diff --git a/WebApplication/Views/Shared/_Layout.cshtml b/WebApplication/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000..a78d1b6 --- /dev/null +++ b/WebApplication/Views/Shared/_Layout.cshtml @@ -0,0 +1,65 @@ + + + + + + @ViewData["Title"] + + + + + + + + + + +
+ +
+
+ +
+ @RenderBody() +
+
+ + + + + + + + + + + + @RenderSection("Scripts", required: false) + + diff --git a/WebApplication/Views/Shared/_ValidationScriptsPartial.cshtml b/WebApplication/Views/Shared/_ValidationScriptsPartial.cshtml new file mode 100644 index 0000000..3c0e077 --- /dev/null +++ b/WebApplication/Views/Shared/_ValidationScriptsPartial.cshtml @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/WebApplication/Views/_ViewImports.cshtml b/WebApplication/Views/_ViewImports.cshtml new file mode 100644 index 0000000..faa560a --- /dev/null +++ b/WebApplication/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using WebApplication +@using WebApplication.Models +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/WebApplication/Views/_ViewStart.cshtml b/WebApplication/Views/_ViewStart.cshtml new file mode 100644 index 0000000..a5f1004 --- /dev/null +++ b/WebApplication/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/WebApplication/WebApplication.csproj b/WebApplication/WebApplication.csproj new file mode 100644 index 0000000..603bc15 --- /dev/null +++ b/WebApplication/WebApplication.csproj @@ -0,0 +1,21 @@ + + + + netcoreapp2.2 + InProcess + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + diff --git a/WebApplication/WebApplication.sln b/WebApplication/WebApplication.sln new file mode 100644 index 0000000..944dfe8 --- /dev/null +++ b/WebApplication/WebApplication.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.645 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication", "WebApplication.csproj", "{5B518736-1FE7-4EC6-8343-7B7C6366B410}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5B518736-1FE7-4EC6-8343-7B7C6366B410}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B518736-1FE7-4EC6-8343-7B7C6366B410}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B518736-1FE7-4EC6-8343-7B7C6366B410}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B518736-1FE7-4EC6-8343-7B7C6366B410}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {16717501-42FB-4994-BDCA-CFD15F822745} + EndGlobalSection +EndGlobal diff --git a/WebApplication/appsettings.Development.json b/WebApplication/appsettings.Development.json new file mode 100644 index 0000000..e203e94 --- /dev/null +++ b/WebApplication/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/WebApplication/appsettings.json b/WebApplication/appsettings.json new file mode 100644 index 0000000..2870c0a --- /dev/null +++ b/WebApplication/appsettings.json @@ -0,0 +1,11 @@ +{ + "ConnectionStrings": { + "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=mobilesdb;Trusted_Connection=True;" + }, + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/WebApplication/wwwroot/css/site.css b/WebApplication/wwwroot/css/site.css new file mode 100644 index 0000000..c486131 --- /dev/null +++ b/WebApplication/wwwroot/css/site.css @@ -0,0 +1,56 @@ +/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification +for details on configuring this project to bundle and minify static web assets. */ + +a.navbar-brand { + white-space: normal; + text-align: center; + word-break: break-all; +} + +/* Sticky footer styles +-------------------------------------------------- */ +html { + font-size: 14px; +} +@media (min-width: 768px) { + html { + font-size: 16px; + } +} + +.border-top { + border-top: 1px solid #e5e5e5; +} +.border-bottom { + border-bottom: 1px solid #e5e5e5; +} + +.box-shadow { + box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); +} + +button.accept-policy { + font-size: 1rem; + line-height: inherit; +} + +/* Sticky footer styles +-------------------------------------------------- */ +html { + position: relative; + min-height: 100%; +} + +body { + /* Margin bottom by footer height */ + margin-bottom: 60px; +} +.footer { + position: absolute; + bottom: 0; + width: 100%; + white-space: nowrap; + /* Set the fixed height of the footer here */ + height: 60px; + line-height: 60px; /* Vertically center the text there */ +} diff --git a/WebApplication/wwwroot/favicon.ico b/WebApplication/wwwroot/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..a3a799985c43bc7309d701b2cad129023377dc71 GIT binary patch literal 32038 zcmeHwX>eTEbtY7aYbrGrkNjgie?1jXjZ#zP%3n{}GObKv$BxI7Sl;Bwl5E+Qtj&t8 z*p|m4DO#HoJC-FyvNnp8NP<{Na0LMnTtO21(rBP}?EAiNjWgeO?z`{3ZoURUQlV2d zY1Pqv{m|X_oO91|?^z!6@@~od!@OH>&BN;>c@O+yUfy5w>LccTKJJ&`-k<%M^Zvi( z<$dKp=jCnNX5Qa+M_%6g|IEv~4R84q9|7E=|Ho(Wz3f-0wPjaRL;W*N^>q%^KGRr7 zxbjSORb_c&eO;oV_DZ7ua!sPH=0c+W;`vzJ#j~-x3uj};50#vqo*0w4!LUqs*UCh9 zvy2S%$#8$K4EOa&e@~aBS65_hc~Mpu=454VT2^KzWqEpBA=ME|O;1cn?8p<+{MKJf zbK#@1wzL44m$k(?85=Obido7=C|xWKe%66$z)NrzRwR>?hK?_bbwT z@Da?lBrBL}Zemo1@!9pYRau&!ld17h{f+UV0sY(R{ET$PBB|-=Nr@l-nY6w8HEAw* zRMIQU`24Jl_IFEPcS=_HdrOP5yf81z_?@M>83Vv65$QFr9nPg(wr`Ke8 zaY4ogdnMA*F7a4Q1_uXadTLUpCk;$ZPRRJ^sMOch;rlbvUGc1R9=u;dr9YANbQ<4Z z#P|Cp9BP$FXNPolgyr1XGt$^lFPF}rmBF5rj1Kh5%dforrP8W}_qJL$2qMBS-#%-|s#BPZBSETsn_EBYcr(W5dq( z@f%}C|iN7)YN`^)h7R?Cg}Do*w-!zwZb9=BMp%Wsh@nb22hA zA{`wa8Q;yz6S)zfo%sl08^GF`9csI9BlGnEy#0^Y3b);M+n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C*vCTr~UdTiR`JGuNH8v(J|FTiSEcPrBpmHRtmd zI2Jng0J=bXK);YY^rM?jzn?~X-Pe`GbAy{D)Y6D&1GY-EBcy%Bq?bKh?A>DD9DD!p z?{q02wno2sraGUkZv5dx+J8)&K$)No43Zr(*S`FEdL!4C)}WE}vJd%{S6-3VUw>Wp z?Aasv`T0^%P$2vE?L+Qhj~qB~K%eW)xH(=b_jU}TLD&BP*Pc9hz@Z=e0nkpLkWl}> z_5J^i(9Z7$(XG9~I3sY)`OGZ#_L06+Dy4E>UstcP-rU@xJ$&rxvo!n1Ao`P~KLU-8 z{zDgN4-&A6N!kPSYbQ&7sLufi`YtE2uN$S?e&5n>Y4(q#|KP!cc1j)T^QrUXMPFaP z_SoYO8S8G}Z$?AL4`;pE?7J5K8yWqy23>cCT2{=-)+A$X^-I9=e!@J@A&-;Ufc)`H}c(VI&;0x zrrGv()5mjP%jXzS{^|29?bLNXS0bC%p!YXI!;O457rjCEEzMkGf~B3$T}dXBO23tP z+Ci>;5UoM?C@bU@f9G1^X3=ly&ZeFH<@|RnOG--A&)fd)AUgjw?%izq{p(KJ`EP0v z2mU)P!+3t@X14DA=E2RR-|p${GZ9ETX=d+kJRZL$nSa0daI@&oUUxnZg0xd_xu>Vz lzF#z5%kSKX?YLH3ll^(hI(_`L*t#Iva2Ede*Z;>H_ Date: Mon, 10 Jun 2019 18:17:34 +0300 Subject: [PATCH 12/13] Some fixes --- WebApplication/Startup.cs | 2 +- WebApplication/Views/Home/Index.cshtml | 2 +- WebApplication/appsettings.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/WebApplication/Startup.cs b/WebApplication/Startup.cs index 4c7dcfc..399a98e 100644 --- a/WebApplication/Startup.cs +++ b/WebApplication/Startup.cs @@ -28,7 +28,7 @@ public void ConfigureServices(IServiceCollection services) { // получаем строку подключения из файла конфигурации string connection = Configuration.GetConnectionString("DefaultConnection"); - // добавляем контекст MobileContext в качестве сервиса в приложение + // добавляем контекст TelevisionContext в качестве сервиса в приложение services.AddDbContext(options => options.UseSqlServer(connection)); services.AddMvc(); diff --git a/WebApplication/Views/Home/Index.cshtml b/WebApplication/Views/Home/Index.cshtml index bc7ca97..194bd8a 100644 --- a/WebApplication/Views/Home/Index.cshtml +++ b/WebApplication/Views/Home/Index.cshtml @@ -1,6 +1,6 @@ @model IEnumerable @{ - ViewBag.Title = "Все смартфоны"; + ViewBag.Title = "Все телевизоры"; } Добавить модель телевизора diff --git a/WebApplication/appsettings.json b/WebApplication/appsettings.json index 2870c0a..8c54394 100644 --- a/WebApplication/appsettings.json +++ b/WebApplication/appsettings.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=mobilesdb;Trusted_Connection=True;" + "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=televisionsdb;Trusted_Connection=True;" }, "Logging": { "LogLevel": { From 5a1ba20126cc5e7fda4f6077ac65b54d80c57b8a Mon Sep 17 00:00:00 2001 From: FeLL1kS Date: Tue, 11 Jun 2019 00:19:55 +0300 Subject: [PATCH 13/13] Button --- WebApplication/Views/Home/Create.cshtml | 2 +- WebApplication/Views/Home/Delete.cshtml | 2 +- WebApplication/Views/Home/Edit.cshtml | 2 +- WebApplication/Views/Home/Index.cshtml | 4 +-- WebApplication/Views/Shared/_Layout.cshtml | 5 +-- WebApplication/wwwroot/css/site.css | 39 +++++++++++++++++----- 6 files changed, 39 insertions(+), 15 deletions(-) diff --git a/WebApplication/Views/Home/Create.cshtml b/WebApplication/Views/Home/Create.cshtml index 638f822..8bffd26 100644 --- a/WebApplication/Views/Home/Create.cshtml +++ b/WebApplication/Views/Home/Create.cshtml @@ -16,6 +16,6 @@
- +
\ No newline at end of file diff --git a/WebApplication/Views/Home/Delete.cshtml b/WebApplication/Views/Home/Delete.cshtml index d076f88..930e506 100644 --- a/WebApplication/Views/Home/Delete.cshtml +++ b/WebApplication/Views/Home/Delete.cshtml @@ -24,7 +24,7 @@
- +
diff --git a/WebApplication/Views/Home/Edit.cshtml b/WebApplication/Views/Home/Edit.cshtml index aaa170a..8641ca7 100644 --- a/WebApplication/Views/Home/Edit.cshtml +++ b/WebApplication/Views/Home/Edit.cshtml @@ -17,6 +17,6 @@
- +
\ No newline at end of file diff --git a/WebApplication/Views/Home/Index.cshtml b/WebApplication/Views/Home/Index.cshtml index bc7ca97..5ce4e6a 100644 --- a/WebApplication/Views/Home/Index.cshtml +++ b/WebApplication/Views/Home/Index.cshtml @@ -2,9 +2,9 @@ @{ ViewBag.Title = "Все смартфоны"; } -Добавить модель телевизора +Добавить модель телевизора
- + @foreach (var item in Model) { diff --git a/WebApplication/Views/Shared/_Layout.cshtml b/WebApplication/Views/Shared/_Layout.cshtml index a78d1b6..fe7c13d 100644 --- a/WebApplication/Views/Shared/_Layout.cshtml +++ b/WebApplication/Views/Shared/_Layout.cshtml @@ -19,9 +19,9 @@
-
+
diff --git a/WebApplication/wwwroot/css/site.css b/WebApplication/wwwroot/css/site.css index c486131..69379ab 100644 --- a/WebApplication/wwwroot/css/site.css +++ b/WebApplication/wwwroot/css/site.css @@ -45,12 +45,35 @@ body { /* Margin bottom by footer height */ margin-bottom: 60px; } -.footer { - position: absolute; - bottom: 0; - width: 100%; - white-space: nowrap; - /* Set the fixed height of the footer here */ - height: 60px; - line-height: 60px; /* Vertically center the text there */ + +.button { + font-weight: 700; + text-decoration: none; + color: #000; + text-transform: uppercase; + letter-spacing: 1.6px; + display: inline-block; + border-width: 2px; + border-color: #000; + border-style: solid; + border-radius: 50px; + padding-top: 8px; + padding-bottom: 8px; + padding-left: 23px; + padding-right: 23px; + margin-bottom: 15px; +} + +.button:hover{ + color: #fff; + background-color: #000; } + +a { + transition: 0.2s ease-out; + margin-top: 1%; +} + +a:hover { + text-decoration: none; +} \ No newline at end of file
МодельВозрастЦена
МодельВозрастЦена