Skip to content

Commit

Permalink
Version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPulman committed Jul 25, 2022
1 parent e677247 commit bf1bc2e
Show file tree
Hide file tree
Showing 39 changed files with 7,563 additions and 0 deletions.
537 changes: 537 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
time: "08:00"
timezone: "Europe/London"
open-pull-requests-limit: 20
61 changes: 61 additions & 0 deletions .github/workflows/BuildOnly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: S7PlcRx CI-BuildOnly

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build-and-release:

runs-on: windows-2022

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x

- name: Add MSBuild to PATH
uses: glennawatson/setup-msbuild@v1.0.3
with:
prerelease: true

- name: NBGV
id: nbgv
uses: dotnet/nbgv@master
with:
setAllVars: true
- run: echo 'SemVer2=${{ steps.nbgv.outputs.SemVer2 }}'

- name: NuGet Restore
run: dotnet restore S7PlcRx.sln
working-directory: src

- name: Build
run: msbuild /t:build,pack /nowarn:MSB4011 /maxcpucount /p:NoPackageAnalysis=true /verbosity:minimal /p:Configuration=Release S7PlcRx.sln
working-directory: src

- name: Run Unit Tests and Generate Coverage
uses: glennawatson/coverlet-msbuild@v1
with:
project-files: 'src/**/*Tests*.csproj'
no-build: true
include-filter: 'S7PlcRx*'
output-format: cobertura
configuration: Release

- name: Upload Code Coverage
uses: codecov/codecov-action@v3

- name: Create NuGet Artifacts
uses: actions/upload-artifact@master
with:
name: nuget
path: '**/*.nupkg'
80 changes: 80 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: S7PlcRx CI-Build

on:
push:
branches: [ "main" ]

jobs:
build-and-release:

runs-on: windows-2022

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x

- name: Add MSBuild to PATH
uses: glennawatson/setup-msbuild@v1.0.3
with:
prerelease: true

- name: NBGV
id: nbgv
uses: dotnet/nbgv@master
with:
setAllVars: true
- run: echo 'SemVer2=${{ steps.nbgv.outputs.SemVer2 }}'

- name: NuGet Restore
run: dotnet restore S7PlcRx.sln
working-directory: src

- name: Build
run: msbuild /t:build,pack /nowarn:MSB4011 /maxcpucount /p:NoPackageAnalysis=true /verbosity:minimal /p:Configuration=Release S7PlcRx.sln
working-directory: src

- name: Run Unit Tests and Generate Coverage
uses: glennawatson/coverlet-msbuild@v1
with:
project-files: 'src/**/*Tests*.csproj'
no-build: true
include-filter: 'S7PlcRx*'
output-format: cobertura
configuration: Release

- name: Upload Code Coverage
uses: codecov/codecov-action@v3

- name: Create NuGet Artifacts
uses: actions/upload-artifact@master
with:
name: nuget
path: '**/*.nupkg'

- name: Changelog
uses: glennawatson/ChangeLog@v1
id: changelog

- name: Create Release
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.nbgv.outputs.SemVer2 }}
release_name: ${{ steps.nbgv.outputs.SemVer2 }}
body: |
${{ steps.changelog.outputs.commitLog }}
- name: NuGet Push
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
SOURCE_URL: https://api.nuget.org/v3/index.json
run: |
dotnet nuget push -s ${{ env.SOURCE_URL }} -k ${{ env.NUGET_AUTH_TOKEN }} **/*.nupkg --skip-duplicate
74 changes: 74 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<Project DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Authors>Chris Pulman</Authors>
<Description>A Reactive S7 PLC Library</Description>
<Copyright>Copyright © https://github.com/ChrisPulman $([System.DateTime]::Now.ToString(yyyy))</Copyright>
<IsTestProject>$(MSBuildProjectName.Contains('Tests'))</IsTestProject>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>preview</LangVersion>
<Configuration>$(TargetFramework)</Configuration>
<Company>ChrisPulman</Company>
<NoWarn>CS1591</NoWarn>
<Nullable>enable</Nullable>
<PackageIcon>S7PlcRx.png</PackageIcon>
<Configurations>Debug;Release;PreRelease</Configurations>
<PackageReleaseNotes>Compatability with Net 6 and netstandard2.0</PackageReleaseNotes>
<PackageTags>S7;Siemens;PLC;S7-200;S7-300;S7-400;S7-1200;S7-1500;rx;reactive;extensions;observable;LINQ;net;netstandard</PackageTags>
<EnableNETAnalyzers>True</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>

<PackageProjectUrl>https://github.com/ChrisPulman/S7PlcRx</PackageProjectUrl>
<RepositoryUrl>https://github.com/ChrisPulman/S7PlcRx</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<!--https://devblogs.microsoft.com/dotnet/producing-packages-with-source-link/-->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<DebugType>embedded</DebugType>
<IncludeSymbols>true</IncludeSymbols>

<!-- Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup Condition="'$(IsTestProject)' != 'true'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)images\S7PlcRx.png" Pack="true" PackagePath="\"/>
<None Include="$(MSBuildThisFileDirectory)LICENSE" Pack="true" PackagePath="LICENSE" />
</ItemGroup>

<ItemGroup Condition="'$(IsTestProject)' == 'true'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Moq" Version="4.18.1" />
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<!--<Compile Update="**\*.cs" DependentUpon="I%(Filename).cs" />-->
<PackageReference Include="Nerdbank.GitVersioning" Version="3.5.108" PrivateAssets="all" />
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.435" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="4.1.1" PrivateAssets="All" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
</ItemGroup>
</Project>
Binary file added Images/S7PlcRx.ico
Binary file not shown.
2,330 changes: 2,330 additions & 0 deletions Images/S7PlcRx.pdn

Large diffs are not rendered by default.

Binary file added Images/S7PlcRx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
![License](https://img.shields.io/github/license/ChrisPulman/S7PlcRx.svg) [![Build](https://github.com/ChrisPulman/S7PlcRx/actions/workflows/BuildOnly.yml/badge.svg)](https://github.com/ChrisPulman/S7PlcRx/actions/workflows/BuildOnly.yml) ![Nuget](https://img.shields.io/nuget/dt/S7PlcRx?color=pink&style=plastic) [![NuGet](https://img.shields.io/nuget/v/S7PlcRx.svg?style=plastic)](https://www.nuget.org/packages/S7PlcRx)

<p align="left">
<a href="https://github.com/ChrisPulman/S7PlcRx">
<img alt="S7PlcRx" src="https://github.com/ChrisPulman/S7PlcRx/blob/main/Images/S7PlcRx.png" width="200"/>
</a>
</p>

# S7PlcRx
S7 PLC Communications Library
22 changes: 22 additions & 0 deletions Version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.0",
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/main$"
],
"nugetPackageVersion": {
"semVer": 2,
"precision": "build"
},
"cloudBuild": {
"setVersionVariables": true,
"buildNumber": {
"enabled": false
}
},
"release": {
"versionIncrement": "build",
"firstUnstableTag": "alpha"
}
}
41 changes: 41 additions & 0 deletions src/S7PlcRx/S7PlcRx.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32630.192
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ProjectConfig", "ProjectConfig", "{62ECE40E-CA31-4602-8670-35BAF2C83672}"
ProjectSection(SolutionItems) = preProject
..\..\.editorconfig = ..\..\.editorconfig
..\..\.gitignore = ..\..\.gitignore
..\..\.github\workflows\BuildOnly.yml = ..\..\.github\workflows\BuildOnly.yml
..\..\.github\dependabot.yml = ..\..\.github\dependabot.yml
..\..\Directory.Build.props = ..\..\Directory.Build.props
..\..\.github\workflows\dotnet.yml = ..\..\.github\workflows\dotnet.yml
..\..\README.md = ..\..\README.md
..\..\stylecop.json = ..\..\stylecop.json
..\..\Version.json = ..\..\Version.json
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "S7PlcRx", "S7PlcRx\S7PlcRx.csproj", "{72EEC05E-CCFF-414F-ACD9-67F26CE1848E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
PreRelease|Any CPU = PreRelease|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{72EEC05E-CCFF-414F-ACD9-67F26CE1848E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72EEC05E-CCFF-414F-ACD9-67F26CE1848E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72EEC05E-CCFF-414F-ACD9-67F26CE1848E}.PreRelease|Any CPU.ActiveCfg = PreRelease|Any CPU
{72EEC05E-CCFF-414F-ACD9-67F26CE1848E}.PreRelease|Any CPU.Build.0 = PreRelease|Any CPU
{72EEC05E-CCFF-414F-ACD9-67F26CE1848E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72EEC05E-CCFF-414F-ACD9-67F26CE1848E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7727F7B6-C5BD-45F4-B7F3-B5DA765C4277}
EndGlobalSection
EndGlobal
36 changes: 36 additions & 0 deletions src/S7PlcRx/S7PlcRx/Core/PLCRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) Chris Pulman. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using S7PlcRx.Enums;

namespace S7PlcRx.Core
{
/// <summary>
/// PLC Request.
/// </summary>
internal class PLCRequest
{
/// <summary>
/// Initializes a new instance of the <see cref="PLCRequest"/> class.
/// </summary>
/// <param name="request">The request.</param>
/// <param name="tag">The tag.</param>
public PLCRequest(PLCRequestType request, Tag tag)
{
Request = request;
Tag = tag;
}

/// <summary>
/// Gets the request.
/// </summary>
/// <value>The request.</value>
public PLCRequestType Request { get; }

/// <summary>
/// Gets the tag.
/// </summary>
/// <value>The tag.</value>
public Tag Tag { get; }
}
}
Loading

0 comments on commit bf1bc2e

Please sign in to comment.