当前位置: 首页>>代码示例>>C#>>正文


C# IImageStream类代码示例

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


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


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