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


C# IReader类代码示例

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


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


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