Ejemplo n.º 1
0
        public Form_Download()
        {
            InitializeComponent();
            HelpDownloadThreadList = new List <Thread>();
            OtherMachineIP         = new List <IPAddress>();
            listBox_IPList.Items.Add("172.18.175.247");
            OtherMachineIP.Add(IPAddress.Parse("172.18.175.247"));
#if DEBUG
            OutPutPrint = PrintToListBox;
#endif
        }
Ejemplo n.º 2
0
Archivo: Kcp.cs Proyecto: Heasn/Lamp
 public Kcp(OutPutDelegate output, EndPoint user)
 {
     mSndWnd   = IKCP_WND_SND;
     mRcvWnd   = IKCP_WND_RCV;
     mRmtWnd   = IKCP_WND_RCV;
     mMtu      = IKCP_MTU_DEF;
     mMss      = mMtu - IKCP_OVERHEAD;
     mRxRto    = IKCP_RTO_DEF;
     mRxMinrto = IKCP_RTO_MIN;
     mInterval = IKCP_INTERVAL;
     mTsFlush  = IKCP_INTERVAL;
     mSsthresh = IKCP_THRESH_INIT;
     mBuffer   = PooledByteBufferAllocator.Default.Buffer((mMtu + IKCP_OVERHEAD) * 3);
     mOutPut   = output;
     mUser     = user;
 }
Ejemplo n.º 3
0
        public List <Thread> ThreadList; //当前运行的线程列表

        public DownloadTask(string savePath, TaskConfig taskconfig, Form_Download masterForm)
        {
            MasterForm = masterForm;
            downloadCompletedDelegate = MasterForm.DownloadCompleted;
            OutPutPrint         = MasterForm.PrintToListBox;
            CriticalSectionLock = new object();
            this.SavePath       = savePath;
            Config           = taskconfig;
            state            = DownloadState.Stop;
            CurrentThreads   = 0;
            DownloadProgress = 0.0;
            ThreadList       = new List <Thread>(10);
            if (Config.SupportResume)
            {
                SaveConfig();
            }
            if (!File.Exists(SavePath))
            {
                FileStream file = new FileStream(SavePath, FileMode.Create, FileAccess.Write);
                file.SetLength((long)Config.FileLength);
                file.Close();
            }
        }