Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
0
 public void WriteString_ShouldWriteNextItem()
 {
     // Act/Assert
     Assert.AreEqual(ABSaveWriter.WriteString("cool", true), "\u0001cool");
 }
Exemplo n.º 3
0
 public void WriteString_ShouldNotWriteNextItem()
 {
     // Act/Assert
     Assert.AreEqual(ABSaveWriter.WriteString("cool", false), "cool");
 }