예제 #1
0
        private void RenameAllfile()
        {
            DirectoryInfo dInfo = new DirectoryInfo(@selectedPath);

            FileInfo[] fInfos = dInfo.GetFiles();

            foreach (FileInfo f in fInfos)
            {
                if (f.FullName.Contains(".smi"))
                {
                    subFiles.Add(f);
                }
                else
                {
                    videoNameList.Add(f.FullName);
                }
            }


            subFiles.Sort((a, b) => StringLogicalComparer.Compare(a.Name, b.Name));
            videoNameList.Sort((a, b) => StringLogicalComparer.Compare(a, b));

            int i = 0;

            foreach (FileInfo f in subFiles)
            {
                string subName = videoNameList[i].Remove(videoNameList[i].Length - 3, 3);
                File.Move(f.FullName, subName + "smi");
                ++i;
            }
        }
예제 #2
0
        public int Compare(object x, object y)
        {
            int result = 0;

            if ((x is FileInfo) && (y is FileInfo))
            {
                FileInfo _fx = ( FileInfo )x;
                FileInfo _fy = ( FileInfo )y;

                result = StringLogicalComparer.Compare(_fx.Name, _fy.Name);
            }

            return(result);
        }