示例#1
0
        public static void RemoveAllExistingDpmIdDefinitions(List <string> dpmIDs)
        {
            List <string> listofAllConstants = new List <string>();

            using (StreamReader reader = new StreamReader(_currentDirectoryPath + "ALG.CRDIV.Constants.xsr"))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    if (line.StartsWith("constant DPM_ID"))
                    {
                        string val = ClassHelpers.Between(line, "constant ", "=eba_met");
                        if (!ClassHelpers.HasValue(val, dpmIDs))
                        {
                            line = "";
                            listofAllConstants.Add(line);
                        }
                        else
                        {
                            listofAllConstants.Add(line);
                        }
                    }
                }
                reader.Close();
            }
        }
示例#2
0
        public static List <string> GetListofNotUsedConstants()
        {
            string mappingFilePath = _currentDirectoryPath + "SphinxRulesOutput_Consistency.xsr";
            Dictionary <int, string> dictGetUsedConstants = new Dictionary <int, string>();

            if (File.Exists(mappingFilePath))
            {
                dictGetUsedConstants = GeneralHelper.ReadMappingFromXsr(mappingFilePath);
            }
            if (dictGetUsedConstants.Count <= 0)
            {
                return(new List <string>());
            }

            List <string> listofMappings = new List <string>();

            listofMappings = dictGetUsedConstants.Values.ToList();


            List <string> listofNotUsedConstants = new List <string>();

            using (StreamReader reader = new StreamReader(_currentDirectoryPath + "ALG.CRDIV.Constants.xsr"))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    if (line.StartsWith("constant DPM_ID"))
                    {
                        string val = "$" + ClassHelpers.Between(line, "constant ", "=eba_met");
                        if (!ClassHelpers.HasValue(val, listofMappings))
                        {
                            line = "//" + line;
                            listofNotUsedConstants.Add(line);
                        }
                        else
                        {
                            listofNotUsedConstants.Add(line);
                        }
                    }
                }
                reader.Close();
            }
            return(listofNotUsedConstants);
        }