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

C# IReader类代码示例

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

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



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

示例1: StartGame_WithInInvalidCommand_ShouldNotThrow

        public void StartGame_WithInInvalidCommand_ShouldNotThrow()
        {
            this.mockReader = new MockIReader("invalid").GetSpecialReader("invalid");
            var engine = new GameEngine(this.gameLogic, this.mockPrinter, this.mockReader, this.db, this.topScoreController, this.gamesController);

            engine.StartGame();
        }
开发者ID:Baloons-Pop-3,项目名称:Baloons-Pop-Three,代码行数:7,代码来源:GameEngineTests.cs


示例2: Core

 public Core(ILogicController controller, IReader reader, IWriter writer, IGameInstance game)
 {
     this.controller = controller;
     this.reader = reader;
     this.writer = writer;
     this.game = game;
 }
开发者ID:TemplarRei,项目名称:Battle-Field-3,代码行数:7,代码来源:Core.cs


示例3: ThirdGenCacheFile

		public ThirdGenCacheFile(IReader reader, EngineDescription buildInfo, string buildString)
		{
			_buildInfo = buildInfo;
			_segmenter = new FileSegmenter(buildInfo.SegmentAlignment);
			Allocator = new MetaAllocator(this, 0x10000);
			Load(reader, buildString);
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:7,代码来源:ThirdGenCacheFile.cs


示例4: StructureReader

        private long _offset; // The offset that the reader is currently at

        #endregion Fields

        #region Constructors

        /// <summary>
        ///     (private) Constructs a new StructureReader.
        /// </summary>
        /// <param name="reader">The IReader to read from.</param>
        private StructureReader(IReader reader)
        {
            _reader = reader;
            _baseOffset = reader.Position;
            _offset = _baseOffset;
            _collection = new StructureValueCollection();
        }
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:17,代码来源:StructureReader.cs


示例5: ReadBlocks

		private static void ReadBlocks(IReader reader, ContainerReader containerFile, TagContainer tags)
		{
			while (containerFile.NextBlock())
			{
				switch (containerFile.BlockName)
				{
					case "data":
						// Data block
						tags.AddDataBlock(ReadDataBlock(reader, containerFile.BlockVersion));
						break;

					case "tag!":
						// Extracted tag
						tags.AddTag(ReadTag(reader, containerFile.BlockVersion));
						break;

					case "ersp":
						// Extracted Raw Resource Page
						tags.AddExtractedResourcePage(ReadExtractedResourcePage(reader, containerFile.BlockVersion));
						break;

					case "rspg":
						// Resource page
						tags.AddResourcePage(ReadResourcePage(reader, containerFile.BlockVersion));
						break;

					case "rsrc":
						// Resource info
						tags.AddResource(ReadResource(reader, containerFile.BlockVersion));
						break;
				}
			}
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:33,代码来源:TagContainerReader.cs


示例6: FourthGenCacheFile

        public FourthGenCacheFile(IReader map_reader, IReader tag_reader, IReader string_reader, IReader tagnames_reader, EngineDescription buildInfo, string buildString)
		{
			_buildInfo = buildInfo;
			_segmenter = new FileSegmenter(buildInfo.SegmentAlignment);
			Allocator = new MetaAllocator(this, 0x10000);
            Load(map_reader, tag_reader, string_reader, tagnames_reader, buildString);
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:7,代码来源:FourthGenCacheFile.cs


示例7: GetTagAddress

        public static uint GetTagAddress(IReader memoryReader, ushort index, uint exeBase)
        {
            //uint newcountaddr = MaxTagCountAddress;
            // Read the tag count and validate the tag index
            memoryReader.SeekTo(MaxTagCountAddress + exeBase);
            var maxIndex = memoryReader.ReadUInt16();
            if (index >= maxIndex)
                return 0;

            // Read the tag index table to get the index of the tag in the address table
            memoryReader.SeekTo(TagIndexArrayPointerAddress + exeBase);
            var tagIndexTableAddress = memoryReader.ReadUInt32();
            if (tagIndexTableAddress == 0)
                return 0;
            memoryReader.SeekTo(tagIndexTableAddress + index * 4);
            var addressIndex = memoryReader.ReadInt32();
            if (addressIndex < 0)
                return 0;

            // Read the tag's address in the address table
            memoryReader.SeekTo(TagAddressArrayPointerAddress + exeBase);
            var tagAddressTableAddress = memoryReader.ReadUInt32();
            if (tagAddressTableAddress == 0)
                return 0;
            memoryReader.SeekTo(tagAddressTableAddress + addressIndex * 4);
            return memoryReader.ReadUInt32();
        }
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:27,代码来源:EldoradoRTEProvider.cs


示例8: CompareSegments

        /// <summary>
        ///     Compares two sets of file segments and the segment contents.
        /// </summary>
        /// <param name="originalSegments">The original set of file segments.</param>
        /// <param name="originalReader">The stream to use to read from the original file.</param>
        /// <param name="newSegments">The modified set of file segments.</param>
        /// <param name="newReader">The stream to use to read from the modified file.</param>
        /// <returns>The differences that were found.</returns>
        public static List<SegmentChange> CompareSegments(IEnumerable<FileSegment> originalSegments, IReader originalReader,
			IEnumerable<FileSegment> newSegments, IReader newReader)
        {
            List<FileSegment> originalList = originalSegments.ToList();
            List<FileSegment> newList = newSegments.ToList();

            if (originalList.Count != newList.Count)
                throw new InvalidOperationException("The files have different segment counts");

            var results = new List<SegmentChange>();
            for (int i = 0; i < originalList.Count; i++)
            {
                FileSegment originalSegment = originalList[i];
                FileSegment newSegment = newList[i];
                List<DataChange> changes = DataComparer.CompareData(originalReader, (uint) originalSegment.Offset,
                    originalSegment.ActualSize, newReader, (uint) newSegment.Offset, newSegment.ActualSize,
                    originalSegment.ResizeOrigin != SegmentResizeOrigin.Beginning);
                if (changes.Count > 0 || originalSegment.Size != newSegment.Size)
                {
                    var change = new SegmentChange((uint) originalSegment.Offset, originalSegment.ActualSize, (uint) newSegment.Offset,
                        newSegment.ActualSize, originalSegment.ResizeOrigin != SegmentResizeOrigin.Beginning);
                    change.DataChanges.AddRange(changes);
                    results.Add(change);
                }
            }
            return results;
        }
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:35,代码来源:SegmentComparer.cs


示例9: EventEngine

 public EventEngine(IReader reader, IWriter writer, IEventHolder eventHolder, IEventLogger eventLogger)
 {
     this.reader = reader;
     this.writer = writer;
     this.eventHolder = eventHolder;
     this.eventLogger = eventLogger;
 }
开发者ID:AlexanderDimitrov,项目名称:HighQualityCode,代码行数:7,代码来源:EventEngine.cs


示例10: Parse

        public IModel Parse(IReader reader)
        {
            int numLines;
            if (lineMatcher.Matches(reader, 0, out numLines))
            {
                string[] lines = reader.ReadLines(numLines);
                int lineNo = 0;
                List<string> data = new List<string>();
                List<string> comment = new List<string>();
                foreach (string line in lines)
                {
                    string dataLine = dataParser.Parse(lineNo, line);
                    if (!string.IsNullOrEmpty(dataLine))
                    {
                        data.Add(dataLine);
                    }

                    string commentLine = commentParser.Parse(lineNo, line);
                    if (!string.IsNullOrEmpty(commentLine))
                    {
                        comment.Add(commentLine);
                    }
                    lineNo++;
                }

                IModel model = modelFactory(name, string.Join(" ", data), string.Join("\n", comment));

                if (impliedModelParsers != null)
                {
                    return impliedModelParsers.Aggregate(model, (current, impliedParser) => impliedParser.Matches(current) ? impliedParser.Parse(current) : current);
                }
                return model;
            }
            return null;
        }
开发者ID:JoePlant,项目名称:ellipse-data-dictionary,代码行数:35,代码来源:SingleLineParser.cs


示例11: Parse

        public IModel Parse(IReader reader)
        {
            IModel currentModel = modelParser.Parse(reader);
            IModel childModel = childrenParser.Parse(reader);

            List<IModel> children = new List<IModel>();
            while (childModel != null)
            {
                children.Add(childModel);
                childModel = childrenParser.Parse(reader);
            }

            HierarchyModel currentHierarchy = currentModel as HierarchyModel;
            if (currentHierarchy != null && children.Count > 0)
            {
                if (currentHierarchy.ChildModels.Length == 1)
                {
                    return new HierarchyModel(currentHierarchy.Model, new IModel[]
                        {
                            new HierarchyModel(currentHierarchy.ChildModels[0], children.ToArray())
                        });
                }
            }
            return children.Count == 0 ? currentModel : new HierarchyModel(currentModel, children.ToArray());
        }
开发者ID:JoePlant,项目名称:ellipse-data-dictionary,代码行数:25,代码来源:HierarchyParser.cs


示例12: ThirdGenLanguagePackLoader

        /// <summary>
        ///     Initializes a new instance of the <see cref="ThirdGenLanguagePackLoader" /> class.
        /// </summary>
        /// <param name="cacheFile">The cache file.</param>
        /// <param name="languageGlobals">The language globals.</param>
        /// <param name="buildInfo">Information about the cache file's engine.</param>
        /// <param name="reader">The stream to read from.</param>
        public ThirdGenLanguagePackLoader(ICacheFile cacheFile, ThirdGenLanguageGlobals languageGlobals,
			EngineDescription buildInfo, IReader reader)
        {
            _languageGlobals = languageGlobals;
            _languages = languageGlobals.Languages.Where(l => l.StringCount != 0).Select(l => l.Language).ToList();
            LoadGroups(reader, cacheFile, buildInfo);
        }
开发者ID:ChadSki,项目名称:Assembly,代码行数:14,代码来源:ThirdGenLanguagePackLoader.cs


示例13: ReadPatchInfo

		private static void ReadPatchInfo(IReader reader, byte version, Patch output)
		{
			// Version 0 (all versions)
			output.MapID = reader.ReadInt32();
			output.MapInternalName = reader.ReadAscii();
			output.Name = reader.ReadUTF16();
			output.Description = reader.ReadUTF16();
			output.Author = reader.ReadUTF16();

			int screenshotLength = reader.ReadInt32();
			if (screenshotLength > 0)
				output.Screenshot = reader.ReadBlock(screenshotLength);

			// Version 1
			if (version >= 1)
			{
				output.MetaPokeBase = reader.ReadUInt32();
				output.MetaChangesIndex = reader.ReadSByte();
			}

			// Version 2
			if (version >= 2)
				output.OutputName = reader.ReadAscii();
			else
				output.OutputName = "";
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:26,代码来源:AssemblyPatchLoader.cs


示例14: ReadBlocks

		private static Patch ReadBlocks(IReader reader, ContainerReader container)
		{
			var result = new Patch();
			while (container.NextBlock())
			{
				switch (container.BlockName)
				{
					case "titl":
						ReadPatchInfo(reader, container.BlockVersion, result);
						break;

					case "segm":
						ReadSegmentChanges(reader, result);
						break;

					case "blfc":
						ReadBlfInfo(reader, result);
						break;

						#region Deprecated

					case "meta":
						ReadMetaChanges(reader, result);
						break;

					case "locl":
						ReadLocaleChanges(reader, result);
						break;

						#endregion Deprecated
				}
			}
			return result;
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:34,代码来源:AssemblyPatchLoader.cs


示例15: LoadPatch

        public static Patch LoadPatch(IReader reader, bool isAlteration)
        {
            Patch patch = new Patch();
            SegmentChange change = new SegmentChange(0, 0, 0, 0, true);
            patch.Author = "Ascension/Alteration Patch";
            patch.Description = "Ascension/Alteration Patch";
            if (isAlteration)
            {
                //do shitty alteration stuff
                byte authorLength = reader.ReadByte();
                patch.Author = reader.ReadAscii((int)authorLength);
                byte descLength = reader.ReadByte();
                patch.Description = reader.ReadAscii((int)descLength);

            }
            //create ascension patch object and change segment

            while (!reader.EOF)
            {
                //get valuable info
                var segmentOffset = reader.ReadUInt32();
                var segmentSize = reader.ReadInt32();
                var segmentData = reader.ReadBlock(segmentSize);

                //Add change data

                change.DataChanges.Add(new DataChange(segmentOffset, segmentData));

            }
            patch.SegmentChanges.Add(change);
            return patch;
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:32,代码来源:OldPatchLoader.cs


示例16: LoadContext

        public ScriptContext LoadContext(IReader reader)
        {
            var values = LoadTag(reader);

            return new ScriptContext()
            {
                ObjectReferences     = ReadObjects(reader, values, _referencedObjects),
                TriggerVolumes       = ReadObjects(reader, values, _triggerVolumes),
                CutsceneFlags        = ReadObjects(reader, values, _cutsceneFlags),
                CutsceneCameraPoints = ReadObjects(reader, values, _cutsceneCameraPoints),
                CutsceneTitles       = ReadObjects(reader, values, _cutsceneTitles),
                DeviceGroups         = ReadObjects(reader, values, _deviceGroups),
                AISquadGroups        = ReadObjects(reader, values, _aiSquadGroups),
                AISquads             = ReadObjects(reader, values, _aiSquads),
                AIObjects            = ReadObjects(reader, values, _aiObjects),
                StartingProfiles     = ReadObjects(reader, values, _startingProfiles),
                ZoneSets             = ReadObjects(reader, values, _zoneSets),
                ObjectFolders        = ReadObjects(reader, values, _objectFolders),
                PointSets            = ReadPointSets(reader, values),

                AISquadSingleLocations = _aiSquadSingleLocations,
                AIObjectWaves          = _aiObjectWaves,
                PointSetPoints         = _pointSetPoints
            };
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:25,代码来源:ThirdGenScenarioScriptFile.cs


示例17: ReadVertexBuffers

		/// <summary>
		///     Reads the vertex buffers for a model from a stream and passes them to an IModelProcessor.
		/// </summary>
		/// <param name="reader">The stream to read the vertex buffers from.</param>
		/// <param name="model">The model's metadata.</param>
		/// <param name="sectionsToRead">
		///     A BitArray controlling which sections to read. Indices which are set to to true will be
		///     read.
		/// </param>
		/// <param name="buildInfo">Information about the cache file's target engine.</param>
		/// <param name="processor">The IModelProcessor to pass the read model data to.</param>
		private static void ReadVertexBuffers(IReader reader, IRenderModel model, BitArray sectionsToRead,
			EngineDescription buildInfo, IModelProcessor processor)
		{
			for (int i = 0; i < model.Sections.Length; i++)
				ReadSectionVertices(reader, model.Sections[i], model.BoundingBoxes[0], buildInfo,
					sectionsToRead[i] ? processor : null);
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:18,代码来源:ModelReader.cs


示例18: LoadCacheFile

        /// <summary>
        ///     Loads a cache file from a stream.
        /// </summary>
        /// <param name="reader">The stream to read from.</param>
        /// <param name="engineDb">The engine database to use to process the cache file.</param>
        /// <param name="engineInfo">On output, this will contain the cache file's engine description.</param>
        /// <returns>The cache file that was loaded.</returns>
        /// <exception cref="ArgumentException">Thrown if the cache file is invalid.</exception>
        /// <exception cref="NotSupportedException">Thrown if the cache file's target engine is not supported.</exception>
        public static ICacheFile LoadCacheFile(IReader reader, EngineDatabase engineDb, out EngineDescription engineInfo)
        {
            // Set the reader's endianness based upon the file's header magic
            reader.SeekTo(0);
            byte[] headerMagic = reader.ReadBlock(4);
            reader.Endianness = DetermineCacheFileEndianness(headerMagic);

            // Load engine version info
            var version = new CacheFileVersionInfo(reader);
            if (version.Engine != EngineType.SecondGeneration && version.Engine != EngineType.ThirdGeneration)
                throw new NotSupportedException("Engine not supported");

            // Load build info
            engineInfo = engineDb.FindEngineByVersion(version.BuildString);
            if (engineInfo == null)
                throw new NotSupportedException("Engine version \"" + version.BuildString + "\" not supported");

            // Load the cache file depending upon the engine version
            switch (version.Engine)
            {
                case EngineType.SecondGeneration:
                    return new SecondGenCacheFile(reader, engineInfo, version.BuildString);

                case EngineType.ThirdGeneration:
                    return new ThirdGenCacheFile(reader, engineInfo, version.BuildString);

                default:
                    throw new NotSupportedException("Engine not supported");
            }
        }
开发者ID:ChadSki,项目名称:Assembly,代码行数:39,代码来源:CacheFileLoader.cs


示例19: CSVReaderWriter

        public CSVReaderWriter(IReader readerStream)
        {
            WriterStream = null;
            readerStream.ThrowIfNull("readerStream");

            ReaderStream = readerStream;
        }
开发者ID:dminik,项目名称:AddressProcessor,代码行数:7,代码来源:CSVReaderWriter.cs


示例20: SetUp

        public void SetUp()
        {
            _reader = MockRepository.GenerateStub<IReader<Artist>>();
            _writer = MockRepository.GenerateStub<IWriter<Artist>>();

            _operationOutput = new ExceptionOperationOutput();
        }
开发者ID:gregsochanik,项目名称:RESTfulService,代码行数:7,代码来源:ArtistHandlerPutTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IRealmClient类代码示例发布时间:2022-05-24
下一篇:
C# IReadOnlyList类代码示例发布时间: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