SignalR integration in VB6
This commit is contained in:
+24
-112
@@ -1,127 +1,39 @@
|
||||
namespace CommonConsole
|
||||
{
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SignalR;
|
||||
|
||||
public partial class Program
|
||||
using System;
|
||||
|
||||
public class Program
|
||||
{
|
||||
private static readonly HttpClient httpClient = new HttpClient();
|
||||
const string URL = "http://sla12iis01.emea.sensus.net/LaaProductionWeb";
|
||||
// const string URL = "http://localhost:52822/LaaProductionWeb/";
|
||||
|
||||
public static void Main()
|
||||
{
|
||||
//Task.Factory
|
||||
// .StartNew(async () =>
|
||||
// {
|
||||
// using (var httpRequestMessage = new HttpRequestMessage())
|
||||
// {
|
||||
// httpRequestMessage.Content = new StringContent("{}", Encoding.UTF8, "application/json");
|
||||
// httpRequestMessage.Method = HttpMethod.Post;
|
||||
// httpRequestMessage.RequestUri = new Uri("http://localhost:52822/LaaProductionWeb/api/Login/AD");
|
||||
|
||||
// //using (var httpResponseMessage = await httpClient.SendAsync(httpRequestMessage))
|
||||
// //{
|
||||
// // Console.WriteLine(httpResponseMessage);
|
||||
|
||||
// // using (var httpContent = httpResponseMessage.Content)
|
||||
// // {
|
||||
// // var content = await httpContent.ReadAsStringAsync();
|
||||
// // var obj = JsonConvert.DeserializeObject(content);
|
||||
|
||||
// // Console.WriteLine(JsonConvert.SerializeObject(obj, Formatting.Indented));
|
||||
// // }
|
||||
// //}
|
||||
// }
|
||||
// });
|
||||
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
public void SaveMeterState()
|
||||
{
|
||||
if (this.MeterNr == NA)
|
||||
var client = new DataHub();
|
||||
client.Connect(URL);
|
||||
client.DataReceived += data =>
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
var proeprty = data.GetProperty(i);
|
||||
var value = data.GetString(proeprty);
|
||||
Console.WriteLine($"{proeprty} = {value}");
|
||||
}
|
||||
|
||||
if (OmniContext.Current.Exists(this.MeterNr))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var commands = new List<byte[]>
|
||||
{
|
||||
new byte[] { 0x01 },
|
||||
new byte[] { 0x03 },
|
||||
new byte[] { 0x05 },
|
||||
new byte[] { 0x07 },
|
||||
new byte[] { 0x09 },
|
||||
new byte[] { 0x0B },
|
||||
new byte[] { 0x0D },
|
||||
new byte[] { 0x0F },
|
||||
new byte[] { 0x11 },
|
||||
new byte[] { 0x13 },
|
||||
new byte[] { 0x15 },
|
||||
new byte[] { 0x17 },
|
||||
new byte[] { 0x1F },
|
||||
new byte[] { 0x21 },
|
||||
new byte[] { 0x25 },
|
||||
new byte[] { 0x27 },
|
||||
new byte[] { 0x29 },
|
||||
new byte[] { 0x2B },
|
||||
new byte[] { 0xFD, 0x02 },
|
||||
new byte[] { 0xFD, 0x05 },
|
||||
new byte[] { 0xFD, 0x06 },
|
||||
new byte[] { 0xFD, 0x08 },
|
||||
new byte[] { 0xFD, 0x0A },
|
||||
new byte[] { 0xFD, 0x0E },
|
||||
new byte[] { 0xFD, 0x10 },
|
||||
new byte[] { 0xFD, 0x12 },
|
||||
new byte[] { 0xFD, 0x14 },
|
||||
new byte[] { 0xFD, 0x22 },
|
||||
new byte[] { 0xFD, 0x24 },
|
||||
new byte[] { 0xFD, 0x26 },
|
||||
new byte[] { 0xFD, 0x28 },
|
||||
new byte[] { 0xFD, 0x39 },
|
||||
new byte[] { 0xFD, 0x3D },
|
||||
new byte[] { 0xFD, 0x55 },
|
||||
new byte[] { 0xFD, 0x63 },
|
||||
new byte[] { 0xFD, 0x7B },
|
||||
new byte[] { 0xFD, 0x7E, 0x00 },
|
||||
new byte[] { 0xFD, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
new byte[] { 0xFD, 0x8B },
|
||||
new byte[] { 0xFD, 0xA9 },
|
||||
new byte[] { 0xFD, 0xAA },
|
||||
new byte[] { 0xFD, 0xAC },
|
||||
new byte[] { 0xFD, 0xB7 },
|
||||
new byte[] { 0xFD, 0xBC },
|
||||
new byte[] { 0xFD, 0xC2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
new byte[] { 0xFD, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
new byte[] { 0xFD, 0xC4, 0x00 },
|
||||
new byte[] { 0xFD, 0xC6 },
|
||||
new byte[] { 0xFD, 0xC7 }
|
||||
Console.WriteLine();
|
||||
};
|
||||
|
||||
var meterState = new StringBuilder();
|
||||
var counter = 0;
|
||||
|
||||
foreach (var cmd in commands)
|
||||
while (true)
|
||||
{
|
||||
var response = this.connection.Send(cmd);
|
||||
var entry = $"{BitConverter.ToString(cmd)}:{BitConverter.ToString(response)};";
|
||||
|
||||
meterState.Append(entry);
|
||||
var dictionary = new DataDictionary();
|
||||
dictionary.AddInt(nameof(counter), counter++);
|
||||
dictionary.AddString("message", Console.ReadLine());
|
||||
client.Send(dictionary);
|
||||
}
|
||||
|
||||
OmniContext.Current.Add(this.MeterNr, meterState.ToString());
|
||||
|
||||
this.WriteToLog();
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user