Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ZipFileUtils.cs
Go to the documentation of this file.
3
5
6internal static class ZipFileUtils
7{
8 public static string EntryFromPath(string entry, int offset, int length, ref char[] buffer, bool appendPathSeparator = false)
9 {
11 {
12 offset++;
13 length--;
14 }
15 if (length == 0)
16 {
18 {
19 return string.Empty;
20 }
21 return "/";
22 }
23 int num = (appendPathSeparator ? (length + 1) : length);
26 for (int i = 0; i < length; i++)
27 {
28 char c = buffer[i];
30 {
31 buffer[i] = '/';
32 }
33 }
35 {
36 buffer[length] = '/';
37 }
38 return new string(buffer, 0, num);
39 }
40
41 public static void EnsureCapacity(ref char[] buffer, int min)
42 {
43 if (buffer.Length < min)
44 {
45 int num = buffer.Length * 2;
46 if (num < min)
47 {
48 num = min;
49 }
50 char[] array = buffer;
51 buffer = ArrayPool<char>.Shared.Rent(num);
52 ArrayPool<char>.Shared.Return(array);
53 }
54 }
55
57 {
58 using IEnumerator<string> enumerator = Directory.EnumerateFileSystemEntries(possiblyEmptyDir.FullName).GetEnumerator();
59 return !enumerator.MoveNext();
60 }
61}
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
static bool IsDirEmpty(DirectoryInfo possiblyEmptyDir)
static string EntryFromPath(string entry, int offset, int length, ref char[] buffer, bool appendPathSeparator=false)
static void EnsureCapacity(ref char[] buffer, int min)
static IEnumerable< string > EnumerateFileSystemEntries(string path)
Definition Directory.cs:256
static readonly char AltDirectorySeparatorChar
Definition Path.cs:73
static readonly char DirectorySeparatorChar
Definition Path.cs:71