PointerInfo IDumpDataReader.Read(CancellationToken token, IProgress <int> prog)
        {
            var sw = new System.Diagnostics.Stopwatch();

            sw.Start();
            PointerInfo pointerInfo = new PointerInfo();

            //ReadIndicate();
            fileStream.BaseStream.Seek(0, SeekOrigin.Begin);
            int magic = fileStream.ReadInt32();

            if (magic == 0x4E5A4665)
            {
                m_compress = true;
            }

            long start  = 135 + 8 * 5;                                 // Edizon start of data dump
            long length = (fileStream.BaseStream.Length - start) / 16; // from Address+ to address

            fileStream.BaseStream.Seek(start, SeekOrigin.Begin);
            int readSize = (int)(fileStream.BaseStream.Length - start);

            byte[] buff;
            if (m_compress)
            {
                byte[] cbuff = fileStream.ReadBytes(readSize);
                buff   = new byte[readSize * 4];
                length = LZ_Uncompress(cbuff, buff, readSize) / 16;
            }
            else
            {
                buff = fileStream.ReadBytes(readSize);
            }
            // WIP
            //byte[] outbuff = new byte[readSize * 9 / 8];
            //byte[] outbuff2 = new byte[readSize];
            //ulong[] outbuff3 = new ulong[readSize / 8];
            //bool error = false;
            //int csize = (int)LZ_Compress(buff, outbuff, readSize);
            //int osize = (int)LZ_Uncompress(outbuff, outbuff2, csize);
            //int osize2 = (int)LZ_Uncompress2(outbuff,outbuff3, csize);
            //for (int i = 0; i < readSize; i++)
            //{
            //    if (buff[i] != outbuff2[i])
            //        error = true;
            //}
            //for (int i = 0; i < readSize/8; i++)
            //{
            //    if (outbuff3[i] !=(ulong) BitConverter.ToInt64(buff, i*8))
            //        error = true;
            //}
            // end test
            for (int index = 0; index < length; index++)
            {
                if (token.IsCancellationRequested)
                {
                    token.ThrowIfCancellationRequested();
                }
                long       source       = BitConverter.ToInt64(buff, (index * 2) << 3);     //fileStream.ReadInt64();
                long       target       = BitConverter.ToInt64(buff, (index * 2 + 1) << 3); //fileStream.ReadInt64();
                MemoryType sourcetype   = GetMemoryType(source);
                long       startAddress = GetStartAddress(sourcetype);
                Address    from         = new Address(sourcetype, source - startAddress);
                Address    to           = new Address(MemoryType.HEAP, target - heapStartAddress);
                pointerInfo.AddPointer(from, to);
                if (index % 10000 == 1)
                {
                    prog.Report((int)((long)100 * (index + 1) / length));
                }
            }
            pointerInfo.MakeList();
            sw.Stop();
            TimeSpan ts = sw.Elapsed;

            //3.28.24
            return(pointerInfo);
        }
        PointerInfo IDumpDataReader.Read(CancellationToken token, IProgress <int> prog)
        {
            var sw = new System.Diagnostics.Stopwatch();

            sw.Start();
            PointerInfo pointerInfo = new PointerInfo();
            const int   readMaxSize = 4096;

            ReadIndicate();

            //foreach (NoexsDumpIndex x in indices)
            for (int index = 0; index < indices.Count; index++)
            {
                NoexsDumpIndex x = indices[index];
                if (token.IsCancellationRequested)
                {
                    token.ThrowIfCancellationRequested();
                }
                if (!IsMainHeapAddress(x.address))
                {
                    continue;
                }
                fileStream.BaseStream.Seek(x.pos, SeekOrigin.Begin);
                MemoryType type         = GetMemoryType(x.address);
                long       startAddress = GetStartAddress(type);
                long       address      = x.address - startAddress;
                long       rem          = x.size;

                while (rem > 0)
                {
                    if (token.IsCancellationRequested)
                    {
                        token.ThrowIfCancellationRequested();
                    }
                    int readSize = readMaxSize;
                    if (rem < readSize)
                    {
                        readSize = (int)rem;
                    }
                    rem -= readSize;
                    byte[] buff = fileStream.ReadBytes(readSize);
                    //pickup pointer from heap
                    int loopcnt = readSize / 8;
                    for (int i = 0; i < loopcnt; i++)
                    {
                        long tmp_data = BitConverter.ToInt64(buff, i << 3);
                        if (IsHeapAddress(tmp_data))
                        {
                            Address from = new Address(type, address);
                            Address to   = new Address(MemoryType.HEAP, tmp_data - heapStartAddress);
                            pointerInfo.AddPointer(from, to);
                        }
                        address += 8;
                    }
                }
                prog.Report((int)(100 * (index + 1) / indices.Count));
            }
            pointerInfo.MakeList();
            sw.Stop();
            TimeSpan ts = sw.Elapsed;

            //3.28.24
            return(pointerInfo);
        }