static void dd_OnDataArrived(byte[] in_listVariablePool) { Console.WriteLine("收到数据!"); VariablePool vp = new VariablePool(); vp.Init(in_listVariablePool); string ip = (string)vp.Get("IP", 0);// 获取发送方的IP // 以上是接受数据 // 下方是发送数据 vp.Init(); vp.Put("IP", ip); vp.Put("string", DateTime.Now.ToString()); dd.Send(vp.GetVariablePool(), ip); }
public static void SetVariable(Address _variable_address, Variable variable) { VariablePool varpool = GetPool(_variable_address.Parent); Variable temp = varpool.Pull(_variable_address.Name); varpool.Put(_variable_address.Name, variable); }
public static void PutVariable(Address _variable_address, Variable variable, bool auto_purge = true) { VariablePool varpool = GetPool(_variable_address.Parent); if (auto_purge && variable.Address != null) { if (variable.Address.Name.Contains("$SYSTEM$__temp")) { if (varpool.HasVariable(variable.Address.Name)) { varpool.Pull(variable.Address.Name); } } } varpool.Put(_variable_address.Name, variable); variable.Address = _variable_address; }