32 using OpenSim.Framework.Serialization;
33 using OpenSim.Region.Framework.Scenes;
35 namespace OpenSim.Region.CoreModules.World.Archiver
41 public static class ArchiveHelpers
52 return ArchiveConstants.CreateOarObjectFilename(sog.Name, sog.UUID, sog.AbsolutePosition);
64 return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition);
72 public static Stream GetStream(
string path)
74 if (File.Exists(path))
76 return new FileStream(path, FileMode.Open, FileAccess.Read);
82 Uri uri =
new Uri(path);
83 if (uri.Scheme ==
"file")
85 return new FileStream(uri.AbsolutePath, FileMode.Open, FileAccess.Read);
89 if (uri.Scheme !=
"http")
90 throw new Exception(String.Format(
"Unsupported URI scheme ({0})", path));
96 catch (UriFormatException)
100 throw new Exception(String.Format(
"Cannot find file {0}", path));
105 public static Stream URIFetch(Uri uri)
107 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
111 request.ContentLength = 0;
112 request.KeepAlive =
false;
114 WebResponse response = request.GetResponse();
115 Stream file = response.GetResponseStream();
121 if (response.ContentLength == 0)
122 throw new Exception(String.Format(
"{0} returned an empty file", uri.ToString()));
125 return new BufferedStream(file, 1000000);
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
Interactive OpenSim region server