示例#1
0
        public void replaceOldForNewFilename(FileRename _file)
        {
            string spacer;
            Match  match = Extract.Match(_file.OldFilename);

            _file.Match = match.Success;

            MatchCollection myMatchCollection = Regex.Matches(_file.OldFilename, Extract.ToString());

            _file.Match = allMatches(myMatchCollection);

            if (_file.Match)
            {
                foreach (Match myMatch in myMatchCollection)
                {
                    foreach (Group myGroup in myMatch.Groups)
                    {
                        foreach (Capture myCapture in myGroup.Captures)
                        {
                            //_file.NewFilename = _file.NewFilename.Replace("<" + myGroup.ToString() + ">", myCapture.Value);
                        }

                        GroupCollection gc = myMatch.Groups;

                        // Itération sur les groupes de capture de Extract
                        for (int j = 0; j < gc.Count; j++)
                        {
                            spacer = " ";
                            //Console.WriteLine(spacer + "Group[" + j + "]: " + gc[j].Value);
                            //Console.WriteLine(spacer + "Printing captures for this group...");
                            CaptureCollection cc = gc[j].Captures;

                            for (int k = 0; k < cc.Count; k++)
                            {
                                spacer = "  ";
                                //Console.WriteLine(spacer + "Capture[" + k + "]: " + cc[k].Value);
                                _file.NewFilename = _file.NewFilename.Replace("<" + myGroup.ToString() + ">", cc[k].Value);
                            }
                        }
                    }
                }
            }
        }
示例#2
0
 public void removeFile(FileRename file)
 {
     m_files.Remove(file);
 }
示例#3
0
 public void addFile(FileRename file)
 {
     m_files.Add(file);
 }