Exemplo n.º 1
0
        /// <summary>
        /// 取得配置文件名称(=最新更新时间)及文件大小
        /// </summary>
        /// <param name="destid"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public static byte[] GetXFileByLately(byte destid, GetFileInfo.Parameter para)
        {
            byte[] donedata;
            byte   subtype = (byte)MSGEncoding.GetFileInfo.GetXFileByLately;

            byte[] data = GetFileInfo.GetData(para, subtype);
            PrepareData.Msg_Bus _frame = new PrepareData.Msg_Bus();
            _frame.flag       = PrepareData.BUS_FRAME_FLAG;
            _frame.srcID      = MSGEncoding.srcID;
            _frame.destID     = destid;
            _frame.msgDir     = (byte)MSGEncoding.MsgDir.Request;
            _frame.msgVer     = MSGEncoding.msgVer;
            _frame.msgType    = (byte)MSGEncoding.MsgType.GetFileInfo;
            _frame.msgSubType = (byte)MSGEncoding.GetFileInfo.GetXFileByLately;
            _frame.dataLen    = (ushort)data.Length;
            donedata          = PrepareData.MergeMsg(ref _frame, data);
            return(donedata);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 组包中获取数据域字节数组
        /// </summary>
        /// <param name="para">发送摘要</param>
        /// <param name="subtype">包子类型,用于区分getdata调用哪些</param>
        /// <returns></returns>
        public static byte[] GetData(GetFileInfo.Parameter para, byte subtype)
        {
            byte[] tempdata;

            List <byte> _tempdata = new List <byte>();

            switch (subtype)
            {
            //按日期范围查询数据文件名及文件大小
            case (byte)MSGEncoding.GetFileInfo.GetFileByRange:
            {
                long start = TimerTick.TimeSpanToSecond(para.starttime);
                long stop  = TimerTick.TimeSpanToSecond(para.endtime);
                WriteUnit.AddTimeToList(_tempdata, start);
                WriteUnit.AddTimeToList(_tempdata, stop);
                break;
            }

            //查询离指定日期最近的x个数据文件名及文件大小
            case (byte)MSGEncoding.GetFileInfo.GetXFileByLately:
            {
                long time = TimerTick.TimeSpanToSecond(para.timepoint);
                WriteUnit.AddTimeToList(_tempdata, time);
                WriteUnit.AddUshortToList(_tempdata, para.filenum);
                break;
            }

            //取得配置文件名称(=更新时间)及文件大小
            case (byte)MSGEncoding.GetFileInfo.GetcfgFile:
            {
                //发送内容为空,通过包类型及子类型截取
                break;
            }

            default:
            {
                //MessageBox.Show("文件信息查询子类消息编号超出范围!");
                break;
            }
            }
            tempdata = _tempdata.ToArray <byte>();
            return(tempdata);
        }