private void addToDBPF(string filename, string typeID, string groupID, string instanceID, Database db)
 {
     Stream input = File.Open(filename, FileMode.Open, FileAccess.Read);
     ResourceKey rkey = new ResourceKey((ulong)Gibbed.Helpers.StringHelpers.ParseHex64(instanceID), (uint)Gibbed.Helpers.StringHelpers.ParseHex32(typeID), (uint)Gibbed.Helpers.StringHelpers.ParseHex32(groupID));
     db.SetResourceStream(rkey, input);
     input.Close();
 }
Beispiel #2
0
        public static void ParseEWCatFishingDreamTrees()
        {
            Dictionary <string, XmlElement> instanceDefults = DreamsAndPromisesManager.ParseDefaults();
            List <DreamTree> cacheTrees = new List <DreamTree>();

            uint[]      array  = new uint[2];
            uint[]      array2 = array;
            ResourceKey item   = new ResourceKey(0xA43129F3D1D0E08C, 0x0604ABDA, 0x0);

            array2[0]++;
            if (DreamsAndPromisesManager.ParseDreamTreeByKey(item, instanceDefults, ref cacheTrees))
            {
                array2[1]++;
            }
        }
 public void AddBuffs(ResourceKey[] resourceKeys)
 {
     try {
         /* Process the XML file inside the .package file */
         /* First is the FNV64 hash of file in the .package, second is the type (_XML), and third the group. */
         /* Customize first, leave second and third as they are. */
         ResourceKey key = new ResourceKey (ResourceUtils.HashString64 ("Template.TplBuff.Buffs"), 0x0333406C, 0x0);
         XmlDbData xmlDbData = XmlDbData.ReadData (key, false);
         if (xmlDbData != null) {
             BuffManager.ParseBuffData (xmlDbData, true);
         }
     } catch {
         /* You can use Logger to report failure */
     }
 }
Beispiel #4
0
        public TType LoadResource <TType>(ResourceKey key)
            where TType : class, IFormat, new()
        {
            var input = this.LoadResource(key);

            if (input == null)
            {
                return(null);
            }

            var instance = new TType();

            instance.Deserialize(input);
            return(instance);
        }
        public override int GetHashCode()
        {
            unchecked
            {
                int result = ResourceKey != null?ResourceKey.GetHashCode() : 0;

                result = (result * 397) ^ (CodecType != null ? CodecType.GetHashCode() : 0);
                result = (result * 397) ^ (MediaType != null ? MediaType.GetHashCode() : 0);
                result = (result * 397) ^ IsStrict.GetHashCode();
                result = (result * 397) ^ (Extensions != null ? Extensions.GetHashCode() : 0);
                result = (result * 397) ^ (Configuration != null ? Configuration.GetHashCode() : 0);
                result = (result * 397) ^ IsSystem.GetHashCode();
                return(result);
            }
        }
Beispiel #6
0
        public async Task WhenDeletingAResourceForASecondTime_ThenWeDoNotGetANewVersion()
        {
            var saveResult = await Mediator.UpsertResourceAsync(Samples.GetJsonSample("Weight"));

            var resourceKey = new ResourceKey("Observation", saveResult.Resource.Id);

            await Mediator.DeleteResourceAsync(resourceKey, false);

            var deletedResourceKey2 = await Mediator.DeleteResourceAsync(resourceKey, false);

            Assert.Null(deletedResourceKey2.ResourceKey.VersionId);

            await Assert.ThrowsAsync <ResourceGoneException>(
                () => Mediator.GetResourceAsync(new ResourceKey <Observation>(saveResult.Resource.Id)));
        }
Beispiel #7
0
        public static void OnWorldLoadFinishedHandler(object sender, EventArgs e)
        {
            maskPartSkin         = ResourceKey.Parse(0x034AEECB + "-" + 0x00000000 + "-" + 0x9F734D5B9D920083);
            sSkinAddBuffListener = EventTracker.AddListener(EventTypeId.kGotBuff, new ProcessEventDelegate(SkinAdd.OnGotBuff));
            PartSearch search = new PartSearch();

            foreach (CASPart part in search)
            {
                if (part.Key == maskPartSkin)
                {
                    SkinAddMask = part;
                }
            }
            search.Reset();
        }
Beispiel #8
0
 public object Convert(object[] values, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
 {
     if (values.Length >= 2 &&
         values[0] is ResourceKey &&
         values[1] is FrameworkElement)
     {
         ResourceKey      key = (ResourceKey)values[0];
         FrameworkElement fe  = (FrameworkElement)values[1];
         return(fe.FindResource(key));
     }
     else
     {
         throw new ArgumentException("values[0] must be a ResourceKey and values[1] must be a FrameworkElement!");
     }
 }
Beispiel #9
0
                /// <summary>
                ///  currencySpacing{
                ///      afterCurrency{
                ///          currencyMatch{"[:^S:]"}
                ///          insertBetween{" "}
                ///          surroundingMatch{"[:digit:]"}
                ///      }
                ///      beforeCurrency{
                ///          currencyMatch{"[:^S:]"}
                ///          insertBetween{" "}
                ///          surroundingMatch{"[:digit:]"}
                ///      }
                ///  }
                /// </summary>
                internal void ConsumeCurrencySpacingTable(ResourceKey key, ResourceValue value)
                {
                    Debug.Assert(spacingInfo != null);
                    IResourceTable spacingTypesTable = value.GetTable();

                    for (int i = 0; spacingTypesTable.GetKeyAndValue(i, key, value); ++i)
                    {
                        CurrencySpacingInfo.SpacingType type;
                        if (key.ContentEquals("beforeCurrency"))
                        {
                            type = CurrencySpacingInfo.SpacingType.Before;
                            spacingInfo.HasBeforeCurrency = true;
                        }
                        else if (key.ContentEquals("afterCurrency"))
                        {
                            type = CurrencySpacingInfo.SpacingType.After;
                            spacingInfo.HasAfterCurrency = true;
                        }
                        else
                        {
                            continue;
                        }

                        IResourceTable patternsTable = value.GetTable();
                        for (int j = 0; patternsTable.GetKeyAndValue(j, key, value); ++j)
                        {
                            CurrencySpacingInfo.SpacingPattern pattern;
                            if (key.ContentEquals("currencyMatch"))
                            {
                                pattern = CurrencySpacingInfo.SpacingPattern.CurrencyMatch;
                            }
                            else if (key.ContentEquals("surroundingMatch"))
                            {
                                pattern = CurrencySpacingInfo.SpacingPattern.SurroundingMatch;
                            }
                            else if (key.ContentEquals("insertBetween"))
                            {
                                pattern = CurrencySpacingInfo.SpacingPattern.InsertBetween;
                            }
                            else
                            {
                                continue;
                            }

                            spacingInfo.SetSymbolIfNull(type, pattern, value.GetString());
                        }
                    }
                }
        public async Task <ReindexSingleResourceResponse> Handle(ReindexSingleResourceRequest request, CancellationToken cancellationToken)
        {
            EnsureArg.IsNotNull(request, nameof(request));

            if (await _authorizationService.CheckAccess(DataActions.Reindex, cancellationToken) != DataActions.Reindex)
            {
                throw new UnauthorizedFhirActionException();
            }

            var             key            = new ResourceKey(request.ResourceType, request.ResourceId);
            ResourceWrapper storedResource = await _fhirDataStore.GetAsync(key, cancellationToken);

            if (storedResource == null)
            {
                throw new ResourceNotFoundException(string.Format(Core.Resources.ResourceNotFoundById, request.ResourceType, request.ResourceId));
            }

            await _searchParameterOperations.GetAndApplySearchParameterUpdates(cancellationToken);

            // We need to extract the "new" search indices since the assumption is that
            // a new search parameter has been added to the fhir server.
            ResourceElement resourceElement = _resourceDeserializer.Deserialize(storedResource);
            IReadOnlyCollection <SearchIndexEntry> newIndices = _searchIndexer.Extract(resourceElement);

            // If it's a post request we need to go update the resource in the database.
            if (request.HttpMethod == HttpPostName)
            {
                await ProcessPostReindexSingleResourceRequest(storedResource, newIndices);
            }

            // Create a new parameter resource and include the new search indices and the corresponding values.
            var parametersResource = new Parameters
            {
                Id        = Guid.NewGuid().ToString(),
                VersionId = "1",
                Parameter = new List <Parameters.ParameterComponent>(),
            };

            foreach (SearchIndexEntry searchIndex in newIndices)
            {
                parametersResource.Parameter.Add(new Parameters.ParameterComponent()
                {
                    Name = searchIndex.SearchParameter.Code.ToString(), Value = new FhirString(searchIndex.Value.ToString())
                });
            }

            return(new ReindexSingleResourceResponse(parametersResource.ToResourceElement()));
        }
Beispiel #11
0
        private void writeLocalResource(Database db, string keyName)
        {
            if (String.IsNullOrEmpty(keyName))
            {
                return;
            }
            //if (!validateKey(keyName)) return;

            if (Helpers.localFiles.ContainsKey(keyName))
            {
                ResourceKey key    = new ResourceKey(keyName);
                Stream      newDDS = File.Open((string)Helpers.localFiles[keyName], FileMode.Open, FileAccess.Read, FileShare.Read);
                db.SetResourceStream(key, newDDS);
                newDDS.Close();
            }
        }
Beispiel #12
0
        //public static Pattern DiscoverPatternStartUp()
        //{
        //    ResourceKey getPattern = new ResourceKey();
        //    PatternInfo mPatternInfoInit = new PatternInfo();
        //    List<ResourceKey> checkIfAdded = new List<ResourceKey>();

        //    do
        //    {
        //        getPattern = RandomUtil.GetRandomObjectFromList(ObjectLoader.EasySewablesList);
        //        if (!checkIfAdded.Contains(getPattern))
        //        {
        //            checkIfAdded.Add(getPattern);
        //            break;
        //        }
        //    }
        //    while (true);

        //    if (mStoredPatternsKeySettingsList.Contains(getPattern))
        //    {
        //        try
        //        {
        //            for (int i = 0; i < ObjectLoader.sewableSettings.Count; i++)
        //            {
        //                mPatternInfoInit.resKeyPattern = getPattern;
        //                // Move on if the reskey is invalid.
        //                if (mPatternInfoInit.resKeyPattern == ResourceKey.kInvalidResourceKey)
        //                {
        //                    continue;
        //                }

        //                mPatternInfoInit.fabricsNeeded = ObjectLoader.sewableSettings[i].typeFabric;
        //                mPatternInfoInit.IsMagic = ObjectLoader.sewableSettings[i].isMagicProject;
        //                mPatternInfoInit.amountOfFabricToRemove = ObjectLoader.sewableSettings[i].amountRemoveFabric;
        //                mPatternInfoInit.mSkilllevel = 0;
        //                mPatternInfoInit.isClothing = ObjectLoader.sewableSettings[i].isClothing;
        //                mPatternInfoInit.mClothingName = ObjectLoader.sewableSettings[i].clothingName;
        //                mPatternInfoInit.mWasPatternGifted = false;

        //                if (mPatternInfoInit.isClothing)
        //                {
        //                    mPatternInfoInit.mSimOutfit = new CASPart(mPatternInfoInit.resKeyPattern);
        //                }

        //                // Pattern OBJD key.
        //                ResourceKey reskey1 = new ResourceKey(0x19D4F5930F26B2D8, 0x319E4F1D, 0x00000000);
        //                Pattern.PatternObjectInitParams initData = new Pattern.PatternObjectInitParams(mPatternInfoInit.fabricsNeeded, mPatternInfoInit.IsMagic, mPatternInfoInit.amountOfFabricToRemove, mPatternInfoInit.mSkilllevel, mPatternInfoInit.resKeyPattern, mPatternInfoInit.isClothing, mPatternInfoInit.mSimOutfit, mPatternInfoInit.mClothingName, mPatternInfoInit.mWasPatternGifted);
        //                Pattern pattern = (Pattern)GlobalFunctions.CreateObjectOutOfWorld(reskey1, null, initData);

        //                if (pattern.GetType() == typeof(FailureObject))
        //                {
        //                    return null;
        //                }
        //                // We always pick a random EASY EA resource (and creator stuff) but clothing will always have a hardness level of medium. So we don't need the clothing check!!
        //                if (pattern != null)
        //                {
        //                    IGameObject getname = (GameObject)GlobalFunctions.CreateObjectOutOfWorld(mPatternInfoInit.resKeyPattern, null, initData);
        //                    if (getname != null)
        //                    {
        //                        // Currently uses the pattern object's name. We need to concatinate the sewable's name here as well. Since EA never made a function to get the name direction from the resource key, we need to do this.
        //                        mPatternInfoInit.Name = pattern.GetLocalizedName() + ": " + getname.GetLocalizedName();
        //                        pattern.NameComponent.SetName(pattern.GetLocalizedName() + ": " + getname.GetLocalizedName());
        //                        // Now we finally got the name and can destroy the object.
        //                        getname.Destroy();
        //                    }
        //                    // Currently uses the pattern object's name. We need to concatinate the sewable's name here as well. Since EA never made a function to get the name direction from the resource key, we need to do this.
        //                    mPatternInfoInit.Name = pattern.GetLocalizedName() + ": " + getname.GetLocalizedName();
        //                    pattern.NameComponent.SetName(pattern.GetLocalizedName() + ": " + getname.GetLocalizedName());
        //                    return pattern;
        //                }
        //                else if (pattern != null && mPatternInfoInit.isClothing)
        //                {
        //                    mPatternInfoInit.Name = mPatternInfoInit.mClothingName;
        //                    pattern.NameComponent.SetName(mPatternInfoInit.Name);

        //                    pattern.mPatternInfo = mPatternInfoInit;
        //                    return pattern;
        //                }
        //                else
        //                {
        //                    GlobalOptionsSewingTable.print("Lyralei's Sewing table: \n \n The pattern doesn't exist! Did you delete things from the sewing table .package? Else, contact Lyralei.");
        //                    return null;
        //                }
        //            }
        //        }
        //        catch (Exception ex2)
        //        {
        //            GlobalOptionsSewingTable.print("Lyralei's Sewing table: \n \n REPORT THIS TO LYRALEI: " + ex2.ToString());
        //            return null;
        //        }
        //    }
        //    return null;
        //}

        public static ResourceKey GetUnregisteredpattern(Sim actor, bool NeedsToCache)
        {
            ResourceKey    getPattern = new ResourceKey();
            SimDescription actorDesc  = actor.SimDescription;

            // Checks whether the current actor already knows the pattern chosen.
            do
            {
                getPattern = GetRandomKeyWithSKills(actor);

                if (!SewingSkill.HasAlreadyDiscoveredThis(actorDesc.mSimDescriptionId, getPattern))
                {
                    return(getPattern);
                }
            }while (true);
        }
Beispiel #13
0
 public void AddBuffs(ResourceKey[] resourceKeys)
 {
     try {
         /* Process the XML file inside the .package file */
         /* First is the FNV64 hash of file in the .package, second is the type (_XML), and third the group. */
         /* Customize first, leave second and third as they are. */
         ResourceKey key       = new ResourceKey(ResourceUtils.HashString64("Template.TplBuff.Buffs"), 0x0333406C, 0x0);
         XmlDbData   xmlDbData = XmlDbData.ReadData(key, false);
         if (xmlDbData != null)
         {
             BuffManager.ParseBuffData(xmlDbData, true);
         }
     } catch {
         /* You can use Logger to report failure */
     }
 }
        public async Task HardDeleteAsync(ResourceKey key, CancellationToken cancellationToken)
        {
            await _model.EnsureInitialized();

            using (var connection = new SqlConnection(_configuration.ConnectionString))
            {
                await connection.OpenAsync(cancellationToken);

                using (var command = connection.CreateCommand())
                {
                    V1.HardDeleteResource.PopulateCommand(command, resourceTypeId: _model.GetResourceTypeId(key.ResourceType), resourceId: key.Id);

                    await command.ExecuteNonQueryAsync(cancellationToken);
                }
            }
        }
Beispiel #15
0
        public Dictionary <teResourceGUID, ResourceKey> GetKeys()
        {
            Dictionary <teResourceGUID, ResourceKey> @return = new Dictionary <teResourceGUID, ResourceKey>();

            foreach (teResourceGUID key in TrackedFiles[0x90])
            {
                STUResourceKey resourceKey = GetInstance <STUResourceKey>(key);
                if (resourceKey == null)
                {
                    continue;
                }
                @return[key] = new ResourceKey(resourceKey);
            }

            return(@return);
        }
Beispiel #16
0
        static MainWindow()
        {
            // Use reflection and LINQ query to determine all of the Brush-related ResourceKeys in SystemColors.
            IEnumerable <PropertyInfo> colorProperties =
                from p in typeof(SystemColors).GetProperties()
                where p.PropertyType == typeof(ResourceKey) &&
                p.Name.Contains("BrushKey")
                select p;

            // Add these keys to our ObservableCollection so we can bind to them.
            foreach (PropertyInfo p in colorProperties)
            {
                ResourceKey k = p.GetValue(null, null) as ResourceKey;
                SystemColorBrushKeys.Add(k);
            }
        }
        public async Task <IResource> UpdateObservation(ResourceKey original, IResource update)
        {
            try
            {
                var visiBloodPressure = _resourceMapper.MapViSiBloodPressure(update);

                var result = _visiContext.BloodPressure.Update(visiBloodPressure);
                await _visiContext.SaveChangesAsync();

                return(_resourceMapper.MapBloodPressure(result.Entity));
            }
            catch (Exception ex)
            {
                throw new VonkRepositoryException($"Error on update of {original} to {update.Key()}", ex);
            }
        }
Beispiel #18
0
 // Token: 0x06000D48 RID: 3400 RVA: 0x00014F68 File Offset: 0x00013F68
 public ThumbnailKey(ResourceKey objectDescKey, uint bodyType, uint ageGender, ThumbnailSize size)
 {
     this.mDescKey                = objectDescKey;
     this.mTemplateObjectId       = default(ObjectGuid);
     this.mIndex                  = -1;
     this.mSize                   = size;
     this.mCamera                 = ThumbnailCamera.Default;
     this.mBodyType               = bodyType;
     this.mAgeGender              = ageGender;
     this.mLiveUpdate             = false;
     this.mTechnique              = ThumbnailTechnique.Default;
     this.mMaterialState          = 0u;
     this.mGeometryState          = 3787619543u;
     this.mDoNotCache             = false;
     this.mAdditionalSizesToCache = ThumbnailSizeMask.None;
 }
            public async Task Get_Computers_With_Hal_Should_Have_Valid_Links()
            {
                var response = await _httpClient.GetAsync(ResourceKey);

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);

                var result = JsonConvert.DeserializeObject <LinkedCollectionResourceWrapperDto <ComputerDto> >(await response.Content.ReadAsStringAsync());

                result.Value.Should().NotBeNullOrEmpty();

                var self = result.Links.FirstOrDefault(x => x.Rel == "self");

                Assert.NotNull(self);
                Assert.Equal(HttpMethod.Get.ToString(), self.Method, ignoreCase: true);
                Assert.Equal(_httpClient.BaseAddress + ResourceKey.Substring(1), self.Href);
            }
Beispiel #20
0
        public static void LoadBuffXMLandParse(ResourceKey[] resourceKeys)
        {
            ResourceKey key       = new ResourceKey(1655640191445312029ul, 53690476u, 0u);
            XmlDbData   xmlDbData = XmlDbData.ReadData(key, false);
            bool        flag      = xmlDbData != null;

            if (flag)
            {
                BuffManager.ParseBuffData(xmlDbData, true);
            }
            if (!once)
            {
                once = true;
                UIManager.NewHotInstallStoreBuffData += LoadBuffXMLandParse;
            }
        }
Beispiel #21
0
            // Methods
            public override ThumbnailKey GetIconKey()
            {
                ResourceKey key = base.Target.GetResourceKey();

                foreach (Slot slot in base.Target.GetContainmentSlots())
                {
                    HotBeverageMachine.Cup cup = base.Target.GetContainedObject(slot) as HotBeverageMachine.Cup;
                    if (cup != null)
                    {
                        key = cup.GetResourceKey();
                        break;
                    }
                }

                return(new ThumbnailKey(key, ThumbnailSize.Medium));
            }
Beispiel #22
0
        public static SimDescription DGSMakeSSimDescription(CASAgeGenderFlags age, CASAgeGenderFlags gender, WorldName homeWorld, uint outfitCategoriesToBuild)
        {
            Color[] hairColors;
            if (age == CASAgeGenderFlags.Elder)
            {
                hairColors = Genetics.GetRandomElderHairColor();
            }
            else
            {
                hairColors = Genetics.GetGeneticHairColor(homeWorld);
            }
            float       skinToneIndex = 0f;
            ResourceKey skinTone      = Genetics.RandomSkin(false, homeWorld, ref skinToneIndex);

            return(DGSMakeSSimDescription(null, age, gender, skinTone, skinToneIndex, hairColors, homeWorld, outfitCategoriesToBuild, false));
        }
Beispiel #23
0
 public static void OnWorldLoadFinishedHandler()
 {
     VTBiteMaskPart        = ResourceKey.Parse(makeupTypeID + "-" + makeupGroupID + "-" + makeupInstanceID);
     sBiteMarkBuffListener = EventTracker.AddListener(EventTypeId.kGotBuff, new ProcessEventDelegate(VTBiteMark.OnGotBuff));
     {
         PartSearch search = new PartSearch();
         foreach (CASPart part in search)
         {
             if (part.Key == VTBiteMaskPart)
             {
                 biteMask = part;
             }
         }
         search.Reset();
     }
 }
Beispiel #24
0
            public override void PopulatePieMenuPicker(ref InteractionInstanceParameters parameters, out List <ObjectPicker.TabInfo> listObjs, out List <ObjectPicker.HeaderInfo> headers, out int NumSelectableRows)
            {
                NumSelectableRows = 0x1;
                headers           = new List <ObjectPicker.HeaderInfo>();
                listObjs          = new List <ObjectPicker.TabInfo>();
                headers.Add(new ObjectPicker.HeaderInfo("Ui/Caption/ObjectPicker:Title", "Ui/Tooltip/ObjectPicker:Name", 0xfa));

                Sim actor = parameters.Actor as Sim;

                List <ObjectPicker.RowInfo> rowInfo = new List <ObjectPicker.RowInfo>();
                GreyedOutTooltipCallback    greyedOutTooltipCallback = null;

                foreach (Book book in TabletEx.GetBooksInTown(parameters.Actor as Sim, false, true, parameters.Autonomous))
                //foreach (Book book in Tablet.GetBooksOnMyLot(parameters.Actor as Sim, false, true))
                {
                    // Custom
                    ReadBookData bookData;
                    if (actor.ReadBookDataList.TryGetValue(book.Data.ID, out bookData))
                    {
                        if (bookData.TimesRead > 0)
                        {
                            continue;
                        }
                    }

                    if (!(book is SheetMusic) && book.TestReadBook(parameters.Actor as Sim, parameters.Autonomous, ref greyedOutTooltipCallback))
                    {
                        List <ObjectPicker.ColumnInfo> columnInfo = new List <ObjectPicker.ColumnInfo>();
                        ResourceKey        objectDescKey          = new ResourceKey((ulong)ResourceUtils.XorFoldHashString32("book_standard"), 0x1661233, 0x1);
                        ThumbnailKey       thumbnail = new ThumbnailKey(objectDescKey, ThumbnailSize.Medium, ResourceUtils.HashString32(book.Data.GeometryState), ResourceUtils.HashString32(book.Data.MaterialState));
                        MedicalJournalData data      = book.Data as MedicalJournalData;
                        if (data != null)
                        {
                            columnInfo.Add(new ObjectPicker.ThumbAndTextColumn(thumbnail, data.GetTitle((book as MedicalJournal).mOwner, data.CurrentEdition)));
                        }
                        else
                        {
                            columnInfo.Add(new ObjectPicker.ThumbAndTextColumn(thumbnail, book.Data.Title));
                        }
                        ObjectPicker.RowInfo info = new ObjectPicker.RowInfo(book, columnInfo);
                        rowInfo.Add(info);
                    }
                }

                ObjectPicker.TabInfo item = new ObjectPicker.TabInfo("Coupon", Localization.LocalizeString("Ui/Caption/ObjectPicker:Books", new object[0x0]), rowInfo);
                listObjs.Add(item);
            }
Beispiel #25
0
        /// <summary>
        /// Selects the style for item based on the <see cref="IExposeStyleKeys"/> resource key
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="item">The item.</param>
        /// <param name="styleKeySource">The style key.</param>
        public static void SelectStyleForItem(FrameworkElement element, object item, IExposeStyleKeys styleKeySource)
        {
            var control = element as Control;
            var context = control?.DataContext as CommandBarDefinitionBase;

            if (context == null)
            {
                return;
            }
            ResourceKey key = null;

            if (context.CommandDefinition == null)
            {
                key = styleKeySource.MenuStyleKey;
                element.SetResourceReference(FrameworkElement.StyleProperty, key);
                return;
            }

            switch (context.CommandDefinition.ControlType)
            {
            case CommandControlTypes.Separator:
                key = styleKeySource.SeparatorStyleKey;
                break;

            case CommandControlTypes.Button:
            case CommandControlTypes.SplitDropDown:
                key = styleKeySource.ButtonStyleKey;
                break;

            case CommandControlTypes.Combobox:
                key = styleKeySource.ComboBoxStyleKey;
                break;

            case CommandControlTypes.Menu:
                key = styleKeySource.MenuStyleKey;
                break;

            case CommandControlTypes.MenuToolbar:
                key = styleKeySource.MenuControllerStyleKey;
                break;
            }
            if (key == null)
            {
                return;
            }
            element.SetResourceReference(FrameworkElement.StyleProperty, key);
        }
Beispiel #26
0
            private static bool OnPerform(StackTrace trace, StackFrame frame)
            {
                if (sSemaphore)
                {
                    return(true);
                }

                try
                {
                    sSemaphore = true;

                    //if (CASDresserSheet.gSingleton != null) return true;

                    CASDresserClothing dresser = CASDresserClothing.gSingleton;
                    if (dresser != null)
                    {
                        dresser.mDefaultText.Visible = false;
                    }

                    CASClothingCategory ths = CASClothingCategory.gSingleton;
                    if (ths == null)
                    {
                        return(true);
                    }

                    if (ths.mCategoryText.Caption.Equals(ths.GetClothingStateName(CASClothingState.Career)) && (Responder.Instance.CASModel.OutfitIndex == 0x0))
                    {
                        ths.mCurrentPreset       = null;
                        ths.mCurrentFocusedRow   = null;
                        ths.mTempFocusedRow      = null;
                        ths.mSelectedType        = CASClothingRow.SelectedTypes.None;
                        ths.mShareButton.Enabled = false;
                        ths.mTrashButton.Enabled = false;
                        ths.mSaveButton.Enabled  = false;
                        ths.mSortButton.Enabled  = false;
                        ths.mSortButton.Tag      = false;
                        ResourceKey layoutKey = ResourceKey.CreateUILayoutKey("CASClothingRow", 0x0);
                        ths.mClothingTypesGrid.BeginPopulating(ths.AddGridItem, ths.mPartsList, 0x3, layoutKey, null);
                    }

                    return(true);
                }
                finally
                {
                    sSemaphore = false;
                }
            }
Beispiel #27
0
        public static Pattern GetRandomClothingPattern(Sim sim)
        {
            ResourceKey reskeyPattern;
            SewingSkill sewingSkill = sim.SkillManager.AddElement(SewingSkill.kSewingSkillGUID) as SewingSkill;

            do
            {
                reskeyPattern = RandomUtil.GetRandomObjectFromList(ObjectLoader.mStoredClothingPattern);

                if (!SewingSkill.HasAlreadyDiscoveredThis(sim.mSimDescription.mSimDescriptionId, reskeyPattern))
                {
                    break;
                }
            }while (true);

            if (reskeyPattern != ResourceKey.kInvalidResourceKey)
            {
                PatternInfo mPatternInfoInit = new PatternInfo();
                mPatternInfoInit.resKeyPattern = reskeyPattern;
                ObjectLoader.sewableSetting sSetting = ObjectLoader.dictSettings[reskeyPattern];
                mPatternInfoInit.fabricsNeeded          = sSetting.typeFabric;
                mPatternInfoInit.IsMagic                = sSetting.isMagicProject;
                mPatternInfoInit.amountOfFabricToRemove = sSetting.amountRemoveFabric;
                mPatternInfoInit.isClothing             = sSetting.isClothing;
                mPatternInfoInit.mClothingName          = sSetting.clothingName;
                mPatternInfoInit.mWasPatternGifted      = false;

                if (mPatternInfoInit.isClothing)
                {
                    mPatternInfoInit.mSimOutfit = new CASPart(mPatternInfoInit.resKeyPattern);
                }

                ResourceKey reskey1 = new ResourceKey(0x19D4F5930F26B2D8, 0x319E4F1D, 0x00000000);
                Pattern.PatternObjectInitParams initData = new Pattern.PatternObjectInitParams(mPatternInfoInit.fabricsNeeded, mPatternInfoInit.IsMagic, mPatternInfoInit.amountOfFabricToRemove, mPatternInfoInit.mSkilllevel, mPatternInfoInit.resKeyPattern, mPatternInfoInit.isClothing, mPatternInfoInit.mSimOutfit, mPatternInfoInit.mClothingName, mPatternInfoInit.mWasPatternGifted);
                Pattern pattern = (Pattern)GlobalFunctions.CreateObjectOutOfWorld(reskey1, null, initData);

                mPatternInfoInit.Name = mPatternInfoInit.mClothingName;
                pattern.NameComponent.SetName(mPatternInfoInit.mClothingName);

                pattern.mPatternInfo = mPatternInfoInit;
                sim.Inventory.TryToAdd(pattern);
                sewingSkill.AddPatternCount(1);

                return(pattern);
            }
            return(null);
        }
Beispiel #28
0
        public async Task GivenUpdatedResources_WhenBulkUpdatingSearchParameterIndicesAsync_ThenResourceMetadataIsUnchanged()
        {
            ResourceElement patientResource1 = CreatePatientResourceElement("Patient1", Guid.NewGuid().ToString());
            SaveOutcome     upsertResult1    = await Mediator.UpsertResourceAsync(patientResource1);

            ResourceElement patientResource2 = CreatePatientResourceElement("Patient2", Guid.NewGuid().ToString());
            SaveOutcome     upsertResult2    = await Mediator.UpsertResourceAsync(patientResource2);

            SearchParameter searchParam     = null;
            const string    searchParamName = "newSearchParam";

            try
            {
                searchParam = await CreatePatientSearchParam(searchParamName, SearchParamType.String, "Patient.name");

                ISearchValue searchValue = new StringSearchValue(searchParamName);

                (ResourceWrapper original1, ResourceWrapper updated1) = await CreateUpdatedWrapperFromExistingPatient(upsertResult1, searchParam, searchValue);

                (ResourceWrapper original2, ResourceWrapper updated2) = await CreateUpdatedWrapperFromExistingPatient(upsertResult2, searchParam, searchValue);

                var resources = new List <ResourceWrapper> {
                    updated1, updated2
                };

                await _dataStore.BulkUpdateSearchParameterIndicesAsync(resources, CancellationToken.None);

                // Get the reindexed resources from the database
                var             resourceKey1 = new ResourceKey(upsertResult1.RawResourceElement.InstanceType, upsertResult1.RawResourceElement.Id, upsertResult1.RawResourceElement.VersionId);
                ResourceWrapper reindexed1   = await _dataStore.GetAsync(resourceKey1, CancellationToken.None);

                var             resourceKey2 = new ResourceKey(upsertResult2.RawResourceElement.InstanceType, upsertResult2.RawResourceElement.Id, upsertResult2.RawResourceElement.VersionId);
                ResourceWrapper reindexed2   = await _dataStore.GetAsync(resourceKey2, CancellationToken.None);

                VerifyReindexedResource(original1, reindexed1);
                VerifyReindexedResource(original2, reindexed2);
            }
            finally
            {
                if (searchParam != null)
                {
                    _searchParameterDefinitionManager.DeleteSearchParameter(searchParam.ToTypedElement());
                    await _fixture.TestHelper.DeleteSearchParameterStatusAsync(searchParam.Url, CancellationToken.None);
                }
            }
        }
Beispiel #29
0
        public void AddBuffs(ResourceKey[] keys)
        {
            try
            {
                ResourceKey key  = new ResourceKey(ResourceUtils.HashString64("Duglarogg.Abductor.Buffs"), 0x0333406C, 0u);
                XmlDbData   data = XmlDbData.ReadData(key, false);

                if (data != null)
                {
                    BuffManager.ParseBuffData(data, true);
                }
            }
            catch (Exception e)
            {
                Logger.WriteExceptionLog(e, this, "Duglarogg.AbductorSpace.Booters.BuffBooter.AddBuffs Error");
            }
        }
        public object Convert(object[] values, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values.Length >= 2 &&
                values[0] is ResourceKey &&
                values[1] is FrameworkElement &&
                parameter is ColorToStringConversionMode)
            {
                ResourceKey      key      = (ResourceKey)values[0];
                FrameworkElement fe       = (FrameworkElement)values[1];
                object           resource = fe.FindResource(key);
                var converterMode         = (ColorToStringConversionMode)parameter;

                if (resource is SolidColorBrush)
                {
                    SolidColorBrush brush = (SolidColorBrush)resource;
                    Color           color = brush.Color;

                    switch (converterMode)
                    {
                    case ColorToStringConversionMode.Hex:
                        return(color.ToString());

                    case ColorToStringConversionMode.RGB:
                        return("" + color.R + ", " + color.G + ", " + color.B +
                               (color.A == (byte)255 ? "" : " (A=" + color.A + ")"));

                    default:
                        Debug.Fail("Invalid SolidColorBrushKeyToStringConverterMode value.",
                                   "Supported values are SolidColorBrushKeyToStringConverterMode.Hex and SolidColorBrushKeyToStringConverterMode.RGB");
                        return(null);       // should never hit this.
                    }
                }
                else
                {
                    Debug.Fail("Found matching resource but it is not of type SolidColorBrush", "Found resource with key " +
                               key + " on FrameworkElement " + fe + ", but it is not of type SolidColorBrush.  This converter only works when the " +
                               "supplied key indicates a SolidColorBrush resource");
                    return(null);
                }
            }
            else
            {
                throw new ArgumentException("values[0] must be a ResourceKey and values[1] must be a FrameworkElement, " +
                                            "and parameter must be a SolidColorBrushKeyToStringConverterMode.");
            }
        }
Beispiel #31
0
        public Optional <T> Get <T>(ResourceKey key)
        {
            //GemfruitMod.Logger.Log(LogLevel.DEBUG, "ResourceRegistry", $"Trying to fetch {key}");
            if (!_dictionary.ContainsKey(key))
            {
                //GemfruitMod.Logger.Log(LogLevel.DEBUG, "ResourceRegistry", "Key not found");
                return(Optional <T> .None());
            }

            if (!(_dictionary[key] is T))
            {
                throw new Exception($"bad type '{typeof(T)}' for asset '{key}'");
            }

            //GemfruitMod.Logger.Log(LogLevel.DEBUG, "ResourceRegistry", "Key found!!");
            return(new Optional <T>((T)_dictionary[key]));
        }
Beispiel #32
0
 public static void OnWorldLoadFinishedHandler()
 {
     VTThirstMaskPart    = ResourceKey.Parse(kMaskTypeID + "-" + kMaskGroupID + "-" + kMaskInstanceID);
     sThirstBuffListener = EventTracker.AddListener(EventTypeId.kGotBuff, new ProcessEventDelegate(VTThirst.OnGotBuff));
     AlarmManager.Global.AddAlarm(40f, TimeUnit.Seconds, new AlarmTimerCallback(VTThirst.AddChildrenEyes), "Add Children Eyes Procces", AlarmType.NeverPersisted, null);
     {
         PartSearch search = new PartSearch();
         foreach (CASPart part in search)
         {
             if (part.Key == VTThirstMaskPart)
             {
                 ThirstMask = part;
             }
         }
         search.Reset();
     }
 }
		static void InitEmbeddedResourcesUrls (Assembly assembly, Hashtable hashtable)
		{
			WebResourceAttribute [] attrs = (WebResourceAttribute []) assembly.GetCustomAttributes (typeof (WebResourceAttribute), false);
			for (int i = 0; i < attrs.Length; i++) {
				string resourceName = attrs [i].WebResource;
				if (resourceName != null && resourceName.Length > 0) {
#if SYSTEM_WEB_EXTENSIONS
					ResourceKey rkNoNotify = new ResourceKey (resourceName, false);
					ResourceKey rkNotify = new ResourceKey (resourceName, true);

					if (!hashtable.Contains (rkNoNotify))
						hashtable.Add (rkNoNotify, CreateResourceUrl (assembly, resourceName, false));
					if (!hashtable.Contains (rkNotify))
						hashtable.Add (rkNotify, CreateResourceUrl (assembly, resourceName, true));
#else
					if (!hashtable.Contains (resourceName))
						hashtable.Add (resourceName, CreateResourceUrl (assembly, resourceName, false));
#endif
				}
			}
		}
		void RemoveDuplicateEmbeddedResources() {
			var resources = new Dictionary<ResourceKey, List<EmbeddedResource>>();
			foreach (var tmp in module.Resources) {
				var rsrc = tmp as EmbeddedResource;
				if (rsrc == null)
					continue;
				if (rsrc.Offset == null)
					continue;
				List<EmbeddedResource> list;
				var key = new ResourceKey(rsrc);
				if (!resources.TryGetValue(key, out list))
					resources[key] = list = new List<EmbeddedResource>();
				list.Add(rsrc);
			}

			foreach (var list in resources.Values) {
				if (list.Count <= 1)
					continue;

				EmbeddedResource resourceToKeep = null;
				foreach (var rsrc in list) {
					if (UTF8String.IsNullOrEmpty(rsrc.Name))
						continue;

					resourceToKeep = rsrc;
					break;
				}
				if (resourceToKeep == null)
					continue;

				foreach (var rsrc in list) {
					if (rsrc == resourceToKeep)
						continue;
					AddResourceToBeRemoved(rsrc, string.Format("Duplicate of resource {0}", Utils.ToCsharpString(resourceToKeep.Name)));
				}
			}
		}
Beispiel #35
0
        // From SimDescription.Instantiate
        private static Sim Perform(SimDescription ths, Vector3 position, ResourceKey outfitKey, bool forceAlwaysAnimate, OnReset reset)
        {
            Household.HouseholdSimsChangedCallback changedCallback = null;
            Household changedHousehold = null;

            bool isChangingWorlds = GameStates.sIsChangingWorlds;

            bool isLifeEventManagerEnabled = LifeEventManager.sIsLifeEventManagerEnabled;

            Corrections.RemoveFreeStuffAlarm(ths);

            using (SafeStore store = new SafeStore(ths, SafeStore.Flag.LoadFixup | SafeStore.Flag.Selectable | SafeStore.Flag.Unselectable))
            {
                try
                {
                    // Stops the memories system from interfering
                    LifeEventManager.sIsLifeEventManagerEnabled = false;

                    // Stops UpdateInformationKnownAboutRelationships()
                    GameStates.sIsChangingWorlds = true;

                    if (ths.Household != null)
                    {
                        changedCallback = ths.Household.HouseholdSimsChanged;
                        changedHousehold = ths.Household;

                        ths.Household.HouseholdSimsChanged = null;
                    }

                    if (ths.CreatedSim != null)
                    {
                        AttemptToPutInSafeLocation(ths.CreatedSim, false);

                        if (reset != null)
                        {
                            ths.CreatedSim.SetObjectToReset();

                            reset(ths.CreatedSim, false);
                        }

                        return ths.CreatedSim;
                    }

                    if (ths.AgingState != null)
                    {
                        bool flag = outfitKey == ths.mDefaultOutfitKey;

                        ths.AgingState.SimBuilderTaskDeferred = false;

                        ths.AgingState.PreInstantiateSim(ref outfitKey);
                        if (flag)
                        {
                            ths.mDefaultOutfitKey = outfitKey;
                        }
                    }

                    int capacity = forceAlwaysAnimate ? 0x4 : 0x2;
                    Hashtable overrides = new Hashtable(capacity);
                    overrides["simOutfitKey"] = outfitKey;
                    overrides["rigKey"] = CASUtils.GetRigKeyForAgeGenderSpecies((ths.Age | ths.Gender) | ths.Species);
                    if (forceAlwaysAnimate)
                    {
                        overrides["enableSimPoseProcessing"] = 0x1;
                        overrides["animationRunsInRealtime"] = 0x1;
                    }

                    string instanceName = "GameSim";
                    ProductVersion version = ProductVersion.BaseGame;
                    if (ths.Species != CASAgeGenderFlags.Human)
                    {
                        instanceName = "Game" + ths.Species;
                        version = ProductVersion.EP5;
                    }

                    SimInitParameters initData = new SimInitParameters(ths);
                    Sim target = GlobalFunctions.CreateObjectWithOverrides(instanceName, version, position, 0x0, Vector3.UnitZ, overrides, initData) as Sim;
                    if (target != null)
                    {
                        if (target.SimRoutingComponent == null)
                        {
                            // Performed to ensure that a useful error message is produced when the Sim construction fails
                            target.OnCreation();
                            target.OnStartup();
                        }

                        target.SimRoutingComponent.EnableDynamicFootprint();
                        target.SimRoutingComponent.ForceUpdateDynamicFootprint();

                        ths.PushAgingEnabledToAgingManager();

                        /* This code is idiotic
                        if ((ths.Teen) && (target.SkillManager != null))
                        {
                            Skill skill = target.SkillManager.AddElement(SkillNames.Homework);
                            while (skill.SkillLevel < SimDescription.kTeenHomeworkSkillStartLevel)
                            {
                                skill.ForceGainPointsForLevelUp();
                            }
                        }
                        */

                        // Custom
                        OccultTypeHelper.SetupForInstantiatedSim(ths.OccultManager);

                        if (ths.IsAlien)
                        {
                            World.ObjectSetVisualOverride(target.ObjectId, eVisualOverrideTypes.Alien, null);
                        }

                        AttemptToPutInSafeLocation(target, false);

                        EventTracker.SendEvent(EventTypeId.kSimInstantiated, null, target);

                        /*
                        MiniSimDescription description = MiniSimDescription.Find(ths.SimDescriptionId);
                        if ((description == null) || (!GameStates.IsTravelling && (ths.mHomeWorld == GameUtils.GetCurrentWorld())))
                        {
                            return target;
                        }
                        description.UpdateInWorldRelationships(ths);
                        */

                        if (ths.HealthManager != null)
                        {
                            ths.HealthManager.Startup();
                        }

                        if (((ths.SkinToneKey.InstanceId == 15475186560318337848L) && !ths.OccultManager.HasOccultType(OccultTypes.Vampire)) && (!ths.OccultManager.HasOccultType(OccultTypes.Werewolf) && !ths.IsGhost))
                        {
                            World.ObjectSetVisualOverride(ths.CreatedSim.ObjectId, eVisualOverrideTypes.Genie, null);
                        }

                        if (ths.Household.IsAlienHousehold)
                        {
                            (Sims3.UI.Responder.Instance.HudModel as HudModel).OnSimCurrentWorldChanged(true, ths);
                        }

                        if (Household.RoommateManager.IsNPCRoommate(ths.SimDescriptionId))
                        {
                            Household.RoommateManager.AddRoommateInteractions(target);
                        }
                    }

                    return target;
                }
                finally
                {
                    LifeEventManager.sIsLifeEventManagerEnabled = isLifeEventManagerEnabled;

                    GameStates.sIsChangingWorlds = isChangingWorlds;

                    if ((changedHousehold != null) && (changedCallback != null))
                    {
                        changedHousehold.HouseholdSimsChanged = changedCallback;

                        if (changedHousehold.HouseholdSimsChanged != null)
                        {
                            changedHousehold.HouseholdSimsChanged(Sims3.Gameplay.CAS.HouseholdEvent.kSimAdded, ths.CreatedSim, null);
                        }
                    }
                }
            }
        }        
        private bool isLocalFile(ResourceKey key)
        {
            /*
            Stream input = File.Open(this.currentFile.FullName);

            input.Seek(0, SeekOrigin.Begin);
            DatabasePackedFile dbpf = new DatabasePackedFile();
            try
            {
                dbpf.Read(input);
            }
            catch (Gibbed.Sims3.FileFormats.NotAPackageException)
            {
                MessageBox.Show("bad file: {0}");
                input.Close();
                return false;
            }

            for (int i = 0; i < dbpf.Entries.Count; i++)
            {
                DatabasePackedFile.Entry entry = dbpf.Entries[i];
                if (entry.Key.InstanceId == key.InstanceId && entry.Key.GroupId == key.GroupId && entry.Key.TypeId == key.TypeId)
                {
                    return true;
                }
            }
            input.Close();
            */
            return false;
        }
Beispiel #37
0
		// Creates an entity given its ID and its URI, and put it into
		// the cache argument if the argument is not null.
        private Entity MakeEntity(Int64 resourceId, string uri, Hashtable cache)
        {
			if (resourceId == 0)
				return null;
			if (resourceId == 1)
				return Statement.DefaultMeta;
			
			ResourceKey rk = new ResourceKey(resourceId);
			
			if (cache != null && cache.ContainsKey(rk))
				return (Entity)cache[rk];
			
			Entity ent;
			if (uri != null) {
				ent = new Entity(uri);
			} else {
				ent = new BNode();
			}
			
			SetResourceKey(ent, rk);
			
			if (cache != null)
				cache[rk] = ent;
				
			return ent;
		}
 public FormField(ResourceKey resourceKey, string fieldName, int rank)
 {
     this.ResourceKey = resourceKey;
     this.FieldName = fieldName;
     this.Rank = rank;
 }
Beispiel #39
0
 public SimOutfit GetSimOutfitFromSimDescriptionKey(ResourceKey key, OutfitCategories outfitCategory)
 {
     return mCASModel.GetSimOutfitFromSimDescriptionKey(key, outfitCategory);
 }
Beispiel #40
0
 public ISimDescription GetSimDescription(ResourceKey key, ref ResourceKeyContentCategory category)
 {
     return mCASModel.GetSimDescription(key, ref category);
 }
Beispiel #41
0
        public static bool OnPrepareObject(ObjectGuid templateId, ObjectGuid targetId, int index, uint uintVal1, uint uintVal2, ThumbnailSize size, uint prepareType, uint uintVal3)
        {
            try
            {
                switch (((PrepareType)prepareType))
                {
                    case PrepareType.kPrepareHousehold:
                        try
                        {
                            return ThumbnailHelper.PrepareHouseholdForThumbnail(templateId.Value);
                        }
                        catch (Exception e)
                        {
                            Common.DebugException("PrepareHouseholdForThumbnail", e);
                            return false;
                        }

                    case PrepareType.kPrepareSimWithoutTemplate:
                        {
                            ResourceKey outfitKey = new ResourceKey(targetId.Value, (uint)templateId.Value, uintVal1);
                            bool useCasSimBuilder = uintVal2 != 0x0;
                            int num = index;
                            int ghostIndex = -1;
                            if ((outfitKey.TypeId != 0xdea2951c) && ((index < 0x100) || (index > 0x300)))
                            {
                                if (num > -4)
                                {
                                    num = -1;
                                }
                                if ((index >= 6) && (index < 0x20))
                                {
                                    ghostIndex = index - 0x5;
                                }
                            }
                            return ThumbnailHelper.SetupForSimThumbnailUsingSimBuilder(outfitKey, num, ghostIndex, useCasSimBuilder, size);
                        }
                    case PrepareType.kPrepareLot:
                        return ThumbnailHelper.PrepareLotForThumbnail(templateId.Value);

                    case PrepareType.kPreparePromSims:
                        {
                            Sim sim = GameObject.GetObject(new ObjectGuid(templateId.Value)) as Sim;
                            if ((sim == null) || !sim.IsHorse)
                            {
                                // Custom
                                return PreparePromSimsForThumbnail(templateId.Value, targetId.Value);
                            }
                            return ThumbnailHelper.PrepareEquestrianRaceSimsForThumbnail(templateId.Value, targetId.Value);
                        }
                    case PrepareType.kPreparePhotoBoothSims:
                        return ThumbnailHelper.PreparePhotoBoothSimsForThumbnail(templateId.Value, targetId.Value);

                    case PrepareType.kPrepareSimsUsingObject:
                        return ThumbnailHelper.PrepareThumbnailForSimsUsingObject(templateId.Value);

                    case PrepareType.kPrepareSimsForSelfPhoto:
                        return ThumbnailHelper.PrepareSelfPhotoSimsForThumbnail(templateId.Value, targetId.Value);

                    case PrepareType.kPrepareSculptureSim:
                        return ThumbnailHelper.PrepareSculptureSimForThumbnail(targetId.Value);

                    case PrepareType.kPrepareSimsForServoBotArenaPic:
                        return ThumbnailHelper.PrepareServoBotArenaSimsForThumbnail(templateId.Value);
                }

                if ((((templateId.Value == 0x34aeecbL) || (templateId.Value == 0x358b08aL)) || ((templateId.Value == 0x93d84841L) || (templateId.Value == 0x51df2ddL))) || ((templateId.Value == 0x72683c15L) || (templateId.Value == 0x3555ba8L)))
                {
                    CASAgeGenderFlags ageGender = (CASAgeGenderFlags)uintVal1;
                    bool flag2 = uintVal2 != 0x0;
                    ResourceKey partKey = new ResourceKey(targetId.Value, (uint)templateId.Value, uintVal3);
                    if (flag2)
                    {
                        return ThumbnailHelper.SetupForCASThumbnailUsingCASSimbuilder(partKey, index, ageGender, size);
                    }
                    return ThumbnailHelper.SetupForCASThumbnailUsingSeparateSimbuilder(partKey, index, ageGender, size);
                }

                IScriptProxy proxyPreInit = Simulator.GetProxyPreInit(templateId);
                if (proxyPreInit != null)
                {
                    object target = proxyPreInit.Target;
                    if (target == null)
                    {
                        return false;
                    }
                    Sim sim2 = target as Sim;
                    if (sim2 != null)
                    {
                        if ((index >= 6) && (index < 0x20))
                        {
                            if (!sim2.SimDescription.IsEP11Bot)
                            {
                                uint deathTypeFromMoodID = (uint)SimDescription.GetDeathTypeFromMoodID((MoodID)index);
                                World.ObjectSetGhostState(targetId, deathTypeFromMoodID, (uint)sim2.SimDescription.AgeGenderSpecies);
                            }
                            else
                            {
                                World.ObjectSetGhostState(targetId, 0x17, (uint)sim2.SimDescription.AgeGenderSpecies);
                            }
                        }
                        if (sim2.SimDescription.IsVampire)
                        {
                            World.ObjectSetVisualOverride(targetId, eVisualOverrideTypes.Vampire, null);
                        }
                        else if (sim2.SimDescription.IsWerewolf)
                        {
                            World.ObjectSetVisualOverride(targetId, eVisualOverrideTypes.Werewolf, null);
                        }
                        else if (sim2.SimDescription.IsGenie)
                        {
                            World.ObjectSetVisualOverride(targetId, eVisualOverrideTypes.Genie, null);
                        }
                        if (sim2.SimDescription.IsAlien)
                        {
                            World.ObjectSetVisualOverride(targetId, eVisualOverrideTypes.Alien, null);
                        }

                        SimOutfit outfit = (sim2.Service == null) ? sim2.SimDescription.GetOutfit(OutfitCategories.Everyday, 0x0) : sim2.SimDescription.GetOutfit(OutfitCategories.Career, 0x0);
                        if ((outfit != null) && ((outfit.AgeGenderSpecies & (CASAgeGenderFlags.Child | CASAgeGenderFlags.Teen | CASAgeGenderFlags.YoungAdult | CASAgeGenderFlags.Toddler | CASAgeGenderFlags.Baby | CASAgeGenderFlags.Adult | CASAgeGenderFlags.Elder)) == sim2.SimDescription.Age))
                        {
                            CASUtils.SetOutfitInGameObject(outfit.Key, targetId);
                            ThumbnailHelper.SelectSimPose(index, outfit.AgeGenderSpecies & (CASAgeGenderFlags.Child | CASAgeGenderFlags.Teen | CASAgeGenderFlags.YoungAdult | CASAgeGenderFlags.Toddler | CASAgeGenderFlags.Baby | CASAgeGenderFlags.Adult | CASAgeGenderFlags.Elder), outfit.AgeGenderSpecies & ((CASAgeGenderFlags)0xcf00), 0x0, false);
                            return true;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("OnPrepareObject", e);
            }
            return false;
        }
Beispiel #42
0
 public CommonOptionItem(string name, int count, ResourceKey icon)
     : this(name, count)
 {
     SetThumbnail(icon);
 }
Beispiel #43
0
 public void SetThumbnail(ResourceKey icon)
 {
     mThumbnail = new ThumbnailKey(icon, ThumbnailSize.Medium);
 }
Beispiel #44
0
        public static void RandomizeBlends(Logger log, SimDescription me, Vector2 rangeIfSet, bool addToExisting, Vector2 rangeIfUnset, bool propagate, bool disallowAlien)
        {
            using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(me, CASParts.sPrimary))
            {
                if (!builder.OutfitValid) return;

                foreach (BlendUnit blend in BlendUnits)
                {
                    switch (me.Species)
                    {
                        case CASAgeGenderFlags.Human:
                            switch (blend.Category)
                            {
                                case FacialBlendCategories.Dog:
                                case FacialBlendCategories.LittleDog:
                                case FacialBlendCategories.Cat:
                                case FacialBlendCategories.PetCommon:
                                case FacialBlendCategories.Horse:
                                    continue;
                            }
                            break;
                        case CASAgeGenderFlags.Cat:
                            if ((blend.Category != FacialBlendCategories.PetCommon) && (blend.Category != FacialBlendCategories.Cat)) continue;
                            break;
                        case CASAgeGenderFlags.LittleDog:
                            if ((blend.Category != FacialBlendCategories.PetCommon) && (blend.Category != FacialBlendCategories.LittleDog)) continue;
                            break;
                        case CASAgeGenderFlags.Dog:
                            if ((blend.Category != FacialBlendCategories.PetCommon) && (blend.Category != FacialBlendCategories.Dog)) continue;
                            break;
                        case CASAgeGenderFlags.Horse:
                            if ((blend.Category != FacialBlendCategories.PetCommon) && (blend.Category != FacialBlendCategories.Horse)) continue;
                            break;
                    }

                    if (disallowAlien)
                    {
                        ResourceKey alienEyeCKey = new ResourceKey(ResourceUtils.HashString64("EyeAlienCorrector"), 0x358b08a, 0);
                        if (blend.mKey == alienEyeCKey)
                        {
                            continue;
                        }

                        ResourceKey alienEyeKey = new ResourceKey(ResourceUtils.HashString64("EyeAlien"), 0x358b08a, 0);
                        if (blend.mKey == alienEyeKey)
                        {
                            continue;
                        }

                        ResourceKey alienEarKey = new ResourceKey(ResourceUtils.HashString64("EarPoint"), 0x358b08a, 0);
                        if (blend.mKey == alienEarKey)
                        {
                            continue;
                        }
                    }

                    float value = GetValue(builder.Builder, blend);

                    if (value == 0)
                    {
                        value = RandomUtil.GetFloat(rangeIfUnset.x, rangeIfUnset.y);

                        if (value > 1)
                        {
                            value = 1;
                        }
                        else if (value < -1)
                        {
                            value = -1;
                        }

                        if (log != null)
                        {
                            log("Unset Final 100s", (int)(value * 100));
                        }
                    }
                    else
                    {
                        if (!addToExisting)
                        {
                            value = 0;
                        }

                        float newValue = RandomUtil.GetFloat(rangeIfSet.x, rangeIfSet.y);

                        if (log != null)
                        {
                            log("Set Delta 100s", (int)(newValue * 100));
                        }

                        value += newValue;

                        if (value > 1)
                        {
                            value = 1;
                        }
                        else if (value < -1)
                        {
                            value = -1;
                        }

                        if (log != null)
                        {
                            log("Set Final 100s", (int)(value * 100));
                        }
                    }

                    SetValue(builder.Builder, blend, value);
                }
            }

            if (propagate)
            {
                new SavedOutfit.Cache(me).PropagateGenetics(me, CASParts.sPrimary);
            }
        }
Beispiel #45
0
        private static void PopulateTypesGrid(CASHair ths)
        {
            if (ths == null) return;

            ICASModel cASModel = Responder.Instance.CASModel;
            Color[] colors = new Color[] { new Color(0x0), new Color(0x0), new Color(0x0), new Color(0x0) };
            ths.mHairTypesGrid.Clear();
            CASPart wornPart = ths.GetWornPart();
            ResourceKey resKey = ResourceKey.CreateUILayoutKey("GenericCasItem", 0x0);

            bool isHat = false;
            bool flag = false;
            if (ths.mHairType == CASHair.HairType.Hat)
            {
                ths.mHatsShareButton.Enabled = false;
                ths.mHatsDeleteButton.Enabled = false;
                ths.mDesignButton.Enabled = CASHair.PartIsHat(wornPart);

                isHat = true;
            }

            bool shouldEnableCatalogProductFilter = false;

            List<object> objectList = Responder.Instance.StoreUI.GetCASFeaturedStoreItems(BodyTypes.Hair, cASModel.OutfitCategory, (cASModel.Age | cASModel.Species) | cASModel.Gender, isHat);
            ths.mContentTypeFilter.FilterObjects(objectList, out shouldEnableCatalogProductFilter);

            if (!MasterController.Settings.mCompactHatCAS)
            {
                foreach (object obj2 in objectList)
                {
                    IFeaturedStoreItem item = obj2 as IFeaturedStoreItem;

                    if ((ths.mHairType == CASHair.HairType.Hat) == (0x0 != (item.CategoryFlags & 0x400000)))
                    {
                        WindowBase windowByExportID = UIManager.LoadLayout(resKey).GetWindowByExportID(0x1);
                        if (windowByExportID != null)
                        {
                            windowByExportID.Tag = item;
                            windowByExportID.GetChildByID(0x23, true);
                            Window childByID = windowByExportID.GetChildByID(0x20, true) as Window;
                            if (childByID != null)
                            {
                                ImageDrawable drawable = childByID.Drawable as ImageDrawable;
                                if (drawable != null)
                                {
                                    drawable.Image = UIUtils.GetUIImageFromThumbnailKey(item.ThumbKey);
                                    childByID.Invalidate();
                                }
                            }
                            childByID = windowByExportID.GetChildByID(0x300, true) as Window;
                            childByID.Tag = item;
                            childByID.CreateTooltipCallbackFunction = ths.StoreItemCreateTooltip;
                            childByID.Visible = true;
                            childByID = windowByExportID.GetChildByID(0x303, true) as Window;
                            childByID.Visible = item.IsSale;

                            Button button = windowByExportID.GetChildByID(0x301, true) as Button;
                            button.Caption = item.PriceString;
                            button.Tag = windowByExportID;
                            button.Click += ths.OnBuyButtonClick;
                            button.FocusAcquired += ths.OnBuyButtonFocusAcquired;
                            button.FocusLost += ths.OnBuyButtonFocusLost;
                            ths.mHairTypesGrid.AddItem(new ItemGridCellItem(windowByExportID, item));
                        }
                    }
                }
            }

            foreach (CASPart part2 in ths.mPartsList)
            {
                bool isWardrobePart = Responder.Instance.CASModel.ActiveWardrobeContains(part2);
                uint num3 = CASUtils.PartDataNumPresets(part2.Key);
                ResourceKeyContentCategory customContentType = UIUtils.GetCustomContentType(part2.Key);
                if (!UIUtils.IsContentTypeDisabled(UIUtils.GetCustomContentType(part2.Key)))
                {
                    ObjectDesigner.SetCASPart(part2.Key);
                    string designPreset = ObjectDesigner.GetDesignPreset(ObjectDesigner.GetDesignPresetIndexFromId(ObjectDesigner.DefaultPresetId));
                    if (string.IsNullOrEmpty(designPreset))
                    {
                        ResourceKey key2 = new ResourceKey(part2.Key.InstanceId, 0x333406c, part2.Key.GroupId);
                        designPreset = Simulator.LoadXMLString(key2);
                    }

                    CASPartPreset preset = new CASPartPreset(part2, designPreset);
                    string str2 = "";
                    string str3 = "";
                    if (wornPart.Key == preset.mPart.Key)
                    {
                        str2 = Responder.Instance.CASModel.GetDesignPreset(wornPart);
                        str3 = CASUtils.ReplaceHairColors(str2, colors);
                    }

                    if (preset.Valid && ((ths.mHairType == CASHair.HairType.Hair) || (ObjectDesigner.DefaultPresetId == uint.MaxValue)))
                    {
                        ths.AddHairTypeGridItem(ths.mHairTypesGrid, resKey, preset, isWardrobePart, ref shouldEnableCatalogProductFilter);
                        if ((preset.mPart.Key == wornPart.Key) && ((ths.mHairType == CASHair.HairType.Hair) || CASUtils.DesignPresetCompare(str2, designPreset)))
                        {
                            ths.mHairTypesGrid.SelectedItem = ths.mHairTypesGrid.Count - 1;
                            flag = true;
                        }
                    }

                    if (ths.mHairType == CASHair.HairType.Hat)
                    {
                        if (MasterController.Settings.mCompactHatCAS)
                        {
                            num3 = 1;
                        }

                        for (int i = 0x0; i < num3; i++)
                        {
                            uint presetId = CASUtils.PartDataGetPresetId(part2.Key, (uint)i);
                            customContentType = UIUtils.GetCustomContentType(part2.Key, presetId);

                            preset = new CASPartPreset(part2, presetId, CASUtils.PartDataGetPreset(part2.Key, (uint)i));
                            if (preset.Valid)
                            {
                                bool flag4 = ths.AddHairTypeGridItem(ths.mHairTypesGrid, resKey, preset, isWardrobePart, ref shouldEnableCatalogProductFilter);
                                if ((wornPart.Key == preset.mPart.Key) && CASUtils.DesignPresetCompare(str3, CASUtils.ReplaceHairColors(preset.mPresetString, colors)))
                                {
                                    ths.mSavedPresetId = preset.mPresetId;
                                    flag = true;
                                    if (flag4)
                                    {
                                        ths.mHairTypesGrid.SelectedItem = ths.mHairTypesGrid.Count - 1;
                                        if (ObjectDesigner.IsUserDesignPreset((uint)i))
                                        {
                                            ths.mHatsShareButton.Enabled = true;
                                            ths.mHatsDeleteButton.Enabled = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            ths.mHairTypesGrid.Tag = shouldEnableCatalogProductFilter;
            if (ths.mHairStylesGrid.Tag == null)
            {
                ths.mHairStylesGrid.Tag = false;
            }

            ths.mSortButton.Tag = ((bool)ths.mHairTypesGrid.Tag) ? (true) : (bool)ths.mHairStylesGrid.Tag;
            if (flag)
            {
                ths.mSaveButton.Enabled = false;
            }
            else if ((ths.mHairType == CASHair.HairType.Hat) && CASHair.PartIsHat(wornPart))
            {
                WindowBase win = UIManager.LoadLayout(resKey).GetWindowByExportID(0x1);
                if (win != null)
                {
                    Window window2 = win.GetChildByID(0x20, true) as Window;
                    if (window2 != null)
                    {
                        window2.Visible = false;
                    }
                    window2 = win.GetChildByID(0x24, true) as Window;
                    if (window2 != null)
                    {
                        window2.Visible = true;
                    }
                    ths.mHairTypesGrid.AddTempItem(new ItemGridCellItem(win, null));
                }
                ths.mSaveButton.Enabled = true;
            }
            ths.mUndoOnDelete = false;
            ths.mContentTypeFilter.UpdateFilterButtonState();
        }
Beispiel #46
0
 public bool DeleteSimFromContent(ResourceKey key)
 {
     return mCASModel.DeleteSimFromContent(key);
 }
Beispiel #47
0
 public static void RequestLoadSim(ResourceKey sim)
 {
     CASLogic.CASOperationStack.Instance.Push(new SetSimDescOperationEx(sim));
 }
Beispiel #48
0
 public void RequestLoadSim(ResourceKey key)
 {
     mCASModel.RequestLoadSim(key);
 }
Beispiel #49
0
            public PartPreset(CASPart part)
            {
                mPart = part;
                mPresetId = uint.MaxValue;

                ResourceKey resKey = new ResourceKey(part.Key.InstanceId, 0x333406c, part.Key.GroupId);
                mPresetString = Simulator.LoadXMLString(resKey);
            }
Beispiel #50
0
 public void RequestSetHairColorPreset(BodyTypes bodyType, ResourceKey hairPresetKey)
 {
     mCASModel.RequestSetHairColorPreset(bodyType, hairPresetKey);
 }
        public void SetResourceStream(ResourceKey key, MemoryStream stream)
        {
            byte[] data = new byte[stream.Length];

            long oldPosition = stream.Position;
            stream.Seek(0, SeekOrigin.Begin);
            stream.Read(data, 0, data.Length);
            stream.Seek(oldPosition, SeekOrigin.Begin);

            this.SetResource(key, data);
        }
Beispiel #52
0
 public void ExecuteSetSkinTone(ResourceKey key)
 {
     mCASModel.ExecuteSetSkinTone(key);
 }
        public void SetResource(ResourceKey key, byte[] data)
        {
            if (this.Stream.CanWrite == false)
            {
                throw new NotSupportedException();
            }

            if (this._Entries.ContainsKey(key) && this._Entries[key] is StreamEntry)
            {
                this.OriginalEntries[key] = (StreamEntry)this._Entries[key];
            }

            MemoryEntry entry = new MemoryEntry();
            entry.Compressed = false;
            entry.CompressedSize = entry.DecompressedSize = (uint)data.Length;
            entry.Data = (byte[])(data.Clone());

            this._Entries[key] = entry;
        }
Beispiel #54
0
 public OccultTypes GetOccultTypeFromKey(ResourceKey key)
 {
     return mCASModel.GetOccultTypeFromKey(key);
 }
        private void button4_Click(object sender, EventArgs e)
        {
            Stream file;
            Database db;
            ResourceKey rkey;
            Stream input;

            file = File.Open("P:\\Games\\Working\\Skins\\afface - dark\\afface-dark.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\afface - dark\\afface-dark.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x304910BE2CB17463, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\afface - light\\afface-light.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\afface - dark\\afface-dark.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x40E5744B0DBFC323, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\af-tf-efbody - dark\\af-tf-efbody fullybarbie-dark.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\af-tf-efbody - dark\\fullybarbie-dark.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x185D7126C73DC404, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0x13F78C079D70D7F8, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\af-tf-efbody - dark\\af-tf-efbody nipplesandpubes-dark.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\af-tf-efbody - dark\\nipplesandpubes-dark.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x185D7126C73DC404, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0x13F78C079D70D7F8, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\af-tf-efbody - dark\\af-tf-efbody nipplesnopubes-dark.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\af-tf-efbody - dark\\nipplesnopubes-dark.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x185D7126C73DC404, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0x13F78C079D70D7F8, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\af-tf-efbody - light\\af-tf-efbody fullybarbie-light.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\af-tf-efbody - light\\fullybarbie.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x798410349B50700C, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0xB4CDC208D8D51BF0, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\af-tf-efbody - light\\af-tf-efbody nipplesandpubes-light.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\af-tf-efbody - light\\nipplesandpubes.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x798410349B50700C, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0xB4CDC208D8D51BF0, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\af-tf-efbody - light\\af-tf-efbody nipplesnopubes-light.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\af-tf-efbody - light\\nipplesnopubes.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x798410349B50700C, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0xB4CDC208D8D51BF0, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\am-embody - dark\\am-embody fullhair-dark.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\am-embody - dark\\ambody-fullhair.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0xB1D30A51A5ED1903, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0xD4EE1715BCEA0F77, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\am-embody - dark\\am-embody hairless-dark.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\am-embody - dark\\ambody-hairless.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0xB1D30A51A5ED1903, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0xD4EE1715BCEA0F77, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\am-embody - dark\\am-embody lighterchest-dark.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\am-embody - dark\\ambody-lighterchest.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0xB1D30A51A5ED1903, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0xD4EE1715BCEA0F77, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\am-embody - dark\\am-embody nopubesnohappytrail-dark.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\am-embody - dark\\ambody-nopubesnohappytraillighthair.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0xB1D30A51A5ED1903, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0xD4EE1715BCEA0F77, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\am-embody - dark\\am-embody lighthairwithpubesnohappytrail-dark.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\am-embody - dark\\am-lighthairwithpubesnohappytrail.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0xB1D30A51A5ED1903, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0xD4EE1715BCEA0F77, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\am-embody - light\\am-embody fullhair-light.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\am-embody - light\\ambody-fullhair.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x4DB46D1662895FC3, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0x9121FA3B0B65C88F, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\am-embody - light\\am-embody hairless-light.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\am-embody - light\\ambodyhairless.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x4DB46D1662895FC3, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0x9121FA3B0B65C88F, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\am-embody - light\\am-embody lighterchest-light.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\am-embody - light\\ambody-lighterchest.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x4DB46D1662895FC3, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0x9121FA3B0B65C88F, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\am-embody - light\\am-embody nopubesnohappytrail-light.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\am-embody - light\\ambody-nopubesnohappytraillighthair.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x4DB46D1662895FC3, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0x9121FA3B0B65C88F, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\am-embody - light\\am-embody lighthairwithpubesnohappytrail-dark.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\am-embody - light\\am-lighthairwithpubesnohappytrail.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x4DB46D1662895FC3, 11720834, 0);
            db.SetResourceStream(rkey, input);
            rkey = new ResourceKey((ulong)0x9121FA3B0B65C88F, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\amface - dark\\amface-dark.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\amface - dark\\amface-dark.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x6CA41C919ECE1BE0, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\amface - light\\amface-light.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\amface - light\\amface.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x6F853F0E35157E24, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\efface - dark\\efface-dark.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\efface - dark\\efface-dark.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x629E533C0262E927, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\efface - light\\efface-light.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\efface - light\\efface.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x503C527E546E8C5F, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\emface - dark\\emface-dark.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\emface - dark\\emface - dark.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x21F6BAC9B048B934, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("P:\\Games\\Working\\Skins\\emface - light\\emface-light.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("P:\\Games\\Working\\Skins\\emface - light\\emface.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x7EDD5D417BC66680, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("J:\\Users\\Stuart\\AppData\\Roaming\\Miranda\\Received Files\\[email protected]\\afBottomBriefs_biki_no.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("J:\\Users\\Stuart\\AppData\\Roaming\\Miranda\\Received Files\\[email protected]\\afBottomBriefs_biki_0x849f383fd886bb35_0x00B2D882-0x00000000-0x849F383FD886BB35.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x849F383FD886BB35, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("J:\\Users\\Stuart\\AppData\\Roaming\\Miranda\\Received Files\\[email protected]\\afTopBra_Strapless_no.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("J:\\Users\\Stuart\\AppData\\Roaming\\Miranda\\Received Files\\[email protected]\\afTopBra_Strapless__0x0baf3c417b3d7bd2_0x00B2D882-0x00000000-0x0BAF3C417B3D7BD2.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0x0BAF3C417B3D7BD2, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            file = File.Open("J:\\Users\\Stuart\\AppData\\Roaming\\Miranda\\Received Files\\[email protected]\\NoZzzs.package", FileMode.Create, FileAccess.ReadWrite);
            input = File.Open("J:\\Users\\Stuart\\AppData\\Roaming\\Miranda\\Received Files\\[email protected]\\z_0xaf63bd4c8601b7a5_0x00B2D882-0x00000000-0xAF63BD4C8601B7A5.dds", FileMode.Open, FileAccess.Read);
            db = new Database(file, false);
            rkey = new ResourceKey((ulong)0xAF63BD4C8601B7A5, 11720834, 0);
            db.SetResourceStream(rkey, input);
            db.Commit(true);
            input.Close();
            file.Close();

            MessageBox.Show("Done");
        }
Beispiel #56
0
 public void OnSimSavedProxy(ResourceKey key)
 {
     try
     {
         if (OnSimSaved != null)
         {
             OnSimSaved(key);
         }
     }
     catch (Exception e)
     {
         Common.Exception("OnSimSavedProxy", e);
     }
 }
Beispiel #57
0
 public void RequestDeleteUserUniform(ResourceKey key)
 {
     mCASModel.RequestDeleteUserUniform(key);
 }
Beispiel #58
0
 public void RequestSetFurMap(ResourceKey furMap, bool finalize)
 {
     mCASModel.RequestSetFurMap(furMap, finalize);
 }
Beispiel #59
0
            public CrossWorldData(SimDescription sim)
            {
                mName = sim.FullName;

                mOutfitCache = new SavedOutfit.Cache(sim);

                SimOutfit outfit = sim.GetOutfit(OutfitCategories.Everyday, 0);
                if (outfit != null)
                {
                    mSkinToneKey = outfit.SkinToneKey;
                    mSkinToneIndex = outfit.SkinToneIndex;
                }
                else
                {
                    mSkinToneKey = sim.SkinToneKey;
                    mSkinToneIndex = sim.SkinToneIndex;
                }

                mMalePreference = sim.mGenderPreferenceMale;
                mFemalePreference = sim.mGenderPreferenceFemale;

                if (sim.CreatedSim != null)
                {
                    if (sim.CreatedSim.mPreviousOutfitKey != null)
                    {
                        try
                        {
                            mPreviousOutfitCategory = sim.GetOutfitCategoryFromResKey(sim.CreatedSim.mPreviousOutfitKey, out mPreviousOutfitIndex);
                        }
                        catch
                        { }
                    }

                    if (sim.CreatedSim.DreamsAndPromisesManager != null)
                    {
                        ActiveDreamNode node = sim.CreatedSim.DreamsAndPromisesManager.LifetimeWishNode;
                        if (node != null)
                        {
                            mLifetimeWishTally = node.InternalCount;
                        }
                    }
                }

                if (sim.Pregnancy != null)
                {
                    mPregnantGender = sim.Pregnancy.mGender;
                }

                foreach (Trait trait in sim.TraitManager.List)
                {
                    if (trait.IsReward) continue;

                    mTraits.Add(trait.Guid);
                }

                SocialNetworkingSkill networkSkill = sim.SkillManager.GetSkill<SocialNetworkingSkill>(SkillNames.SocialNetworking);
                if (networkSkill != null)
                {
                    // This value is set to mNumberOfBlogFollowers for some reason
                    mNumberOfFollowers = networkSkill.mNumberOfFollowers;

                    // Not transitioned at all
                    mBlogsCreated = networkSkill.mBlogsCreated;
                }

                RockBand bandSkill = sim.SkillManager.GetSkill<RockBand>(SkillNames.RockBand);
                if (bandSkill != null)
                {
                    mBandInfo = bandSkill.mBandInfo;
                }

                Collecting collecting = sim.SkillManager.GetSkill<Collecting>(SkillNames.Collecting);
                if (collecting != null)
                {
                    // Error in CollectingPropertyStreamWriter:Export() requires that mGlowBugData by transfered manually
                    //   Exported as two Int64, but Imported as a Int64 and Int32
                    mGlowBugData = collecting.mGlowBugData;

                    mMushroomsCollected = collecting.mMushroomsCollected;
                }

                NectarSkill nectar = sim.SkillManager.GetSkill<NectarSkill>(SkillNames.Nectar);
                if (nectar != null)
                {
                    mNectarHashesMade = nectar.mHashesMade;
                }

                Photography photography = sim.SkillManager.GetSkill<Photography>(SkillNames.Photography);
                if (photography != null)
                {
                    mSubjectRecords = photography.mSubjectRecords;
                }

                RidingSkill riding = sim.SkillManager.GetSkill<RidingSkill>(SkillNames.Riding);
                if (riding != null)
                {
                    // Error in the Import (Copy/Paste fail by the looks of it), where the CrossCountry Wins are imported instead
                    mCrossCountryCompetitionsWon = new List<uint>(riding.mCrossCountryCompetitionsWon);
                    mJumpCompetitionsWon = new List<uint>(riding.mJumpCompetitionsWon);
                }

                if ((sim.OccultManager != null) && (sim.OccultManager.mOccultList != null))
                {
                    mOccult = new List<OccultBaseClass>(sim.OccultManager.mOccultList);
                }
            }
Beispiel #60
0
        private static IGameObject CreateObjectInternal(ulong instance, ProductVersion version, Hashtable data, Simulator.ObjectInitParameters initData)
        {
            ResourceKey key = new ResourceKey(instance, 0x319e4f1d, ResourceUtils.ProductVersionToGroupId(version));

            return GlobalFunctions.CreateObjectInternal(key, data, initData);
        }