Esempio n. 1
0
        public static void WriteTdfList(TdfList tdf, Stream s)
        {
            s.WriteByte(tdf.SubType);
            CompressInteger(tdf.Count, s);
            for (int i = 0; i < tdf.Count; i++)
            {
                switch (tdf.SubType)
                {
                case 0:
                    CompressInteger(((List <long>)tdf.List)[i], s);
                    break;

                case 1:
                    WriteString(((List <string>)tdf.List)[i], s);
                    break;

                case 3:
                    Blaze.TdfStruct str = ((List <Blaze.TdfStruct>)tdf.List)[i];
                    if (str.startswith2)
                    {
                        s.WriteByte(2);
                    }
                    foreach (Tdf ttdf in str.Values)
                    {
                        WriteTdf(ttdf, s);
                    }
                    s.WriteByte(0);
                    break;

                case 9:
                    WriteTrippleValue(((List <TrippleVal>)tdf.List)[i], s);
                    break;
                }
            }
        }
Esempio n. 2
0
        public static void WriteTdfDoubleList(TdfDoubleList tdf, Stream s)
        {
            s.WriteByte(tdf.SubType1);
            s.WriteByte(tdf.SubType2);
            CompressInteger(tdf.Count, s);
            for (int i = 0; i < tdf.Count; i++)
            {
                switch (tdf.SubType1)
                {
                case 0:
                    CompressInteger(((List <long>)(tdf.List1))[i], s);
                    break;

                case 1:
                    WriteString(((List <string>)(tdf.List1))[i], s);
                    break;

                case 3:
                    Blaze.TdfStruct str = ((List <Blaze.TdfStruct>)tdf.List1)[i];
                    if (str.startswith2)
                    {
                        s.WriteByte(2);
                    }
                    foreach (Tdf ttdf in str.Values)
                    {
                        WriteTdf(ttdf, s);
                    }
                    s.WriteByte(0);
                    break;

                case 0xA:
                    WriteFloat(s, ((List <float>)(tdf.List1))[i]);
                    break;
                }
                switch (tdf.SubType2)
                {
                case 0:
                    CompressInteger(((List <long>)(tdf.List2))[i], s);
                    break;

                case 1:
                    WriteString(((List <string>)(tdf.List2))[i], s);
                    break;

                case 3:
                    Blaze.TdfStruct str = ((List <Blaze.TdfStruct>)tdf.List2)[i];
                    if (str.startswith2)
                    {
                        s.WriteByte(2);
                    }
                    foreach (Tdf ttdf in str.Values)
                    {
                        WriteTdf(ttdf, s);
                    }
                    s.WriteByte(0);
                    break;

                case 0xA:
                    WriteFloat(s, ((List <float>)(tdf.List2))[i]);
                    break;
                }
            }
        }