Esempio n. 1
0
 /// <summary>
 /// 返回事件消息Json字符串
 /// </summary>
 /// <returns></returns>
 public static string GetEventMessageJson(string mes)
 {
     Model.Transmission.NetEventMessage f = new Model.Transmission.NetEventMessage();
     f.sender   = KeyData.StaticInfo.MyUser.Name;
     f.senderIP = KeyData.StaticInfo.MyUser.IP;
     f.message  = mes;
     Model.Transmission.NetInfo info = f;
     info.typeID     = Model.Transmission.NET_EVENTMESSAGE;
     info.JsonString = JsonConvert.SerializeObject(f);
     return(JsonConvert.SerializeObject(info));
 }
Esempio n. 2
0
 /// <summary>
 /// 返回包重发申请Json字符串
 /// </summary>
 /// <param name="packKey"></param>
 /// <param name="packid"></param>
 /// <returns></returns>
 public static string GetRetransmis(string packKey, int packid)
 {
     Model.Transmission.NetRetransmis f = new Model.Transmission.NetRetransmis();
     f.sender   = KeyData.StaticInfo.MyUser.Name;
     f.senderIP = KeyData.StaticInfo.MyUser.IP;
     f.packid   = packid;
     f.packKey  = packKey;
     Model.Transmission.NetInfo info = f;
     info.typeID     = Model.Transmission.NET_RETRANSMIS;
     info.JsonString = JsonConvert.SerializeObject(f);
     return(JsonConvert.SerializeObject(info));
 }
Esempio n. 3
0
 /// <summary>
 /// 返回序列化后的Json远程协助请求数据
 /// </summary>
 public static string GetRemoteJson(string message, bool isCoon)
 {
     Model.Transmission.NetRemoteInfo info = new Model.Transmission.NetRemoteInfo();
     info.sender   = KeyData.StaticInfo.MyUser.Name;
     info.senderIP = KeyData.StaticInfo.MyUser.IP;
     info.IsCoon   = isCoon;
     info.message  = message;
     Model.Transmission.NetInfo nf = info;
     nf.typeID     = Model.Transmission.NET_REMOTEINFOID;
     nf.JsonString = JsonConvert.SerializeObject(info);
     return(JsonConvert.SerializeObject(nf));
 }
Esempio n. 4
0
 /// <summary>
 /// 返回文件下载状态反回信息
 /// </summary>
 /// <param name="staeStr"></param>
 /// <param name="id"></param>
 /// <param name="isSucc"></param>
 /// <returns></returns>
 public static string GetFileRequestRetJson(string staeStr, string id, bool isSucc)
 {
     Model.Transmission.NetFileRequestRet f = new Model.Transmission.NetFileRequestRet();
     f.sender         = KeyData.StaticInfo.MyUser.Name;
     f.senderIP       = KeyData.StaticInfo.MyUser.IP;
     f.staeMessage    = staeStr;
     f.identification = id;
     f.isSucc         = isSucc;
     Model.Transmission.NetInfo info = f;
     info.JsonString = JsonConvert.SerializeObject(f);
     info.typeID     = Model.Transmission.NET_FILEREQUESTRET;
     return(JsonConvert.SerializeObject(info));
 }
Esempio n. 5
0
 /// <summary>
 /// 文件下载请求消息
 /// </summary>
 /// <param name="path"></param>
 /// <param name="id"></param>
 /// <returns></returns>
 public static string GetFileRequestJson(string path, string id, int prot)
 {
     Model.Transmission.NetFileRequest f1 = new Model.Transmission.NetFileRequest();
     f1.filePath       = path;
     f1.identification = id;
     f1.sender         = KeyData.StaticInfo.MyUser.Name;
     f1.senderIP       = KeyData.StaticInfo.MyUser.IP;
     f1.conProt        = prot;
     Model.Transmission.NetInfo info = f1;
     info.JsonString = JsonConvert.SerializeObject(f1);
     info.typeID     = Model.Transmission.NET_FILEREQUEST;
     return(JsonConvert.SerializeObject(info));
 }
Esempio n. 6
0
 /// <summary>
 /// 返回序列化后的Json消息文件
 /// </summary>
 /// <param name="message">消息内容</param>
 /// <param name="isPublic">是否为公共消息</param>
 /// <returns>Json文件字符串</returns>
 public static string GetNetMessageJson(string message, bool atAll, List <string> ats = null)
 {
     Model.Transmission.NetMessage mes = new Model.Transmission.NetMessage();
     mes.message  = message;
     mes.sender   = KeyData.StaticInfo.MyUser.Name;
     mes.senderIP = KeyData.StaticInfo.MyUser.IP;
     mes.ats      = ats == null?new List <string>():ats;
     mes.atAll    = atAll;
     Model.Transmission.NetInfo info = mes;
     info.typeID     = Model.Transmission.NET_MESSAGEID;
     info.JsonString = JsonConvert.SerializeObject(mes);
     return(JsonConvert.SerializeObject(info));
 }
Esempio n. 7
0
            /// <summary>
            /// 远程协助返回消息
            /// </summary>
            /// <param name="message"></param>
            /// <param name="isSucc"></param>
            /// <param name="sendProt"></param>
            /// <returns></returns>
            public static string GetRemoteRetJson(string added, bool isSucc, bool isCoon)
            {
                Model.Transmission.NetRemoteRetInfo ret = new Model.Transmission.NetRemoteRetInfo();
                ret.isSucc   = isSucc;
                ret.isCoon   = isCoon;
                ret.sender   = KeyData.StaticInfo.MyUser.Name;
                ret.senderIP = KeyData.StaticInfo.MyUser.IP;
                ret.added    = added;
                Model.Transmission.NetInfo info = ret;
                info.typeID     = Model.Transmission.NET_RETURNINFOID;
                info.JsonString = JsonConvert.SerializeObject(ret);

                return(JsonConvert.SerializeObject(info));
            }
Esempio n. 8
0
            /// <summary>
            /// 返回序列化后的Json用户数据文件
            /// </summary>
            /// <param name="isOnlineMessage"></param>
            /// <returns></returns>
            public static string GetNetUserDataJson(bool isOnlineMessage, bool sendBackFlag)
            {
                Model.Transmission.NetUserData user = new Model.Transmission.NetUserData();
                user.Channel       = KeyData.StaticInfo.MyUser.Channel;
                user.HeadImgID     = KeyData.StaticInfo.MyUser.HeadimgName;
                user.senderIP      = KeyData.StaticInfo.MyUser.IP;
                user.sender        = KeyData.StaticInfo.MyUser.Name;
                user.OnlineData    = isOnlineMessage;
                user.forceSendBack = sendBackFlag;
                Model.Transmission.NetInfo info = user;
                info.JsonString = JsonConvert.SerializeObject(user);
                info.typeID     = Model.Transmission.NET_USERDATAID;

                return(JsonConvert.SerializeObject(info));
            }
Esempio n. 9
0
            /// <summary>
            /// 返回一个序列化后的Json文件信息
            /// </summary>
            public static string GetNetFileDataJson(string filePath)
            {
                FileInfo finfo    = new FileInfo(filePath);
                long     filelen  = finfo.Length;
                string   fileName = System.IO.Path.GetFileName(filePath);

                Model.Transmission.NetFileData fileData = new Model.Transmission.NetFileData();
                fileData.fileLen        = filelen.ToString();
                fileData.filename       = fileName;
                fileData.senderFilePath = filePath;
                fileData.sender         = KeyData.StaticInfo.MyUser.Name;
                fileData.senderIP       = KeyData.StaticInfo.MyUser.IP;
                Model.Transmission.NetInfo info = fileData;
                info.typeID     = Model.Transmission.NET_FILEDATAID;
                info.JsonString = JsonConvert.SerializeObject(fileData);

                return(JsonConvert.SerializeObject(info));
            }