📄 msglist.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//该源码下载自www.51aspx.com(51aspx.com)
namespace SimpleChat
{
public class MsgList
{
int msgNum = 8;
public int msgNowID;
MsgStructure [] messageList;
public MsgList()
{
msgNowID = 0;
messageList = new MsgStructure[msgNum];
}
public void MsgPush(string msg)
{
msgNowID++;
MsgStructure tmpMsg = new MsgStructure(msgNowID, msg);
for(int i=0;i<msgNum-1;i++)
{
messageList[i] = messageList[i + 1];
}
messageList[msgNum - 1] = tmpMsg;
}
public string[] GetMsg(int nowID)
{
int tmpCount = msgNowID - nowID;
string[] tmpStr;
if (tmpCount > 0)
{
tmpStr = new string[tmpCount];
int tmpBig = tmpCount>=8?8:tmpCount;
for(int i=0;i<tmpBig;i++)
{
tmpStr[i] = "<br />" + messageList[msgNum - tmpBig + i].MsgBody;
}
return tmpStr;
}
else
{
return null;
}
}
}
class MsgStructure
{
int msgID;
public int MsgID
{
get
{
return msgID;
}
set
{
msgID = value;
}
}
string msgBody;
public string MsgBody
{
get
{
return msgBody;
}
set
{
msgBody = value;
}
}
public MsgStructure(int id)
{
msgID = id;
msgBody = "";
}
public MsgStructure(int id,string msg)
{
msgID = id;
msgBody = msg;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -