Esempio n. 1
0
        public override int OnCalculateSize(bool force)
        {
            int size = BRESHeader.Size;

            _rootSize = 0x20 + (Children.Count * 0x10);

            //Get entry count and data start
            _numEntries = 0;
            //Children.Sort(NodeComparer.Instance);
            foreach (BRESGroupNode n in Children)
            {
                //n.Children.Sort(NodeComparer.Instance);
                _rootSize   += (n.Children.Count * 0x10) + 0x18;
                _numEntries += n.Children.Count;
            }
            size += _rootSize;

            //Get strings and advance entry offset
            _stringTable.Clear();
            foreach (BRESGroupNode n in Children)
            {
                _stringTable.Add(n.Name);
                foreach (BRESEntryNode c in n.Children)
                {
                    size = size.Align(c.DataAlign) + c.CalculateSize(force);
                    c.GetStrings(_stringTable);
                }
            }
            _strOffset = size = size.Align(4);

            size += _stringTable.GetTotalSize();

            return(size.Align(0x80));
        }
Esempio n. 2
0
 public void Dispose()
 {
     Entry = null;
     StringTable?.Clear();
     StringTable = null;
     RawRecords?.Clear();
     RawRecords?.TrimExcess();
     RawRecords = null;
     Records?.Clear();
     Records = null;
 }
Esempio n. 3
0
 public virtual void Close()
 {
     Reader.Close();
     Reader.Dispose();
     LocaleTables.Clear();
     Strings.Clear();
     IndexItems.Clear();
     play        = null;
     zone        = null;
     ugh_        = null;
     buildNode   = null;
     versionNode = null;
     vertexNode  = null;
     Header      = null;
     IndexHeader = null;
 }
        private void OK_click(Object source, EventArgs args)
        {
            try
            {
                selectedClasses.Clear();

                for (int i = 0; i < selectedClassList.Items.All.Length; i++)
                {
                    selectedClasses.Add(selectedClassList.Items.All[i].ToString());
                }
            }

            catch (Exception e)
            {
                MessageBox.Show(WMISys.GetString("WMISE_Exception", e.Message, e.StackTrace));
            }
        }
Esempio n. 5
0
        // Group: File Functions
        // __________________________________________________________________________


        /* Function: LoadBinaryFile
         * Loads the information in <SearchIndex.nd> and returns whether it was successful.  If not all the out parameters will still
         * return objects, they will just be empty.
         */
        public static bool LoadBinaryFile(Path filename, out StringTable <IDObjects.NumberSet> prefixTopicIDs)
        {
            prefixTopicIDs = new StringTable <IDObjects.NumberSet>(KeySettingsForPrefixes);

            BinaryFile binaryFile = new BinaryFile();
            bool       result     = true;

            try
            {
                if (binaryFile.OpenForReading(filename, "2.0") == false)
                {
                    result = false;
                }
                else
                {
                    // [String: Prefix]
                    // [NumberSet: Prefix Topic IDs]
                    // ...
                    // [String: null]

                    for (;;)
                    {
                        string prefix = binaryFile.ReadString();

                        if (prefix == null)
                        {
                            break;
                        }

                        IDObjects.NumberSet topicIDs = binaryFile.ReadNumberSet();
                        prefixTopicIDs.Add(prefix, topicIDs);
                    }
                }
            }
            catch
            { result = false; }
            finally
            { binaryFile.Dispose(); }

            if (result == false)
            {
                prefixTopicIDs.Clear();
            }

            return(result);
        }
Esempio n. 6
0
        /// <summary>
        /// Clear data that we cache about types and object contents that can change between objects.
        /// </summary>
        void ClearPerObjectCachedData()
        {
            // Reset the type/field name and data string tables to empty for each object.
            m_DataStringTable.Clear();
            m_TypeStringTable.Clear();

            // Clear the type and field name indices from the cached type data as each object's type string table is distinct so the indices from any previously written objects will be invalid
            foreach (KeyValuePair <Type, TypeData> typeDataCacheEntry in m_TypeDataCache)
            {
                typeDataCacheEntry.Value.m_AssemblyQualifiedNameIndex = -1;

                foreach (FieldData fieldData in typeDataCacheEntry.Value.m_Fields)
                {
                    fieldData.m_NameIndex = -1;
                }
            }

            // Clear the assembly qualified type name cache as the indices of the assembly qualified type names in the type stringtable will likely be different for this object than the previous one serialized
            m_TypeQualifiedNameIndices.Clear();
        }
Esempio n. 7
0
        public override unsafe void Export(string outPath)
        {
            Rebuild();

            StringTable table = new StringTable();

            GetStrings(table);

            int dataLen = WorkingUncompressed.Length.Align(4);
            int size    = dataLen + table.GetTotalSize();

            using (FileStream stream = new FileStream(outPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, 8, FileOptions.RandomAccess))
            {
                stream.SetLength(size);
                using (FileMap map = FileMap.FromStream(stream))
                {
                    System.Memory.Move(map.Address, WorkingUncompressed.Address, (uint)WorkingUncompressed.Length);
                    table.WriteTable(map.Address + dataLen);
                    PostProcess(null, map.Address, WorkingUncompressed.Length, table);
                }
            }
            table.Clear();
        }
Esempio n. 8
0
 void StringTableRevertToDefault()
 {
     BaseNameStringIndex = TypeExtensions.kNone;
     StringTable.Clear();
 }