protected void WriteToMemory()
{
foreach (var SectionHeader in SectionHeadersWithFlag(Elf.SectionHeader.FlagsSet.Allocate))
{
var SectionHeaderFileStream = FileStream.SliceWithLength(SectionHeader.Offset, SectionHeader.Size);
var SectionHeaderMemoryStream = MemoryStream.SliceWithLength(SectionHeader.Address + BaseAddress, SectionHeader.Size);
Console.WriteLine("WriteToMemory('{0:X}') : 0x{1:X} : {2} : {3}", GetStringFromStringTable(SectionHeader.Name), SectionHeader.Address, SectionHeader.Type, SectionHeader.Size);
Console.WriteLine(" 0x{0:X} - 0x{1:X}", SectionHeader.Address + BaseAddress, SectionHeader.Size);
switch (SectionHeader.Type)
{
case Elf.SectionHeader.TypeEnum.ProgramBits:
//Console.WriteLine(SectionHeaderFileStream.ReadAll().ToHexString());
SectionHeaderMemoryStream.WriteStream(SectionHeaderFileStream);
break;
case Elf.SectionHeader.TypeEnum.NoBits:
SectionHeaderMemoryStream.WriteByteRepeated(0, SectionHeader.Size);
break;
default:
break;
}
}
}