Exemplo n.º 1
0
            private static InventoryFolderBase GetCurrentOutfitFolder(CachedUserInfo userInfo)
            {
                InventoryFolderBase CurrentOutfitFolder = null;

                try
                {
                    CurrentOutfitFolder = userInfo.FindFolderForType((int)AssetType.CurrentOutfitFolder);
                }
                catch (InventoryStorageException)
                {
                    // could not find it by type. load root and try to find it by name.
                    InventorySubFolderBase foundFolder = null;
                    InventoryFolderBase rootFolder = userInfo.FindFolderForType((int)AssetType.RootFolder);
                    foreach (var subfolder in rootFolder.SubFolders)
                    {
                        if (subfolder.Name == COF_NAME)
                        {
                            foundFolder = subfolder;
                            break;
                        }
                    }
                    if (foundFolder != null)
                    {
                        CurrentOutfitFolder = userInfo.GetFolder(foundFolder.ID);
                        if (CurrentOutfitFolder != null)
                        {
                            CurrentOutfitFolder.Level = InventoryFolderBase.FolderLevel.TopLevel;
                            userInfo.UpdateFolder(CurrentOutfitFolder);
                        }
                    }
                }
                if(CurrentOutfitFolder != null)
                    CurrentOutfitFolder = userInfo.GetFolder(CurrentOutfitFolder.ID);
                return CurrentOutfitFolder;
            }
            private static InventoryFolderBase GetCurrentOutfitFolder(CachedUserInfo userInfo)
            {
                // Duplicate method exists at Scene.Inventory.cs::Scene::GetCurrentOutfitFolder

                InventoryFolderBase currentOutfitFolder = null;

                try
                {
                    currentOutfitFolder = userInfo.FindFolderForType((int)FolderType.CurrentOutfit);
                }
                catch (InventoryStorageException)
                {
                    // could not find it by type. load root and try to find it by name.
                    InventorySubFolderBase foundFolder = null;
                    InventoryFolderBase rootFolder = userInfo.FindFolderForType((int)FolderType.Root);
                    foreach (var subfolder in rootFolder.SubFolders)
                    {
                        if (subfolder.Name == COF_NAME)
                        {
                            foundFolder = subfolder;
                            break;
                        }
                    }
                    if (foundFolder != null)
                    {
                        currentOutfitFolder = userInfo.GetFolder(foundFolder.ID);
                        if (currentOutfitFolder != null)
                        {
                            currentOutfitFolder.Level = InventoryFolderBase.FolderLevel.TopLevel;
                            userInfo.UpdateFolder(currentOutfitFolder);
                        }
                    }
                }
                if(currentOutfitFolder != null)
                    currentOutfitFolder = userInfo.GetFolder(currentOutfitFolder.ID);
                return currentOutfitFolder;
            }