private void SanitizePath(ref string directory) { string[] splitPath = directory.Trim().Split(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }); string newDirectory = String.Empty; foreach (string partPath in splitPath) { newDirectory += CleanFileName(partPath) + Path.DirectorySeparatorChar; } InvalidDirs.Add(directory, newDirectory); directory = newDirectory; }
private void CreateDirectory(ref string directory) { if (InvalidDirs.ContainsKey(directory)) { InvalidDirs.TryGetValue(directory, out directory); } string folderPath = Path.Combine(ExtractPath, directory); if (!Directory.Exists(folderPath)) { try { Directory.CreateDirectory(folderPath); } catch (DirectoryNotFoundException) { InvalidDirs.Add(directory, directory += "_"); folderPath = Path.Combine(ExtractPath, directory); if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } } catch (NotSupportedException) { SanitizePath(ref directory); folderPath = Path.Combine(ExtractPath, directory); if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } } catch (ArgumentException) { SanitizePath(ref directory); folderPath = Path.Combine(ExtractPath, directory); if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } } } }
public void DumpDir(WzDirectory mainDir) { DumpDir(mainDir, WzFolderName); InvalidDirs.Clear(); InvalidDirs = null; }