Skip to content

Commit c16a42a

Browse files
committed
Добавьте файлы проекта.
1 parent fa2c568 commit c16a42a

File tree

8 files changed

+262
-0
lines changed

8 files changed

+262
-0
lines changed

TemplateMethodExample.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.2.32630.192
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TemplateMethodExample", "TemplateMethodExample\TemplateMethodExample.csproj", "{8316BB23-E672-4359-A35B-7AFFF7486AE6}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{8316BB23-E672-4359-A35B-7AFFF7486AE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{8316BB23-E672-4359-A35B-7AFFF7486AE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{8316BB23-E672-4359-A35B-7AFFF7486AE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{8316BB23-E672-4359-A35B-7AFFF7486AE6}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {99F94756-ABCB-4CDA-8ABA-E3D3F963B8C7}
24+
EndGlobalSection
25+
EndGlobal

TemplateMethodExample/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5+
</startup>
6+
</configuration>

TemplateMethodExample/Program.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using TemplateMethodExample.Ramen;
7+
8+
namespace TemplateMethodExample
9+
{
10+
internal class Program
11+
{
12+
static void Main(string[] args)
13+
{
14+
RamenTemplate wheatRamen = new WheatRamen();
15+
RamenTemplate sobaRamen = new SobaRamen();
16+
17+
Console.WriteLine("Cooking Wheat Ramen");
18+
wheatRamen.Cooking();
19+
Console.WriteLine();
20+
Console.WriteLine("Cooking Soba Ramen");
21+
sobaRamen.Cooking();
22+
23+
Console.ReadLine();
24+
25+
}
26+
}
27+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// Общие сведения об этой сборке предоставляются следующим набором
6+
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
7+
// связанные с этой сборкой.
8+
[assembly: AssemblyTitle("TemplateMethodExample")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("TemplateMethodExample")]
13+
[assembly: AssemblyCopyright("Copyright © 2022")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
18+
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
19+
// из модели COM задайте для атрибута ComVisible этого типа значение true.
20+
[assembly: ComVisible(false)]
21+
22+
// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM
23+
[assembly: Guid("8316bb23-e672-4359-a35b-7afff7486ae6")]
24+
25+
// Сведения о версии сборки состоят из указанных ниже четырех значений:
26+
//
27+
// Основной номер версии
28+
// Дополнительный номер версии
29+
// Номер сборки
30+
// Номер редакции
31+
//
32+
// Можно задать все значения или принять номера сборки и редакции по умолчанию
33+
// используя "*", как показано ниже:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace TemplateMethodExample.Ramen
8+
{
9+
public abstract class RamenTemplate
10+
{
11+
public void Cooking()
12+
{
13+
AddNoodle();
14+
AddBroth();
15+
AddMeat();
16+
AddVedgetables();
17+
18+
if (AddEggDecision()) { AddEgg(); }
19+
if (AddSauseDecision()) { AddSause(); }
20+
}
21+
22+
public abstract void AddNoodle();
23+
public abstract void AddSause();
24+
public abstract void AddMeat();
25+
public abstract void AddEgg();
26+
public void AddVedgetables() => Console.WriteLine("Added Vedgetables");
27+
public void AddBroth() => Console.WriteLine("Added Broth");
28+
public virtual bool AddSauseDecision() => true;
29+
public virtual bool AddEggDecision() => true;
30+
}
31+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace TemplateMethodExample.Ramen
8+
{
9+
internal class SobaRamen : RamenTemplate
10+
{
11+
public override void AddEgg()
12+
{
13+
Console.WriteLine("Added 3 eggs slices");
14+
}
15+
16+
public override void AddMeat()
17+
{
18+
Console.WriteLine("Added 5 beef meat slices");
19+
}
20+
21+
public override void AddNoodle()
22+
{
23+
Console.WriteLine("Added buckwheat noodle");
24+
}
25+
26+
public override void AddSause()
27+
{
28+
Console.WriteLine("Added spicy sauce");
29+
}
30+
31+
32+
public override bool AddEggDecision()
33+
{
34+
Console.Write("You want add eggs? (y/n): ");
35+
var userInput = Console.ReadLine();
36+
37+
if (userInput.ToLower() == "y") { return true; }
38+
return false;
39+
}
40+
}
41+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace TemplateMethodExample.Ramen
8+
{
9+
internal class WheatRamen : RamenTemplate
10+
{
11+
public override void AddEgg()
12+
{
13+
Console.WriteLine("Added 2 eggs slices");
14+
}
15+
16+
public override void AddMeat()
17+
{
18+
Console.WriteLine("Added 5 chiken meat slices");
19+
}
20+
21+
public override void AddNoodle()
22+
{
23+
Console.WriteLine("Added wheat noodle");
24+
}
25+
26+
public override void AddSause()
27+
{
28+
Console.WriteLine("Added sweet and sour sauce");
29+
}
30+
31+
public override bool AddSauseDecision()
32+
{
33+
Console.Write("You want add sause? (y/n): ");
34+
var userInput = Console.ReadLine();
35+
36+
if (userInput.ToLower() == "y") { return true; }
37+
return false;
38+
}
39+
}
40+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{8316BB23-E672-4359-A35B-7AFFF7486AE6}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>TemplateMethodExample</RootNamespace>
10+
<AssemblyName>TemplateMethodExample</AssemblyName>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="System" />
37+
<Reference Include="System.Core" />
38+
<Reference Include="System.Xml.Linq" />
39+
<Reference Include="System.Data.DataSetExtensions" />
40+
<Reference Include="Microsoft.CSharp" />
41+
<Reference Include="System.Data" />
42+
<Reference Include="System.Net.Http" />
43+
<Reference Include="System.Xml" />
44+
</ItemGroup>
45+
<ItemGroup>
46+
<Compile Include="Ramen\RamenTemplate.cs" />
47+
<Compile Include="Program.cs" />
48+
<Compile Include="Properties\AssemblyInfo.cs" />
49+
<Compile Include="Ramen\SobaRamen.cs" />
50+
<Compile Include="Ramen\WheatRamen.cs" />
51+
</ItemGroup>
52+
<ItemGroup>
53+
<None Include="App.config" />
54+
</ItemGroup>
55+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
56+
</Project>

0 commit comments

Comments
 (0)