Beispiel #1
0
        public void Send(object data, MiMFa_SocketPacketDataType dt)
        {
            try
            {
                try
                {
                    Send(new MiMFa_SimplePacket(MiMFa_SocketPacketSubject.Chat, data, dt));
                    SendData(data, Sender.InterlocutorIPEndPoint, 0);
                    string detail = "<div class='DETAIL'>" + Configuration.Default.Time + "</div>";
                    string shtml  = "<div style='text-align:right;'><div class='SEND'>";
                    string ehtml  = "</div></div>";
                    if (data == null)
                    {
                        SetHTML(shtml + Display.Done(data) + detail + ehtml);
                    }
                    else if (data is byte[])
                    {
                        switch (dt)
                        {
                        case MiMFa_SocketPacketDataType.None:
                            break;

                        case MiMFa_SocketPacketDataType.Image:
                            SetHTML(shtml + Display.Done(MiMFa_IOService.TryDeserialize((byte[])data)) + detail + ehtml);
                            break;

                        case MiMFa_SocketPacketDataType.Text:
                            SetHTML(shtml + Display.Done(data) + detail + ehtml);
                            break;

                        default:
                            var mim = General.MiMFa_GetDetail.GetMimeObject(data).Split('/').First();
                            if (mim == "image")
                            {
                                SetHTML(shtml + Display.Done(General.MiMFa_Convert.ToImage((byte[])data)) + detail + ehtml);
                            }
                            else
                            {
                                SetHTML(shtml + Display.Done(data) + detail + ehtml);
                            }
                            break;
                        }
                    }
                    else
                    {
                        SetHTML(shtml + Display.Done(data) + detail + ehtml);
                    }
                }
                finally { InputClear(); }
            }
            catch (Exception ex)
            {
                SendError(RTB.Text, Sender.InterlocutorIPEndPoint, 0, ex);
                NotSendAlert(ex);
            }
        }
Beispiel #2
0
 public MiMFa_SimplePacket(MiMFa_SocketPacketSubject msps = MiMFa_SocketPacketSubject.CheckIn, object obj = null, MiMFa_SocketPacketDataType dataType = MiMFa_SocketPacketDataType.File, object attach = null)
 {
     ID = id++;
     SetSubject(msps);
     SetDataType(dataType);
     SetData(obj);
     SetAttach(attach);
 }
Beispiel #3
0
 public void SetDataType(MiMFa_SocketPacketDataType dataType)
 {
     DataType = dataType;
 }