初始化
This commit is contained in:
120
ConsoleApp2/Program.cs
Normal file
120
ConsoleApp2/Program.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using System.Net.WebSockets;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using BLWData.Entity;
|
||||
using CommonEntity;
|
||||
using CommonTools;
|
||||
using MessagePack;
|
||||
using Microsoft.FSharp.Collections;
|
||||
|
||||
namespace ConsoleApp2
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
string afds = "hello";
|
||||
string dda = afds;
|
||||
dda = "world";
|
||||
Console.WriteLine(afds);
|
||||
|
||||
string YYY = File.ReadAllText("3.txt");
|
||||
NengHao? poo = System.Text.Json.JsonSerializer.Deserialize<NengHao>(YYY);
|
||||
byte[] qf = MyMessagePacker.FastSerialize(poo);
|
||||
|
||||
|
||||
////宝镜系统使用
|
||||
//EnergyConsumption ese = new EnergyConsumption();
|
||||
//ese.HotelCode = poo.HotelCode;
|
||||
//ese.HostNumber = poo.HostNumber;
|
||||
//ese.Mac = poo.Mac;
|
||||
//ese.EndPoint = poo.EndPoint;
|
||||
//ese.V = poo.V;
|
||||
//ese.A = poo.A;
|
||||
//ese.P = poo.P;
|
||||
//ese.KWH = poo.KW_H;
|
||||
//ese.SumKWH = poo.Sum_KW_H;
|
||||
//ese.CreateTime = poo.CreateTime;
|
||||
//ese.IsTakeCard = poo.IsTakeCard;
|
||||
//ese.RoomNumber = poo.RoomNumber;
|
||||
//ese.CarbonVIP = poo.CarbonVIP;
|
||||
|
||||
//byte[] data = ese.ToByteArray();
|
||||
//string TopicKey1 = KafkaKey.BLWLog4BaoJing_RCU_Topic;
|
||||
//string DetailKey1 = KafkaKey.UDPPackageWholeDataMonitor;
|
||||
string[] NNN = "34-D0-B8-11-80-80".Split('-');
|
||||
string n1 = NNN[4];
|
||||
string n2 = NNN[5];
|
||||
byte bbn1 = Convert.ToByte(n1, 16);
|
||||
byte bbn2 = Convert.ToByte(n2, 16);
|
||||
short MAC1 = Convert.ToInt16(bbn1);
|
||||
short MAC2 = Convert.ToInt16(bbn2);
|
||||
string HOSTNUMBER = "099008" + MAC1 + MAC2;
|
||||
|
||||
string nnn = File.ReadAllText("1.txt");
|
||||
UDPPackage? usa = JsonSerializer.Deserialize<UDPPackage>(nnn);
|
||||
AAA a = new AAA();
|
||||
MyClass mm = new MyClass();
|
||||
mm.Age = 30;
|
||||
mm.FirstName = "Test";
|
||||
mm.LastName = "我是一从此非常大霏霏 的数据";
|
||||
a.MyClass = new List<MyClass> { mm };
|
||||
var asd = System.Text.Json.JsonSerializer.Serialize(a);
|
||||
|
||||
var qqfa = Encoding.UTF8.GetBytes(asd.ToString());
|
||||
|
||||
//byte[] qf = MyMessagePacker.FastSerialize(mm);
|
||||
string uuu = MyMessagePacker.FastDeserialize<string>(qf);
|
||||
AAA uuu111 = MyMessagePacker.FastDeserialize<AAA>(qf);
|
||||
//Console.WriteLine(uuu.MyClass.FirstOrDefault().FirstName);
|
||||
|
||||
FSharpList<byte> b = ListModule.OfArray(new byte[] { 0x01, 0x02, 0x03 });
|
||||
FSharpList<byte> b1 = ListModule.OfArray(new byte[] { 0x01, 0x02, 0x03 });
|
||||
bool bf = fv.check(b, b1);
|
||||
Console.WriteLine(bf);
|
||||
Console.WriteLine("Hello, World!");
|
||||
}
|
||||
public static void google_parse()
|
||||
{
|
||||
EnergyConsumption e = new EnergyConsumption();
|
||||
|
||||
byte[] bbb = new byte[] { };
|
||||
e = EnergyConsumption.Parser.ParseFrom(bbb);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class ItsClass
|
||||
{
|
||||
[Key(0)]
|
||||
public string Data { get; set; }
|
||||
}
|
||||
[MessagePackObject]
|
||||
public class MyClass
|
||||
{
|
||||
// Key attributes take a serialization index (or string name)
|
||||
// The values must be unique and versioning has to be considered as well.
|
||||
// Keys are described in later sections in more detail.
|
||||
[Key(0)]
|
||||
public int Age { get; set; }
|
||||
|
||||
[Key(1)]
|
||||
public string FirstName { get; set; }
|
||||
|
||||
[Key(2)]
|
||||
public string LastName { get; set; }
|
||||
|
||||
// All fields or properties that should not be serialized must be annotated with [IgnoreMember].
|
||||
[IgnoreMember]
|
||||
public string FullName { get { return FirstName + LastName; } }
|
||||
}
|
||||
[MessagePackObject()]
|
||||
public class AAA
|
||||
{
|
||||
[Key(0)]
|
||||
public List<MyClass> MyClass { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user