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

📄 modinfoio.cs

📁 一个农村管理系统的程序 数据库那部分可能不全 大家可以
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Threading;

namespace MsgSystem
{
    static class ModInfoIO
    {

        //下面这两个是从外部获取的数据的链表或向外部发送的数据的链表的"引用",
        public static ArrayList inList = null;
        public static ArrayList outList = null;
        public static int maxSize = 0;


        //初始化函数
        static bool init( )
        {
            bool rtn = false;


            return rtn;
        }



        //这个函数是信息获取线程的主函数,这个函数从外部获取相关数据,并存放到 inList中
        public static void inThreadMethod()
        {
            RawInfo info = new RawInfo();
            while( true)
            {
                //pay enough attention to the properties here, set them to some value or leave them empty.EVERY FIELD

                info.from = "13951769554"; 
                info.time = new DateTime();
                info.rawInfo = "abcd0x123456";

    /*
     * 先从外部获取数据,放到一个info中, 并存到inList中
     * 
     * */
                lock (inList)
                {
                    if (inList.Count > maxSize)
                    {

                        //we should encounter a alarm here, indicates that the pool is full,
                    }
                    else
                    {
                        inList.Add(info);

                    }
                }

                //let it have a sleep, the time interval should be small enough, the structure here is to be modified
                Thread.Sleep( 500);
  
            }
        }

        public static void outThreadMethod()
        {
            RawInfo info = new RawInfo();
            while (true)
            {
               
                lock ( outList)
                {
                    if (outList.Count > 0)
                    {
                        info =  ( RawInfo)outList[0];
                        outList.Remove(info);

                        /*
                         * we  put the codes that send this info out here.
                         * 
                         * */
                    }

                }
                Thread.Sleep( 500);

            }


        }



    }




}

⌨️ 快捷键说明

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