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

◆ OpenStream()

static Stream Microsoft.Xna.Framework.TitleContainer.OpenStream ( string name)
inlinestatic

Definition at line 11 of file TitleContainer.cs.

12 {
13 if (string.IsNullOrEmpty(name))
14 {
15 throw new ArgumentNullException("name");
16 }
17 name = GetCleanPath(name);
18 if (IsCleanPathAbsolute(name))
19 {
20 throw new ArgumentException(FrameworkResources.InvalidTitleContainerName);
21 }
22 try
23 {
25 new Uri(uriString, UriKind.Relative);
26 }
27 catch (Exception innerException)
28 {
29 throw new ArgumentException(FrameworkResources.InvalidTitleContainerName, innerException);
30 }
31 try
32 {
33 string path = Path.Combine(TitleLocation.Path, name);
34 return File.OpenRead(path);
35 }
36 catch (Exception ex)
37 {
39 {
40 throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, FrameworkResources.OpenStreamNotFound, new object[1] { name }));
41 }
42 throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, FrameworkResources.OpenStreamError, new object[1] { name }), ex);
43 }
44 }
static string GetCleanPath(string path)
static bool IsCleanPathAbsolute(string path)
static CultureInfo CurrentCulture
static FileStream OpenRead(string path)
Definition File.cs:236
static string Combine(string path1, string path2)
Definition Path.cs:304
static readonly char AltDirectorySeparatorChar
Definition Path.cs:73
static readonly char DirectorySeparatorChar
Definition Path.cs:71
UriKind
Definition UriKind.cs:4

References System.IO.Path.AltDirectorySeparatorChar, System.IO.Path.Combine(), System.Globalization.CultureInfo.CurrentCulture, System.IO.Path.DirectorySeparatorChar, System.Globalization.Format, Microsoft.Xna.Framework.TitleContainer.GetCleanPath(), Microsoft.Xna.Framework.FrameworkResources.InvalidTitleContainerName, Microsoft.Xna.Framework.TitleContainer.IsCleanPathAbsolute(), System.IO.File.OpenRead(), Microsoft.Xna.Framework.FrameworkResources.OpenStreamError, Microsoft.Xna.Framework.FrameworkResources.OpenStreamNotFound, and Microsoft.Xna.Framework.TitleLocation.Path.