Skip to content

Commit dc2642c

Browse files
committed
Add project files.
1 parent dc07ee2 commit dc2642c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1532
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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>{7F20835C-B8D6-4B39-803B-058E433D23E4}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>AbstractFactory</RootNamespace>
10+
<AssemblyName>AbstractFactory</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="Concrete\Iphone.cs" />
47+
<Compile Include="Concrete\Samsung.cs" />
48+
<Compile Include="Factory\IphoneFactoryPh.cs" />
49+
<Compile Include="Factory\IPhoneFactory.cs" />
50+
<Compile Include="Factory\SamsungFactory.cs" />
51+
<Compile Include="Interface\IPhone.cs" />
52+
<Compile Include="Program.cs" />
53+
<Compile Include="Properties\AssemblyInfo.cs" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<None Include="App.config" />
57+
</ItemGroup>
58+
<ItemGroup />
59+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
60+
</Project>

AbstractFactory/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>

AbstractFactory/Concrete/Iphone.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using FactoryMethodPattern.SecondImplementation.Interface;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace FactoryMethodPattern.SecondImplementation.Concrete
9+
{
10+
class Iphone : IPhone
11+
{
12+
private string model;
13+
private string battery;
14+
public Iphone(string model, string battery)
15+
{
16+
this.model = model;
17+
this.battery = battery;
18+
}
19+
public string Battery()
20+
{
21+
return battery;
22+
}
23+
24+
public string Model()
25+
{
26+
return model;
27+
}
28+
public override string ToString()
29+
{
30+
return $"Iphone:{this.model}--{this.battery}";
31+
}
32+
}
33+
}

AbstractFactory/Concrete/Samsung.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using FactoryMethodPattern.SecondImplementation.Interface;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace FactoryMethodPattern.SecondImplementation.Concrete
9+
{
10+
class Samsung : IPhone
11+
{
12+
private string model;
13+
private string battery;
14+
public Samsung(string model,string battery)
15+
{
16+
this.model = model;
17+
this.battery = battery;
18+
}
19+
public string Battery()
20+
{
21+
return battery;
22+
}
23+
24+
public string Model()
25+
{
26+
return model;
27+
}
28+
public override string ToString()
29+
{
30+
return $"Samsung:{this.model}--{this.battery}";
31+
}
32+
}
33+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using FactoryMethodPattern.SecondImplementation.Interface;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace AbstractFactory.Factory
9+
{
10+
interface IPhoneFactory
11+
{
12+
IPhone CreatePhone(string model,string battery);
13+
}
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using FactoryMethodPattern.SecondImplementation.Interface;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace AbstractFactory.Factory
9+
{
10+
class IphoneFactoryPh : IPhoneFactory
11+
{
12+
public IPhone CreatePhone(string model, string battery)
13+
{
14+
return new IPhone("xr","500mah");
15+
}
16+
}
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using FactoryMethodPattern.SecondImplementation.Concrete;
2+
using FactoryMethodPattern.SecondImplementation.Interface;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace AbstractFactory.Factory
10+
{
11+
class SamsungFactory : IPhoneFactory
12+
{
13+
public IPhone CreatePhone(string model, string battery)
14+
{
15+
return new Samsung("S8", "1500mah");
16+
}
17+
}
18+
}

AbstractFactory/Interface/IPhone.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace FactoryMethodPattern.SecondImplementation.Interface
8+
{
9+
interface IPhone
10+
{
11+
string Model();
12+
string Battery();
13+
}
14+
}

AbstractFactory/Program.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using AbstractFactory.Factory;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace AbstractFactory
9+
{
10+
class Program
11+
{
12+
static void Main(string[] args)
13+
{
14+
SamsungFactory samsungFactory = new SamsungFactory();
15+
samsungFactory.CreatePhone("s8", "500mah");
16+
}
17+
}
18+
}
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+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("AbstractFactory")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("AbstractFactory")]
13+
[assembly: AssemblyCopyright("Copyright © 2021")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("7f20835c-b8d6-4b39-803b-058e433d23e4")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)