Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted to .Net Core #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .vs/PiSharp/v15/.suo
Binary file not shown.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
8 changes: 8 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ExpandedNodes": [
"",
"\\src"
],
"SelectedNode": "\\src\\PiSharpGpio.sln",
"PreviewInSolutionExplorer": false
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
Binary file added src/.vs/PiSharpGpio/v15/.suo
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8e596988bceef6a53aa28a9b556930d0acc5e129
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8e596988bceef6a53aa28a9b556930d0acc5e129
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c5ada5c0b222be9220d782343094c69e8d7c41a7
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c5ada5c0b222be9220d782343094c69e8d7c41a7
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bfb222fa9361e5efb824463e4816442d2dcc2143
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.GpioSimulator\bin\Debug\Images\LEDOff.png
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.GpioSimulator\bin\Debug\Images\LEDOn.png
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.GpioSimulator\bin\Debug\Images\SwitchOff.png
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.GpioSimulator\bin\Debug\Images\SwitchOn.png
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.GpioSimulator\bin\Debug\PiSharp.GpioSimulator.exe.config
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.GpioSimulator\bin\Debug\PiSharp.GpioSimulator.exe
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.GpioSimulator\bin\Debug\PiSharp.GpioSimulator.pdb
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.GpioSimulator\obj\x86\Debug\PiSharp.GpioSimulator.csprojResolveAssemblyReference.cache
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.GpioSimulator\obj\x86\Debug\PiSharp.GpioSimulator.FrmAbout.resources
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.GpioSimulator\obj\x86\Debug\PiSharp.GpioSimulator.Main.resources
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.GpioSimulator\obj\x86\Debug\PiSharp.GpioSimulator.Properties.Resources.resources
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.GpioSimulator\obj\x86\Debug\PiSharp.GpioSimulator.csproj.GenerateResource.Cache
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.GpioSimulator\obj\x86\Debug\PiSharp.GpioSimulator.exe
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.GpioSimulator\obj\x86\Debug\PiSharp.GpioSimulator.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bfb222fa9361e5efb824463e4816442d2dcc2143
21 changes: 10 additions & 11 deletions src/PiSharp.LibGpio/LibGpio.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
//-----------------------------------------------------------------------
// <remarks>
// 2017-04-27 - Modified by James Evans - Converted this project to utilize .Net Core v1.1
//</remarks>
// <copyright file="LibGpio.cs" company="Andrew Bradford">
// Copyright (C) 2012 Andrew Bradford
//
Expand Down Expand Up @@ -116,7 +119,7 @@ public void CloseChannel(BroadcomPinNumber pinNumber)
this.SetDirection(pinNumber, Direction.Input);
}



Debug.WriteLine(string.Format("[PiSharp.LibGpio] Broadcom GPIO number '{0}', configured for use", pinNumber));
}
Expand Down Expand Up @@ -216,7 +219,7 @@ public void OutputValue(BroadcomPinNumber pinNumber, bool value)

var gpioId = string.Format("gpio{0}", (int)pinNumber);
var filePath = Path.Combine(gpioId, "value");
using (var streamWriter = new StreamWriter(Path.Combine(this.GetGpioPath(), filePath), false))
using (var streamWriter = new StreamWriter(File.Open(Path.Combine(GetGpioPath().ToString(), filePath), FileMode.OpenOrCreate)))
{
if (value)
{
Expand Down Expand Up @@ -399,14 +402,14 @@ private void UnExport(BroadcomPinNumber pinNumber)
private void Export(BroadcomPinNumber pinNumber)
{
// The simulator requires directories to be created first, but the RasPi does not and throws an exception.
if (this.TestMode || Environment.OSVersion.Platform != PlatformID.Unix)
if (this.TestMode || !System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX))
{
var exportDir = string.Format("gpio{0}", (int)pinNumber);
var exportPath = Path.Combine(this.GetGpioPath(), exportDir);
if (!Directory.Exists(exportPath))
{
Directory.CreateDirectory(exportPath);
File.Create(Path.Combine(exportPath, "value")).Close();
File.Create(Path.Combine(exportPath, "value"));
}
}

Expand All @@ -432,7 +435,7 @@ private void SetDirection(BroadcomPinNumber pinNumber, Direction direction)
{
var gpioId = string.Format("gpio{0}", (int)pinNumber);
var filePath = Path.Combine(gpioId, "direction");
using (var streamWriter = new StreamWriter(Path.Combine(this.GetGpioPath(), filePath), false))
using (var streamWriter = new StreamWriter(File.Open(Path.Combine(GetGpioPath().ToString(), filePath), FileMode.OpenOrCreate)))
{
if (direction == Direction.Input)
{
Expand Down Expand Up @@ -463,16 +466,12 @@ private void SetDirection(BroadcomPinNumber pinNumber, Direction direction)
/// <returns>The correct path for the IO and mode</returns>
private string GetGpioPath()
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT || Environment.OSVersion.Platform == PlatformID.Win32Windows
|| Environment.OSVersion.Platform == PlatformID.Win32S || Environment.OSVersion.Platform == PlatformID.WinCE)
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows))
{
// If we're running under Windows, use a Windows format test path
return "C:\\RasPiGpioTest";
}
else if (this.TestMode
|| Environment.OSVersion.Platform == PlatformID.MacOSX
|| Environment.OSVersion.Platform == PlatformID.Unix
|| ((int)Environment.OSVersion.Platform) == 128) // 128 is used for OSX on for .NET versions <4.0 on Mono, see https://github.com/andycb/PiSharp/issues/3
else if (this.TestMode || System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX))
{
// If we're in Test mode or running on a Mac, use a Unix style test path
return "/tmp/RasPiGpioTest";
Expand Down
66 changes: 4 additions & 62 deletions src/PiSharp.LibGpio/PiSharp.LibGpio.csproj
Original file line number Diff line number Diff line change
@@ -1,65 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{2880BE93-F857-4E19-AF08-94AF812FB3A8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PiSharp.LibGpio</RootNamespace>
<AssemblyName>PiSharp.LibGpio</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;GpioTestMode</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Entities\PhysicalPinNumber.cs" />
<Compile Include="Entities\RaspberryPinNumber.cs" />
<Compile Include="Entities\BroadcomPinNumber.cs" />
<Compile Include="Entities\Direction.cs" />
<Compile Include="LibGpio.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<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>
55 changes: 0 additions & 55 deletions src/PiSharp.LibGpio/Properties/AssemblyInfo.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v1.1",
"signature": "da39a3ee5e6b4b0d3255bfef95601890afd80709"
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v1.1": {
"pisharp.libgpio.core/1.0.0": {
"runtime": {
"PiSharp.LibGpio.Core.dll": {}
}
}
}
},
"libraries": {
"pisharp.libgpio.core/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v1.1",
"signature": "da39a3ee5e6b4b0d3255bfef95601890afd80709"
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v1.1": {
"pisharp.libgpio/1.0.0": {
"runtime": {
"PiSharp.LibGpio.dll": {}
}
}
}
},
"libraries": {
"pisharp.libgpio/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e10ccbdd8032da069e60fa0805b77edfd058356e
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("PiSharp.LibGpio")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("Package Description")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("PiSharp.LibGpio")]
[assembly: System.Reflection.AssemblyTitleAttribute("PiSharp.LibGpio")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("PiSharp.LibGpio.Core")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("Package Description")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("PiSharp.LibGpio.Core")]
[assembly: System.Reflection.AssemblyTitleAttribute("PiSharp.LibGpio.Core")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
C:\Git\PiSharp-master\src\PiSharp.LibGpio.Core\bin\Debug\netcoreapp1.1\PiSharp.LibGpio.Core.deps.json
C:\Git\PiSharp-master\src\PiSharp.LibGpio.Core\bin\Debug\netcoreapp1.1\PiSharp.LibGpio.Core.dll
C:\Git\PiSharp-master\src\PiSharp.LibGpio.Core\bin\Debug\netcoreapp1.1\PiSharp.LibGpio.Core.pdb
C:\Git\PiSharp-master\src\PiSharp.LibGpio.Core\obj\Debug\netcoreapp1.1\PiSharp.LibGpio.Core.csprojResolveAssemblyReference.cache
C:\Git\PiSharp-master\src\PiSharp.LibGpio.Core\obj\Debug\netcoreapp1.1\PiSharp.LibGpio.Core.AssemblyInfo.cs
C:\Git\PiSharp-master\src\PiSharp.LibGpio.Core\obj\Debug\netcoreapp1.1\PiSharp.LibGpio.Core.dll
C:\Git\PiSharp-master\src\PiSharp.LibGpio.Core\obj\Debug\netcoreapp1.1\PiSharp.LibGpio.Core.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
C:\Git\PiSharp-master\src\PiSharp.LibGpio\bin\Debug\netcoreapp1.1\PiSharp.LibGpio.deps.json
C:\Git\PiSharp-master\src\PiSharp.LibGpio\obj\Debug\netcoreapp1.1\PiSharp.LibGpio.AssemblyInfo.cs
C:\Git\PiSharp-master\src\PiSharp.LibGpio\bin\Debug\netcoreapp1.1\PiSharp.LibGpio.dll
C:\Git\PiSharp-master\src\PiSharp.LibGpio\bin\Debug\netcoreapp1.1\PiSharp.LibGpio.pdb
C:\Git\PiSharp-master\src\PiSharp.LibGpio\obj\Debug\netcoreapp1.1\PiSharp.LibGpio.dll
C:\Git\PiSharp-master\src\PiSharp.LibGpio\obj\Debug\netcoreapp1.1\PiSharp.LibGpio.pdb
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.LibGpio\bin\Debug\netcoreapp1.1\PiSharp.LibGpio.deps.json
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.LibGpio\bin\Debug\netcoreapp1.1\PiSharp.LibGpio.dll
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.LibGpio\bin\Debug\netcoreapp1.1\PiSharp.LibGpio.pdb
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.LibGpio\obj\Debug\netcoreapp1.1\PiSharp.LibGpio.csprojResolveAssemblyReference.cache
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.LibGpio\obj\Debug\netcoreapp1.1\PiSharp.LibGpio.AssemblyInfo.cs
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.LibGpio\obj\Debug\netcoreapp1.1\PiSharp.LibGpio.dll
C:\Users\dewli\Source\Repos\PiSharp\src\PiSharp.LibGpio\obj\Debug\netcoreapp1.1\PiSharp.LibGpio.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
18 changes: 18 additions & 0 deletions src/PiSharp.LibGpio/obj/PiSharp.LibGpio.Core.csproj.nuget.g.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">C:\Git\PiSharp-master\src\PiSharp.LibGpio.Core\obj\project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\dewli\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">4.1.0</NuGetToolVersion>
</PropertyGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)microsoft.diasymreader.native\1.4.1\build\Microsoft.DiaSymReader.Native.props" Condition="Exists('$(NuGetPackageRoot)microsoft.diasymreader.native\1.4.1\build\Microsoft.DiaSymReader.Native.props')" />
</ImportGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
</Project>
Loading