Exemplo n.º 1
0
Arquivo: ARen.cs Projeto: burstas/rmps
        public void AppendFile(string[] files)
        {
            if (files == null)
            {
                //ShowEcho("");
                return;
            }

            TRen ren;
            foreach (string file in files)
            {
                if (!File.Exists(file))
                {
                    continue;
                }

                if (HasDup(file))
                {
                    continue;
                }

                ren = new TRen { File = file, Path = Path.GetDirectoryName(file), SrcName = Path.GetFileName(file) };
                _FileList.Add(ren);
                GvFile.Rows.Add(ren.SrcName, "");
            }

            _Reviewed = false;
            ShowEcho("执行重命名前请记得预览一下结果哟!");
        }
Exemplo n.º 2
0
Arquivo: ARen.cs Projeto: burstas/rmps
 private string GenDup(TRen ren)
 {
     string tmp = Path.Combine(ren.Path, ren.DstName);
     if (File.Exists(tmp))
     {
         string fn = Path.GetFileNameWithoutExtension(ren.DstName);
         string fe = Path.GetExtension(ren.DstName);
         int idx = 1;
         do
         {
             ren.DstName = string.Format("{0} ({1}){2}", fn, idx++, fe);
             tmp = Path.Combine(ren.Path, ren.DstName);
         } while (File.Exists(tmp));
     }
     return tmp;
 }