/// <summary>
        /// Sets this item as an array, with a certain item type.
        /// </summary>
        /// <param name="items">Items to add at the beginning.</param>
        public ABSaveParserItem(List <TInnerType> items)
        {
            // This constructor is for an array, so make it an array.
            ItemType = ABSaveParserItemType.Array;

            // Now, create a new instance of the InnerItems list.
            InnerItems = new List <TInnerType>(items);

            // Since this is an array, the rest isn't needed.
            ObjectItems      = null;
            ActualDictionary = null;
        }
        /// <summary>
        /// Adds an item for an object - with a dictionary of KeyValue pairs.
        /// </summary>
        /// <param name="name">The name of this item.</param>
        /// <param name="value">The value in this item.</param>
        public ABSaveParserItem(ABSaveObjectItems items)
        {
            // This constructor is for an object, so make it an object.
            ItemType = ABSaveParserItemType.Object;

            // Make the ObjectItems a new dictionary with all the items in it.
            ObjectItems = items;

            // Since this is an object, the rest isn't needed.
            InnerItems       = null;
            ActualDictionary = null;
        }
Example #3
0
        static void ConvertVariableToABSave(ABSaveType type, StringBuilder sb, ABSaveSettings settings, Helpers.ABSaveObjectItems members, ref bool notFirst, ref ABSavePrimitiveType lastType, int i)
        {
            // If we're doing it named - write the name.
            if (type == ABSaveType.WithNames)
            {
                // Write the name out, don't write the Next Instruction character if it's the first item or the last item had a "lowerInnerlevel" sign after it.
                ABSaveWriter.WriteString(members.Items[i].Info.Name, ABSaveUtils.RequiresLowerInnerLevelSymbol(lastType) ? false : notFirst, true, sb);

                // Since we've written the name out... And the "notFirst" variable is used to determine whether to write the next instruction symbol or not... Set "notFirst" to true since it will HAVE to have the next instruction symbol now.
                notFirst = true;
            }

            // Serialize each variable, to the StringBuilder. If the last member was an array or object, then instead of getting it to write the
            // "next instruction" character, we need to get it to write the "lower" symbol instead.
            ABSaveSerializer.Serialize(members.Items[i].Value, type, settings, out lastType, true, sb, ABSaveUtils.RequiresLowerInnerLevelSymbol(lastType) ? false : notFirst, i == members.Count - 1);

            // Update the "notFirst" variable if it's false and we've gone through one item.
            if (!notFirst)
            {
                notFirst = true;
            }
        }