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

◆ GetRandomDirectory()

static string System.IO.IsolatedStorage.Helper.GetRandomDirectory ( string rootDirectory,
IsolatedStorageScope scope )
inlinestaticpackage

Definition at line 105 of file Helper.cs.

106 {
107 string text = GetExistingRandomDirectory(rootDirectory);
108 if (string.IsNullOrEmpty(text))
109 {
110 using Mutex mutex = CreateMutexNotOwned(rootDirectory);
111 if (!mutex.WaitOne())
112 {
113 throw new IsolatedStorageException(System.SR.IsolatedStorage_Init);
114 }
115 try
116 {
117 text = GetExistingRandomDirectory(rootDirectory);
118 if (string.IsNullOrEmpty(text))
119 {
120 text = Path.Combine(rootDirectory, Path.GetRandomFileName(), Path.GetRandomFileName());
121 CreateDirectory(text, scope);
122 }
123 }
124 finally
125 {
126 mutex.ReleaseMutex();
127 }
128 }
129 return text;
130 }
static Mutex CreateMutexNotOwned(string pathName)
Definition Helper.cs:159
static void CreateDirectory(string path, IsolatedStorageScope scope)
Definition Helper.cs:164
static string GetExistingRandomDirectory(string rootDirectory)
Definition Helper.cs:132
static string IsolatedStorage_Init
Definition SR.cs:32
Definition SR.cs:7

References System.IO.Path.Combine(), System.IO.IsolatedStorage.Helper.CreateDirectory(), System.IO.IsolatedStorage.Helper.CreateMutexNotOwned(), System.IO.IsolatedStorage.Helper.GetExistingRandomDirectory(), System.IO.Path.GetRandomFileName(), System.SR.IsolatedStorage_Init, and System.text.

Referenced by System.IO.IsolatedStorage.Helper.GetRootDirectory().