Skip to content

Commit

Permalink
提交源码
Browse files Browse the repository at this point in the history
  • Loading branch information
jieqiang authored and jieqiang committed Dec 23, 2017
1 parent fbf3a74 commit 566cd8a
Show file tree
Hide file tree
Showing 1,876 changed files with 1,672,176 additions and 0 deletions.
Binary file added .vs/Iddd/v15/.suo
Binary file not shown.
Empty file.
Binary file added .vs/Iddd/v15/Server/sqlite3/storage.ide
Binary file not shown.
1,028 changes: 1,028 additions & 0 deletions .vs/config/applicationhost.config

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions ConsoleApp/Algorithm/Addition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp
{
public class Addition : IAlgorithmStrategy
{
public int Num1;
public int Num2;
public void Calculation(int a, int b)
{
Console.WriteLine("计算结果:"+(a+b));
}
}
}
69 changes: 69 additions & 0 deletions ConsoleApp/Algorithm/GenericsFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp.Algorithm
{
public class GenericsFactory<T> : IGenericsFactory<T> where T : IAlgorithmStrategy
{
protected Dictionary<string, Type> Strategys;
protected Func<Type, T> Creator;
public void InitStrategy()
{
if (Strategys == null) {

}
}
public void CreatorSetting(Func<Type, T> creator)
{
throw new NotImplementedException();
}

public T GetStrategy(string name)
{
throw new NotImplementedException();
}

public List<T> GetStrategyList()
{
throw new NotImplementedException();
}

public Type GetStrategyType()
{
throw new NotImplementedException();
}

public void Register(Type type)
{
throw new NotImplementedException();
}
}

public static class CommonHelp
{


/// <summary>
/// 去重
/// </summary>
/// <typeparam name="TSource"></typeparam>
/// <typeparam name="Tkey"></typeparam>
/// <param name="source"></param>
/// <param name="selector"></param>
/// <returns></returns>
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> selector)
{
HashSet<TKey> seenKeys = new HashSet<TKey>();
foreach (TSource element in source)
{
if (seenKeys.Add(selector(element)))
{
yield return element;
}
}
}
}
}
29 changes: 29 additions & 0 deletions ConsoleApp/Algorithm/IGenericsFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp.Algorithm
{
public interface IGenericsFactory<T>where T:IAlgorithmStrategy
{
/// <summary>
/// 可以通过外部配置
/// </summary>
/// <param name="creator"></param>
void CreatorSetting(Func<Type, T> creator);

void Register(Type type);
/// <summary>
/// 根据名称获取
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
T GetStrategy(string name);

List<T> GetStrategyList();

Type GetStrategyType();
}
}
7 changes: 7 additions & 0 deletions ConsoleApp/Algorithm/IalgorithmStrategy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace ConsoleApp
{
public interface IAlgorithmStrategy
{
void Calculation(int a,int b);
}
}
13 changes: 13 additions & 0 deletions ConsoleApp/Algorithm/Multiplication.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp.Algorithm
{
public class Multiplication
{

}
}
13 changes: 13 additions & 0 deletions ConsoleApp/Algorithm/StrategyContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp
{
public class StrategyContext
{

}
}
16 changes: 16 additions & 0 deletions ConsoleApp/Algorithm/Subtraction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp
{
public class Subtraction : IAlgorithmStrategy
{
public void Calculation(int a, int b)
{
Console.WriteLine("计算结果为:"+(a-b));
}
}
}
6 changes: 6 additions & 0 deletions ConsoleApp/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
</configuration>
71 changes: 71 additions & 0 deletions ConsoleApp/ConsoleApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9EFED439-767F-4F0F-9D09-9EF025B13C7C}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ConsoleApp</RootNamespace>
<AssemblyName>ConsoleApp</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Algorithm\Addition.cs" />
<Compile Include="Algorithm\GenericsFactory.cs" />
<Compile Include="Algorithm\IGenericsFactory.cs" />
<Compile Include="Algorithm\Multiplication.cs" />
<Compile Include="HanDuck\Duck.cs" />
<Compile Include="HanDuck\FlyBehavior.cs" />
<Compile Include="HanDuck\IFlyBehavior.cs" />
<Compile Include="HanDuck\IQuackbehavior.cs" />
<Compile Include="HanDuck\ISweepingBehavior.cs" />
<Compile Include="HanDuck\QuackBehavior.cs" />
<Compile Include="HanDuck\RubberDuck.cs" />
<Compile Include="HanDuck\SweepingBehavior.cs" />
<Compile Include="HanDuck\WoodDuck.cs" />
<Compile Include="Algorithm\IAlgorithmStrategy.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Algorithm\StrategyContext.cs" />
<Compile Include="Algorithm\Subtraction.cs" />
<Compile Include="Reflection\AssemblyFinder.cs" />
<Compile Include="Reflection\TypeFinder.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
32 changes: 32 additions & 0 deletions ConsoleApp/HanDuck/Duck.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp.HanDuck
{
public abstract class Duck
{
public IFlyBehavior FlyBehavior { get; set; }
public IQuackbehavior Quackbehavior { get; set; }
public ISweepingBehavior SweepingBehavior { get; set; }

public abstract void Display();
public void PerformFly()
{
FlyBehavior.Fly();
}
public void PerformQuack()
{
Quackbehavior.Quack();
}
public void PerformSweeping()
{
SweepingBehavior.Swimming();
}


}
}
16 changes: 16 additions & 0 deletions ConsoleApp/HanDuck/FlyBehavior.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp.HanDuck
{
public class FlyBehavior : IFlyBehavior
{
public void Fly()
{
Console.WriteLine("WO 快要飞起来了");
}
}
}
13 changes: 13 additions & 0 deletions ConsoleApp/HanDuck/IFlyBehavior.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp.HanDuck
{
public interface IFlyBehavior
{
void Fly();
}
}
13 changes: 13 additions & 0 deletions ConsoleApp/HanDuck/IQuackbehavior.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp.HanDuck
{
public interface IQuackbehavior
{
void Quack();
}
}
13 changes: 13 additions & 0 deletions ConsoleApp/HanDuck/ISweepingBehavior.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp.HanDuck
{
public interface ISweepingBehavior
{
void Swimming();
}
}
16 changes: 16 additions & 0 deletions ConsoleApp/HanDuck/QuackBehavior.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp.HanDuck
{
public class QuackBehavior : IQuackbehavior
{
public void Quack()
{
Console.WriteLine("呱呱,呱呱 ,呱呱呱。。。"); ;
}
}
}
Loading

0 comments on commit 566cd8a

Please sign in to comment.