⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 persistentproperty.cs

📁 全功能c#编译器
💻 CS
字号:
// <file>
//     <copyright see="prj:///doc/copyright.txt"/>
//     <license see="prj:///doc/license.txt"/>
//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
//     <version value="$version"/>
// </file>
using System;
using System.IO;
using System.Reflection;
using ICSharpCode.SharpDevelop.Services;

namespace SharpDevelop.Internal.Parser
{
	public sealed class PersistentProperty : AbstractProperty
	{
		const uint canGetFlag = (uint)(1 << 29);
		const uint canSetFlag = (uint)(1 << 30);
		
		bool canGet = false;
		bool canSet = false;
		
		public override bool CanGet {
			get {
				return canGet;
			}
		}
		
		public override bool CanSet {
			get {
				return canSet;
			}
		}
		
		public PersistentProperty(BinaryReader reader, ClassProxyCollection classProxyCollection)
		{
			FullyQualifiedName = reader.ReadString();
			Documentation      = reader.ReadString();
			uint m = reader.ReadUInt32();
			modifiers          = (ModifierEnum)(m & (canGetFlag - 1));
			canGet             = (m & canGetFlag) == canGetFlag;
			canSet             = (m & canSetFlag) == canSetFlag;
			
			returnType         = new PersistentReturnType(reader, classProxyCollection);
			if (returnType.Name == null) {
				returnType = null;
			}
		}
		
		public void WriteTo(BinaryWriter writer)
		{
			writer.Write(FullyQualifiedName);
			writer.Write(Documentation);
			writer.Write((uint)modifiers + (CanGet ? canGetFlag : 0) + (CanSet ? canSetFlag : 0));
			((PersistentReturnType)returnType).WriteTo(writer);
		}
		
		public PersistentProperty(ClassProxyCollection classProxyCollection, IProperty property)
		{
			FullyQualifiedName = property.Name;
			modifiers          = property.Modifiers;
			if (property.Documentation != null) {
				Documentation = property.Documentation;
			} else {
				Documentation = String.Empty;
			}
			
			if (property.ReturnType != null) {
				returnType     = new PersistentReturnType(classProxyCollection, property.ReturnType);
			}
			region = getterRegion = setterRegion = null;
			canGet = property.CanGet;
			canSet = property.CanSet;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -