⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 receive.aspx.cs

📁 c#网络聊天室源码c#网络聊天室源码c#网络聊天室源码
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;
using Utility;

namespace SimpleChat
{
    public partial class Receive : System.Web.UI.Page
    {
        string tmpType;
        string tmpMsg;
        string tmpName;
        protected void Page_Load(object sender, EventArgs e)
        {
            tmpType = Utility.Fetch.Get("type");
            if (tmpType == "send")
            {
                tmpMsg = Utility.Fetch.Post("msg").Replace("\r\n","<br />");
                tmpName = Utility.Fetch.Post("name");
                object tmpObj = Caching.Get("g1");
                if(tmpObj == null)
                {
                    MsgList tmpList = new MsgList();
                    tmpList.MsgPush(tmpName + ":<br />" + tmpMsg);
                    Caching.Set("g1",tmpList,null);
                }
                else
                {
                    MsgList tmpList = (MsgList)tmpObj;
                    tmpList.MsgPush(tmpName + ":<br />" + tmpMsg);
                    Caching.Set("g1", tmpList, null);
                }
            }
            else if(tmpType == "get")
            {
                Response.Clear();
                int tmpID = Convert.ToInt32(Fetch.Get("nowid"));
                object tmpObj = Caching.Get("g1");
                if(tmpObj == null)
                {
                    Response.Write("0");
                }
                else
                {
                    MsgList tmpList = (MsgList)tmpObj; 
                    Response.Write(tmpList.msgNowID+"|");
                    string[] tmpStr = tmpList.GetMsg(tmpID);
                    if(tmpStr == null)
                    {
                        Response.Write("0");
                    }
                    else
                    {
                        for (int i = 0; i < tmpStr.Length; i++)
                        {
                            Response.Write(tmpStr[i]);
                        }
                    }
                }
                Response.Flush();
                Response.End();
            }


        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -