本文整理汇总了C#中ImageMap类的典型用法代码示例。如果您正苦于以下问题:C# ImageMap类的具体用法?C# ImageMap怎么用?C# ImageMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageMap类属于命名空间,在下文中一共展示了ImageMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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);
}
示例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());
}
示例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));
}
}
示例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);
}
示例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");
}
示例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());
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
}
示例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);
}
示例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;
}
示例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);
}