コード例 #1
0
        /// <summary>
        /// 更新产品列表框
        /// </summary>
        private void UpdateProductCombo()
        {
            //加载产品名称
            List <string> secList = new List <string>();

            secList = iniFileOp.ReadSections();
            productNameList.Clear();

            for (int i = 0; i < secList.Count; i++)
            {
                if (secList[i] == "SysSetting" || secList[i] == "CurOpProduct")
                {
                    secList.RemoveAt(i);
                }
            }

            if (secList.Count <= 0)
            {
                return;
            }

            foreach (string sec in secList)
            {
                productNameList.Add(sec);
            }

            productCombo.Items.AddRange(secList.ToArray());
            curProductName             = iniFileOp.ReadString("CurOpProduct", "ProductName", string.Empty);;//secList[0];
            productCombo.SelectedIndex = productCombo.FindString(curProductName);
            UpdatePointCombo();
        }
コード例 #2
0
        /// <summary>
        /// 更新产品列表框
        /// </summary>
        private void UpdateProductCombo()
        {
            //加载产品名称
            List <string> secList = new List <string>();

            secList = iniFileOp.ReadSections();
            productNameList.Clear();

            for (int i = 0; i < secList.Count; i++)
            {
                if (secList[i] == "SysSetting" || secList[i] == "CurOpProduct")
                {
                    secList.RemoveAt(i);
                }
            }

            if (secList.Count <= 0)
            {
                initialFlag = true; //初始化标志置位
                return;
            }

            foreach (string sec in secList)
            {
                productNameList.Add(sec);
            }

            productCombo.Items.AddRange(secList.ToArray());
            productCombo.SelectedIndex = 0;
            curProductName             = secList[0];
            UpdatePointCombo();
        }
コード例 #3
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);
                }
            }
        }
コード例 #4
0
        public override IEnumerable <CommandDTOBase?> Execute(string[] args)
        {
            var searchPath          = $"{Environment.GetEnvironmentVariable("SystemRoot")}\\System32\\GroupPolicy\\DataStore\\0\\sysvol\\";
            var sysnativeSearchPath = $"{Environment.GetEnvironmentVariable("SystemRoot")}\\Sysnative\\GroupPolicy\\DataStore\\0\\sysvol\\";
            var files = FindFiles(searchPath, "audit.csv");
            // var sysnativeFiles = FindFiles(sysnativeSearchPath, "audit.csv");  // TODO: Need to implement parsing of this
            var classicFiles = FindFiles(searchPath, "GptTmpl.inf");

            foreach (var classicFilePath in classicFiles)
            {
                var result = ParseGPOPath(classicFilePath);
                var domain = result[0];
                var gpo    = result[1];

                //ParseClassicPolicy
                var sections = IniFileHelper.ReadSections(classicFilePath);

                if (!sections.Contains("Event Audit"))
                {
                    continue;
                }

                var settings = ParseClassicPolicy(classicFilePath);

                yield return(new AuditPolicyGPO(
                                 classicFilePath,
                                 domain,
                                 gpo,
                                 "classic",
                                 settings
                                 ));
            }

            foreach (var filePath in files)
            {
                var result = ParseGPOPath(filePath);
                var domain = result[0];
                var gpo    = result[1];

                var settings = ParseAdvancedPolicy(filePath);

                yield return(new AuditPolicyGPO(
                                 filePath,
                                 domain,
                                 gpo,
                                 "advanced",
                                 settings
                                 ));
            }
        }