예제 #1
0
        /// <summary>
        /// Does the actual serialization of the given data structures.
        /// </summary>
        private static void Serialize(int begin, Stream stream, List <KeyValuePair <uint, List <KeyValuePair <uint, uint> > > > tagIndex,
                                      ObjectTable <string> stringTable)
        {
            RuntimeTypeModel typeModel = TagIndexSerializer.CreateTypeModel();

            // move until after the index (index contains two int's, startoftagindex, endoffile).
            stream.Seek(begin + 8, SeekOrigin.Begin);

            // serialize string table.
            List <string> strings = new List <string>();

            for (uint id = 0; id < stringTable.Count; id++)
            {
                strings.Add(stringTable.Get(id));
            }
            stringTable.Clear();
            stringTable = null;
            typeModel.Serialize(stream, strings);
            long startOfTagsIndex = stream.Position - begin;

            // serialize tagindex.
            typeModel.Serialize(stream, tagIndex);
            long endOfFile = stream.Position - begin;

            // write index.
            stream.Seek(begin, SeekOrigin.Begin);
            stream.Write(BitConverter.GetBytes((int)startOfTagsIndex), 0, 4); // write start position of tagindex.
            stream.Write(BitConverter.GetBytes((int)endOfFile), 0, 4);        // write size of complete file.

            stream.Seek(begin + endOfFile, SeekOrigin.Begin);
        }
예제 #2
0
 public void InitalizeTest()
 {
     // Make sure the object table is completely empty at the beginning of each test
     // TODO: This need should be elimited once the object table class is changed to be a singleton pattern instead
     // of a static class
     ObjectTable.Clear();
 }
예제 #3
0
        public void CleanUp()
        {
            if (Physics.Instantiated)
            {
                throw new Exception("After a test has run, the Physics singleton should have been disposed");
            }

            ObjectTable.Clear();

            if (_errorLog != null && _errorLog.HasErrors)
            {
                Trace.TraceError("There were errors, check the error log");
            }

            _errorLog = null;
        }
예제 #4
0
        /// <summary>
        /// Does the actual serialization of the given data structures.
        /// </summary>
        private static void Serialize(int begin, Stream stream, List<KeyValuePair<uint, List<KeyValuePair<uint, uint>>>> tagIndex,
            ObjectTable<string> stringTable)
        {
            RuntimeTypeModel typeModel = TagIndexSerializer.CreateTypeModel();

            // move until after the index (index contains two int's, startoftagindex, endoffile).
            stream.Seek(begin + 8, SeekOrigin.Begin);

            // serialize string table.
            List<string> strings = new List<string>();
            for (uint id = 0; id < stringTable.Count; id++)
            {
                strings.Add(stringTable.Get(id));
            }
            stringTable.Clear();
            stringTable = null;
            typeModel.Serialize(stream, strings);
            long startOfTagsIndex = stream.Position - begin;

            // serialize tagindex.
            typeModel.Serialize(stream, tagIndex);
            long endOfFile = stream.Position - begin;

            // write index.
            stream.Seek(begin, SeekOrigin.Begin);
            stream.Write(BitConverter.GetBytes((int)startOfTagsIndex), 0, 4); // write start position of tagindex.
            stream.Write(BitConverter.GetBytes((int)endOfFile), 0, 4); // write size of complete file.

            stream.Seek(begin + endOfFile, SeekOrigin.Begin);
        }
예제 #5
0
 public void CleanUp()
 {
     ObjectTable.Clear();
 }