资源简介
《计算机网络系统实践》课设成果。winform版联机五子棋,分客户端和服务端,修正了一些bug。带聊天功能,仿QQ界面,可以发小的图片和声音,但不适合发送几十兆以上的大数据包,会有内存溢出的问题

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Resources;
namespace Client
{
public partial class ChatPanel : UserControl
{
string path = string.Empty;
public static string myHead = “http://pics.sc.chinaz.com/Files/pic/icons128/7066/b5.png“;
public static string yourHead = “http://pics.sc.chinaz.com/Files/pic/icons128/7066/b5.png“;
StringBuilder sb;
public ChatPanel()
{
InitializeComponent();
//自定义控件Load事件里的代码不执行,故在构造函数中写
webKitBrowser_Load(null null);
}
private void webKitBrowser_Load(object sender EventArgs e)
{
//两个客户端同时启动时,防止文件读写冲突,随机给文件命名
//这样会在MsgReceived文件夹里产生很多文件
path = string.Format(“{0}\\MsgReceived\\{1}.html“ Application.StartupPath Guid.NewGuid().ToString());
if (webBrowser1.Version.Major >= 10)
{
//IE10以上默认开启特效
File.Copy(Application.StartupPath + “\\MsgReceived\\index.html“ path);
}
else
{
File.Copy(Application.StartupPath + “\\MsgReceived\\indexnostyle.html“ path);
}
webBrowser1.Navigate(path);
sb = new StringBuilder(File.ReadAllText(path));
}
public void AppendMsg(string msg string name bool isMyWords = true)
{
string str = string.Empty;
if (isMyWords)
{
str = @“
![]()
“ + name + @“
“ + msg + @“
“;
}
else
{
str = @“
![]()
“ + name + @“
“ + msg + @“
“;
}
sb = sb.Replace(““ ““).Append(str);
//File.CreateText(path).Write(sb.ToString());
using (FileStream fs = new FileStream(path FileMode.Create))
{
byte[] buffer = Encoding.UTF8.GetBytes(sb.ToString());
fs.Write(buffer 0 buffer.Length);
}
webBrowser1.Navigate(“file://“ + path);
}
public void Clear(bool flag)
{
//File.Delete(path);
ReLoad(flag);
}
public void AppendSysMsg(string msg string name)
{
string
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4586496 2018-10-14 13:47 可执行文件\Client.exe
文件 102912 2018-10-14 13:46 可执行文件\Server.exe
..A..H. 100864 2018-10-15 17:48 源程序\.vs\FiveChess\v14\.suo
文件 184 2018-10-14 17:14 源程序\Client\App.config
文件 90746 2018-10-13 00:35 源程序\Client\bin\Debug\background\1.png
文件 309071 2018-10-13 00:30 源程序\Client\bin\Debug\background\2.png
文件 317647 2018-10-13 00:32 源程序\Client\bin\Debug\background\3.png
文件 165426 2018-10-13 00:34 源程序\Client\bin\Debug\background\4.png
文件 22688 2018-10-15 17:44 源程序\Client\bin\Debug\Client.vshost.exe
文件 184 2018-10-14 17:14 源程序\Client\bin\Debug\Client.vshost.exe.config
文件 490 2017-03-19 05:00 源程序\Client\bin\Debug\Client.vshost.exe.manifest
文件 18349 2018-09-04 13:30 源程序\Client\bin\Debug\image\2507a718972bd407ddd95c3573899e510eb309fb.jpg
文件 15983 2018-09-04 13:28 源程序\Client\bin\Debug\image\6f3561224f4a20a43ddc890f98529822700ed0df.jpg
文件 5750 2018-09-04 13:29 源程序\Client\bin\Debug\image\873b9b2bd40735fac4f0fa7196510fb30e24089c.jpg
文件 16138 2018-09-04 13:29 源程序\Client\bin\Debug\image\882c47fbfbedab643772f908ff36afc378311e9c.jpg
文件 12729 2018-09-04 13:29 源程序\Client\bin\Debug\image\9d163ffa828ba61e59ef7ce74934970a314e599c.jpg
文件 17010 2018-09-04 13:29 源程序\Client\bin\Debug\image\9f3f8b01a18b87d61c6605d70f0828381e30fdf1.jpg
文件 29440 2018-09-04 13:30 源程序\Client\bin\Debug\image\a07798eef01f3a295bc101009125bc315d607c92.jpg
文件 14978 2018-09-04 13:29 源程序\Client\bin\Debug\image\bd009bdda144ad34f77d324fd8a20cf433ad85df.jpg
文件 24824 2018-09-04 13:29 源程序\Client\bin\Debug\image\f81c8b94a4c27d1ec0268f0c13d5ad6edcc4389c.jpg
文件 2730 2018-10-15 12:33 源程序\Client\bin\Debug\MsgReceived\048e25dd-68f8-4253-8250-b5389659456b.html
文件 1540 2018-10-15 10:03 源程序\Client\bin\Debug\MsgReceived\4ffb5abd-2f67-4801-a943-03d10282d2da.html
文件 2912 2018-10-15 12:33 源程序\Client\bin\Debug\MsgReceived\8b39f110-37fa-41b4-8da1-d03d4bb7e8f9.html
文件 2792 2018-10-15 10:03 源程序\Client\bin\Debug\MsgReceived\css\content.css
文件 14485 2018-10-15 10:03 源程序\Client\bin\Debug\MsgReceived\css\default.css
文件 484 2018-10-15 10:03 源程序\Client\bin\Debug\MsgReceived\css\jquery.classyleaves.css
文件 380 2018-10-15 10:03 源程序\Client\bin\Debug\MsgReceived\css\jquery.classyleaves.min.css
文件 1825 2018-10-15 10:03 源程序\Client\bin\Debug\MsgReceived\css\normalize.css
文件 1540 2018-10-15 10:03 源程序\Client\bin\Debug\MsgReceived\fonts\icomoon.eot
文件 1866 2018-10-15 10:03 源程序\Client\bin\Debug\MsgReceived\fonts\icomoon.svg
............此处省略147个文件信息
相关资源
- C# Socket Server Client 通讯应用 完整的服
- C# 五子棋程序 附带编程日记
- C# Socket Tcp文件传输和文字聊天系统
- 用WPF开发的多人聊天室 语言C#
- C# Socket TCP通信
- unity+Socket+KCP+Protobuf的Unity局域网联机
- NET CORE 下实现WEB SOCKET通信
- 使用Socket发送数据
- SignalR在线聊天(websocket)
- Socket获取扫码枪扫码的数据
- C# 五子棋(winform源码)
- Socket聊天室(客户端与服务端相互通
- socket服务端
- socket通讯实例(入门级)58873
- C#多线程以及Socket通讯
- 大文件Socket 传输 客户端和服务端
- Tcp/ip socket 服务器/客户端
- C# 五子棋 游戏源码
- Sockets通信框架
- C# winform Socket大文件传输
- C# 实现局域网视频监控Socket 编程
- c#五子棋游戏开发论文
- C# 使用 TcpClient,Socket 聊天
- 网页js与本地C#程序 websocket通讯实现打
- 使用WPF+MVVMlight编写的Socket服务器/多客
- C#实现人机对战五子棋
- vb.net 与 c#.net 网络编程之 socket 套接字
- C#仿QQ聊天软件源码, 即时通信源码
- C#高性能大容量SOCKET并发
- 五子棋源代码(C#源代码)
评论
共有 条评论