Ejemplo n.º 1
0
 /// <summary>
 /// 引发 <seealso cref="FSLib.IPMessager.Core.FileTaskManager.FileReceiveRequiring"/> 事件
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnFileReceiveRequiring(FileReceiveRequiredEventArgs e)
 {
     if (FileReceiveRequiring != null)
     {
         FileReceiveRequiring(this, e);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 触发请求接收文件事件
 /// </summary>
 /// <param name="e">事件参数</param>
 void OnFileReceiveRequired(FileReceiveRequiredEventArgs e)
 {
     if (FileReceiveRequired != null)
     {
         FileReceiveRequired(this, e);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 检测任务是否可以启动
        /// </summary>
        void StartReceive()
        {
            if ((Config.TasksMultiReceiveCount > 0 && activeReceiveItems.Count >= Config.TasksMultiReceiveCount) || ReceiveTask.Count == 0)
            {
                return;
            }
            //RunCount-Fix thread limit issue
            int runCount = 0;

            foreach (FileTaskInfo t in ReceiveTask)
            {
                for (int j = 0; j < t.TaskList.Count; j++)
                {
                    if (t.TaskList[j].State == FileTaskItemState.Scheduled)
                    {
                        FileTaskInfo task = t;
                        FileTaskItem item = task.TaskList[j];

                        //开始传输

                        FileReceiveRequiredEventArgs e = new FileReceiveRequiredEventArgs(task, item);
                        OnFileReceiveRequiring(e);
                        if (!e.IsHandled)
                        {
                            OnFileReceiveRequired(e);
                        }
                        runCount++;

                        //标记状态
                        MarkReceiveTaskItemState(item, FileTaskItemState.Initializing);
                        if (activeReceiveItems.Count + runCount >= Config.TasksMultiReceiveCount && Config.TasksMultiReceiveCount > 0)
                        {
                            return;                                                                                                                                     //超过数目则退出
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
		/// <summary>
		/// 检测任务是否可以启动
		/// </summary>
		void StartReceive()
		{
			if ((Config.TasksMultiReceiveCount > 0 && activeReceiveItems.Count >= Config.TasksMultiReceiveCount) || ReceiveTask.Count == 0) return;
			//RunCount-Fix thread limit issue
			int runCount = 0;

			foreach (FileTaskInfo t in ReceiveTask)
			{
				for (int j = 0; j < t.TaskList.Count; j++)
				{
					if (t.TaskList[j].State == FileTaskItemState.Scheduled)
					{
						FileTaskInfo task = t;
						FileTaskItem item = task.TaskList[j];

						//开始传输

						FileReceiveRequiredEventArgs e = new FileReceiveRequiredEventArgs(task, item);
						OnFileReceiveRequiring(e);
						if (!e.IsHandled) OnFileReceiveRequired(e);
						runCount++;

						//标记状态
						MarkReceiveTaskItemState(item, FileTaskItemState.Initializing);
						if (activeReceiveItems.Count + runCount >= Config.TasksMultiReceiveCount && Config.TasksMultiReceiveCount > 0) return;	//超过数目则退出
					}
				}
			}
		}
Ejemplo n.º 5
0
		/// <summary>
		/// 引发 <seealso cref="FSLib.IPMessager.Core.FileTaskManager.FileReceiveRequiring"/> 事件
		/// </summary>
		/// <param name="e"></param>
		protected virtual void OnFileReceiveRequiring(FileReceiveRequiredEventArgs e)
		{
			if (FileReceiveRequiring != null) FileReceiveRequiring(this, e);
		}
Ejemplo n.º 6
0
		/// <summary>
		/// 触发请求接收文件事件
		/// </summary>
		/// <param name="e">事件参数</param>
		void OnFileReceiveRequired(FileReceiveRequiredEventArgs e)
		{
			if (FileReceiveRequired != null) FileReceiveRequired(this, e);
		}
Ejemplo n.º 7
0
		/// <summary>
		/// 请求接收文件
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		void _taskManager_FileReceiveRequired(object sender, FileReceiveRequiredEventArgs e)
		{
			if (!IsInitialized) return;

			new Thread(() => { PerformFileReceive(e.Task, e.Item); }) { IsBackground = true }.Start();
		}