本文整理汇总了C#中InventoryFolderBase类的典型用法代码示例。如果您正苦于以下问题:C# InventoryFolderBase类的具体用法?C# InventoryFolderBase怎么用?C# InventoryFolderBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InventoryFolderBase类属于命名空间,在下文中一共展示了InventoryFolderBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddFolder
public virtual bool AddFolder(InventoryFolderBase folder)
{
object remoteValue = DoRemoteByURL("InventoryServerURI", folder);
if (remoteValue != null || m_doRemoteOnly)
return remoteValue == null ? false : (bool) remoteValue;
InventoryFolderBase check = GetFolder(folder);
if (check != null)
return false;
return m_Database.StoreFolder(folder);
}
示例2: ParseInventoryFolders
private InventoryFolderBase[] ParseInventoryFolders (Dictionary<string, List<string>> retVal)
{
List<InventoryFolderBase> folders = new List<InventoryFolderBase> ();
if (retVal.Count == 0)
return folders.ToArray();
for (int i = 0; i < retVal.ElementAt(0).Value.Count; i++)
{
InventoryFolderBase folder = new InventoryFolderBase ();
folder.Name = retVal["folderName"][i];
folder.Type = short.Parse (retVal["type"][i]);
folder.Version = (ushort)int.Parse (retVal["version"][i]);
folder.ID = UUID.Parse (retVal["folderID"][i]);
folder.Owner = UUID.Parse (retVal["agentID"][i]);
folder.ParentID = UUID.Parse (retVal["parentFolderID"][i]);
folders.Add (folder);
}
return folders.ToArray ();
}
示例3: PurgeFolder
public virtual bool PurgeFolder(InventoryFolderBase folder)
{
if (!m_AllowDelete && !ParentIsLinkFolder(folder.ID))
return false;
if (!ParentIsTrash(folder.ID))
return false;
List<InventoryFolderBase> subFolders = m_Database.GetFolders(
new string[] { "parentFolderID" },
new string[] { folder.ID.ToString() });
foreach (InventoryFolderBase x in subFolders)
{
PurgeFolder(x);
m_Database.DeleteFolders("folderID", x.ID.ToString(), true);
}
m_Database.DeleteItems("parentFolderID", folder.ID.ToString());
return true;
}
示例4: PurgeFolder
/// <summary>
/// This method will delete all the items and folders in the given folder.
/// </summary>
/// If the inventory service has not yet delievered the inventory
/// for this user then the request will be queued.
///
/// <param name="folderID"></param>
public bool PurgeFolder(UUID folderID)
{
// m_log.InfoFormat("[AGENT INVENTORY]: Purging folder {0} for {1} uuid {2}",
// folderID, remoteClient.Name, remoteClient.AgentId);
if (m_hasReceivedInventory)
{
InventoryFolderImpl purgedFolder = RootFolder.FindFolder(folderID);
if (purgedFolder != null)
{
// XXX Nasty - have to create a new object to hold details we already have
InventoryFolderBase purgedBaseFolder = new InventoryFolderBase();
purgedBaseFolder.Owner = purgedFolder.Owner;
purgedBaseFolder.ID = purgedFolder.ID;
purgedBaseFolder.Name = purgedFolder.Name;
purgedBaseFolder.ParentID = purgedFolder.ParentID;
purgedBaseFolder.Type = purgedFolder.Type;
purgedBaseFolder.Version = purgedFolder.Version;
m_InventoryService.PurgeFolder(purgedBaseFolder);
purgedFolder.Purge();
return true;
}
}
else
{
AddRequest(
new InventoryRequest(
Delegate.CreateDelegate(typeof(PurgeFolderDelegate), this, "PurgeFolder"),
new object[] { folderID }));
return true;
}
return false;
}
示例5: UpdateFolder
/// <summary>
/// Handle a client request to update the inventory folder
/// </summary>
///
/// If the inventory service has not yet delievered the inventory
/// for this user then the request will be queued.
///
/// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE
/// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing,
/// and needs to be changed.
///
/// <param name="folderID"></param>
/// <param name="type"></param>
/// <param name="name"></param>
/// <param name="parentID"></param>
public bool UpdateFolder(string name, UUID folderID, ushort type, UUID parentID)
{
// m_log.DebugFormat(
// "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId);
if (m_hasReceivedInventory)
{
InventoryFolderImpl folder = RootFolder.FindFolder(folderID);
// Delegate movement if updated parent id isn't the same as the existing parentId
if (folder.ParentID != parentID)
MoveFolder(folderID, parentID);
InventoryFolderBase baseFolder = new InventoryFolderBase();
baseFolder.Owner = m_userProfile.ID;
baseFolder.ID = folderID;
baseFolder.Name = name;
baseFolder.ParentID = parentID;
baseFolder.Type = (short)type;
baseFolder.Version = RootFolder.Version;
m_InventoryService.UpdateFolder(baseFolder);
folder.Name = name;
folder.Type = (short)type;
}
else
{
AddRequest(
new InventoryRequest(
Delegate.CreateDelegate(typeof(UpdateFolderDelegate), this, "UpdateFolder"),
new object[] { name, folderID, type, parentID }));
}
return true;
}
示例6: FinishedStartup
public void FinishedStartup()
{
string IARName = "DefaultInventory.iar";
IniConfigSource iniSource = null;
try
{
iniSource = new IniConfigSource("DefaultInventory/Inventory.ini", Nini.Ini.IniFileType.AuroraStyle);
}
catch
{
}
IConfig libConfig = m_config.Configs["DefaultAssetsIARCreator"];
if (libConfig == null)
libConfig = iniSource.Configs["DefaultAssetsIARCreator"];
if (libConfig != null)
{
if (!libConfig.GetBoolean("Enabled", false))
return;
IARName = libConfig.GetString("NameOfIAR", IARName);
}
else
return;
m_service = m_registry.RequestModuleInterface<ILibraryService>();
RegionInfo regInfo = new RegionInfo();
IScene m_MockScene = null;
//Make the scene for the IAR loader
if (m_registry is IScene)
m_MockScene = (IScene)m_registry;
else
{
m_MockScene = new Scene();
m_MockScene.Initialize(regInfo);
m_MockScene.AddModuleInterfaces(m_registry.GetInterfaces());
}
UserAccount uinfo = m_MockScene.UserAccountService.GetUserAccount(null, m_service.LibraryOwner);
//Make the user account for the default IAR
if (uinfo == null)
{
uinfo = new UserAccount(m_service.LibraryOwner);
uinfo.Name = m_service.LibraryOwnerName;
//m_MockScene.InventoryService.CreateUserInventory(m_service.LibraryOwner, false);
MainConsole.Instance.InfoFormat("[DefaultInventoryToIARConverter]: 1,1");
InventoryFolderBase newFolder = new InventoryFolderBase
{
Name = "My Inventory",
Type = 9,
Version = 1,
ID = new UUID("00000112-000f-0000-0000-000100bba000"),
Owner = m_service.LibraryOwner,
ParentID = UUID.Zero
};
MainConsole.Instance.InfoFormat("[DefaultInventoryToIARConverter]: 1,3");
}
MainConsole.Instance.InfoFormat("[DefaultInventoryToIARConverter]: 1,4");
List<AssetBase> assets = new List<AssetBase> ();
if (m_MockScene.InventoryService != null)
{
//Add the folders to the user's inventory
InventoryCollection i = m_MockScene.InventoryService.GetFolderContent (m_service.LibraryOwner, UUID.Zero);
if (i != null)
{
foreach (InventoryItemBase item in i.Items)
{
AssetBase asset = m_MockScene.RequestModuleInterface<IAssetService> ().Get (item.AssetID.ToString ());
if (asset != null)
assets.Add (asset);
}
}
}
InventoryFolderBase rootFolder = null;
List<InventoryFolderBase> rootFolders = m_MockScene.InventoryService.GetRootFolders (m_service.LibraryOwner);
foreach (InventoryFolderBase folder in rootFolders)
{
if (folder.Name == "My Inventory")
continue;
rootFolder = folder;
break;
}
if (rootFolder != null)
{
//Save the IAR of the default assets
InventoryArchiveWriteRequest write = new InventoryArchiveWriteRequest (Guid.NewGuid (), null, m_MockScene,
uinfo, "/", new GZipStream (new FileStream (IARName, FileMode.Create), CompressionMode.Compress), true, rootFolder, assets);
write.Execute ();
}
}
示例7: LoadItems
private void LoadItems(OSDMap items, UUID OwnerID, InventoryFolderBase folderForAppearance, AvatarAppearance appearance, out List<InventoryItemBase> litems)
{
litems = new List<InventoryItemBase>();
foreach (KeyValuePair<string, OSD> kvp in items)
{
string serialization = kvp.Value.AsString();
InventoryItemBase item = OpenSim.Framework.Serialization.External.UserInventoryItemSerializer.Deserialize(serialization);
m_log.Info("[AvatarArchive]: Loading item " + item.ID.ToString());
UUID oldID = item.ID;
item = GiveInventoryItem(item.CreatorIdAsUuid, OwnerID, item, folderForAppearance);
litems.Add(item);
FixItemIDs(oldID, item, appearance);
}
}
示例8: LoadAvatarArchive
public void LoadAvatarArchive(string FileName, string Name)
{
UserAccount account = UserAccountService.GetUserAccount(UUID.Zero, Name);
m_log.Info("[AvatarArchive] Loading archive from " + FileName);
if (account == null)
{
m_log.Error("[AvatarArchive] User not found!");
return;
}
string file = "";
if (FileName.EndsWith(".database"))
{
m_log.Info("[AvatarArchive] Loading archive from the database " + FileName);
FileName = FileName.Substring(0, FileName.Length - 9);
Aurora.Framework.IAvatarArchiverConnector avarchiver = DataManager.RequestPlugin<IAvatarArchiverConnector>();
AvatarArchive archive = avarchiver.GetAvatarArchive(FileName);
file = archive.ArchiveXML;
}
else
{
m_log.Info("[AvatarArchive] Loading archive from " + FileName);
StreamReader reader = new StreamReader(FileName);
file = reader.ReadToEnd();
reader.Close();
reader.Dispose();
}
string FolderNameToLoadInto = "";
OSD m = OSDParser.DeserializeLLSDXml(file);
if (m.Type != OSDType.Map)
{
m_log.Warn("[AvatarArchiver]: Failed to load AA from " + FileName + ", text: " + file);
return;
}
OSDMap map = ((OSDMap)m);
OSDMap assetsMap = ((OSDMap)map["Assets"]);
OSDMap itemsMap = ((OSDMap)map["Items"]);
OSDMap bodyMap = ((OSDMap)map["Body"]);
AvatarAppearance appearance = ConvertXMLToAvatarAppearance(bodyMap, out FolderNameToLoadInto);
appearance.Owner = account.PrincipalID;
List<InventoryItemBase> items = new List<InventoryItemBase>();
InventoryFolderBase AppearanceFolder = InventoryService.GetFolderForType (account.PrincipalID, InventoryType.Unknown, AssetType.Clothing);
InventoryFolderBase folderForAppearance
= new InventoryFolderBase(
UUID.Random(), FolderNameToLoadInto, account.PrincipalID,
-1, AppearanceFolder.ID, 1);
InventoryService.AddFolder(folderForAppearance);
folderForAppearance = InventoryService.GetFolder(folderForAppearance);
try
{
LoadAssets(assetsMap, appearance);
LoadItems(itemsMap, account.PrincipalID, folderForAppearance, appearance, out items);
}
catch (Exception ex)
{
m_log.Warn("[AvatarArchiver]: Error loading assets and items, " + ex.ToString());
}
AvatarData adata = new AvatarData(appearance);
AvatarService.SetAvatar(account.PrincipalID, adata);
m_log.Info("[AvatarArchive] Loaded archive from " + FileName);
}
示例9: moveInventoryFolder
public void moveInventoryFolder(InventoryFolderBase folder) { m_wrappedPlugin.moveInventoryFolder(folder); }
示例10: updateInventoryFolder
public void updateInventoryFolder(InventoryFolderBase folder) { m_wrappedPlugin.updateInventoryFolder(folder); }
示例11: addInventoryFolder
public void addInventoryFolder(InventoryFolderBase folder) { m_wrappedPlugin.addInventoryFolder(folder); }
示例12: CreateInventorySkel
private void CreateInventorySkel(UserProfileData userProf)
{
IInventoryProviderSelector inventorySelect = ProviderRegistry.Instance.Get<IInventoryProviderSelector>();
IInventoryStorage storage = inventorySelect.GetProvider(userProf.ID);
InventoryFolderBase folder = new InventoryFolderBase();
UUID user = userProf.ID;
folder.ParentID = UUID.Zero;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "My Inventory";
folder.Type = (short)AssetType.Folder;
folder.Version = 1;
storage.CreateFolder(folder);
UUID rootFolder = folder.ID;
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Animations";
folder.Type = (short)AssetType.Animation;
folder.Version = 1;
storage.CreateFolder(folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Body Parts";
folder.Type = (short)AssetType.Bodypart;
folder.Version = 1;
storage.CreateFolder(folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Calling Cards";
folder.Type = (short)AssetType.CallingCard;
folder.Version = 1;
storage.CreateFolder(folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Clothing";
folder.Type = (short)AssetType.Clothing;
folder.Version = 1;
storage.CreateFolder(folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Gestures";
folder.Type = (short)AssetType.Gesture;
folder.Version = 1;
storage.CreateFolder(folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Landmarks";
folder.Type = (short)AssetType.Landmark;
folder.Version = 1;
storage.CreateFolder(folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Lost And Found";
folder.Type = (short)AssetType.LostAndFoundFolder;
folder.Version = 1;
storage.CreateFolder(folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Notecards";
folder.Type = (short)AssetType.Notecard;
folder.Version = 1;
storage.CreateFolder(folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Objects";
folder.Type = (short)AssetType.Object;
folder.Version = 1;
storage.CreateFolder(folder);
//.........这里部分代码省略.........
示例13: GetFolder
public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
List<InventoryFolderBase> folders = m_Database.GetFolders(
new string[] { "folderID"},
new string[] { folder.ID.ToString() });
if (folders.Count == 0)
return null;
return folders[0];
}
示例14: CreateUserRootFolder
public virtual bool CreateUserRootFolder (UUID principalID)
{
bool result = false;
InventoryFolderBase rootFolder = GetRootFolder (principalID);
if (rootFolder == null)
{
List<InventoryFolderBase> rootFolders = GetInventorySkeleton (principalID);
if (rootFolders.Count == 0)
rootFolder = CreateFolder (principalID, UUID.Zero, (int)AssetType.RootFolder, "My Inventory");
else
{
rootFolder = new InventoryFolderBase ();
rootFolder.Name = "My Inventory";
rootFolder.Type = (short)AssetType.RootFolder;
rootFolder.Version = 1;
rootFolder.ID = rootFolders[0].ParentID;
rootFolder.Owner = principalID;
rootFolder.ParentID = UUID.Zero;
m_Database.StoreFolder(rootFolder);
}
result = true;
}
return result;
}
示例15: ForcePurgeFolder
public virtual bool ForcePurgeFolder (InventoryFolderBase folder)
{
List<InventoryFolderBase> subFolders = m_Database.GetFolders(
new string[] { "parentFolderID" },
new string[] { folder.ID.ToString () });
foreach (InventoryFolderBase x in subFolders)
{
ForcePurgeFolder (x);
m_Database.DeleteFolders ("folderID", x.ID.ToString (), false);
}
m_Database.DeleteItems ("parentFolderID", folder.ID.ToString ());
m_Database.DeleteFolders("folderID", folder.ID.ToString(), false);
return true;
}