コード例 #1
0
        private void WriteInternal(Stream stream, byte nodeIndexSize, List <int> offsets, DictionaryNode dictionary)
        {
            var  keys      = new byte[nodeIndexSize * dictionary.Count];
            var  values    = new byte[nodeIndexSize * dictionary.Count];
            long streamPos = stream.Position;

            stream.Write(keys, 0, keys.Length);
            stream.Write(values, 0, values.Length);

            KeyValuePair <string, PNode>[] elems = dictionary.ToArray();

            for (int i = 0; i < dictionary.Count; i++)
            {
                int elementIdx = WriteInternal(stream, nodeIndexSize, offsets, NodeFactory.CreateKeyElement(elems[i].Key));
                FormatIdx(elementIdx, nodeIndexSize).CopyTo(keys, nodeIndexSize * i);
            }
            for (int i = 0; i < dictionary.Count; i++)
            {
                int elementIdx = WriteInternal(stream, nodeIndexSize, offsets, elems[i].Value);
                FormatIdx(elementIdx, nodeIndexSize).CopyTo(values, nodeIndexSize * i);
            }

            stream.Seek(streamPos, SeekOrigin.Begin);
            stream.Write(keys, 0, keys.Length);
            stream.Write(values, 0, values.Length);
            stream.Seek(0, SeekOrigin.End);
        }
コード例 #2
0
ファイル: BinaryFormatWriter.cs プロジェクト: gamebtc/IPASign
        // Token: 0x06000032 RID: 50 RVA: 0x00002C70 File Offset: 0x00000E70
        private void WriteInternal(Stream stream, byte nodeIndexSize, List <int> offsets, DictionaryNode dictionary)
        {
            byte[] array    = new byte[(int)nodeIndexSize * dictionary.Count];
            byte[] array2   = new byte[(int)nodeIndexSize * dictionary.Count];
            long   position = stream.Position;

            stream.Write(array, 0, array.Length);
            stream.Write(array2, 0, array2.Length);
            KeyValuePair <string, PNode>[] array3 = dictionary.ToArray <KeyValuePair <string, PNode> >();
            for (int i = 0; i < dictionary.Count; i++)
            {
                BinaryFormatWriter.FormatIdx(this.WriteInternal(stream, nodeIndexSize, offsets, NodeFactory.CreateKeyElement(array3[i].Key)), nodeIndexSize).CopyTo(array, (int)nodeIndexSize * i);
            }
            for (int j = 0; j < dictionary.Count; j++)
            {
                BinaryFormatWriter.FormatIdx(this.WriteInternal(stream, nodeIndexSize, offsets, array3[j].Value), nodeIndexSize).CopyTo(array2, (int)nodeIndexSize * j);
            }
            stream.Seek(position, SeekOrigin.Begin);
            stream.Write(array, 0, array.Length);
            stream.Write(array2, 0, array2.Length);
            stream.Seek(0L, SeekOrigin.End);
        }