Пример #1
0
 /// <summary>
 /// 停止网络线程
 /// </summary>
 public void Stop()
 {
     Runing = false;
     Terminal.Get().Stop();
     FileSend.Get().Stop();
     MessageQueue.Get().Stop();
 }
Пример #2
0
        /// <summary>
        /// 配置文件信息
        /// </summary>
        /// <returns></returns>
        public string config()
        {
            string rt = "";

            rt += "程序路径: " + System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
            rt += "\n工作路径: " + Environment.CurrentDirectory;
            rt += "\n服务器端口: " + Net.Get().GetIp();
            rt += "\n文件服务器端口: " + FileSend.Get().getIP();
            rt += "\n配置文件路径: " + Configure.LogPath();
            rt += "\n截图目录: " + Configure.ScreenshotPath();
            rt += "\n用户列表: " + Configure.UserListPath();
            return(rt + "\n");
        }
Пример #3
0
 /// <summary>
 /// 读取文件信息,且加入文件传输队列
 /// </summary>
 /// <param name="path">要读取的文件路径</param>
 /// <returns>返回一个文件下载操作,null为错误</returns>
 private byte[] ReadFile(string path)
 {
     try
     {
         FileInfo fi     = new FileInfo(path);
         long     size   = fi.Length;
         string   fileid = FileSend.Get().AddFile(fi, User.GetSid(e));
         return(SendMessage.ToBytes("FILE\t" + path + "\t" + size + "\t" + fileid));
     }
     catch
     {
         error = "File no found or read error";
     }
     return(null);
 }
Пример #4
0
        /// <summary>
        /// 文件传输队列信息
        /// </summary>
        /// <returns></returns>
        public string file()
        {
            string rt = "等待传输的文件列表:\n";

            string[] ls = FileSend.Get().GetPathList();
            if (ls.Length > 0)
            {
                foreach (string s in ls)
                {
                    rt += s + "\n";
                }
            }
            else
            {
                rt += "列表为空";
            }
            return(rt + "\n");
        }
Пример #5
0
 /// <summary>
 /// 启动网络线程
 /// </summary>
 /// <returns>启动状态</returns>
 public bool Start()
 {
     try
     {
         ipEP   = new IPEndPoint(Configure.ServerIP(), Configure.ServerPort());
         Runing = true;
         udp    = new UdpClient(ipEP);
         MessageQueue.Get().Start();
         FileSend.Get().Start();
         Terminal.Get().Start();
     }
     catch (Exception ex)
     {
         Log.a("Net Start Exception:" + ex.StackTrace + ":" + ex.Message);
         return(false);
     }
     return(true);
 }