Aggiunta core, config e modelli

This commit is contained in:
Samuele Locatelli
2021-12-01 18:05:50 +01:00
parent be164fb527
commit 2b46550404
33 changed files with 2512 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Iob.Config
{
public class AdapterConf
{
}
}
+3
View File
@@ -0,0 +1,3 @@
{
}
+59
View File
@@ -0,0 +1,59 @@
<?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>{ECD556AC-F81F-4D23-A02E-7555EEC3C0E9}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Iob.Config</RootNamespace>
<AssemblyName>Iob.Config</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<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="..\VersGen\VersGen.cs">
<Link>VersGen.cs</Link>
</Compile>
<Compile Include="AdapterConf.cs" />
<Compile Include="IobConf.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServerConf.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Data\commonSetup.json" />
</ItemGroup>
<ItemGroup>
<Folder Include="Data\Target\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+12
View File
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Iob.Config
{
public class IobConf
{
}
}
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
// associate a un assembly.
[assembly: AssemblyTitle("Iob.Config")]
[assembly: AssemblyDescription("Config Management Class")]
[assembly: AssemblyConfiguration("")]
//[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Iob.Config")]
//[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
// COM, impostare su true l'attributo ComVisible per tale tipo.
[assembly: ComVisible(false)]
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
[assembly: Guid("ecd556ac-f81f-4d23-a02e-7555eec3c0e9")]
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
//
// Versione principale
// Versione secondaria
// Numero di build
// Revisione
//
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
// usando l'asterisco '*' come illustrato di seguito:
// [assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
+12
View File
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Iob.Config
{
public class ServerConf
{
}
}
+12
View File
@@ -0,0 +1,12 @@
---------------------------------------------------------------
------- SteamWareLib SDK -------
---------------------------------------------------------------
Libreria di utility base di SteamWare.
Le dipendenze inserite sono necessarie al funzionamento dell'SDK.
Sono inclusi a titolo di esempio vari files di conf:
* example-NLog.config
Attenzione a configurare correttamente il file NLog.xml includendo il rule per la classe, vedere ad esempio il file example-NLog.config allegato.
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

+172
View File
@@ -0,0 +1,172 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using static SteamWare.Logger.Logging;
using static SteamWare.Logger.Constants;
using Iob.Model;
namespace Iob.Core
{
public static class ExceptionManager
{
#region Private Fields
private static bool MessageBoxShow = false;
#endregion Private Fields
#region Public Methods
public static string GetExceptionMethodName(Exception ex)
{
var s = new StackTrace(ex, true);
var thisasm = Assembly.GetExecutingAssembly();
Console.WriteLine(s.GetFrames().Count());
foreach (var a in s.GetFrames())
{
var d = a.GetMethod();
Console.WriteLine(d.Name);
}
return s.GetFrames().FirstOrDefault()?.GetMethod().Name;
}
public static void ManageError(ERROR_LEVEL errorLevel, string message, bool beforeFormReady = false)
{
switch (errorLevel)
{
case ERROR_LEVEL.INFO:
{
// Log
LogInfo(message);
// Notify users
NotifyUsers(CreateMessageModel("Info!", message, ERROR_LEVEL.INFO));
}
break;
case ERROR_LEVEL.WARNING:
{
LogWarning(message);
NotifyUsers(CreateMessageModel("Warning!", message, ERROR_LEVEL.WARNING));
}
break;
case ERROR_LEVEL.ERROR:
{
LogError(message);
NotifyUsersAndClose(CreateMessageModel("Error!", message, ERROR_LEVEL.ERROR));
}
break;
case ERROR_LEVEL.FATAL:
{
LogFatal(message);
if (!MessageBoxShow)
{
MessageBoxShow = true;
NotifyUsersAndClose(CreateMessageModel("Fatal Error!", message, ERROR_LEVEL.FATAL), beforeFormReady);
// Check if the server form is ready (if not i have to close manually)
if (beforeFormReady)
// Close the application
Environment.Exit(1);
}
}
break;
default:
{
LogFatal(message);
if (!MessageBoxShow)
{
MessageBoxShow = true;
NotifyUsersAndClose(CreateMessageModel("Generic Error!", message, ERROR_LEVEL.FATAL), beforeFormReady);
}
}
break;
}
}
public static void ManageException(ERROR_LEVEL errorLevel, Exception exception)
{
string message = exception.Message;
if (exception.InnerException != null)
{
// Add inner exception message (if exists)
message += " | " + exception.InnerException.Message;
}
// Add method name
message += " | " + GetExceptionMethodName(exception);
ManageError(errorLevel, message);
}
#endregion Public Methods
#region Private Methods
private static ErrorMessageModel CreateMessageModel(string title, string message, ERROR_LEVEL level, string methodName = "")
{
if (methodName != "")
message = message + " | " + methodName;
return new ErrorMessageModel()
{
Title = title,
Message = message,
ErrorLevel = level
};
}
private static void LogAndNotifyUsers(ErrorMessageModel error)
{
// Log
LogMessage(error.Message, (ERROR_LEVEL)error.ErrorLevel);
NotifyUsersAndClose(error);
}
private static void NotifyUsers(ErrorMessageModel error, bool beforeFormReady = false)
{
#if false
if (beforeFormReady)
{
MessageBox.Show(new Form { TopMost = true }, error.Message, error.Title, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
MessageServices.Current.Publish(SEND_MESSAGE, null, error);
}
#endif
}
private static void NotifyUsersAndClose(ErrorMessageModel error, bool beforeFormReady = false)
{
#if false
if (beforeFormReady)
{
// Notify user
MessageServices.Current.Publish(SEND_STOP_THREADS);
MessageBox.Show(new Form { TopMost = true }, error.Message, error.Title, MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageServices.Current.Publish(SEND_STOP_SERVER);
}
else
{
// Notify user
//MessageServices.Current.Publish(SEND_STOP_THREADS);
MessageServices.Current.Publish(SEND_MESSAGE, null, error);
}
#endif
}
#endregion Private Methods
}
}
+193
View File
@@ -0,0 +1,193 @@
<?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>{E7373C65-E16A-4F99-8911-BFE72593133E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Iob.Core</RootNamespace>
<AssemblyName>Iob.Core</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Crc32C.NET, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Crc32C.NET.1.0.5.0\lib\net20\Crc32C.NET.dll</HintPath>
</Reference>
<Reference Include="DnsClient, Version=1.3.2.0, Culture=neutral, PublicKeyToken=4574bb5573c51424, processorArchitecture=MSIL">
<HintPath>..\packages\DnsClient.1.3.2\lib\net45\DnsClient.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.2.0.246, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.1\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="MongoDB.Bson, Version=2.11.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Bson.2.11.2\lib\net452\MongoDB.Bson.dll</HintPath>
</Reference>
<Reference Include="MongoDB.Driver, Version=2.11.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Driver.2.11.2\lib\net452\MongoDB.Driver.dll</HintPath>
</Reference>
<Reference Include="MongoDB.Driver.Core, Version=2.11.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Driver.Core.2.11.2\lib\net452\MongoDB.Driver.Core.dll</HintPath>
</Reference>
<Reference Include="MongoDB.Libmongocrypt, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Libmongocrypt.1.0.0\lib\net452\MongoDB.Libmongocrypt.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.4\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="Pipelines.Sockets.Unofficial, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42ea0a778e13fbe2, processorArchitecture=MSIL">
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.1.16\lib\net461\Pipelines.Sockets.Unofficial.dll</HintPath>
</Reference>
<Reference Include="SharpCompress, Version=0.26.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
<HintPath>..\packages\SharpCompress.0.26.0\lib\net46\SharpCompress.dll</HintPath>
</Reference>
<Reference Include="Snappy.NET, Version=1.1.1.8, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Snappy.NET.1.1.1.8\lib\net45\Snappy.NET.dll</HintPath>
</Reference>
<Reference Include="StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46, processorArchitecture=MSIL">
<HintPath>..\packages\StackExchange.Redis.2.1.58\lib\net461\StackExchange.Redis.dll</HintPath>
</Reference>
<Reference Include="SteamWare.IO, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SteamWare.IO.4.9.2009.740\lib\net462\SteamWare.IO.dll</HintPath>
</Reference>
<Reference Include="SteamWare.Logger, Version=4.9.2009.740, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SteamWare.Logger.4.9.2009.740\lib\net462\SteamWare.Logger.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.PerformanceCounter, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.PerformanceCounter.4.7.0\lib\net461\System.Diagnostics.PerformanceCounter.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
</Reference>
<Reference Include="System.IO.Pipelines, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.4.7.2\lib\net461\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
</Reference>
<Reference Include="System.ServiceModel" />
<Reference Include="System.Threading.Channels, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Channels.4.7.1\lib\net461\System.Threading.Channels.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\VersGen\VersGen.cs">
<Link>VersGen.cs</Link>
</Compile>
<Compile Include="ExceptionManager.cs" />
<Compile Include="MessageQueues.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ThreadsFunctions.cs" />
<Compile Include="ThreadsHandler.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Iob.Adapter\Iob.Adapter.csproj">
<Project>{09fd3985-3898-4ad8-9472-2b84d117bbcd}</Project>
<Name>Iob.Adapter</Name>
</ProjectReference>
<ProjectReference Include="..\Iob.Config\Iob.Config.csproj">
<Project>{ecd556ac-f81f-4d23-a02e-7555eec3c0e9}</Project>
<Name>Iob.Config</Name>
</ProjectReference>
<ProjectReference Include="..\Iob.Model\Iob.Model.csproj">
<Project>{3da86f5d-0459-4d24-9b5e-a2c44e5019f3}</Project>
<Name>Iob.Model</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="App_Readme\README_SteamWare.txt" />
<Content Include="App_Readme\SteamWare_demo\example-favicon.ico" />
<Content Include="Core\Compression\Snappy\lib\win\snappy32.dll" />
<Content Include="Core\Compression\Snappy\lib\win\snappy64.dll" />
<Content Include="Core\Compression\Zstandard\lib\win\libzstd.dll" />
<Content Include="libzstd.dll" />
<Content Include="mongocrypt.dll" />
<Content Include="snappy32.dll" />
<Content Include="snappy64.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\MongoDB.Libmongocrypt.1.0.0\build\MongoDB.Libmongocrypt.targets" Condition="Exists('..\packages\MongoDB.Libmongocrypt.1.0.0\build\MongoDB.Libmongocrypt.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Questo progetto fa riferimento a uno o più pacchetti NuGet che non sono presenti in questo computer. Usare lo strumento di ripristino dei pacchetti NuGet per scaricarli. Per altre informazioni, vedere http://go.microsoft.com/fwlink/?LinkID=322105. Il file mancante è {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MongoDB.Libmongocrypt.1.0.0\build\MongoDB.Libmongocrypt.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MongoDB.Libmongocrypt.1.0.0\build\MongoDB.Libmongocrypt.targets'))" />
<Error Condition="!Exists('..\packages\MongoDB.Driver.Core.2.11.2\build\MongoDB.Driver.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MongoDB.Driver.Core.2.11.2\build\MongoDB.Driver.Core.targets'))" />
</Target>
<Import Project="..\packages\MongoDB.Driver.Core.2.11.2\build\MongoDB.Driver.Core.targets" Condition="Exists('..\packages\MongoDB.Driver.Core.2.11.2\build\MongoDB.Driver.Core.targets')" />
</Project>
+12
View File
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Iob.Core
{
public static class MessageQueues
{
}
}
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
// associate a un assembly.
[assembly: AssemblyTitle("Iob.Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
//[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Iob.Core")]
//[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
// COM, impostare su true l'attributo ComVisible per tale tipo.
[assembly: ComVisible(false)]
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
[assembly: Guid("e7373c65-e16a-4f99-8911-bfe72593133e")]
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
//
// Versione principale
// Versione secondaria
// Numero di build
// Revisione
//
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
// usando l'asterisco '*' come illustrato di seguito:
// [assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
File diff suppressed because it is too large Load Diff
+127
View File
@@ -0,0 +1,127 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Threading;
namespace Iob.Core
{
/// <summary>
/// Gestore generale dei threads
/// </summary>
public static class ThreadsHandler
{
private static List<Action> ThreadsFunctionsList = new List<Action>
{
#if false
ThreadsFunctions.ManageWatchdog,
ThreadsFunctions.ReadAdapter,
ThreadsFunctions.SendData,
ThreadsFunctions.ExecuteMapoRequests,
#endif
ThreadsFunctions.StatThread
};
#if false
private static Action ThreadSetupCmsConnect = ThreadsFunctions.SetupCmsConnect;
#endif
private volatile static List<Thread> RunningThreadsList = new List<Thread>();
public static Thread StartClient;
internal volatile static Dictionary<string, string> RunningThreadStatus = new Dictionary<string, string>();
public static void Start()
{
#if false
ThreadsFunctions.RestoreConnection();
if (Config.ServerConfig.ServerStartupConfig.CmsConnectReady)
{
Thread t = new Thread(() => ThreadSetupCmsConnect());
t.Start();
Thread.Sleep(30);
}
#endif
}
public static void StartWorkers()
{
lock (RunningThreadStatus)
RunningThreadStatus.Clear();
SteamWare.IO.Redis myRedis = new SteamWare.IO.Redis();
string myKey = myRedis.redHash("StatThread");
// For each function run in the list a thread
ThreadsFunctionsList.ForEach(threadFunction =>
{
// Run new Thread in the list
Thread t = new Thread(() =>
threadFunction()
);
t.Start();
// aggiungo pausa x evitare sovrapposizioni chiamate
Thread.Sleep(50);
// Add thread to running threads list
lock (RunningThreadsList)
RunningThreadsList.Add(t);
RunningThreadStatus.Add(threadFunction.Method.Name, "---");
});
#if false
MessageServices.Current.Publish(SEND_THREADS_STATUS, null, RunningThreadStatus);
#endif
myRedis.setRSV(myKey, JsonConvert.SerializeObject(ThreadsHandler.RunningThreadStatus));
}
public static void Stop()
{
// Stop each thread
lock (RunningThreadsList)
RunningThreadsList.ForEach(thread =>
{
thread.Abort();
});
// Remove threads from running status
lock (RunningThreadsList)
RunningThreadsList.Clear();
lock (RunningThreadStatus)
{
RunningThreadStatus.Clear();
RunningThreadStatus.Add("TryNcConnection", "---");
}
#if false
MessageServices.Current.Publish(SEND_THREADS_STATUS, null, RunningThreadStatus);
#endif
}
public static void Close()
{
//Abort Nc Read Threads
RunningThreadsList.ForEach(thread =>
{
thread.Abort();
});
if (ThreadsHandler.StartClient != null)
ThreadsHandler.StartClient.Abort();
#if false
//Abort Connect Thread
ThreadsFunctions.AbortNcConnection();
#endif
}
public static void StartClientFromUI()
{
#if false
ThreadsFunctions.StartCMSClient();
#endif
}
}
}
+43
View File
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DnsClient" publicKeyToken="4574bb5573c51424" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.2.0" newVersion="1.3.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="SharpCompress" publicKeyToken="afb0a02973931d96" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.26.0.0" newVersion="0.26.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.3" newVersion="4.1.1.3" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Binary file not shown.
Binary file not shown.
+34
View File
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Crc32C.NET" version="1.0.5.0" targetFramework="net462" />
<package id="DnsClient" version="1.3.2" targetFramework="net462" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.1.1" targetFramework="net462" />
<package id="MongoDB.Bson" version="2.11.2" targetFramework="net462" />
<package id="MongoDB.Driver" version="2.11.2" targetFramework="net462" />
<package id="MongoDB.Driver.Core" version="2.11.2" targetFramework="net462" />
<package id="MongoDB.Libmongocrypt" version="1.0.0" targetFramework="net462" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net462" />
<package id="NLog" version="4.7.4" targetFramework="net462" />
<package id="Pipelines.Sockets.Unofficial" version="2.1.16" targetFramework="net462" />
<package id="SharpCompress" version="0.26.0" targetFramework="net462" />
<package id="SharpZipLib" version="1.2.0" targetFramework="net462" />
<package id="Snappy.NET" version="1.1.1.8" targetFramework="net462" />
<package id="StackExchange.Redis" version="2.1.58" targetFramework="net462" />
<package id="SteamWare.IO" version="4.9.2009.740" targetFramework="net462" />
<package id="SteamWare.Logger" version="4.9.2009.740" targetFramework="net462" />
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
<package id="System.Diagnostics.PerformanceCounter" version="4.7.0" targetFramework="net462" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net462" />
<package id="System.IO.Pipelines" version="4.7.2" targetFramework="net462" />
<package id="System.Memory" version="4.5.4" targetFramework="net462" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net462" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net462" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net462" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net462" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net462" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net462" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net462" />
<package id="System.Threading.Channels" version="4.7.1" targetFramework="net462" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
</packages>
Binary file not shown.
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
---------------------------------------------------------------
------- SteamWareLib SDK -------
---------------------------------------------------------------
Libreria di utility base di SteamWare.
Le dipendenze inserite sono necessarie al funzionamento dell'SDK.
Sono inclusi a titolo di esempio vari files di conf:
* example-NLog.config
Attenzione a configurare correttamente il file NLog.xml includendo il rule per la classe, vedere ad esempio il file example-NLog.config allegato.
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

+20
View File
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static SteamWare.Logger.Constants;
namespace Iob.Model
{
public class ErrorMessageModel
{
#region Public Properties
public ERROR_LEVEL ErrorLevel { get; set; }
public string Message { get; set; }
public string Title { get; set; }
#endregion Public Properties
}
}
+70
View File
@@ -0,0 +1,70 @@
<?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>{3DA86F5D-0459-4D24-9B5E-A2C44E5019F3}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Iob.Model</RootNamespace>
<AssemblyName>Iob.Model</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.4\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="SteamWare.Logger, Version=4.9.2009.740, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SteamWare.Logger.4.9.2009.740\lib\net462\SteamWare.Logger.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<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="ErrorMessageModel.cs" />
<Compile Include="IobError.cs" />
<Compile Include="IobSample.cs" />
<Compile Include="IobSignal.cs" />
<Compile Include="IobTask.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Readme\README_SteamWare.txt" />
<Content Include="App_Readme\SteamWare_demo\example-favicon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+63
View File
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Iob.Model
{
public class IobError
{
public IOB_ERROR_CODES errorCode;
public string localizationKey;
public Exception exception;
public IobError(IOB_ERROR_CODES errorCode, string message, Exception exception)
{
this.errorCode = errorCode;
this.localizationKey = message;
this.exception = exception;
}
public IobError(IOB_ERROR_CODES errorCode, string message)
{
this.errorCode = errorCode;
this.localizationKey = message;
}
public bool IsError()
{
if (errorCode == IOB_ERROR_CODES.OK)
return false;
else
return true;
}
public static IobError InternalError(string message, Exception exception)
{
return new IobError(IOB_ERROR_CODES.INTERNAL_ERROR, message, exception);
}
public static IobError NcError(string message)
{
return new IobError(IOB_ERROR_CODES.NC_PROD_ERROR, message);
}
}
public enum IOB_ERROR_CODES : uint
{
OK = 0
, NOT_CONNECTED
, INTERNAL_ERROR
, NC_PROD_ERROR
, PLC_PROD_ERROR
, BIT_NOT_IN_RANGE
, BYTE_NOT_IN_RANGE
, FUNCTION_NOT_ALLOWED
, INCORRECT_PARAMETERS
, FILE_NOT_FOUND
, PLC_NOT_RUNNING
, S7NET_READ_ERROR
, S7NET_WRITE_ERROR
}
}
+12
View File
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Iob.Model
{
internal class IobSample
{
}
}
+25
View File
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Iob.Model
{
/// <summary>
/// Generico SEGNALE rilevato da IOB
/// Va gestito da successivo layer di trasformazione Ingressi --> eventi su MP.IO
/// </summary>
public class IobSignal
{
/// <summary>
/// Valore evento registrato (formato
/// </summary>
public string dataIN { get; set; } = "";
/// <summary>
/// DataOra evento registrato
/// </summary>
public DateTime TimeStamp { get; set; } = DateTime.Now;
}
}
+12
View File
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Iob.Model
{
class IobTask
{
}
}
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
// associate a un assembly.
[assembly: AssemblyTitle("Iob.Model")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Iob.Model")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
// COM, impostare su true l'attributo ComVisible per tale tipo.
[assembly: ComVisible(false)]
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
[assembly: Guid("3da86f5d-0459-4d24-9b5e-a2c44e5019f3")]
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
//
// Versione principale
// Versione secondaria
// Numero di build
// Revisione
//
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
// usando l'asterisco '*' come illustrato di seguito:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.7.4" targetFramework="net462" />
<package id="SteamWare.Logger" version="4.9.2009.740" targetFramework="net462" />
</packages>