public override void ExportCsv()
        {
            string path = AssetDanshariUtility.GetSaveFilePath(typeof(AssetDuplicateWindow).Name);

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            var style = AssetDanshariStyle.Get();
            var sb    = new StringBuilder();

            sb.AppendFormat("\"{0}\",", style.duplicateHeaderContent.text);
            sb.AppendFormat("\"{0}\",", style.duplicateHeaderContent2.text);
            sb.AppendFormat("\"{0}\",", style.duplicateHeaderContent3.text);
            sb.AppendFormat("\"{0}\"\n", style.duplicateHeaderContent4.text);

            foreach (var group in data.children)
            {
                sb.AppendLine(String.Format(style.duplicateGroup, group.displayName));

                foreach (var info in group.children)
                {
                    sb.AppendFormat("\"{0}\",", info.displayName);
                    sb.AppendFormat("\"{0}\",", info.fileRelativePath);

                    FileMd5Info md5Info = info.bindObj as FileMd5Info;
                    sb.AppendFormat("\"{0}\",", md5Info.fileLength);
                    sb.AppendFormat("\"{0}\"\n", md5Info.fileTime);
                }
            }

            AssetDanshariUtility.SaveFileText(path, sb.ToString());
            GUIUtility.ExitGUI();
        }
        private List <FileMd5Info> GetFileMd5Infos(List <string> fileArray)
        {
            var style    = AssetDanshariStyle.Get();
            var fileList = new List <FileMd5Info>();

            for (int i = 0; i < fileArray.Count;)
            {
                string file = fileArray[i];
                if (string.IsNullOrEmpty(file))
                {
                    i++;
                    continue;
                }
                EditorUtility.DisplayProgressBar(style.progressTitle, file, i * 1f / fileArray.Count);
                try
                {
                    using (var md5 = MD5.Create())
                    {
                        FileInfo fileInfo = new FileInfo(file);
                        using (var stream = File.OpenRead(fileInfo.FullName))
                        {
                            FileMd5Info info = new FileMd5Info();
                            info.filePath = fileInfo.FullName;
                            info.fileSize = fileInfo.Length;
                            info.fileTime = fileInfo.CreationTime.ToString("yyyy-MM-dd HH:mm:ss");
                            info.md5      = BitConverter.ToString(md5.ComputeHash(stream)).ToLower();
                            fileList.Add(info);
                        }
                    }

                    i++;
                }
                catch (Exception e)
                {
                    if (!EditorUtility.DisplayDialog(style.errorTitle, file + "\n" + e.Message,
                                                     style.continueStr, style.cancelStr))
                    {
                        EditorUtility.ClearProgressBar();
                        return(null);
                    }
                }
            }
            return(fileList);
        }
        private AssetInfo GetAssetInfoByFileMd5Info(FileMd5Info fileInfo)
        {
            AssetInfo info = GenAssetInfo(FullPathToRelative(fileInfo.filePath));

            info.bindObj = fileInfo;

            if (fileInfo.fileSize >= (1 << 20))
            {
                fileInfo.fileLength = string.Format("{0:F} MB", fileInfo.fileSize / 1024f / 1024f);
            }
            else if (fileInfo.fileSize >= (1 << 10))
            {
                fileInfo.fileLength = string.Format("{0:F} KB", fileInfo.fileSize / 1024f);
            }
            else
            {
                fileInfo.fileLength = string.Format("{0:F} B", fileInfo.fileSize);
            }

            return(info);
        }
 /// <summary>
 ///     获取文件找不到的信息
 /// </summary>
 public static NotMatchedFileInfo GetFileNotFoundMatchFileInfo(FileMd5Info fileMd5Info)
 {
     return(new NotMatchedFileInfo(fileMd5Info.RelativeFilePath, fileMd5Info.FileSize, fileMd5Info.Md5));
 }
 /// <summary>
 ///     创建未匹配的文件信息
 /// </summary>
 public NotMatchedFileInfo(FileMd5Info fileMd5Info, long actualFileLength, string actualFileMd5)
     : this(fileMd5Info.RelativeFilePath, actualFileLength, fileMd5Info.FileSize, actualFileMd5, fileMd5Info.Md5)
 {
 }