public static void Image(int dst, byte[] val) { var buf = LinksHelper.Generator.Encode(new { source = LinkModule.Id, target = dst, path = "msg.image", data = val, }); LinkModule.Enqueue(buf); _ = HistoryModule.Insert(dst, "image", val); }
public static void Text(int dst, string val) { var buf = LinksHelper.Generator.Encode(new { source = LinkModule.Id, target = dst, path = "msg.text", data = val, }); LinkModule.Enqueue(buf); _ = HistoryModule.Insert(dst, "text", val); }
public static void Text(int dst, string val) { var wtr = PacketWriter.Serialize(new { source = LinkModule.Id, target = dst, path = "msg.text", data = val, }); var buf = wtr.GetBytes(); LinkModule.Enqueue(buf); HistoryModule.Insert(dst, "text", val); }
public static void Image(int dst, byte[] val) { var wtr = PacketWriter.Serialize(new { source = LinkModule.Id, target = dst, path = "msg.image", data = val, }); var buf = wtr.GetBytes(); LinkModule.Enqueue(buf); HistoryModule.Insert(dst, "image", val); }
public static void Directory(int dst, string directory) { var sha = new Share(new DirectoryInfo(directory)); Application.Current.Dispatcher.Invoke(() => ShareModule.ShareList.Add(sha)); var buf = LinksHelper.Generator.Encode(new { source = LinkModule.Id, target = dst, path = "share.info", data = new { key = sha._key, type = "dir", name = sha.Name, endpoints = LinkModule.GetEndPoints(), } }); LinkModule.Enqueue(buf); _ = HistoryModule.Insert(dst, "share", sha); }
/// <summary> /// 发送文件信息 /// </summary> public static void File(int dst, string filepath) { var sha = new Share(new FileInfo(filepath)); Application.Current.Dispatcher.Invoke(() => ShareModule.ShareList.Add(sha)); var wtr = PacketWriter.Serialize(new { source = LinkModule.Id, target = dst, path = "share.info", data = new { key = sha._key, type = "file", name = sha.Name, length = sha.Length, endpoints = LinkModule.GetEndPoints(), } }); var buf = wtr.GetBytes(); LinkModule.Enqueue(buf); HistoryModule.Insert(dst, "share", sha); }