Esempio n. 1
0
        /// <summary>
        /// 写二进制文件
        /// </summary>
        public static void writeFileForBytesWriteStream(string path, BytesWriteStream stream)
        {
            surePath(path);
            FileStream fs = new FileStream(path, FileMode.Create);

            fs.Write(stream.getBuf(), 0, stream.length());
            fs.Close();
        }
Esempio n. 2
0
        /// <summary>
        /// 写二进制文件
        /// </summary>
        public static void writeFileForBytes(string path, BytesWriteStream bytes)
        {
            surePath(path);
            FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write);

            fs.Write(bytes.getBuf(), 0, bytes.length());
            fs.Close();
        }
Esempio n. 3
0
        //sync

        /** 推字节(IO线程) */
        public override void toSendStream(BytesWriteStream stream)
        {
            if (!checkIsCurrent())
            {
                return;
            }

            toSend(stream.getBuf(), 0, stream.length());
        }
Esempio n. 4
0
        //--stream--//

        /// <summary>
        /// 将流写入自身
        /// </summary>
        public void writeBytesStream(BytesWriteStream stream, int pos, int length)
        {
            if (stream.length() < pos + length)
            {
                tailError();
                return;
            }

            writeByteArr(stream._buf, pos, length);
        }
Esempio n. 5
0
 /// <summary>
 /// 写到流里
 /// </summary>
 public void writeToStream(BytesWriteStream stream)
 {
     if (_writed)
     {
         stream.writeBytesStream(_stream, 0, _stream.length());
     }
     else
     {
         doWriteToStream(stream);
     }
 }
Esempio n. 6
0
 public override void toSendStream(BytesWriteStream stream)
 {
     _kcp.Send(new Span <byte>(stream.getBuf(), 0, stream.length()));
 }