Пример #1
0
        private void apply_dfm(String fileName)
        {
            System.Console.WriteLine("File: " + fileName);
            DFMWrapper dfm = new DFMWrapper(fileName);

            int count_replacements = 0;

            foreach (SubstitutionInfo si in m_Substitutions)
            {
                int c = si.Substitution.Apply(fileName, dfm);
                if (-1 != c)
                {
                    si.SuccessfullyApplied = c != 0;
                    count_replacements    += c;
                }
            }
            if (count_replacements != 0)
            {
                dfm.Save(fileName);
                System.Console.WriteLine(fileName + String.Format(" saved; {0} replacements", count_replacements));
            }
            else
            {
                System.Console.WriteLine(fileName + String.Format(": save is skipped, there were no replacements"));
            }
        }
Пример #2
0
        public int Apply(String fileName, DFMWrapper dfm)
        {
            String fn = System.IO.Path.GetFileName(fileName).ToLower();

            if (!m_Files.ContainsKey(fn))
            {
                return(-1);
            }

            int counter_replaces        = 0;
            List <LocationInfo> entries = m_Files[fn];

            foreach (LocationInfo info in entries)
            {
                counter_replaces += dfm.Replace(info.Path, info.PropertyName, Msgid, Msgstr, Program.USE_BRUTOREPLACER);
            }
            return(counter_replaces);
        }
Пример #3
0
        private void apply_dfm(String fileName) {
            System.Console.WriteLine("File: " + fileName);
            DFMWrapper dfm = new DFMWrapper(fileName);

            int count_replacements = 0;
            foreach (SubstitutionInfo si in m_Substitutions) {
                int c = si.Substitution.Apply(fileName, dfm);
                if (-1 != c) {
                    si.SuccessfullyApplied = c != 0;
                    count_replacements += c;
                }
            }
            if (count_replacements != 0) {
                dfm.Save(fileName);
                System.Console.WriteLine(fileName + String.Format(" saved; {0} replacements", count_replacements));
            } else {
                System.Console.WriteLine(fileName + String.Format(": save is skipped, there were no replacements"));
            }
        }
Пример #4
0
        public int Apply(String fileName, DFMWrapper dfm) {
            String fn = System.IO.Path.GetFileName(fileName).ToLower();
            if (!m_Files.ContainsKey(fn)) return -1;

            int counter_replaces = 0;
            List<LocationInfo> entries = m_Files[fn];
            foreach (LocationInfo info in entries) {
                counter_replaces += dfm.Replace(info.Path, info.PropertyName, Msgid, Msgstr, Program.USE_BRUTOREPLACER);
            }
            return counter_replaces;
        }