Exemplo n.º 1
0
        public static void ListFiles(FileSystemInfo fileSysInfo)
        {
            MFileInfo info = new MFileInfo();

            info.FullName = fileSysInfo.FullName;
            info.FileName = fileSysInfo.Name;

            if (IsIgnore(info.FullName))
            {
                return;
            }
            else if (System.IO.Directory.Exists(info.FullName))
            {
                info.IsFolder = true;
            }
            else if (System.IO.File.Exists(info.FullName))
            {
                info.IsFolder = false;
            }
            else
            {
                return;
            }


            if (info.IsFolder)
            {
                #region 偵測資料夾
                //info.UniqueCode = getFileUniqueCode(info.FullName + fileSysInfo.CreationTime);
                //info.LastUpdateTime = fileSysInfo.LastWriteTime;
                //listFileInfo.Add(info);
                #endregion

                DirectoryInfo dirInfo = new DirectoryInfo(info.FullName);
                foreach (FileSystemInfo item in dirInfo.GetFileSystemInfos())
                {
                    ListFiles(item);
                }
            }
            else
            {
                //Console.WriteLine(info.FullName + "\t" + fileSysInfo);
                info.LastUpdateTime = fileSysInfo.LastWriteTime;
                info.UniqueCode     = getFileUniqueCode(info.FullName);
                //info.show();
                listFileInfo.Add(info);
            }
        }
Exemplo n.º 2
0
 public void record(MFileInfo data)
 {
     pFile.WriteLine(string.Format("{0},{1}", data.FullName, data.UniqueCode));
 }