Esempio n. 1
0
        private ExtractionManager()
        {
            //需要对packetsToSend进行初始化,将之前未发送的添加到队列
            IList <byte[]> list = PacketsToSendDic.GetPacketsToSendDic().GetAllPackets2Send();

            foreach (byte[] bytes in list)
            {
                packetsToSend.Enqueue(bytes);
            }
            PacketsToSendDic.GetPacketsToSendDic().DeleteAll();
            string path = Environment.CurrentDirectory + @"\StructuresMoudles.ini";
            //初始化结构物模块号关系
            List <string> sections = IniFileHelper.ReadSections(path);

            foreach (string section in sections)
            {
                string modulestr    = IniFileHelper.GetString(section, "moduleNo", string.Empty, path);
                string structurestr = IniFileHelper.GetString(section, "structureId", string.Empty, path);
                int    structureId;
                if (int.TryParse(structurestr.Trim(), out structureId) && !string.IsNullOrEmpty(modulestr))
                {
                    string[] modules = modulestr.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    structModuleNodic.TryAdd(structureId, modules);
                }
            }
        }