Unnessesery projects deleted

This commit is contained in:
Stoyan Zlatev
2024-09-18 11:37:19 +02:00
parent fc3da54e9d
commit f4d7e5c55c
36 changed files with 197 additions and 1460 deletions
@@ -100,5 +100,8 @@
<Name>Common.Utils.Extensions</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="configuration.json" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+152
View File
@@ -1,10 +1,162 @@
namespace CommonConsole
{
using Common.Logic.Extensions.SQL;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
public class Program
{
public static void Main()
{
SQLConnection
.CreateSQLConnection("Server=SLASQL01.emea.sensus.net; Database=Auftrag; User ID=sa; Password=sqlserver;")
.CreateCommand(@"
SELECT CONVERT(VARBINARY(8), '0x' + REPLACE(x.Address, '-', ''), 1)
, CONVERT(VARBINARY(256), '0x' + REPLACE(x.Value, '-', ''), 1)
FROM (SELECT rh.Address
, rh.Value
, ROW_NUMBER() OVER (PARTITION BY rh.Address ORDER BY rh.date DESC) AS Row
FROM GenesisMeterRegisterHistory AS rh
WHERE rh.PcbId = @pcbId) AS x
WHERE x.Row = 1
ORDER BY x.Address")
.SetParameter("pcbId", "241330796")
.ExecuteReader(reader =>
{
var address = reader.GetValue<Byte[]>(0);
if (address.Length == 2)
{
var value = reader.GetValue<Byte[]>(1);
Console.WriteLine($"App: {address[0], 5:X2} Register: {address[1], 5:X2} Data: {BitConverter.ToString(value)}");
}
});
}
public class Cordonel : Dictionary<String, App>
{
[OnDeserialized]
internal void OnDeserialized(StreamingContext _)
{
foreach (var x in this)
{
x.Value.Name = x.Key;
}
}
}
public class App
{
public Byte Id { get; set; }
public String Name { get; set; }
public V Version { get; set; }
public Registers Registers { get; set; }
public Statuses Status { get; set; }
}
public class V
{
public UInt16? First { get; set; }
public UInt16? Last { get; set; }
}
public class Registers : Dictionary<String, Register>
{
[OnDeserialized]
internal void OnDeserialized(StreamingContext _)
{
foreach (var x in this)
{
x.Value.Name = x.Key;
}
}
}
public class Register
{
public Byte Id { get; set; }
public String Name { get; set; }
public Detail[] Details { get; set; }
}
public class Detail
{
public V Version { get; set; }
public String Type { get; set; }
public String StaticType { get; set; }
public String Description { get; set; }
public Privilege Privilege { get; set; }
public Values Values { get; set; }
}
public class Values
{
public Object Minimum { get; set; }
public Object Maximum { get; set; }
public Object Default { get; set; }
}
public class Privilege
{
public Privileges Lvl1 { get; set; }
public Privileges Lvl2 { get; set; }
public Privileges Lvl3 { get; set; }
public Privileges Lvl4 { get; set; }
public Privileges Lvl5 { get; set; }
public Privileges Lvl6 { get; set; }
public Privileges Lvl7 { get; set; }
public Privileges Lvl8 { get; set; }
}
public enum Privileges
{
NA,
RO,
WO,
RW,
}
public class Statuses : Dictionary<String, Status>
{
[OnDeserialized]
internal void OnDeserialized(StreamingContext _)
{
foreach (var x in this)
{
x.Value.Name = x.Key;
}
}
}
public class Status
{
public Byte Id { get; set; }
public String Name { get; set; }
}