Пример #1
0
        private void CreateOARFile(ImportSettings settings, string filename)
        {
            string rootDir = ExportCommand.dumpDir + "../oarfile/";

            OarFile.PrepareDir(rootDir);

            // Objects
            foreach (PrimToCreate parent in parents)
            {
                var ls = new Linkset()
                {
                    Parent = parent
                };
                parent.Link = ls;
                LocalScene.Links.Add(ls);
            }
            foreach (PrimToCreate ch in childs)
            {
                var pp = ch.ParentPrim;
                if (pp == null)
                {
                    continue;
                }
                pp.Link.ChildAdd(ch);
            }
            foreach (var ls in LockInfo.CopyOf(LocalScene.Links))
            {
                ls.Children.Sort(compareLocalIDs);
                if (ls.Parent.IsAsset)
                {
                    LocalScene.AssetLinks.Add(ls);
                    LocalScene.Links.Remove(ls);
                }
            }
            foreach (var ls in LocalScene.Links)
            {
                OarFile.SaveLinkset(ls, rootDir + "objects/" + ls.Parent.NewID + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[AssetType.Object], false, settings);
            }
            // Assets
            foreach (ItemToCreate asset in LocalScene.Assets)
            {
                File.WriteAllBytes(rootDir + "assets/" + asset.OldID + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.AssetType], asset.AssetData);
            }
            foreach (var ls in LocalScene.AssetLinks)
            {
                OarFile.SaveLinkset(ls, rootDir + "assets/" + ls.Parent.NewID + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[AssetType.Object], true, settings);
            }
            // Terrain
            if (settings.ContainsKey("terrain"))
            {
                ExportCommand.Exporting.SaveTerrainRaw32(rootDir + "terrains/heightmap.raw");
            }

            string parcelDirs = rootDir + "landdata/";

            Directory.CreateDirectory(parcelDirs);

            OarFile.PackageArchive(rootDir, filename, settings.ContainsKey("terrain"), settings.ContainsKey("land"));
        }
Пример #2
0
 static void WriteUUID(XmlTextWriter writer, string name, UUID id, ImportSettings options)
 {
     writer.WriteStartElement(name);
     if (options.ContainsKey("old-guids"))
     {
         writer.WriteElementString("Guid", id.ToString());
     }
     else
     {
         writer.WriteElementString("UUID", id.ToString());
     }
     writer.WriteEndElement();
 }
Пример #3
0
        private void CreateOARFile(ImportSettings settings, string filename)
        {
            string rootDir = ExportCommand.dumpDir + "../oarfile/";

            OarFile.PrepareDir(rootDir);

            // Objects
            foreach (PrimToCreate parent in parents)
            {
                var ls = new Linkset()
                             {
                                 Parent = parent
                             };
                parent.Link = ls;
                LocalScene.Links.Add(ls);
            }
            foreach (PrimToCreate ch in childs)
            {
                var pp = ch.ParentPrim;
                if (pp == null)
                {
                    continue;
                }
                pp.Link.ChildAdd(ch);
            }
            foreach (var ls in LockInfo.CopyOf(LocalScene.Links))
            {
                ls.Children.Sort(compareLocalIDs);
                if (ls.Parent.IsAsset)
                {
                    LocalScene.AssetLinks.Add(ls);
                    LocalScene.Links.Remove(ls);
                }
            }
            foreach (var ls in LocalScene.Links)
            {
                OarFile.SaveLinkset(ls, rootDir + "objects/" + ls.Parent.NewID + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[AssetType.Object], false, settings);
            }
            // Assets
            foreach (ItemToCreate asset in LocalScene.Assets)
            {
                File.WriteAllBytes(rootDir + "assets/" + asset.OldID + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.AssetType], asset.AssetData);
            }
            foreach (var ls in LocalScene.AssetLinks)
            {
                OarFile.SaveLinkset(ls, rootDir + "assets/" + ls.Parent.NewID + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[AssetType.Object], true, settings);
            }
            // Terrain
            if (settings.ContainsKey("terrain")) ExportCommand.Exporting.SaveTerrainRaw32(rootDir + "terrains/heightmap.raw");

            string parcelDirs = rootDir + "landdata/";
            Directory.CreateDirectory(parcelDirs);

            OarFile.PackageArchive(rootDir, filename, settings.ContainsKey("terrain"), settings.ContainsKey("land"));
        }
Пример #4
0
        static void SOPToXml(XmlTextWriter writer, Primitive sop, int linkNum, Primitive parent, ICollection<InventoryBase> taskInventory, ImportSettings options)
        {
            // Primitive parent = null; throw new NotImplementedException();//"GETPArent"
            Primitive.ObjectProperties prop = sop.Properties;
            writer.WriteStartElement("SceneObjectPart");
            writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
            writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");

            WriteUUID(writer, "UUID", sop.ID, options);
            if (CogbotHelpers.IsNullOrZero(sop.ID))
            {
                throw new NullReferenceException("ID " + sop);
            }

            WriteValue(writer,"AllowedDrop",
                                      ((sop.Flags & PrimFlags.AllowInventoryDrop) != 0).ToString().ToLower());

            WriteUserUUID(writer, "CreatorID", prop.CreatorID, options);
            /*
            if (sop.CreatorData != null && sop.CreatorData != string.Empty)
                WES(writer,"CreatorData", sop.CreatorData);
            else if (options.ContainsKey("home"))
            {
                if (m_UserManagement == null)
                    m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>();
                string name = m_UserManagement.GetUserName(sop.CreatorID);
                WES(writer,"CreatorData", (string)options["home"] + ";" + name);
            }
            */
            WriteUUID(writer, "FolderID", prop.FolderID, options);
            WriteInt(writer,"InventorySerial", prop.InventorySerial);

            WriteTaskInventory(sop, writer, taskInventory, options);

            WriteFlags(writer, "ObjectFlags", sop.Flags, options);
            WriteInt(writer,"LocalId", sop.LocalID);
            WriteValue(writer,"Name", prop.Name);
            WriteEnum(writer, "Material", sop.PrimData.Material);
            WriteValue(writer,"PassTouches", "False");// sop.PassTouches.ToString().ToLower());
            WriteUInt(writer,"RegionHandle", sop.RegionHandle);
            WriteValue(writer,"ScriptAccessPin", "0");

            Vector3 groupPosition;
            if (parent == null)
                groupPosition = sop.Position;
            else
                groupPosition = parent.Position;

            WriteVector(writer, "GroupPosition", groupPosition);
            if (sop.ParentID == 0)
                WriteVector(writer, "OffsetPosition", Vector3.Zero);
            else
                WriteVector(writer, "OffsetPosition", sop.Position);
            WriteQuaternion(writer, "RotationOffset", sop.Rotation);

            WriteVector(writer, "Velocity", sop.Velocity);
            WriteVector(writer, "AngularVelocity", sop.AngularVelocity);
            WriteVector(writer, "Acceleration", sop.Acceleration);
            WriteValue(writer,"Description", prop.Description);

            writer.WriteStartElement("Color");
            WriteFloat(writer,"R", sop.TextColor.R);
            WriteFloat(writer,"G", sop.TextColor.G);
            WriteFloat(writer,"B", sop.TextColor.B);
            WriteFloat(writer,"A", sop.TextColor.G);
            writer.WriteEndElement();

            WriteValue(writer,"Text", sop.Text);
            WriteValue(writer,"SitName", prop.SitName);
            WriteValue(writer,"TouchName", prop.TouchName);

            WriteInt(writer,"LinkNum", linkNum);
            WriteEnum(writer,"ClickAction", sop.ClickAction);

            WriteShape(writer, sop, sop.Properties, sop.PrimData, options);

            WriteVector(writer, "Scale", sop.Scale);
            WriteValue(writer,"UpdateFlag", "0");
            WriteVector(writer, "SitTargetOrientation", Vector3.UnitZ);
            WriteVector(writer, "SitTargetPosition", Vector3.Zero);
            WriteVector(writer, "SitTargetPositionLL", Vector3.Zero);
            WriteQuaternion(writer, "SitTargetOrientationLL", Quaternion.Identity);
            WriteInt(writer,"ParentID", sop.ParentID);
            WriteDate(writer, "CreationDate", sop.Properties.CreationDate);
            WriteEnum(writer, "Category", sop.Properties.Category);
            WriteInt(writer,"SalePrice", sop.Properties.SalePrice);
            WriteEnum(writer, "ObjectSaleType", sop.Properties.SaleType);
            WriteInt(writer,"OwnershipCost", sop.Properties.OwnershipCost);
            WriteUUID(writer, "GroupID", sop.GroupID, options);

            UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID;
            WriteUserUUID(writer, "OwnerID", ownerID, options);

            UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : prop.LastOwnerID;
            WriteUserUUID(writer, "LastOwnerID", lastOwnerID, options);

            var perms = prop.Permissions;
            if (!options.Contains("sameperm") || options.Contains("fullperm"))
            {
                perms = Permissions.FullPermissions;
            }
            WriteEnum(writer, "BaseMask", Reperm(perms.BaseMask, options));
            WriteEnum(writer, "OwnerMask", Reperm(perms.OwnerMask, options));
            WriteEnum(writer, "GroupMask", Reperm(perms.GroupMask, options));
            WriteEnum(writer, "EveryoneMask", Reperm(perms.EveryoneMask, options));
            WriteEnum(writer, "NextOwnerMask", Reperm(perms.NextOwnerMask, options));
            WriteFlags(writer, "Flags", sop.Flags, options);
            WriteUUID(writer, "CollisionSound", sop.Sound, options);
            WriteFloat(writer,"CollisionSoundVolume", sop.SoundGain);
            if (sop.MediaURL != null)
                WriteValue(writer,"MediaUrl", sop.MediaURL);
            WriteBytes(writer, "TextureAnimation", sop.TextureAnim.GetBytes());
            WriteBytes(writer, "ParticleSystem", sop.ParticleSys.GetBytes());
            /*
            WES(writer,"PayPrice0", sop.PayPrice[0]);
            WES(writer,"PayPrice1", sop.PayPrice[1]);
            WES(writer,"PayPrice2", sop.PayPrice[2]);
            WES(writer,"PayPrice3", sop.PayPrice[3]);
            WES(writer,"PayPrice4", sop.PayPrice[4]);
            */

            writer.WriteEndElement();
        }
Пример #5
0
        public static void WriteTaskInventory(Primitive sop, XmlTextWriter writer, ICollection<InventoryBase> tinv, ImportSettings options)
        {
            if (tinv == null)
            {
                return;
            }
            int ObjectNum = -1;
            if (tinv.Count > 0) // otherwise skip this
            {
                writer.WriteStartElement("TaskInventory");

                foreach (InventoryBase item2c in tinv)
                {
                    InventoryItem item = item2c as InventoryItem;
                    if (item == null) continue;
                    string itemName = item.Name;
                    bool obj = (item.AssetType == AssetType.Object);
                    UUID itemAssetUUID = obj ? item.RezzID : item.AssetUUID;
                    if (obj)
                    {
                        ObjectNum++;
                        if (CogbotHelpers.IsNullOrZero(itemAssetUUID))
                        {
                            string rtiStatus = ExportCommand.dumpDir + sop.ID + "." + ObjectNum + ".rti";
                            lock (ExportCommand.fileWriterLock)
                            {
                                if (File.Exists(rtiStatus))
                                {
                                    string[] conts = File.ReadAllText(rtiStatus).Split(',');
                                    if (conts.Length > 2)
                                    {
                                        itemAssetUUID = UUID.Parse(conts[0]);
                                    }
                                }
                            }
                        }
                        if (CogbotHelpers.IsNullOrZero(itemAssetUUID))
                        {
                            ExportCommand.LogError(sop.ID, "AssetZERO: " + item);
                            if (!options.ContainsKey("keepmissing")) continue;
                            if (options.ContainsKey("use404"))
                                itemAssetUUID = ImportCommand.GetMissingFiller(item.AssetType);
                            if (options.ContainsKey("error404") && !itemName.Contains("ERROR404"))
                                itemName += "ERROR404";
                            ImportCommand.Importing.Failure("Zero AssetID " + item.Name);
                        }
                    }
                    else
                    {
                        if (CogbotHelpers.IsNullOrZero(itemAssetUUID)) itemAssetUUID = item.RezzID;
                        if (CogbotHelpers.IsNullOrZero(itemAssetUUID))
                        {
                            ExportCommand.LogError(sop.ID, "AssetZERO: " + item);
                            if (!options.ContainsKey("keepmissing")) continue;
                            if (options.ContainsKey("use404"))
                                itemAssetUUID = ImportCommand.GetMissingFiller(item.AssetType);
                            if (options.ContainsKey("error404") && !itemName.Contains("ERROR404"))
                                itemName += "ERROR404";
                            ImportCommand.Importing.Failure("Zero AssetID " + item.Name);
                        }                        
                    }
                    writer.WriteStartElement("TaskInventoryItem");
                    Permissions perms = item.Permissions;
                    if (!options.Contains("sameperm"))
                    {
                        perms = Permissions.FullPermissions;
                    }

                    if (CogbotHelpers.IsNullOrZero(itemAssetUUID))
                    {
                        continue;
                    }
                    WriteUUID(writer, "AssetID", itemAssetUUID, options);
                    WriteEnum(writer, "BasePermissions", perms.BaseMask);
                    WriteDate(writer, "CreationDate", item.CreationDate);

                    WriteUUID(writer, "CreatorID", item.CreatorID, options);

                    /*
                    //todo if (item.CreatorData != null && item.CreatorData != string.Empty)
                        WES(writer,"CreatorData", item.CreatorData);
                    else if (options.ContainsKey("home"))
                    {
                        if (m_UserManagement == null)
                            m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
                        string name = m_UserManagement.GetUserName(item.CreatorID);
                        WES(writer,"CreatorData", (string)options["home"] + ";" + name);
                    }
                    */
                    WriteValue(writer, "Description", item.Description);
                    WriteEnum(writer, "EveryonePermissions", Reperm(perms.EveryoneMask, options));
                    WriteUInt(writer, "Flags", item.Flags);
                    WriteUUID(writer, "GroupID", item.GroupID, options);
                    WriteEnum(writer, "GroupPermissions", Reperm(perms.GroupMask, options));
                    WriteEnum(writer, "InvType", item.InventoryType);
                    WriteUUID(writer, "ItemID", item.UUID, options);
                    //todo WriteUUID(writer, "OldItemID", item.OldItemID, options);

                    UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.LastOwnerID;
                    WriteUserUUID(writer, "LastOwnerID", lastOwnerID, options);

                    WriteValue(writer, "Name", itemName);
                    WriteEnum(writer, "NextPermissions", Reperm(perms.NextOwnerMask, options));

                    UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.OwnerID;
                    WriteUUID(writer, "OwnerID", ownerID, options);

                    WriteEnum(writer, "CurrentPermissions", Reperm(perms.OwnerMask, options));
                    WriteUUID(writer, "ParentID", item.ParentUUID, options);
                    /*todo
                     * WriteUUID(writer, "ParentPartID", item.ParentPartID, options);
                     WriteUUID(writer, "PermsGranter", item.PermsGranter, options);
                     */
                    // todo what is this?
                    WriteEnum(writer, "PermsMask", PermissionMask.All);//  perms.BaseMask);//item.PermsMask);

                    WriteEnum(writer, "Type", item.AssetType);
                    //todo WES(writer,"OwnerChanged", item.OwnerChanged.ToString().ToLower());

                    writer.WriteEndElement(); // TaskInventoryItem
                }

                writer.WriteEndElement(); // TaskInventory
            }
        }
        public static void WriteTaskInventory(Primitive sop, XmlTextWriter writer, ICollection <InventoryBase> tinv, ImportSettings options)
        {
            if (tinv == null)
            {
                return;
            }
            int ObjectNum = -1;

            if (tinv.Count > 0) // otherwise skip this
            {
                writer.WriteStartElement("TaskInventory");

                foreach (InventoryBase item2c in tinv)
                {
                    InventoryItem item = item2c as InventoryItem;
                    if (item == null)
                    {
                        continue;
                    }
                    string itemName      = item.Name;
                    bool   obj           = (item.AssetType == AssetType.Object);
                    UUID   itemAssetUUID = obj ? item.RezzID : item.AssetUUID;
                    if (obj)
                    {
                        ObjectNum++;
                        if (CogbotHelpers.IsNullOrZero(itemAssetUUID))
                        {
                            string rtiStatus = ExportCommand.dumpDir + sop.ID + "." + ObjectNum + ".rti";
                            lock (ExportCommand.fileWriterLock)
                            {
                                if (File.Exists(rtiStatus))
                                {
                                    string[] conts = File.ReadAllText(rtiStatus).Split(',');
                                    if (conts.Length > 2)
                                    {
                                        itemAssetUUID = UUID.Parse(conts[0]);
                                    }
                                }
                            }
                        }
                        if (CogbotHelpers.IsNullOrZero(itemAssetUUID))
                        {
                            ExportCommand.LogError(sop.ID, "AssetZERO: " + item);
                            if (!options.ContainsKey("keepmissing"))
                            {
                                continue;
                            }
                            if (options.ContainsKey("use404"))
                            {
                                itemAssetUUID = ImportCommand.GetMissingFiller(item.AssetType);
                            }
                            if (options.ContainsKey("error404") && !itemName.Contains("ERROR404"))
                            {
                                itemName += "ERROR404";
                            }
                            ImportCommand.Importing.Failure("Zero AssetID " + item.Name);
                        }
                    }
                    else
                    {
                        if (CogbotHelpers.IsNullOrZero(itemAssetUUID))
                        {
                            itemAssetUUID = item.RezzID;
                        }
                        if (CogbotHelpers.IsNullOrZero(itemAssetUUID))
                        {
                            ExportCommand.LogError(sop.ID, "AssetZERO: " + item);
                            if (!options.ContainsKey("keepmissing"))
                            {
                                continue;
                            }
                            if (options.ContainsKey("use404"))
                            {
                                itemAssetUUID = ImportCommand.GetMissingFiller(item.AssetType);
                            }
                            if (options.ContainsKey("error404") && !itemName.Contains("ERROR404"))
                            {
                                itemName += "ERROR404";
                            }
                            ImportCommand.Importing.Failure("Zero AssetID " + item.Name);
                        }
                    }
                    writer.WriteStartElement("TaskInventoryItem");
                    Permissions perms = item.Permissions;
                    if (!options.Contains("sameperm"))
                    {
                        perms = Permissions.FullPermissions;
                    }

                    if (CogbotHelpers.IsNullOrZero(itemAssetUUID))
                    {
                        continue;
                    }
                    WriteUUID(writer, "AssetID", itemAssetUUID, options);
                    WriteEnum(writer, "BasePermissions", perms.BaseMask);
                    WriteDate(writer, "CreationDate", item.CreationDate);

                    WriteUUID(writer, "CreatorID", item.CreatorID, options);

                    /*
                     * //todo if (item.CreatorData != null && item.CreatorData != string.Empty)
                     *  WES(writer,"CreatorData", item.CreatorData);
                     * else if (options.ContainsKey("home"))
                     * {
                     *  if (m_UserManagement == null)
                     *      m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
                     *  string name = m_UserManagement.GetUserName(item.CreatorID);
                     *  WES(writer,"CreatorData", (string)options["home"] + ";" + name);
                     * }
                     */
                    WriteValue(writer, "Description", item.Description);
                    WriteEnum(writer, "EveryonePermissions", Reperm(perms.EveryoneMask, options));
                    WriteUInt(writer, "Flags", item.Flags);
                    WriteUUID(writer, "GroupID", item.GroupID, options);
                    WriteEnum(writer, "GroupPermissions", Reperm(perms.GroupMask, options));
                    WriteEnum(writer, "InvType", item.InventoryType);
                    WriteUUID(writer, "ItemID", item.UUID, options);
                    //todo WriteUUID(writer, "OldItemID", item.OldItemID, options);

                    UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.LastOwnerID;
                    WriteUserUUID(writer, "LastOwnerID", lastOwnerID, options);

                    WriteValue(writer, "Name", itemName);
                    WriteEnum(writer, "NextPermissions", Reperm(perms.NextOwnerMask, options));

                    UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.OwnerID;
                    WriteUUID(writer, "OwnerID", ownerID, options);

                    WriteEnum(writer, "CurrentPermissions", Reperm(perms.OwnerMask, options));
                    WriteUUID(writer, "ParentID", item.ParentUUID, options);

                    /*todo
                     * WriteUUID(writer, "ParentPartID", item.ParentPartID, options);
                     * WriteUUID(writer, "PermsGranter", item.PermsGranter, options);
                     */
                    // todo what is this?
                    WriteEnum(writer, "PermsMask", PermissionMask.All);//  perms.BaseMask);//item.PermsMask);

                    WriteEnum(writer, "Type", item.AssetType);
                    //todo WES(writer,"OwnerChanged", item.OwnerChanged.ToString().ToLower());

                    writer.WriteEndElement(); // TaskInventoryItem
                }

                writer.WriteEndElement(); // TaskInventory
            }
        }
        static void SOPToXml(XmlTextWriter writer, Primitive sop, int linkNum, Primitive parent, ICollection <InventoryBase> taskInventory, ImportSettings options)
        {
            // Primitive parent = null; throw new NotImplementedException();//"GETPArent"
            Primitive.ObjectProperties prop = sop.Properties;
            writer.WriteStartElement("SceneObjectPart");
            writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
            writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");

            WriteUUID(writer, "UUID", sop.ID, options);
            if (CogbotHelpers.IsNullOrZero(sop.ID))
            {
                throw new NullReferenceException("ID " + sop);
            }

            WriteValue(writer, "AllowedDrop",
                       ((sop.Flags & PrimFlags.AllowInventoryDrop) != 0).ToString().ToLower());

            WriteUserUUID(writer, "CreatorID", prop.CreatorID, options);

            /*
             * if (sop.CreatorData != null && sop.CreatorData != string.Empty)
             *  WES(writer,"CreatorData", sop.CreatorData);
             * else if (options.ContainsKey("home"))
             * {
             *  if (m_UserManagement == null)
             *      m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>();
             *  string name = m_UserManagement.GetUserName(sop.CreatorID);
             *  WES(writer,"CreatorData", (string)options["home"] + ";" + name);
             * }
             */
            WriteUUID(writer, "FolderID", prop.FolderID, options);
            WriteInt(writer, "InventorySerial", prop.InventorySerial);

            WriteTaskInventory(sop, writer, taskInventory, options);

            WriteFlags(writer, "ObjectFlags", sop.Flags, options);
            WriteInt(writer, "LocalId", sop.LocalID);
            WriteValue(writer, "Name", prop.Name);
            WriteEnum(writer, "Material", sop.PrimData.Material);
            WriteValue(writer, "PassTouches", "False");// sop.PassTouches.ToString().ToLower());
            WriteUInt(writer, "RegionHandle", sop.RegionHandle);
            WriteValue(writer, "ScriptAccessPin", "0");

            Vector3 groupPosition;

            if (parent == null)
            {
                groupPosition = sop.Position;
            }
            else
            {
                groupPosition = parent.Position;
            }

            WriteVector(writer, "GroupPosition", groupPosition);
            if (sop.ParentID == 0)
            {
                WriteVector(writer, "OffsetPosition", Vector3.Zero);
            }
            else
            {
                WriteVector(writer, "OffsetPosition", sop.Position);
            }
            WriteQuaternion(writer, "RotationOffset", sop.Rotation);

            WriteVector(writer, "Velocity", sop.Velocity);
            WriteVector(writer, "AngularVelocity", sop.AngularVelocity);
            WriteVector(writer, "Acceleration", sop.Acceleration);
            WriteValue(writer, "Description", prop.Description);

            writer.WriteStartElement("Color");
            WriteFloat(writer, "R", sop.TextColor.R);
            WriteFloat(writer, "G", sop.TextColor.G);
            WriteFloat(writer, "B", sop.TextColor.B);
            WriteFloat(writer, "A", sop.TextColor.G);
            writer.WriteEndElement();

            WriteValue(writer, "Text", sop.Text);
            WriteValue(writer, "SitName", prop.SitName);
            WriteValue(writer, "TouchName", prop.TouchName);

            WriteInt(writer, "LinkNum", linkNum);
            WriteEnum(writer, "ClickAction", sop.ClickAction);

            WriteShape(writer, sop, sop.Properties, sop.PrimData, options);

            WriteVector(writer, "Scale", sop.Scale);
            WriteValue(writer, "UpdateFlag", "0");
            WriteVector(writer, "SitTargetOrientation", Vector3.UnitZ);
            WriteVector(writer, "SitTargetPosition", Vector3.Zero);
            WriteVector(writer, "SitTargetPositionLL", Vector3.Zero);
            WriteQuaternion(writer, "SitTargetOrientationLL", Quaternion.Identity);
            WriteInt(writer, "ParentID", sop.ParentID);
            WriteDate(writer, "CreationDate", sop.Properties.CreationDate);
            WriteEnum(writer, "Category", sop.Properties.Category);
            WriteInt(writer, "SalePrice", sop.Properties.SalePrice);
            WriteEnum(writer, "ObjectSaleType", sop.Properties.SaleType);
            WriteInt(writer, "OwnershipCost", sop.Properties.OwnershipCost);
            WriteUUID(writer, "GroupID", sop.GroupID, options);

            UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID;

            WriteUserUUID(writer, "OwnerID", ownerID, options);

            UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : prop.LastOwnerID;

            WriteUserUUID(writer, "LastOwnerID", lastOwnerID, options);

            var perms = prop.Permissions;

            if (!options.Contains("sameperm") || options.Contains("fullperm"))
            {
                perms = Permissions.FullPermissions;
            }
            WriteEnum(writer, "BaseMask", Reperm(perms.BaseMask, options));
            WriteEnum(writer, "OwnerMask", Reperm(perms.OwnerMask, options));
            WriteEnum(writer, "GroupMask", Reperm(perms.GroupMask, options));
            WriteEnum(writer, "EveryoneMask", Reperm(perms.EveryoneMask, options));
            WriteEnum(writer, "NextOwnerMask", Reperm(perms.NextOwnerMask, options));
            WriteFlags(writer, "Flags", sop.Flags, options);
            WriteUUID(writer, "CollisionSound", sop.Sound, options);
            WriteFloat(writer, "CollisionSoundVolume", sop.SoundGain);
            if (sop.MediaURL != null)
            {
                WriteValue(writer, "MediaUrl", sop.MediaURL);
            }
            WriteBytes(writer, "TextureAnimation", sop.TextureAnim.GetBytes());
            WriteBytes(writer, "ParticleSystem", sop.ParticleSys.GetBytes());

            /*
             * WES(writer,"PayPrice0", sop.PayPrice[0]);
             * WES(writer,"PayPrice1", sop.PayPrice[1]);
             * WES(writer,"PayPrice2", sop.PayPrice[2]);
             * WES(writer,"PayPrice3", sop.PayPrice[3]);
             * WES(writer,"PayPrice4", sop.PayPrice[4]);
             */

            writer.WriteEndElement();
        }
Пример #8
0
 static void WriteUUID(XmlTextWriter writer, string name, UUID id, ImportSettings options)
 {
     writer.WriteStartElement(name);
     if (options.ContainsKey("old-guids"))
         writer.WriteElementString("Guid", id.ToString());
     else
         writer.WriteElementString("UUID", id.ToString());
     writer.WriteEndElement();
 }