Пример #1
0
        bool WriteFrame(Frame a_frame)
        {
            if (!m_internalClient.IsConnected)
            {
                InternalConsole.AddMessage("Failed to write to disconnected stream");
            }

            try
            {
                m_internalClient.WriteToStream(a_frame.ToBytes());

                return(true);
            }
            catch (IOException e)
            {
                InternalConsole.Error(string.Format("Discord Client: Failed to write frame: IOException: {0}", e.Message));
            }
            catch (ObjectDisposedException)
            {
                InternalConsole.Error("Discord Client: Failed to write frame: Disposed");
            }
            catch (InvalidOperationException)
            {
                InternalConsole.Error("Discord Client: Invalid Operaion when writing frame");
            }

            return(false);
        }