Exemple #1
0
            public void SetEntry(XivImc info, int subsetID = -1, string slot = "")
            {
                // Variant IDs are 1 based, not 0 based.
                var index = subsetID - 1;

                // Invalid Index, return default.
                if (index >= SubsetCount || index < 0)
                {
                    index = -1;
                }

                // Test for getting default set.
                var subset = DefaultSubset;

                if (index >= 0)
                {
                    subset = SubsetList[index];
                }

                // Get which offset the slot uses.
                var idx = 0;

                if (SlotOffsetDictionary.ContainsKey(slot) && SlotOffsetDictionary[slot] < subset.Count)
                {
                    idx = SlotOffsetDictionary[slot];
                }

                // Assign info.
                subset[idx] = info;
            }
Exemple #2
0
            public void SetEntry(XivImc info, int subsetID = -1, string slot = "", bool allowNew = false)
            {
                // Variant IDs are 1 based, not 0 based.
                var index = subsetID - 1;

                // Invalid Index, return default.
                if ((index >= SubsetCount && !allowNew) || index < 0)
                {
                    index = -1;
                }

                // Test for getting default set.
                var subset = DefaultSubset;

                if (index >= 0)
                {
                    if (index >= SubsetCount)
                    {
                        subset = new List <XivImc>();
                        if (TypeIdentifier == ImcType.Set)
                        {
                            // Five entries for set types.
                            subset.Add(new XivImc());
                            subset.Add(new XivImc());
                            subset.Add(new XivImc());
                            subset.Add(new XivImc());
                            subset.Add(new XivImc());
                        }
                        else
                        {
                            // One entry for nonset types.
                            subset.Add(info);
                        }
                        SubsetList.Add(subset);
                    }
                    else
                    {
                        subset = SubsetList[index];
                    }
                }

                // Get which offset the slot uses.
                var idx = 0;

                if (slot != null && SlotOffsetDictionary.ContainsKey(slot) && SlotOffsetDictionary[slot] < subset.Count)
                {
                    idx = SlotOffsetDictionary[slot];
                }

                // Assign info.
                subset[idx] = info;
            }