• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IImageStream类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IImageStream的典型用法代码示例。如果您正苦于以下问题:C# IImageStream类的具体用法?C# IImageStream怎么用?C# IImageStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IImageStream类属于命名空间,在下文中一共展示了IImageStream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ImageStreamIStream

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="stream">Source stream</param>
 /// <param name="name">Name of original file or <c>null</c> if unknown.</param>
 public ImageStreamIStream(IImageStream stream, string name)
 {
     if (stream == null)
         throw new ArgumentNullException("stream");
     this.stream = stream;
     this.name = name ?? string.Empty;
 }
开发者ID:bprg,项目名称:dnlib,代码行数:12,代码来源:ImageStreamIStream.cs


示例2: Populate

		void Populate(IImageStream reader) {
			var chars = new char[0x200];
			reader.Position = 1;
			while (reader.Position < reader.Length) {
				uint offset = (uint)reader.Position;
				uint len;
				if (!reader.ReadCompressedUInt32(out len)) {
					if (offset == reader.Position)
						reader.Position++;
					continue;
				}
				if (len == 0 || reader.Position + len > reader.Length)
					continue;

				int stringLen = (int)len / 2;
				if (stringLen > chars.Length)
					Array.Resize(ref chars, stringLen);
				for (int i = 0; i < stringLen; i++)
					chars[i] = (char)reader.ReadUInt16();
				if ((len & 1) != 0)
					reader.ReadByte();
				var s = new string(chars, 0, stringLen);

				if (!cachedDict.ContainsKey(s))
					cachedDict[s] = offset;
			}
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:27,代码来源:USHeap.cs


示例3: AddToFavorites

        public void AddToFavorites(IImageStream stream)
        {
            // TODO:
            // make an autopersistable stream feature

            var dirStream = stream as DirectoryImageStream;
            if (dirStream != null)
            {
                var db = DAL.DatabaseService.GetInstance();
                using (var transaction = db.BeginTransaction())
                {
                    var folderRef = new DAL.FolderRefEntity();
                    folderRef.Path = dirStream.Path;

                    DAL.DatabaseService.FolderRefRepository.Write(folderRef);

                    var fav_item = new DAL.FavoritesStreamReference();
                    fav_item.id = folderRef.Key;
                    fav_item.TableName = "folder_refs";

                    DAL.DatabaseService.FavoritesRepository.Write(fav_item);

                    db.CommitTransaction();

                }

            }
        }
开发者ID:EvilBeaver,项目名称:PhotoTagManager,代码行数:28,代码来源:FavoritesImageStream.cs


示例4: Create

		/// <summary>
		/// Creates a <see cref="HotStream"/> instance
		/// </summary>
		/// <param name="version">Hot heap version</param>
		/// <param name="imageStream">Heap stream</param>
		/// <param name="streamHeader">Stream header info</param>
		/// <param name="fullStream">Stream for the full PE file</param>
		/// <param name="baseOffset">Offset in <paramref name="fullStream"/> where the data starts</param>
		/// <returns>A <see cref="HotStream"/> instance or <c>null</c> if <paramref name="version"/>
		/// is invalid</returns>
		public static HotStream Create(HotHeapVersion version, IImageStream imageStream, StreamHeader streamHeader, IImageStream fullStream, FileOffset baseOffset) {
			switch (version) {
			case HotHeapVersion.CLR20: return new HotStreamCLR20(imageStream, streamHeader, fullStream, baseOffset);
			case HotHeapVersion.CLR40: return new HotStreamCLR40(imageStream, streamHeader, fullStream, baseOffset);
			default: return null;
			}
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:17,代码来源:HotStream.cs


示例5: ReadLines

		void ReadLines(PdbReader reader, IImageStream stream) {
			var docs = new Dictionary<long, DbiDocument>();

			stream.Position = 0;
			while (stream.Position < stream.Length) {
				var sig = (ModuleStreamType)stream.ReadUInt32();
				var size = stream.ReadUInt32();
				var begin = stream.Position;
				var end = (begin + size + 3) & ~3;

				if (sig == ModuleStreamType.FileInfo)
					ReadFiles(reader, docs, stream, end);

				stream.Position = end;
			}

			var sortedFuncs = new DbiFunction[Functions.Count];
			Functions.CopyTo(sortedFuncs, 0);
			Array.Sort(sortedFuncs, (a, b) => a.Address.CompareTo(b.Address));

			stream.Position = 0;
			while (stream.Position < stream.Length) {
				var sig = (ModuleStreamType)stream.ReadUInt32();
				var size = stream.ReadUInt32();
				var begin = stream.Position;
				var end = begin + size;

				if (sig == ModuleStreamType.Lines)
					ReadLines(sortedFuncs, docs, stream, end);

				stream.Position = end;
			}
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:33,代码来源:DbiModule.cs


示例6: Add

		/// <summary>
		/// Adds a resource
		/// </summary>
		/// <param name="stream">The resource data</param>
		/// <returns>The resource data</returns>
		public ByteArrayChunk Add(IImageStream stream) {
			if (setOffsetCalled)
				throw new InvalidOperationException("SetOffset() has already been called");
			var rawData = stream.ReadAllBytes();
			length = Utils.AlignUp(length + 4 + (uint)rawData.Length, alignment);
			var data = new ByteArrayChunk(rawData);
			resources.Add(data);
			return data;
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:14,代码来源:NetResources.cs


示例7: CreateImageOptionalHeader

		/// <summary>
		/// Creates an IImageOptionalHeader
		/// </summary>
		/// <param name="reader">PE file reader pointing to the start of the optional header</param>
		/// <param name="verify">Verify section</param>
		/// <returns>The created IImageOptionalHeader</returns>
		/// <exception cref="BadImageFormatException">Thrown if verification fails</exception>
		IImageOptionalHeader CreateImageOptionalHeader(IImageStream reader, bool verify) {
			ushort magic = reader.ReadUInt16();
			reader.Position -= 2;
			switch (magic) {
			case 0x010B: return new ImageOptionalHeader32(reader, imageFileHeader.SizeOfOptionalHeader, verify);
			case 0x020B: return new ImageOptionalHeader64(reader, imageFileHeader.SizeOfOptionalHeader, verify);
			default: throw new BadImageFormatException("Invalid optional header magic");
			}
		}
开发者ID:xingkongtianyu,项目名称:Protect.NET,代码行数:16,代码来源:ImageNTHeaders.cs


示例8: ImageNTHeaders

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="reader">PE file reader pointing to the start of this section</param>
		/// <param name="verify">Verify section</param>
		/// <exception cref="BadImageFormatException">Thrown if verification fails</exception>
		public ImageNTHeaders(IImageStream reader, bool verify) {
			SetStartOffset(reader);
			this.signature = reader.ReadUInt32();
			if (verify && this.signature != 0x4550)
				throw new BadImageFormatException("Invalid NT headers signature");
			this.imageFileHeader = new ImageFileHeader(reader, verify);
			this.imageOptionalHeader = CreateImageOptionalHeader(reader, verify);
			SetEndoffset(reader);
		}
开发者ID:xingkongtianyu,项目名称:Protect.NET,代码行数:15,代码来源:ImageNTHeaders.cs


示例9: StreamHeader

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="reader">PE file reader pointing to the start of this section</param>
		/// <param name="verify">Verify section</param>
		/// <exception cref="BadImageFormatException">Thrown if verification fails</exception>
		public StreamHeader(IImageStream reader, bool verify) {
			SetStartOffset(reader);
			this.offset = reader.ReadUInt32();
			this.streamSize = reader.ReadUInt32();
			this.name = ReadString(reader, 32, verify);
			SetEndoffset(reader);
			if (verify && offset + size < offset)
				throw new BadImageFormatException("Invalid stream header");
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:15,代码来源:StreamHeader.cs


示例10: ImageDosHeader

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="reader">PE file reader</param>
		/// <param name="verify">Verify section</param>
		/// <exception cref="BadImageFormatException">Thrown if verification fails</exception>
		public ImageDosHeader(IImageStream reader, bool verify) {
			SetStartOffset(reader);
			ushort sig = reader.ReadUInt16();
			if (verify && sig != 0x5A4D)
				throw new BadImageFormatException("Invalid DOS signature");
			reader.Position = (long)startOffset + 0x3C;
			this.ntHeadersOffset = reader.ReadUInt32();
			SetEndoffset(reader);
		}
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:15,代码来源:ImageDosHeader.cs


示例11: MsfStream

		public MsfStream(IImageStream[] pages, uint length) {
			byte[] buf = new byte[length];
			int offset = 0;
			foreach (var page in pages) {
				page.Position = 0;
				int len = Math.Min((int)page.Length, (int)(length - offset));
				offset += page.Read(buf, offset, len);
			}
			Content = new MemoryImageStream(0, buf, 0, buf.Length);
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:10,代码来源:MsfStream.cs


示例12: LoadFunctions

		public void LoadFunctions(PdbReader reader, IImageStream stream) {
			stream.Position = 0;
			using (var substream = stream.Create(stream.FileOffset + stream.Position, cbSyms))
				ReadFunctions(substream);

			if (Functions.Count > 0) {
				stream.Position += cbSyms + cbOldLines;
				using (var substream = stream.Create(stream.FileOffset + stream.Position, cbLines))
					ReadLines(reader, substream);
			}
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:11,代码来源:DbiModule.cs


示例13: GetReader_NoLock

		int GetReader_NoLock(uint offset, out IImageStream reader) {
			reader = null;
			if (!IsValidOffset(offset))
				return -1;
			reader = GetReader_NoLock(offset);
			uint length;
			if (!reader.ReadCompressedUInt32(out length))
				return -1;
			if (reader.Position + length < length || reader.Position + length > reader.Length)
				return -1;

			return (int)length;	// length <= 0x1FFFFFFF so this cast does not make it negative
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:13,代码来源:BlobStream.cs


示例14: ImageFileHeader

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="reader">PE file reader pointing to the start of this section</param>
		/// <param name="verify">Verify section</param>
		/// <exception cref="BadImageFormatException">Thrown if verification fails</exception>
		public ImageFileHeader(IImageStream reader, bool verify) {
			SetStartOffset(reader);
			this.machine = (Machine)reader.ReadUInt16();
			this.numberOfSections = reader.ReadUInt16();
			this.timeDateStamp = reader.ReadUInt32();
			this.pointerToSymbolTable = reader.ReadUInt32();
			this.numberOfSymbols = reader.ReadUInt32();
			this.sizeOfOptionalHeader = reader.ReadUInt16();
			this.characteristics = (Characteristics)reader.ReadUInt16();
			SetEndoffset(reader);
			if (verify && this.sizeOfOptionalHeader == 0)
				throw new BadImageFormatException("Invalid SizeOfOptionalHeader");
		}
开发者ID:xingkongtianyu,项目名称:Protect.NET,代码行数:19,代码来源:ImageFileHeader.cs


示例15: Read

		public void Read(IImageStream stream) {
			stream.Position = 0;
			Language = new Guid(stream.ReadBytes(0x10));
			LanguageVendor = new Guid(stream.ReadBytes(0x10));
			DocumentType = new Guid(stream.ReadBytes(0x10));
			CheckSumAlgorithmId = new Guid(stream.ReadBytes(0x10));

			var len = stream.ReadInt32();
			if (stream.ReadUInt32() != 0)
				throw new PdbException("Unexpected value");

			CheckSum = stream.ReadBytes(len);
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:13,代码来源:DbiDocument.cs


示例16: PEInfo

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="reader">PE file reader pointing to the start of this section</param>
		/// <param name="verify">Verify sections</param>
		/// <exception cref="BadImageFormatException">Thrown if verification fails</exception>
		public PEInfo(IImageStream reader, bool verify) {
			reader.Position = 0;
			this.imageDosHeader = new ImageDosHeader(reader, verify);

			if (verify && this.imageDosHeader.NTHeadersOffset == 0)
				throw new BadImageFormatException("Invalid NT headers offset");
			reader.Position = this.imageDosHeader.NTHeadersOffset;
			this.imageNTHeaders = new ImageNTHeaders(reader, verify);

			reader.Position = (long)this.imageNTHeaders.OptionalHeader.StartOffset + this.imageNTHeaders.FileHeader.SizeOfOptionalHeader;
			this.imageSectionHeaders = new ImageSectionHeader[this.imageNTHeaders.FileHeader.NumberOfSections];
			for (int i = 0; i < this.imageSectionHeaders.Length; i++)
				this.imageSectionHeaders[i] = new ImageSectionHeader(reader, verify);
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:20,代码来源:PEInfo.cs


示例17: Create

		/// <summary>
		/// Creates a new <see cref="ISymbolReader"/> instance
		/// </summary>
		/// <param name="pdbImpl">PDB implementation to use</param>
		/// <param name="metaData">.NET metadata. Only need to be non-null if MS COM API should be used</param>
		/// <param name="pdbStream">PDB file stream which is now owned by us</param>
		/// <returns>A new <see cref="ISymbolReader"/> instance or <c>null</c> if it's not possible
		/// to create a <see cref="ISymbolReader"/>.</returns>
		public static ISymbolReader Create(PdbImplType pdbImpl, IMetaData metaData, IImageStream pdbStream) {
			switch (pdbImpl) {
			case PdbImplType.MicrosoftCOM:
				return Dss.SymbolReaderCreator.Create(metaData, pdbStream);

			case PdbImplType.Managed:
				return Managed.SymbolReaderCreator.Create(pdbStream);

			default:
				if (pdbStream != null)
					pdbStream.Dispose();
				throw new InvalidOperationException();
			}
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:22,代码来源:SymbolReaderCreator.cs


示例18: Read

		public void Read(IImageStream stream, long recEnd) {
			stream.Position += 4;
			var end = stream.ReadUInt32();
			stream.Position += 4;
			var len = stream.ReadUInt32();
			stream.Position += 8;
			Token = stream.ReadUInt32();
			Address = PdbAddress.ReadAddress(stream);
			stream.Position += 1 + 2;
			Name = PdbReader.ReadCString(stream);

			stream.Position = recEnd;
			Root = new DbiScope("", Address.Offset, len);
			Root.Read(new RecursionCounter(), stream, end);
			FixOffsets(new RecursionCounter(), Root);
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:16,代码来源:DbiFunction.cs


示例19: ReadString

		static string ReadString(IImageStream reader, int maxLen, bool verify) {
			var origPos = reader.Position;
			var sb = new StringBuilder(maxLen);
			int i;
			for (i = 0; i < maxLen; i++) {
				byte b = reader.ReadByte();
				if (b == 0)
					break;
				sb.Append((char)b);
			}
			if (verify && i == maxLen)
				throw new BadImageFormatException("Invalid stream name string");
			if (i != maxLen)
				reader.Position = origPos + ((i + 1 + 3) & ~3);
			return sb.ToString();
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:16,代码来源:StreamHeader.cs


示例20: Read

		/// <summary>
		/// Read the PDB in the specified stream.
		/// </summary>
		/// <param name="stream">The stream that contains the PDB file</param>
		public void Read(IImageStream stream) {
			try {
				ReadInternal(stream);
			}
			catch (Exception ex) {
				if (ex is PdbException)
					throw;
				throw new PdbException(ex);
			}
			finally {
				streams = null;
				names = null;
				strings = null;
				modules = null;
			}
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:20,代码来源:PdbReader.cs



注:本文中的IImageStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IImmutableSet类代码示例发布时间:2022-05-24
下一篇:
C# IImageService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap