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


C# Field.Reset方法代码示例

本文整理汇总了C#中Field.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# Field.Reset方法的具体用法?C# Field.Reset怎么用?C# Field.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Field的用法示例。


在下文中一共展示了Field.Reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteFieldsRecursive

			static void WriteFieldsRecursive(IO.EndianWriter stream, Compiler comp, List<Import.Field> fields)
			{
				Field temp = new Field();
				foreach (Import.Field f in fields)
				{
					if (f.TypeIndex == comp.TypeIndexStruct)
					{
						var import = comp.OwnerState.Importer as Import;
						Import.TagStruct ts;
						// Assert that the field references a valid definition
						if (import.Structs.TryGetValue(f.Definition, out ts))
							WriteFieldsRecursive(stream, comp, ts.Fields.Fields);
						else
							Debug.Assert.If(false, "Field '{0}' references an undefined tag struct '{1}'",
								comp.Strings[f.Name], f.ToString());
					}
					else
					{
						// StringId support is a hack based on tag_reference fields
						// We internally define the tag reference definition, so we must internally add it
						if (f.TypeIndex == comp.TypeIndexStringId)
							f.ChangeDefinition(Import.kStringIdFieldDefinitionName);

						temp.Reset(f);
						temp.Write(stream);

						// While the initial part of the StringId hack is based on a tag_reference field,
						// we use an additional 32 bits for the string_id handle (instead of playing with
						// the tag_reference's tag_index member). This is seen as padding by the editor
						if (f.TypeIndex == comp.TypeIndexStringId)
						{
							temp.Reset((comp.OwnerState.Importer as Halo1.CheApe.Import).StringIdFieldHandlePadding);
							temp.Write(stream);
						}
					}
				}
			}
开发者ID:CodeAsm,项目名称:open-sauce,代码行数:37,代码来源:Compiler.cs

示例2: Write

			public override void Write(IO.EndianWriter stream)
			{
				Compiler comp = stream.Owner as Compiler;

				#region Fields
				#region Byte swap codes
				/*
				uint fieldBSCodesAddress = stream.PositionUnsigned;
				stream.Write(comp.OwnerState.Definition.FieldTypes[comp.TypeIndexArrayStart].ByteSwapCodes[0]);
				stream.Write((int)1); // array count
				foreach (Import.Field f in fieldSet.Fields)
				{
					if (f.TypeIndex == comp.TypeIndexUselessPad) continue;
					else if (f.TypeIndex == comp.TypeIndexPad || f.TypeIndex == comp.TypeIndexSkip)
						stream.Write(f.ToInt());
					else
						foreach (int x in comp.OwnerState.Definition.FieldTypes[f.TypeIndex].ByteSwapCodes)
							if (x != 0)
								stream.Write(x);
				}
				stream.Write(comp.OwnerState.Definition.FieldTypes[comp.TypeIndexArrayEnd].ByteSwapCodes[0]);
				*/
				#endregion

				uint fieldsAddress = stream.PositionUnsigned;
				Field temp = new Field();
				foreach (Import.Field f in fieldSet.Fields)
				{
					temp.Reset(f);
					temp.Write(stream);
				}
				stream.Write(comp.TypeIndexTerminator); stream.Write((int)0); stream.Write((int)0); stream.Write((int)0);
				#endregion

				int field_set_size = fieldSet.CalculateSize(comp.OwnerState);

				stream.WritePointer(fieldsAddress);
				stream.Write((int)0);
				stream.Write((int)0);
				stream.Write((int)0);
				stream.Write(uint.MaxValue);
				stream.Write(field_set_size);
				stream.Write((int)0);
				stream.Write((int)0);
				stream.WritePointer(fieldsAddress);
				stream.Write(comp.Strings.GetNull());

				stream.Write(comp.Strings.GetNull());
				stream.Write(field_set_size);
				stream.Write((int)0);//stream.WritePointer(fieldBSCodesAddress);
				MiscGroups.bysw.Write(stream);
				stream.Write((int)0/*1*/);

				stream.Write((int)0);
				stream.Write((int)0);
				stream.Write((int)0);
				stream.Write((int)0);
			}
开发者ID:CodeAsm,项目名称:open-sauce,代码行数:58,代码来源:Compiler.cs


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