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

Created new Standard2.1 project and pulled in client from .NET 4.0 project for full features. #70

Open
wants to merge 1 commit 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
52 changes: 51 additions & 1 deletion EasyModbus.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleAppStd", "ConsoleApp
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyModbus_V5.0", "EasyModbus_NET5\EasyModbus_V5.0.csproj", "{83AFFC60-BC95-46B1-861F-B1F80270FBFA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyModbus_Standard2.1", "EasyModbus_Standard2.1\EasyModbus_Standard2.1.csproj", "{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -331,12 +333,60 @@ Global
{83AFFC60-BC95-46B1-861F-B1F80270FBFA}.Release|x64.Build.0 = Release|Any CPU
{83AFFC60-BC95-46B1-861F-B1F80270FBFA}.Release|x86.ActiveCfg = Release|Any CPU
{83AFFC60-BC95-46B1-861F-B1F80270FBFA}.Release|x86.Build.0 = Release|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Debug|ARM.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Debug|ARM.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Debug|x64.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Debug|x64.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Debug|x86.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Debug|x86.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial|Any CPU.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial|Any CPU.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial|ARM.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial|ARM.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial|x64.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial|x64.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial|x86.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial|x86.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial1|Any CPU.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial1|Any CPU.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial1|ARM.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial1|ARM.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial1|x64.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial1|x64.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial1|x86.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial1|x86.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial2|Any CPU.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial2|Any CPU.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial2|ARM.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial2|ARM.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial2|x64.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial2|x64.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial2|x86.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial2|x86.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial3|Any CPU.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial3|Any CPU.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial3|ARM.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial3|ARM.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial3|x64.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial3|x64.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial3|x86.ActiveCfg = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.DebugCommercial3|x86.Build.0 = Debug|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Release|Any CPU.Build.0 = Release|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Release|ARM.ActiveCfg = Release|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Release|ARM.Build.0 = Release|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Release|x64.ActiveCfg = Release|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Release|x64.Build.0 = Release|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Release|x86.ActiveCfg = Release|Any CPU
{B0E8ADB4-6599-4440-92DF-12DA4E36C6BD}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7628B1C9-8DDB-4DBD-A71D-D369A4A166DE}
VisualSVNWorkingCopyRoot = .
SolutionGuid = {7628B1C9-8DDB-4DBD-A71D-D369A4A166DE}
EndGlobalSection
EndGlobal
120 changes: 120 additions & 0 deletions EasyModbus_Standard2.1/EasyModbus.StoreLogData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/*
Copyright (c) 2018-2020 Rossmann-Engineering
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software
and associated documentation files (the "Software"),
to deal in the Software without restriction,
including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission
notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

using System;
using System.Collections.Generic;
using System.Text;

namespace EasyModbus
{
/// <summary>
/// Store Log-Data in a File
/// </summary>
public sealed class StoreLogData
{
private String filename = null;
private static volatile StoreLogData instance;
private static object syncObject = new Object();

/// <summary>
/// Private constructor; Ensures the access of the class only via "instance"
/// </summary>
private StoreLogData()
{
}

/// <summary>
/// Returns the instance of the class (singleton)
/// </summary>
/// <returns>instance (Singleton)</returns>
public static StoreLogData Instance
{
get
{
if (instance == null)
{
lock (syncObject)
{
if (instance == null)
instance = new StoreLogData();
}
}

return instance;
}
}

/// <summary>
/// Store message in Log-File
/// </summary>
/// <param name="message">Message to append to the Log-File</param>
public void Store(String message)
{
if (this.filename == null)
return;

using (System.IO.StreamWriter file =
new System.IO.StreamWriter(Filename, true))
{
file.WriteLine(message);
}
}

/// <summary>
/// Store message in Log-File including Timestamp
/// </summary>
/// <param name="message">Message to append to the Log-File</param>
/// <param name="timestamp">Timestamp to add to the same Row</param>
public void Store(String message, DateTime timestamp)
{
try
{
using (System.IO.StreamWriter file =
new System.IO.StreamWriter(Filename, true))
{
file.WriteLine(timestamp.ToString("dd.MM.yyyy H:mm:ss.ff ") + message);
}
}
catch (Exception e)
{

}
}

/// <summary>
/// Gets or Sets the Filename to Store Strings in a File
/// </summary>
public string Filename
{
get
{
return filename;
}
set
{
filename = value;
}
}
}
}
12 changes: 12 additions & 0 deletions EasyModbus_Standard2.1/EasyModbus_Standard2.1.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>EasyModbus_Standard2._1</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.IO.Ports" Version="5.0.1" />
</ItemGroup>

</Project>
Loading