Exemplo n.º 1
0
 private void WriteAvatarNameData(XmlTextWriter writer, UGUIWithName nd)
 {
     writer.WriteStartElement("map");
     writer.WriteKeyValuePair("username", nd.FullName.Replace(' ', '.'));
     writer.WriteKeyValuePair("display_name", nd.FullName);
     writer.WriteKeyValuePair("display_name_next_update", Date.Now.AddDays(1));
     writer.WriteKeyValuePair("display_name_expires", Date.Now.AddMonths(1));
     writer.WriteKeyValuePair("legacy_first_name", nd.FirstName);
     writer.WriteKeyValuePair("legacy_last_name", nd.LastName);
     writer.WriteKeyValuePair("id", nd.ID);
     writer.WriteKeyValuePair("is_display_name_default", false);
     writer.WriteEndElement();
 }
Exemplo n.º 2
0
 public void ToXml(XmlTextWriter writer)
 {
     writer.WriteStartElement("map");
     writer.WriteKeyValuePair("alt_image_enable", IsAlternativeImageEnabled);
     writer.WriteKeyValuePair("auto_loop", IsAutoLoop);
     writer.WriteKeyValuePair("auto_play", IsAutoPlay);
     writer.WriteKeyValuePair("auto_scale", IsAutoScale);
     writer.WriteKeyValuePair("auto_zoom", IsAutoZoom);
     writer.WriteKeyValuePair("controls", (int)Controls);
     writer.WriteKeyValuePair("current_url", CurrentURL);
     writer.WriteKeyValuePair("first_click_interact", IsInteractOnFirstClick);
     writer.WriteKeyValuePair("width_pixels", Width);
     writer.WriteKeyValuePair("height_pixels", Height);
     writer.WriteKeyValuePair("home_url", HomeURL);
     writer.WriteKeyValuePair("perms_control", (int)ControlPermissions);
     writer.WriteKeyValuePair("perms_interact", (int)InteractPermissions);
     if (WhiteList?.Length > 0)
     {
         bool haveWhitelistEntry = false;
         foreach (string v in WhiteList)
         {
             if (!haveWhitelistEntry)
             {
                 haveWhitelistEntry = true;
                 writer.WriteNamedValue("key", "whitelist");
                 writer.WriteStartElement("array");
             }
             writer.WriteNamedValue("string", v);
         }
         if (haveWhitelistEntry)
         {
             writer.WriteEndElement();
         }
     }
     writer.WriteKeyValuePair("whitelist_enable", IsWhiteListEnabled);
     writer.WriteEndElement();
 }
Exemplo n.º 3
0
        protected static void WriteInventoryItem(InventoryItem item, XmlTextWriter writer, UUID agentID)
        {
            writer.WriteKeyValuePair("agent_id", item.Owner.ID);
            writer.WriteKeyValuePair("asset_id", item.AssetID);
            writer.WriteKeyValuePair("created_at", (uint)item.CreationDate.DateTimeToUnixTime());
            writer.WriteKeyValuePair("desc", item.Description);
            writer.WriteKeyValuePair("flags", (uint)item.Flags);
            writer.WriteKeyValuePair("item_id", item.ID);
            writer.WriteKeyValuePair("name", item.Name);
            writer.WriteKeyValuePair("parent_id", item.ParentFolderID);
            writer.WriteKeyValuePair("type", (int)item.AssetType);
            writer.WriteKeyValuePair("inv_type", (int)item.InventoryType);

            writer.WriteStartElement("key");
            writer.WriteValue("permissions");
            writer.WriteEndElement();
            writer.WriteStartElement("map");
            var basePermissions = (uint)item.Permissions.Base;

            if (agentID == item.Creator.ID)
            {
                basePermissions |= (uint)InventoryPermissionsMask.Transfer | (uint)InventoryPermissionsMask.Copy | (uint)InventoryPermissionsMask.Modify;
            }
            if (agentID == item.Owner.ID)
            {
                basePermissions |= (uint)item.Permissions.Current;
            }
            basePermissions |= (uint)item.Permissions.EveryOne;

            writer.WriteKeyValuePair("base_mask", basePermissions);
            writer.WriteKeyValuePair("creator_id", item.Creator.ID);
            writer.WriteKeyValuePair("everyone_mask", (uint)item.Permissions.EveryOne);
            writer.WriteKeyValuePair("group_id", item.Group.ID);
            writer.WriteKeyValuePair("group_mask", (uint)item.Permissions.Group);
            writer.WriteKeyValuePair("is_owner_group", item.IsGroupOwned);
            writer.WriteKeyValuePair("next_owner_mask", (uint)item.Permissions.NextOwner);
            writer.WriteKeyValuePair("owner_id", item.Owner.ID);
            writer.WriteKeyValuePair("owner_mask", (uint)item.Permissions.Current);
            writer.WriteEndElement();

            writer.WriteStartElement("key");
            writer.WriteValue("sale_info");
            writer.WriteEndElement();
            writer.WriteStartElement("map");
            writer.WriteKeyValuePair("sale_price", item.SaleInfo.Price);
            writer.WriteKeyValuePair("sale_type", (uint)item.SaleInfo.Type);
            writer.WriteEndElement();
        }
 private static void WriteInventoryFolderContent(XmlTextWriter writer, InventoryFolderContent folder,
                                                 bool fetch_folders,
                                                 bool fetch_items, UUID agentID)
 {
     writer.WriteStartElement("map");
     writer.WriteKeyValuePair("agent_id", folder.Owner.ID);
     writer.WriteKeyValuePair("descendents", folder.Folders.Count + folder.Items.Count);
     writer.WriteKeyValuePair("folder_id", folder.FolderID);
     if (fetch_folders)
     {
         writer.WriteStartElement("key");
         writer.WriteValue("categories");
         writer.WriteEndElement();
         writer.WriteStartElement("array");
         foreach (var childfolder in folder.Folders)
         {
             writer.WriteStartElement("map");
             writer.WriteKeyValuePair("folder_id", childfolder.ID);
             writer.WriteKeyValuePair("parent_id", childfolder.ParentFolderID);
             writer.WriteKeyValuePair("name", childfolder.Name);
             if (childfolder.DefaultType != AssetType.RootFolder)
             {
                 writer.WriteKeyValuePair("type", (byte)childfolder.DefaultType);
             }
             else
             {
                 writer.WriteKeyValuePair("type", -1);
             }
             writer.WriteKeyValuePair("preferred_type", -1);
             writer.WriteKeyValuePair("version", childfolder.Version);
             writer.WriteEndElement();
         }
         writer.WriteEndElement();
     }
     if (fetch_items)
     {
         writer.WriteStartElement("key");
         writer.WriteValue("items");
         writer.WriteEndElement();
         writer.WriteStartElement("array");
         foreach (var childitem in folder.Items)
         {
             writer.WriteStartElement("map");
             WriteInventoryItem(childitem, writer, agentID);
             writer.WriteEndElement();
         }
         writer.WriteEndElement();
     }
     writer.WriteKeyValuePair("owner_id", folder.Owner.ID);
     writer.WriteKeyValuePair("version", folder.Version);
     writer.WriteEndElement();
 }