mirror of https://github.com/icedream/npipe.git
				
				
				
			Initial commit
						commit
						c9d6c75e05
					
				|  | @ -0,0 +1,3 @@ | |||
| /npipe/bin | ||||
| /npipe/obj | ||||
| /*.suo | ||||
|  | @ -0,0 +1,2 @@ | |||
| "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\csc.exe" /optimize+ /debug- /nowin32manifest /target:exe /out:npipe.exe npipe\Program.cs npipe\Properties\AssemblyInfo.cs /r:System.Core.dll | ||||
| pause | ||||
|  | @ -0,0 +1,20 @@ | |||
|  | ||||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||||
| # Visual Studio 2012 | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "npipe", "npipe\npipe.csproj", "{404896DF-481E-4747-9173-74174FA76F34}" | ||||
| EndProject | ||||
| Global | ||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| 		Debug|Any CPU = Debug|Any CPU | ||||
| 		Release|Any CPU = Release|Any CPU | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||||
| 		{404896DF-481E-4747-9173-74174FA76F34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||||
| 		{404896DF-481E-4747-9173-74174FA76F34}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{404896DF-481E-4747-9173-74174FA76F34}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{404896DF-481E-4747-9173-74174FA76F34}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(SolutionProperties) = preSolution | ||||
| 		HideSolutionNode = FALSE | ||||
| 	EndGlobalSection | ||||
| EndGlobal | ||||
|  | @ -0,0 +1,65 @@ | |||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Diagnostics; | ||||
| using System.IO.Pipes; | ||||
| 
 | ||||
| namespace npipe | ||||
| { | ||||
|     class Program | ||||
|     { | ||||
|         static void Main(string[] args) | ||||
|         { | ||||
|             if (args.Count() < 2) | ||||
|             { Usage(); return; } | ||||
| 
 | ||||
|             switch (args.First().ToLower()) | ||||
|             { | ||||
|                 case "server": | ||||
|                     { | ||||
|                         try | ||||
|                         { | ||||
|                             NamedPipeServerStream pipe = new NamedPipeServerStream(args.Last(), PipeDirection.Out, 1); | ||||
|                             pipe.WaitForConnection(); | ||||
|                             using (var stdin = Console.OpenStandardInput()) | ||||
|                             { | ||||
|                                 stdin.CopyTo(pipe); | ||||
|                             } | ||||
|                         } | ||||
|                         catch (Exception) | ||||
|                         { | ||||
|                             return; | ||||
|                         } | ||||
|                     } | ||||
|                     break; | ||||
|                 case "client": | ||||
|                     { | ||||
|                         try | ||||
|                         { | ||||
|                             NamedPipeClientStream pipe = new NamedPipeClientStream(".", args.Last(), PipeDirection.In); | ||||
|                             pipe.Connect(); | ||||
|                             using (var stdout = Console.OpenStandardOutput()) | ||||
|                             { | ||||
|                                 pipe.CopyTo(stdout); | ||||
|                             } | ||||
|                         } | ||||
|                         catch (Exception) | ||||
|                         { | ||||
|                             return; | ||||
|                         } | ||||
|                     } | ||||
|                     break; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         static void Usage() | ||||
|         { | ||||
|             Console.WriteLine("Usage:"); | ||||
|             Console.WriteLine("\t" + Process.GetCurrentProcess().ProcessName + " <mode> <pipename>"); | ||||
|             Console.WriteLine(); | ||||
|             Console.WriteLine("Modes:"); | ||||
|             Console.WriteLine("\tserver\tMakes data available via a pipe. Writes to pipe from stdin."); | ||||
|             Console.WriteLine("\tclient\tMakes data available from a pipe. Reads from pipe to stdout."); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,36 @@ | |||
| using System.Reflection; | ||||
| using System.Runtime.CompilerServices; | ||||
| using System.Runtime.InteropServices; | ||||
| 
 | ||||
| // Allgemeine Informationen über eine Assembly werden über die folgenden  | ||||
| // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, | ||||
| // die mit einer Assembly verknüpft sind. | ||||
| [assembly: AssemblyTitle("npipe")] | ||||
| [assembly: AssemblyDescription("")] | ||||
| [assembly: AssemblyConfiguration("")] | ||||
| [assembly: AssemblyCompany("Carl Kittelberger")] | ||||
| [assembly: AssemblyProduct("npipe")] | ||||
| [assembly: AssemblyCopyright("© 2013 Carl Kittelberger")] | ||||
| [assembly: AssemblyTrademark("")] | ||||
| [assembly: AssemblyCulture("")] | ||||
| 
 | ||||
| // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar  | ||||
| // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von  | ||||
| // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. | ||||
| [assembly: ComVisible(false)] | ||||
| 
 | ||||
| // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird | ||||
| [assembly: Guid("dad89c06-6c66-4e29-8ed1-11635c77f54d")] | ||||
| 
 | ||||
| // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: | ||||
| // | ||||
| //      Hauptversion | ||||
| //      Nebenversion  | ||||
| //      Buildnummer | ||||
| //      Revision | ||||
| // | ||||
| // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern  | ||||
| // übernehmen, indem Sie "*" eingeben: | ||||
| // [assembly: AssemblyVersion("1.0.*")] | ||||
| [assembly: AssemblyVersion("1.0.*")] | ||||
| [assembly: AssemblyFileVersion("1.0")] | ||||
|  | @ -0,0 +1,50 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="4.0" DefaultTargets="Build" 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>{404896DF-481E-4747-9173-74174FA76F34}</ProjectGuid> | ||||
|     <OutputType>Exe</OutputType> | ||||
|     <AppDesignerFolder>Properties</AppDesignerFolder> | ||||
|     <RootNamespace>npipe</RootNamespace> | ||||
|     <AssemblyName>npipe</AssemblyName> | ||||
|     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | ||||
|     <FileAlignment>512</FileAlignment> | ||||
|   </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" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <Compile Include="Program.cs" /> | ||||
|     <Compile Include="Properties\AssemblyInfo.cs" /> | ||||
|   </ItemGroup> | ||||
|   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||||
|   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  | ||||
|        Other similar extension points exist, see Microsoft.Common.targets. | ||||
|   <Target Name="BeforeBuild"> | ||||
|   </Target> | ||||
|   <Target Name="AfterBuild"> | ||||
|   </Target> | ||||
|   --> | ||||
| </Project> | ||||
		Loading…
	
		Reference in New Issue