public static ThumbnailKey GetThumbnailKey(IMiniSimDescription ths, ThumbnailSize size, int thumbIndex) { try { if (ths == null) { return(ThumbnailKey.kInvalidThumbnailKey); } MiniSimDescription miniSim = ths as MiniSimDescription; if (miniSim != null) { if (!ThumbnailManager.KeyExistsInDB(miniSim.mThumbKey)) { SimDescription sim = MiniSims.UnpackSim(miniSim); ThumbnailKey thumbnailKey = sim.GetThumbnailKey(ThumbnailSize.Large, 0x0); try { sim.Dispose(false, true); } catch (Exception e) { Common.Exception(sim, e); } return(thumbnailKey); } return(miniSim.mThumbKey); } else if ((ths.CASGenealogy == null) || (ths.CASGenealogy.IsAlive())) { return(ths.GetThumbnailKey(size, thumbIndex)); } else { return(ths.GetDeceasedThumbnailKey(size, thumbIndex)); } } catch (Exception e) { Common.Exception(ths.FullName, e); return(ThumbnailKey.kInvalidThumbnailKey); } }
public static Results UpdateThumbnailKey(MiniSimDescription ths, ref SimDescription sim) { try { if (ths == null) { return(Results.Unnecessary); } if (ThumbnailManager.KeyExistsInDB(ths.mThumbKey)) { return(Results.Unnecessary); } sim = SimDescription.Find(ths.SimDescriptionId); if (sim != null) { return(Results.Unnecessary); } sim = UnpackSim(ths, false); if (sim == null) { return(Results.Failure); } // There is an error creating thumbnails for foreign imaginary friends if (sim.OccultManager != null) { if (sim.OccultManager.mOccultList != null) { OccultTypeHelper.Remove(sim, OccultTypes.ImaginaryFriend, true); } else if (sim.OccultManager.HasOccultType(OccultTypes.ImaginaryFriend)) { sim.OccultManager.mCurrentOccultTypes &= ~OccultTypes.ImaginaryFriend; } } if (ths.mTravelKey == ResourceKey.kInvalidResourceKey) { return(Results.Failure); } ths.mThumbKey = new ThumbnailKey(ths.mTravelKey, 0x0, 0x0, 0x0, ThumbnailSize.Large); ths.mThumbKey.mDescKey.GroupId = 0x0; GenerateCrossWorldThumbnail(ths, sim, true); if (!ThumbnailManager.KeyExistsInDB(ths.mThumbKey)) { ths.mThumbKey = new ThumbnailKey(sim.DefaultOutfitKey, ThumbnailSize.Large); } if (ThumbnailManager.KeyExistsInDB(ths.mThumbKey)) { return(Results.Success); } else { return(Results.Failure); } } catch (Exception e) { Common.Exception(ths.FullName, e); return(Results.Failure); } }