Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ExtractRelativeToDirectory()

static void System.IO.Compression.ZipFileExtensions.ExtractRelativeToDirectory ( this ZipArchiveEntry source,
string destinationDirectoryName,
bool overwrite )
inlinestaticpackage

Definition at line 98 of file ZipFileExtensions.cs.

99 {
100 if (source == null)
101 {
102 throw new ArgumentNullException("source");
103 }
104 if (destinationDirectoryName == null)
105 {
106 throw new ArgumentNullException("destinationDirectoryName");
107 }
108 DirectoryInfo directoryInfo = Directory.CreateDirectory(destinationDirectoryName);
109 string text = directoryInfo.FullName;
110 if (!text.EndsWith(Path.DirectorySeparatorChar))
111 {
112 text += Path.DirectorySeparatorChar;
113 }
114 string fullPath = Path.GetFullPath(Path.Combine(text, source.FullName));
115 if (!fullPath.StartsWith(text, System.IO.PathInternal.StringComparison))
116 {
117 throw new IOException(System.SR.IO_ExtractingResultsInOutside);
118 }
119 if (Path.GetFileName(fullPath).Length == 0)
120 {
121 if (source.Length != 0L)
122 {
123 throw new IOException(System.SR.IO_DirectoryNameWithData);
124 }
125 Directory.CreateDirectory(fullPath);
126 }
127 else
128 {
129 Directory.CreateDirectory(Path.GetDirectoryName(fullPath));
130 source.ExtractToFile(fullPath, overwrite);
131 }
132 }
static StringComparison StringComparison
static string IO_ExtractingResultsInOutside
Definition SR.cs:16
static string IO_DirectoryNameWithData
Definition SR.cs:14
Definition SR.cs:7

References System.IO.Path.Combine(), System.IO.Directory.CreateDirectory(), System.IO.Path.DirectorySeparatorChar, System.IO.FileSystemInfo.FullName, System.IO.Path.GetDirectoryName(), System.IO.Path.GetFileName(), System.IO.Path.GetFullPath(), System.SR.IO_DirectoryNameWithData, System.SR.IO_ExtractingResultsInOutside, System.L, System.source, System.IO.PathInternal.StringComparison, and System.text.