public bool CreateFolderInfo(string folder, string searchPattern, bool getFiles = true, bool clear = true) { if (clear) { this.lstFile.Clear(); } if (!Directory.Exists(folder)) { return(false); } string[] strArray = !getFiles?Directory.GetDirectories(folder) : Directory.GetFiles(folder, searchPattern); if (strArray.Length == 0) { return(false); } foreach (string path in strArray) { FolderAssist.FileInfo fileInfo = new FolderAssist.FileInfo(); fileInfo.FullPath = path; if (getFiles) { fileInfo.FileName = Path.GetFileNameWithoutExtension(path); } fileInfo.time = File.GetLastWriteTime(path); this.lstFile.Add(fileInfo); } return(true); }
public void DeleteSaveFile(FolderAssist.FileInfo fileInfo) { try { File.Delete(fileInfo.FullPath); } catch (Exception e) { Console.WriteLine("could not delete file: " + fileInfo.FullPath + " " + e.Message + e.StackTrace); } }
private static void AddList( List <GameCoordinateFileInfo> list, List <string> coordList, string path, ref int idx) { List <string> toRelease = ListPool <string> .Get(); if (!coordList.IsNullOrEmpty <string>()) { foreach (string coord in coordList) { if (!toRelease.Contains(coord)) { toRelease.Add(coord); } } } FolderAssist folderAssist = new FolderAssist(); folderAssist.CreateFolderInfoEx(path, GameCoordinateFileInfoAssist._searchPatterns, true); int fileCount = folderAssist.GetFileCount(); for (int index = 0; index < fileCount; ++index) { ChaFileCoordinate chaFileCoordinate = new ChaFileCoordinate(); FolderAssist.FileInfo fileInfo = folderAssist.lstFile[index]; if (!chaFileCoordinate.LoadFile(fileInfo.FullPath)) { Debug.Log((object)string.Format("衣装カードファイル読み込みエラー:Code {0}", (object)chaFileCoordinate.GetLastErrorCode())); } else if (!toRelease.Contains(Path.GetFileNameWithoutExtension(chaFileCoordinate.coordinateFileName))) { List <GameCoordinateFileInfo> coordinateFileInfoList = list; GameCoordinateFileInfo coordinateFileInfo1 = new GameCoordinateFileInfo(); GameCoordinateFileInfo coordinateFileInfo2 = coordinateFileInfo1; int num1; idx = (num1 = idx) + 1; int num2 = num1; coordinateFileInfo2.Index = num2; coordinateFileInfo1.FullPath = fileInfo.FullPath; coordinateFileInfo1.FileName = fileInfo.FileName; coordinateFileInfo1.Time = fileInfo.time; GameCoordinateFileInfo coordinateFileInfo3 = coordinateFileInfo1; coordinateFileInfoList.Add(coordinateFileInfo3); } } ListPool <string> .Release(toRelease); }
public void Copy(FolderAssist.FileInfo src) { this.FullPath = src.FullPath; this.FileName = src.FileName; this.time = src.time; }