private void Process() { if (string.IsNullOrEmpty(m_dataFilePath)) { Debug.LogWarning("没有选择任何文件夹"); return; } index = 0; string[] file = Directory.GetFiles(m_dataFilePath, "*." + m_fileType.ToString(), SearchOption.AllDirectories); if (file.Length == 0) { Debug.Log("没有该类型文件~"); return; } UDLib.Editor.CCheckTools.ClearLogList(); EditorApplication.update = delegate() { bool cancle = EditorUtility.DisplayCancelableProgressBar("匹配资源中", file[index], (float)index / (float)file.Length); string unityPath = file[index].Substring(Application.dataPath.Length - 6); List <string> list = UDLib.Editor.CFindReference.FindReferenceForFile(unityPath.Replace(@"\", "/")); UDLib.Editor.CCheckTools.AddErrorInfo(unityPath + "," + list.Count); index++; if (cancle || index >= file.Length) { EditorApplication.update = null; UDLib.Editor.CCheckTools.WriteAllInfoToFile(m_fileType.ToString() + "类型文件引用次数", "", UDLib.Editor.CCheckTools.EFileType.csv); EditorUtility.ClearProgressBar(); Debug.Log("匹配结束"); UDLib.Editor.CCheckTools.LogAll(); } }; EditorUtility.ClearProgressBar(); }
static void MakeSpaceForFile(EFileType fileType, byte[] fileBytes) { if (Directory.Exists(PiUtilities.SavePath + fileType) && IsCacheFull(fileType, fileBytes)) { Action <IEnumerable <FileInfo> > remover = (input) => { foreach (var file in input) { File.Delete(file.FullName); } }; var dir = new DirectoryInfo(PiUtilities.SavePath + fileType.ToString()); List <FileInfo> files = dir.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList(); files.Sort((a, b) => a.LastAccessTimeUtc.CompareTo(b.LastAccessTimeUtc)); int i = 0; while (IsCacheFull(fileType, fileBytes)) { if (i >= files.Count) { return; } remover.Invoke(files.Skip(i).Take(1)); i++; } } }
public FileReference( Bam.Core.TokenizedString path, EFileType type, Project project, bool explicitType = false, ESourceTree sourceTree = ESourceTree.NA, string relativePath = null) : base(project, path.Parse(), "PBXFileReference", type.ToString(), project.GUID, explicitType.ToString(), sourceTree.ToString(), relativePath) { this.Path = path; this.Type = type; this.SourceTree = sourceTree; this.ExplicitType = explicitType; this.RelativePath = relativePath; }
public static void RemoveFolder(EFileType folderType) { var dirInfo = (new DirectoryInfo(PiUtilities.SavePath)); if (dirInfo.Exists) { var dirs = dirInfo.GetDirectories(); foreach (var dir in dirs) { if (string.Equals(dir.Name, folderType.ToString())) { foreach (var file in dir.GetFiles()) { file.Delete(); } dir.Delete(); return; } } } }
/// <summary> /// Fügt eine entsprechende Datendatei in den entsprechenden Order: /// c-data /// r-data /// m-data /// </summary> /// <param name="client"></param> /// <param name="?"></param> public void AddFileToUpdateFolder(FTPSClient client, string folder, string relFilename, EFileType fileType) { //In Update Verzeichniss legen IList<DirectoryListItem> hashDirs=client.GetDirectoryList(folder+"/"); //Updatedatei anlegen string uniqueID=Various.GetUniqueID(); string uniqueIDSHA1=Hash.SHA1.HashString(uniqueID); string filenameLocal=FileSystem.TempPath+uniqueIDSHA1; List<string> lines=new List<string>(); lines.Add(relFilename); lines.Add(fileType.ToString()); File.WriteAllLines(filenameLocal, lines.ToArray()); //Updatedatei hochladen foreach(DirectoryListItem dli in hashDirs) { if(Globals.ClientID==dli.Name) continue; client.PutFile(filenameLocal, folder+"/"+dli.Name+"/"+uniqueIDSHA1); } //Log Globals.Log.Add(LogLevel.Information, "Updatedatei {0} wurde hochgeladen ({1}).", relFilename, folder); }