unsafe private static void AddFilesToFileList(string filelistFile, string path, string lobbyBasePath) { string currentPath = lobbyBasePath; if (path.Length > 0) { currentPath = Path.Combine(lobbyBasePath, path); } foreach (string filename in Directory.GetFiles(currentPath)) { string subFilePath = Path.GetFileName(filename); if (path.Length > 0) { subFilePath = Path.Combine(path, Path.GetFileName(filename)); } FileInfo fileInfo = new FileInfo(filename); //uint crcChecksum = CRCUtility.ChecksumFile(filename); UtilityWrapper.CRCUtils crcUtils = new CRCUtils(); string errorMessage = String.Empty; int crcChecksum = crcUtils.GetCrc32ForFile(filename, ref errorMessage); File.AppendAllText(filelistFile, String.Format("{0} {1,9} {2,8:X} {3}{4}", fileInfo.LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss"), fileInfo.Length.ToString("D9"), crcChecksum.ToString("X8"), subFilePath, System.Environment.NewLine)); } foreach (string directory in Directory.GetDirectories(currentPath)) { AddFilesToFileList(filelistFile, Path.Combine(path, Path.GetFileName(directory)), lobbyBasePath); } }
private static unsafe void AddFilesToFileList(string filelistFile, string path, string lobbyBasePath) { string currentPath = lobbyBasePath; if(path.Length > 0) currentPath = Path.Combine(lobbyBasePath, path); foreach (string filename in Directory.GetFiles(currentPath)) { string subFilePath = Path.GetFileName(filename); if(path.Length > 0) subFilePath= Path.Combine(path, Path.GetFileName(filename)); FileInfo fileInfo = new FileInfo(filename); //uint crcChecksum = CRCUtility.ChecksumFile(filename); UtilityWrapper.CRCUtils crcUtils = new CRCUtils(); string errorMessage = String.Empty; int crcChecksum = crcUtils.GetCrc32ForFile(filename, ref errorMessage); File.AppendAllText(filelistFile, String.Format("{0} {1,9} {2,8:X} {3}{4}", fileInfo.LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss"), fileInfo.Length.ToString("D9"), crcChecksum.ToString("X8"), subFilePath, System.Environment.NewLine)); } foreach (string directory in Directory.GetDirectories(currentPath)) { AddFilesToFileList(filelistFile, Path.Combine(path, Path.GetFileName(directory)), lobbyBasePath); } }