本文整理汇总了C#中ImageMap类的典型用法代码示例。如果您正苦于以下问题:C# ImageMap类的具体用法?C# ImageMap怎么用?C# ImageMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageMap类属于命名空间,在下文中一共展示了ImageMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddExportedEntryPoints
private void AddExportedEntryPoints(Address addrLoad, ImageMap imageMap, List<EntryPoint> entryPoints)
{
ImageReader rdr = imgLoaded.CreateLeReader(rvaExportTable);
rdr.ReadLeUInt32(); // Characteristics
rdr.ReadLeUInt32(); // timestamp
rdr.ReadLeUInt32(); // version.
rdr.ReadLeUInt32(); // binary name.
rdr.ReadLeUInt32(); // base ordinal
int nExports = rdr.ReadLeInt32();
int nNames = rdr.ReadLeInt32();
if (nExports != nNames)
throw new BadImageFormatException("Unexpected discrepancy in PE image.");
uint rvaApfn = rdr.ReadLeUInt32();
uint rvaNames = rdr.ReadLeUInt32();
ImageReader rdrAddrs = imgLoaded.CreateLeReader(rvaApfn);
ImageReader rdrNames = imgLoaded.CreateLeReader(rvaNames);
for (int i = 0; i < nNames; ++i)
{
EntryPoint ep = LoadEntryPoint(addrLoad, rdrAddrs, rdrNames);
if (imageMap.IsExecutableAddress(ep.Address))
{
entryPoints.Add(ep);
}
}
}
开发者ID:gh0std4ncer,项目名称:reko,代码行数:26,代码来源:PeImageLoader.cs
示例2: Setup
public void Setup()
{
mr = new MockRepository();
seg1 = new ImageMapSegment("seg1", AccessMode.Execute) { Address = Address.Ptr32(0x01000) };
seg2 = new ImageMapSegment("seg2", AccessMode.Execute) { Address = Address.Ptr32(0x02000) };
map = new ImageMap(seg1.Address, 0x4000);
}
开发者ID:nemerle,项目名称:reko,代码行数:7,代码来源:ImageMapSegmentDesignerTests.cs
示例3: CheckImageMapTypes
private void CheckImageMapTypes(ImageMap map, params string[] types)
{
int length = types.Length;
Assert.AreEqual(length, map.Items.Count);
for (int i = 0; i < length; i++)
Assert.AreEqual(types[i], map.Items.Values[i].DataType.ToString());
}
开发者ID:relaxar,项目名称:reko,代码行数:7,代码来源:ImageMapTests.cs
示例4: BuildGrid
public void BuildGrid()
{
var grid = PointyHexGrid<UVCell>.ThinRectangle(11, 11);
var baseMap = new PointyHexMap(cellPrefab.Dimensions * 1.1f);
Debug.Log(cellPrefab.Dimensions);
var cellMap = baseMap
.WithWindow(ExampleUtils.ScreenRect)
.AlignMiddleCenter(grid)
.To3DXY();
var imageMap =
new ImageMap<PointyHexPoint>(new Rect(0, 0, 1, 1), grid, baseMap);
foreach (var point in grid)
{
var worldPosition = cellMap[point];
var cell = Instantiate(cellPrefab);
Debug.Log(cell.Dimensions);
cell.transform.parent = gridRoot.transform;
cell.transform.localScale = Vector3.one;
cell.transform.localPosition = worldPosition;
cell.SetTexture(texture);
cell.name = point.ToString();
var imagePoint = imageMap[point];
cell.SetUVs(imagePoint, imageMap.GetCellDimensions(point));
}
}
开发者ID:ifalvarez,项目名称:complices,代码行数:35,代码来源:ImageMapTest.cs
示例5: CheckImageMapSizes
private void CheckImageMapSizes(ImageMap map, params int[] sizes)
{
int length = sizes.Length;
Assert.AreEqual(length, map.Items.Count);
for (int i = 0; i < length; i++)
Assert.AreEqual(sizes[i], map.Items.Values[i].Size);
}
开发者ID:relaxar,项目名称:reko,代码行数:7,代码来源:ImageMapTests.cs
示例6: Example3
void Example3()
{
string imagePath = @"Assets\ODFSample\Examples\example3.png";
TextDocument document = new TextDocument();
document.New();
//Create standard paragraph
Paragraph paragraphOuter = ParagraphBuilder.CreateStandardTextParagraph(document);
//Create the frame with graphic
Frame frame = new Frame(document, "frame1", "graphic1", imagePath);
//Create a Draw Area Rectangle
DrawAreaRectangle drawAreaRec = new DrawAreaRectangle(
document, "0cm", "0cm", "1.5cm", "2.5cm", null);
drawAreaRec.Href = "http://OpenDocument4all.com";
//Create a Draw Area Circle
DrawAreaCircle drawAreaCircle = new DrawAreaCircle(
document, "4cm", "4cm", "1.5cm", null);
drawAreaCircle.Href = "http://AODL.OpenDocument4all.com";
DrawArea[] drawArea = new DrawArea[2] { drawAreaRec, drawAreaCircle };
//Create a Image Map
ImageMap imageMap = new ImageMap(document, drawArea);
//Add Image Map to the frame
frame.Content.Add(imageMap);
//Add frame to paragraph
paragraphOuter.Content.Add(frame);
//Add paragraph to document
document.Content.Add(paragraphOuter);
//Save the document
document.SaveTo(@"example3_simpleImageMap.odt");
}
开发者ID:hebory,项目名称:aodl-examples-for-unity,代码行数:29,代码来源:Example3.cs
示例7: ImageMapCreation
public void ImageMapCreation()
{
ImageMap im = new ImageMap(addrBase, img.Length);
im.AddSegment(Address.SegPtr(0x8000, 2), "", AccessMode.ReadWrite);
im.AddSegment(Address.SegPtr(0x8000, 3), "", AccessMode.ReadWrite);
im.AddSegment(Address.SegPtr(0x8000, 0), "", AccessMode.ReadWrite);
// Verify
IEnumerator<KeyValuePair<Address,ImageMapSegment>> e = im.Segments.GetEnumerator();
Assert.IsTrue(e.MoveNext());
ImageMapSegment seg = e.Current.Value;
Assert.AreEqual(2, seg.Size);
Assert.IsTrue(e.MoveNext());
seg = e.Current.Value;
Assert.AreEqual(1, seg.Size);
Assert.IsTrue(e.MoveNext());
seg = e.Current.Value;
Assert.AreEqual(1, seg.Size);
Assert.IsTrue(!e.MoveNext());
}
开发者ID:gh0std4ncer,项目名称:reko,代码行数:25,代码来源:ImageMapTests.cs
示例8: Program
public Program(LoadedImage image, ImageMap imageMap, IProcessorArchitecture arch, Platform platform) : this()
{
this.Image = image;
this.ImageMap = imageMap;
this.Architecture = arch;
this.Platform = platform;
}
开发者ID:melbcat,项目名称:reko,代码行数:7,代码来源:Program.cs
示例9: Load
public override Program Load(Address addrLoad)
{
BinHexDecoder dec = new BinHexDecoder(new StringReader(Encoding.ASCII.GetString(RawImage)));
IEnumerator<byte> stm = dec.GetBytes().GetEnumerator();
BinHexHeader hdr = LoadBinHexHeader(stm);
byte[] dataFork = LoadFork(hdr.DataForkLength, stm);
byte[] rsrcFork = LoadFork(hdr.ResourceForkLength, stm);
var arch = new M68kArchitecture();
var platform = new MacOSClassic(Services, arch);
if (hdr.FileType == "PACT")
{
Cpt.CompactProArchive archive = new Cpt.CompactProArchive();
List<ArchiveDirectoryEntry> items = archive.Load(new MemoryStream(dataFork));
IArchiveBrowserService abSvc = Services.GetService<IArchiveBrowserService>();
if (abSvc != null)
{
var selectedFile = abSvc.UserSelectFileFromArchive(items);
if (selectedFile != null)
{
var image = selectedFile.GetBytes();
this.rsrcFork = new ResourceFork(image, arch);
this.image = new LoadedImage(addrLoad, image);
this.imageMap = new ImageMap(addrLoad, image.Length);
return new Program(this.image, this.imageMap, arch, platform);
}
}
}
var li = new LoadedImage(addrLoad, dataFork);
return new Program(li, li.CreateImageMap(), arch, platform);
}
开发者ID:melbcat,项目名称:reko,代码行数:32,代码来源:BinHexImageLoader.cs
示例10: CreateTypedItem_EmptyMap
public void CreateTypedItem_EmptyMap()
{
var map = new ImageMap(addrBase, 0x0100);
Assert.AreEqual(1, map.Items.Count);
ImageMapItem item;
Assert.IsTrue(map.TryFindItemExact(addrBase, out item));
Assert.AreEqual(0x100, item.Size);
}
开发者ID:nemerle,项目名称:reko,代码行数:8,代码来源:ImageMapTests.cs
示例11: AddNamedSegment
public void AddNamedSegment()
{
ImageMap map = new ImageMap(Address.SegPtr(0x0B00, 0), 40000);
map.AddSegment(Address.SegPtr(0xC00, 0), "0C00", AccessMode.ReadWrite, 0);
IEnumerator<KeyValuePair<Address,ImageMapSegment>> e = map.Segments.GetEnumerator();
GetNextMapSegment(e);
ImageMapSegment s = GetNextMapSegment(e);
Assert.AreEqual("0C00", s.Name);
Assert.AreEqual(35904, s.Size);
}
开发者ID:nemerle,项目名称:reko,代码行数:10,代码来源:ImageMapTests.cs
示例12: CheckImageMapAddresses
private void CheckImageMapAddresses(ImageMap map, params string[] addresses)
{
int length = addresses.Length;
Assert.AreEqual(length, map.Items.Count);
for (int i = 0; i < length; i++)
{
Assert.AreEqual(addresses[i], map.Items.Keys[i].ToString());
Assert.AreEqual(addresses[i], map.Items.Values[i].Address.ToString());
}
}
开发者ID:relaxar,项目名称:reko,代码行数:10,代码来源:ImageMapTests.cs
示例13: Load
public override Program Load(Address addrLoad)
{
int iImageStart = (exe.e_cparHeader * 0x10);
int cbImageSize = exe.e_cpImage * ExeImageLoader.CbPageSize - iImageStart;
byte[] bytes = new byte[cbImageSize];
int cbCopy = Math.Min(cbImageSize, RawImage.Length - iImageStart);
Array.Copy(RawImage, iImageStart, bytes, 0, cbCopy);
imgLoaded = new LoadedImage(addrLoad, bytes);
imgLoadedMap = imgLoaded.CreateImageMap();
return new Program(imgLoaded, imgLoadedMap, arch, platform);
}
开发者ID:killbug2004,项目名称:reko,代码行数:11,代码来源:MsdosImageLoader.cs
示例14: CreateImageMapItem
private Address CreateImageMapItem(ImageMap map, DataType dt, Address addr = null)
{
addr = (addr != null) ? addr : map.Items.Keys.LastOrDefault();
var curAddr = (addr != null) ? addr : map.BaseAddress;
var size = (uint)dt.Size;
var imageMapItem = new ImageMapItem(size) { Address = curAddr };
if (dt != null)
imageMapItem.DataType = dt;
map.AddItemWithSize(curAddr, imageMapItem);
return imageMapItem.EndAddress;
}
开发者ID:relaxar,项目名称:reko,代码行数:13,代码来源:ImageMapTests.cs
示例15: CreateItem_MiddleOfEmptyRange
public void CreateItem_MiddleOfEmptyRange()
{
var map = new ImageMap(addrBase, 0x0100);
map.AddItemWithSize(
addrBase + 0x10,
new ImageMapItem(0x10) { DataType = new ArrayType(PrimitiveType.Byte, 10) });
map.Dump();
Assert.AreEqual(3, map.Items.Count);
ImageMapItem item;
Assert.IsTrue(map.TryFindItemExact(addrBase, out item));
Assert.AreEqual(0x10, item.Size);
Assert.IsInstanceOf<UnknownType>(item.DataType);
}
开发者ID:nemerle,项目名称:reko,代码行数:13,代码来源:ImageMapTests.cs
示例16: Dump
public void Dump(Program program, ImageMap map, TextWriter stm)
{
if (map == null)
{
DumpAssembler(program.Image, program.Image.BaseAddress, program.Image.BaseAddress + (uint)program.Image.Length, stm);
}
else
{
foreach (ImageMapItem i in map.Items.Values)
{
if (!program.Image.IsValidAddress(i.Address))
continue;
// Address addrLast = i.Address + i.Size;
ImageMapBlock block = i as ImageMapBlock;
if (block != null)
{
stm.WriteLine();
if (program.Procedures.ContainsKey(block.Address))
{
stm.WriteLine(block.Address.GenerateName("fn","()"));
}
else
{
stm.WriteLine(block.Address.GenerateName("l",":"));
}
DumpAssembler(program.Image, block.Address, block.Address + block.Size, stm);
continue;
}
ImageMapVectorTable table = i as ImageMapVectorTable;
if (table != null)
{
stm.WriteLine("{0} table at {1} ({2} bytes)",
table.IsCallTable?"Call":"Jump",
table.Address, table.Size);
foreach (Address addr in table.Addresses)
{
stm.WriteLine("\t{0}", addr != null ? addr.ToString() : "-- null --");
}
DumpData(program.Image, i.Address, i.Size, stm);
}
else
{
DumpData(program.Image, i.Address, i.Size, stm);
}
}
}
}
开发者ID:killbug2004,项目名称:reko,代码行数:48,代码来源:Dumper.cs
示例17: DisassemblyControlForm_Load
private void DisassemblyControlForm_Load(object sender, EventArgs e)
{
var random = new Random(0x4711);
var image = new LoadedImage(Address.Ptr32(0x00100000),
Enumerable.Range(0, 10000)
.Select(i => (byte)random.Next(256)).ToArray());
var imageMap = new ImageMap(image.BaseAddress, image.Bytes.Length);
disassemblyControl1.Model = new DisassemblyTextModel(
new CoreProgram
{
//new Decompiler.Arch.X86.X86ArchitectureFlat32();
Architecture = new Reko.Arch.PowerPC.PowerPcArchitecture32(),
Image = image,
ImageMap = imageMap
});
disassemblyControl1.StartAddress = image.BaseAddress;
}
开发者ID:gitter-badger,项目名称:reko,代码行数:17,代码来源:DisassemblyControlForm.cs
示例18: CreatePointerScanner
public override IEnumerable<Address> CreatePointerScanner(ImageMap map, ImageReader rdr, IEnumerable<Address> knownAddresses, PointerScannerFlags flags)
{
var knownLinAddresses = knownAddresses.Select(a => a.ToUInt32()).ToHashSet();
if (flags != PointerScannerFlags.Calls)
throw new NotImplementedException(string.Format("Haven't implemented support for scanning for {0} yet.", flags));
while (rdr.IsValid)
{
uint linAddrCall = rdr.Address.ToUInt32();
var opcode = rdr.ReadLeUInt32();
if ((opcode & 0x0F000000) == 0x0B000000) // BL
{
int offset = ((int)opcode << 8) >> 6;
uint target = (uint)(linAddrCall + 8 + offset);
if (knownLinAddresses.Contains(target))
yield return Address.Ptr32(linAddrCall);
}
}
}
开发者ID:gitter-badger,项目名称:reko,代码行数:18,代码来源:Arm32ProcessorArchitecture.cs
示例19: chkShowData_CheckedChanged
private void chkShowData_CheckedChanged(object sender, EventArgs e)
{
if (chkShowData.Checked)
{
var img = new LoadedImage(Address.Ptr32(0x00100000), new byte[2560]);
var imgMap = new ImageMap(img.BaseAddress, img.Length);
imgMap.AddItemWithSize(Address.Ptr32(0x00100000), new ImageMapBlock { Size = 30 });
imgMap.AddItemWithSize(Address.Ptr32(0x00100100), new ImageMapBlock { Size = 300 });
imgMap.AddItemWithSize(Address.Ptr32(0x00100500), new ImageMapBlock { Size = 600 });
memoryControl1.ProgramImage = img;
memoryControl1.Architecture = new X86ArchitectureFlat32();
imageMapView1.Image = img;
imageMapView1.ImageMap = imgMap;
}
else
{
memoryControl1.ProgramImage = null;
memoryControl1.Architecture = null;
}
}
开发者ID:gitter-badger,项目名称:reko,代码行数:22,代码来源:MemoryControlDialog.cs
示例20: CreatePointerScanner
public IEnumerable<Address> CreatePointerScanner(ImageMap map, ImageReader rdr, IEnumerable<Address> knownAddresses, PointerScannerFlags flags)
{
throw new NotImplementedException();
}
开发者ID:killbug2004,项目名称:reko,代码行数:4,代码来源:Pdp11Architecture.cs
注:本文中的ImageMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论