Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightAggregationTerminal
This commit is contained in:
commit
a485d1cb58
5 files changed
+73
-148
No files matched your search
+43
-8
@@ -1,14 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using SunlightAggregationTerminal.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
|
||||
namespace SunlightAggregationTerminal.Class
|
||||
{
|
||||
public class DataReceived
|
||||
{
|
||||
public class Person
|
||||
{
|
||||
public required string User { get; set; }
|
||||
public required string Password { get; set; }
|
||||
public required string IP { get; set; }
|
||||
public required string Terminal { get; set; }
|
||||
public required string Dat { get; set; }
|
||||
}
|
||||
|
||||
public static string GetLocalIpSimple()
|
||||
{
|
||||
var host = Dns.GetHostEntry(Dns.GetHostName());
|
||||
foreach (var ip in host.AddressList)
|
||||
{
|
||||
if (ip.AddressFamily == AddressFamily.InterNetwork && !IPAddress.IsLoopback(ip))
|
||||
{
|
||||
return ip.ToString();
|
||||
}
|
||||
}
|
||||
return "No network connection";
|
||||
}
|
||||
|
||||
public static string ServerIP = "";
|
||||
public static string ServerName = "";
|
||||
public static string ServerPassword = "";
|
||||
public static string ServerTerminal = "";
|
||||
|
||||
|
||||
public static void Received(string dat)
|
||||
{
|
||||
try
|
||||
@@ -27,7 +57,7 @@ namespace SunlightAggregationTerminal.Class
|
||||
App.GlobalData.UserId = val.ToString() ?? "";
|
||||
App.GlobalData.LogNo = true;
|
||||
|
||||
HttpServer.HttpTransmit("{\"Command\":\"Info\"}");
|
||||
Transmit("{\"Command\":\"Info\"}");
|
||||
}
|
||||
|
||||
if (data.TryGetValue("UserData", out var value_UserData))
|
||||
@@ -95,11 +125,16 @@ namespace SunlightAggregationTerminal.Class
|
||||
}
|
||||
}
|
||||
|
||||
public static void Transmit(string Dat)
|
||||
public static void Transmit(string Dat)
|
||||
{
|
||||
if (App.GlobalData.LocalAreaNetworkMode)
|
||||
{ TcpServer.TcpTransmit(Dat); }
|
||||
else { HttpServer.HttpTransmit(Dat); }
|
||||
{
|
||||
TcpServer.TcpTransmit(Dat);
|
||||
}
|
||||
else
|
||||
{
|
||||
HttpServer.HttpTransmit(Dat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user