• 大小: 1.12MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-30
  • 语言: C#
  • 标签: C#  UDP  文件传输  可靠  

资源简介

单机自己给自己传10M,左右。与网上盛传的UDP可靠传输传输控制策略不同,底层采用完成端口模式Socket。 实现可靠传输,源码中包含打洞代码,只有普通打洞,没有端口猜测,打洞功能没有加入demo中。 如有更好的建议希望通知我,到空间留言。 或联系QQ 231231526

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace CNIMControlRender
{
    public enum ButtonState
    {
        MouseEnter = 0
        MouseOut = 1
        MouseDown = 2
        MouseUp = 3
    }
    public class ButtonRender: IControlRender
    {
        private ButtonState bs = ButtonState.MouseOut;//正常状态
        /// 
        /// 要绘制的按钮状态
        /// 

        public ButtonState State
        {
            get { return bs; }
            set { bs = value; }
        }
        private Color _borderColor = Color.WhiteSmoke;
        /// 
        /// 边框颜色
        /// 

        public Color BorderColor
        {
            get { return _borderColor; }
            set { _borderColor = value; }
        }
        private Color _glassColor = Color.WhiteSmoke;
        /// 
        /// 鼠标移上时的半透明色
        /// 

        public Color GlassColor
        {
            get { return _glassColor; }
            set { _glassColor = value; }
        }

        private int cornerRadius = 1;
        /// 
        /// 设置圆角半径
        /// 

        public int CornerRadius
        {
            get { return cornerRadius; }
            set { cornerRadius = value; }
        }

        public ButtonRender() { }

        /// 
        /// 绘制按钮
        /// 

        /// 绘制面板
        /// 要绘制的按钮矩形区域
        public void DrawControl(Graphics g Rectangle Bounds)
        {
            GraphicsPath gp = Meth.CreateRoundedRectanglePath(Bounds cornerRadius);
            DrawGlass(g gp Bounds);
        }

        private void DrawGlass(Graphics g GraphicsPath gp Rectangle bounds)
        {
            switch (bs)
            {
                case ButtonState.MouseDown:
                    DrawGlassDown(g gp bounds);
                    break;
                case ButtonState.MouseOut:
                    DrawGlassOut(g gp bounds);
                    break;
                case ButtonState.MouseUp:
                case ButtonState.MouseEnter:
                    DrawGlassEnter(g gp bounds);
                    break;
            }
        }

        private void DrawGlassDown(Graphics g GraphicsPath gpRectangle bounds)
        {

            using (LinearGradientBrush lgb = new LinearGradientBrush(bounds.Location
                new Point(bounds.X bounds.Y + (bounds.Height / 2))
                 Color.FromArgb(128 _glassColor)
                    Color.Transparent))
            {
                lgb.WrapMode = WrapMode.TileFlipXY;
                g.FillPath(lgb gp);
            }
            DrawBorder(g gp);
        }
        private void DrawGlassOut(Graphics g GraphicsPath gp Rectangle bounds)
        {
           
        }
        privat

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      12288  2010-12-16 15:58  C#_UDP可靠文件传输\CNIMControlRender\bin\Debug\CNIMControlRender.dll

     文件      38400  2010-12-16 15:58  C#_UDP可靠文件传输\CNIMControlRender\bin\Debug\CNIMControlRender.pdb

     文件       4011  2010-12-10 13:12  C#_UDP可靠文件传输\CNIMControlRender\ButtonRender.cs

     文件       2393  2010-12-10 13:42  C#_UDP可靠文件传输\CNIMControlRender\CNIMControlRender.csproj

     文件        513  2010-12-10 11:19  C#_UDP可靠文件传输\CNIMControlRender\IControlRender.cs

     文件       2464  2010-12-10 10:49  C#_UDP可靠文件传输\CNIMControlRender\LoadSystemInfo.cs

     文件       4097  2010-12-10 13:06  C#_UDP可靠文件传输\CNIMControlRender\Meth.cs

     文件        489  2010-12-16 15:58  C#_UDP可靠文件传输\CNIMControlRender\obj\Debug\CNIMControlRender.csproj.FileListAbsolute.txt

     文件      12288  2010-12-16 15:58  C#_UDP可靠文件传输\CNIMControlRender\obj\Debug\CNIMControlRender.dll

     文件      38400  2010-12-16 15:58  C#_UDP可靠文件传输\CNIMControlRender\obj\Debug\CNIMControlRender.pdb

     文件       5148  2011-02-23 15:02  C#_UDP可靠文件传输\CNIMControlRender\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       3274  2010-12-10 13:46  C#_UDP可靠文件传输\CNIMControlRender\PanelRender.cs

     文件       5468  2010-12-10 14:43  C#_UDP可靠文件传输\CNIMControlRender\ProgressRender.cs

     文件       1366  2010-12-09 17:35  C#_UDP可靠文件传输\CNIMControlRender\Properties\AssemblyInfo.cs

     文件      26624  2011-02-22 18:35  C#_UDP可靠文件传输\CNIMFileTransmission\bin\Debug\CNIMFileTransmission.dll

     文件      85504  2011-02-22 18:35  C#_UDP可靠文件传输\CNIMFileTransmission\bin\Debug\CNIMFileTransmission.pdb

     文件      13312  2011-02-22 18:35  C#_UDP可靠文件传输\CNIMFileTransmission\bin\Debug\CNIMNetobject.dll

     文件      67072  2011-02-22 18:35  C#_UDP可靠文件传输\CNIMFileTransmission\bin\Debug\CNIMNetobject.pdb

     文件      25600  2011-02-22 18:35  C#_UDP可靠文件传输\CNIMFileTransmission\bin\Debug\CNIMNetWork.dll

     文件      95744  2011-02-22 18:35  C#_UDP可靠文件传输\CNIMFileTransmission\bin\Debug\CNIMNetWork.pdb

     文件       3001  2011-02-16 15:39  C#_UDP可靠文件传输\CNIMFileTransmission\CNIMFileTransmission.csproj

     文件       2267  2011-02-16 14:40  C#_UDP可靠文件传输\CNIMFileTransmission\EventHandle.cs

     文件       6013  2011-02-22 16:45  C#_UDP可靠文件传输\CNIMFileTransmission\FileBlockReceive.cs

     文件       7902  2011-02-22 18:37  C#_UDP可靠文件传输\CNIMFileTransmission\FileBlockSender.cs

     文件        533  2011-02-16 15:41  C#_UDP可靠文件传输\CNIMFileTransmission\FileDataBuffer.cs

     文件      11189  2011-02-22 18:11  C#_UDP可靠文件传输\CNIMFileTransmission\FileReceiver.cs

     文件       9775  2011-02-21 17:11  C#_UDP可靠文件传输\CNIMFileTransmission\FileSender.cs

     文件       1128  2011-02-15 13:41  C#_UDP可靠文件传输\CNIMFileTransmission\FileTransmissionState.cs

     文件       1789  2010-12-06 16:13  C#_UDP可靠文件传输\CNIMFileTransmission\MD5Helper.cs

     文件       3135  2011-02-22 17:53  C#_UDP可靠文件传输\CNIMFileTransmission\obj\Debug\CNIMFileTransmission.csproj.FileListAbsolute.txt

............此处省略283个文件信息

评论

共有 条评论