本文整理汇总了C#中RegionInfo.FromOSD方法的典型用法代码示例。如果您正苦于以下问题:C# RegionInfo.FromOSD方法的具体用法?C# RegionInfo.FromOSD怎么用?C# RegionInfo.FromOSD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RegionInfo
的用法示例。
在下文中一共展示了RegionInfo.FromOSD方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadBackup
public RegionData LoadBackup(string file)
{
if (!File.Exists(file))
return null;
var stream = ArchiveHelpers.GetStream(file);
if (stream == null)
return null;
GZipStream m_loadStream = new GZipStream(stream, CompressionMode.Decompress);
TarArchiveReader reader = new TarArchiveReader(m_loadStream);
List<uint> foundLocalIDs = new List<uint>();
RegionData regiondata = new RegionData();
regiondata.Init();
byte[] data;
string filePath;
TarArchiveReader.TarEntryType entryType;
System.Collections.Concurrent.ConcurrentQueue<byte[]> groups =
new System.Collections.Concurrent.ConcurrentQueue<byte[]>();
//Load the archive data that we need
while ((data = reader.ReadEntry(out filePath, out entryType)) != null)
{
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType)
continue;
if (filePath.StartsWith("parcels/"))
{
//Only use if we are not merging
LandData parcel = new LandData();
OSD parcelData = OSDParser.DeserializeLLSDBinary(data);
parcel.FromOSD((OSDMap) parcelData);
if (parcel.OwnerID != UUID.Parse("05948863-b678-433e-87a4-e44d17678d1d"))
//The default owner of the 'default' region
regiondata.Parcels.Add(parcel);
}
else if (filePath.StartsWith("newstyleterrain/"))
{
regiondata.Terrain = data;
}
else if (filePath.StartsWith("newstylerevertterrain/"))
{
regiondata.RevertTerrain = data;
}
else if (filePath.StartsWith("newstylewater/"))
{
regiondata.Water = data;
}
else if (filePath.StartsWith("newstylerevertwater/"))
{
regiondata.RevertWater = data;
}
else if (filePath.StartsWith("entities/"))
{
groups.Enqueue(data);
}
else if (filePath.StartsWith("regioninfo/"))
{
RegionInfo info = new RegionInfo();
info.FromOSD((OSDMap) OSDParser.DeserializeLLSDBinary(data));
regiondata.RegionInfo = info;
}
data = null;
}
m_loadStream.Close();
m_loadStream = null;
int threadCount = groups.Count > 16 ? 16 : groups.Count;
System.Threading.Thread[] threads = new System.Threading.Thread[threadCount];
for (int i = 0; i < threadCount; i++)
{
threads[i] = new System.Threading.Thread(() =>
{
byte[] groupData;
while (groups.TryDequeue(out groupData))
{
MemoryStream ms = new MemoryStream(groupData);
ISceneEntity sceneObject =
SceneEntitySerializer.SceneObjectSerializer
.FromXml2Format(ref ms,
null);
ms.Close();
ms = null;
data = null;
if (sceneObject != null)
{
foreach (
ISceneChildEntity part in
sceneObject.ChildrenEntities())
{
lock (foundLocalIDs)
{
if (
!foundLocalIDs.Contains(
part.LocalId))
foundLocalIDs.Add(part.LocalId);
else
part.LocalId = 0;
//Reset it! Only use it once!
}
//.........这里部分代码省略.........