text:
01205 354 679 info@spcdevelopments.co.uk
Yew Gardens & Thorney Lane
The Orchards, Frampton
Clarke Close, Quadring
Tower Gardens, Sutterton
Grove House, Boston
Aaron Way Development
Caythorpe
Why Choose SPC
A collection of 8 exclusive homes in Frampton, Lincolnshire
SPC Developments Ltd are currently constructing eight exclusive and luxury homes in the village of Frampton, Lincolnshire. The site is set in a rural location with excellent countryside views, framed around the full perimeter with mature trees and hedgerows, whilst still benefitting from the local village amenities and community within a short walk. The site is split in two with the Craile Eau natural stream dissecting the land, bringing more countryside and natural views and release to your back door.
The development will be divided into two smaller separate developments due to the stream running through the land, one comprising of 4 dwellings, with a newly constructed vehicular entrance onto West End Road, and the other comprising of 4 dwellings leading out on to Bungley Lane, all to be circa 3000-3500 sq. ft each all with either integral or detached double garages, private driveways for ample parking of multiple cars, generous turfed and hard landscaped gardens, along with public and common open space areas.
* Floorplans and measurements are taken from architectural drawings and are for guidance purposes only. Computer generated images are not to scale. Finishes and materials may vary, landscaping is illustrative only.
SITE LOCATION PLAN
SEE HOUSE TYPES
Frampton is a rural village and civil parish in the Borough of Boston, Lincolnshire with excellent countryside views. The village benefits from its own local amenities as well as being situated approximately 3 miles (5 km) south of the old market town of Boston which has a mixture of independent and high street shops as well as many restaurants and coffee shops.
Frampton Marsh is a nature reserve which lies to the east of the village, between the outfalls of the River Witham (The Haven), and the River Welland. Part of the marsh belongs to the Lincolnshire Wildlife Trust, the majority being owned by the RSPB.
Land off West End Road and Bungley Lane, Kirton, Boston, Lincs, PE20 1BT
Explore Yew Gardens & Thorney Lane
Yew Gardens via Bungley Lane – Site Plan
Thorney Lane via West End Road – Site Plan
Yew Gardens & Thorney Lane House Types
Plot 1, Yew Gardens
Plot 1 will be a five bedroom detached property situated in the rural village of Frampton, Lincolnshire. This new home will feature three bathrooms as well as a downstairs WC, cloak room, garden room, generous garden and a detached double garage.
Plot 2 will be a five bedroom detached property situated in the rural village of Frampton, Lincolnshire. This new build will feature three bathrooms as well as a downstairs WC, double height dining space, garden room, generous garden and an attached double garage.
Plot 3 will be a five bedroom detached property situated in the rural village of Frampton, Lincolnshire. This new build will feature three bathrooms as well as a downstairs WC, lobby, garden room, generous garden and an attached double garage.
Plot 4 will be a five bedroom detached property situated in the rural village of Frampton, Lincolnshire. This new build will feature three bathrooms as well as a downstairs WC, garden room, generous garden and a detached double garage.
Plot 5, Thorney Lane
Plot 5 will be a five bedroom detached property situated in the rural village of Frampton, Lincolnshire. This new build will feature three bathrooms as well as a downstairs WC, office/study, generous garden and a detached double garage.
Plot 6 will be a five bedroom detached property situated in the rural village of Frampton, Lincolnshire. This new build will feature three bathrooms as well as a downstairs WC, office/study, generous garden and an attached double garage.
Plot 7 will be a five bedroom detached property situated in the rural village of Frampton, Lincolnshire. This new build will feature three bathrooms as well as a downstairs WC, double height dining space, office/study, generous garden and an attached double garage.
Speak to our sales advisor on 01205 354 679 or…
Clarke Construction
Clarke Group
Poultry Buildings
The Workshop, Slippery Gowt Lane, Wyberton, Boston, Lincolnshire, PE21 7AA
info@spcdevelopments.co.uk
© SPC Developments 2016 | TJS - Web Design Lincolnshire
Thinking of a new project? Use the handy form below to send us a message and we'll get back to you as soon as we can.
I consent to SPC Developments collecting my details through this form.
This site uses cookies, to find out more about our cookie useage click the link - More info


text:
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Threading;
using ICSharpCode.NRefactory.Documentation;
using ICSharpCode.NRefactory.Semantics;
using ICSharpCode.NRefactory.TypeSystem.Implementation;
using ICSharpCode.NRefactory.Utils;
using Mono.Cecil;

namespace ICSharpCode.NRefactory.TypeSystem
{
	/// <summary>
	/// Allows loading an IProjectContent from an already compiled assembly.
	/// </summary>
	/// <remarks>Instance methods are not thread-safe; you need to create multiple instances of CecilLoader
	/// if you want to load multiple project contents in parallel.</remarks>
	public class CecilLoader
	{
		#region Options
		/// <summary>
		/// Specifies whether to include internal members. The default is false.
		/// </summary>
		public bool IncludeInternalMembers { get; set; }

		/// <summary>
		/// Specifies whether to use lazy loading. The default is false.
		/// If this property is set to true, the CecilLoader will not copy all the relevant information
		/// out of the Cecil object model, but will maintain references to the Cecil objects.
		/// This speeds up the loading process and avoids loading unnecessary information, but it causes
		/// the Cecil objects to stay in memory (which can significantly increase memory usage).
		/// It also prevents serialization of the Cecil-loaded type system.
		/// </summary>
		/// <remarks>
		/// Because the type system can be used on multiple threads, but Cecil is not
		/// thread-safe for concurrent read access, the CecilLoader will lock on the <see cref="ModuleDefinition"/> instance
		/// for every delay-loading operation.
		/// If you access the Cecil objects directly in your application, you may need to take the same lock.
		/// </remarks>
		public bool LazyLoad { get; set; }

		/// <summary>
		/// Gets/Sets the documentation provider that is used to retrieve the XML documentation for all members.
		/// </summary>
		public IDocumentationProvider DocumentationProvider { get; set; }

		/// <summary>
		/// Gets/Sets the interning provider.
		/// </summary>
		public IInterningProvider InterningProvider { get; set; }

		/// <summary>
		/// Gets/Sets the cancellation token used by the cecil loader.
		/// </summary>
		public CancellationToken CancellationToken { get; set; }

		/// <summary>
		/// This delegate gets executed whenever an entity was loaded.
		/// </summary>
		/// <remarks>
		/// This callback may be to build a dictionary that maps between
		/// entities and cecil objects.
		/// Warning: if delay-loading is used and the type system is accessed by multiple threads,
		/// the callback may be invoked concurrently on multiple threads.
		/// </remarks>
		public Action<IUnresolvedEntity, MemberReference> OnEntityLoaded { get; set; }

		/// <summary>
		/// Gets a value indicating whether this instance stores references to the cecil objects.
		/// </summary>
		/// <value>
		/// <c>true</c> if this instance has references to the cecil objects; otherwise, <c>false</c>.
		/// </value>
		public bool HasCecilReferences { get { return typeSystemTranslationTable != null; } }
		#endregion

		ModuleDefinition currentModule;
		CecilUnresolvedAssembly currentAssembly;

		/// <summary>
		/// Initializes a new instance of the <see cref="ICSharpCode.NRefactory.TypeSystem.CecilLoader"/> class.
		/// </summary>
		public CecilLoader()
		{
			// Enable interning by default.
			this.InterningProvider = new SimpleInterningProvider();
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="ICSharpCode.NRefactory.TypeSystem.CecilLoader"/> class.
		/// </summary>
		/// <param name='createCecilReferences'>
		/// If true references to the cecil objects are hold. In this case the cecil loader can do a type system -> cecil mapping.
		/// </param>
		[Obsolete("The built-in entity<->cecil mapping is obsolete. Use the OnEntityLoaded callback instead!")]
		public CecilLoader(bool createCecilReferences) : this()
		{
			if (createCecilReferences)
				typeSystemTranslationTable = new Dictionary<object, object> ();
		}

		/// <summary>
		/// Creates a nested CecilLoader for lazy-loading.
		/// </summary>
		private CecilLoader(CecilLoader loader)
		{
			// use a shared typeSystemTranslationTable
			this.typeSystemTranslationTable = loader.typeSystemTranslationTable;
			this.IncludeInternalMembers = loader.IncludeInternalMembers;
			this.LazyLoad = loader.LazyLoad;
			this.OnEntityLoaded = loader.OnEntityLoaded;
			this.currentModule = loader.currentModule;
			this.currentAssembly = loader.currentAssembly;
			// don't use interning - the interning provider is most likely not thread-safe
			// don't use cancellation for delay-loaded members
		}

		#region Load From AssemblyDefinition
		/// <summary>
		/// Loads the assembly definition into a project content.
		/// </summary>
		/// <returns>IProjectContent that represents the assembly</returns>
		[CLSCompliant(false)]
		public IUnresolvedAssembly LoadAssembly(AssemblyDefinition assemblyDefinition)
		{
			if (assemblyDefinition == null)
				throw new ArgumentNullException("assemblyDefinition");

			this.currentModule = assemblyDefinition.MainModule;

			// Read assembly and module attributes
			IList<IUnresolvedAttribute> assemblyAttributes = new List<IUnresolvedAttribute>();
			IList<IUnresolvedAttribute> moduleAttributes = new List<IUnresolvedAttribute>();
			AddAttributes(assemblyDefinition, assemblyAttributes);
			AddAttributes(assemblyDefinition.MainModule, moduleAttributes);

			if (this.InterningProvider != null) {
				assemblyAttributes = this.InterningProvider.InternList(assemblyAttributes);
				moduleAttributes = this.InterningProvider.InternList(moduleAttributes);
			}

			this.currentAssembly = new CecilUnresolvedAssembly(assemblyDefinition.Name.Name, this.DocumentationProvider);
			currentAssembly.Location = assemblyDefinition.MainModule.FullyQualifiedName;
			currentAssembly.AssemblyAttributes.AddRange(assemblyAttributes);
			currentAssembly.ModuleAttributes.AddRange(assemblyAttributes);

			// Register type forwarders:
			foreach (ExportedType type in assemblyDefinition.MainModule.ExportedTypes) {
				if (type.IsForwarder) {
					int typeParameterCount;
					string name = ReflectionHelper.SplitTypeParameterCountFromReflectionName(type.Name, out typeParameterCount);
					var typeRef = new GetClassTypeReference(GetAssemblyReference(type.Scope), type.Namespace, name, typeParameterCount);
					if (this.InterningProvider != null)
						typeRef = this.InterningProvider.Intern(typeRef);
					var key = new FullNameAndTypeParameterCount(type.Namespace, name, typeParameterCount);
					currentAssembly.AddTypeForwarder(key, typeRef);
				}
			}

			// Create and register all types:
			CecilLoader cecilLoaderCloneForLazyLoading = LazyLoad ? new CecilLoader(this) : null;
			List<TypeDefinition> cecilTypeDefs = new List<TypeDefinition>();
			List<DefaultUnresolvedTypeDefinition> typeDefs = new List<DefaultUnresolvedTypeDefinition>();
			foreach (ModuleDefinition module in assemblyDefinition.Modules) {
				foreach (TypeDefinition td in module.Types) {
					this.CancellationToken.ThrowIfCancellationRequested();
					if (this.IncludeInternalMembers || (td.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.Public) {
						string name = td.Name;
						if (name.Length == 0)
							continue;

						if (this.LazyLoad) {
							var t = new LazyCecilTypeDefinition(cecilLoaderCloneForLazyLoading, td);
							currentAssembly.AddTypeDefinition(t);
							RegisterCecilObject(t, td);
						} else {
							var t = CreateTopLevelTypeDefinition(td);
							cecilTypeDefs.Add(td);
							typeDefs.Add(t);
							currentAssembly.AddTypeDefinition(t);
							// The registration will happen after the members are initialized
						}
					}
				}
			}
			// Initialize the type's members:
			for (int i = 0; i < typeDefs.Count; i++) {
				InitTypeDefinition(cecilTypeDefs[i], typeDefs[i]);
			}

			AddToTypeSystemTranslationTable(this.currentAssembly, assemblyDefinition);

			var result = this.currentAssembly;
			this.currentAssembly = null;
			this.currentModule = null;
			return result;
		}

		/// <summary>
		/// Sets the current module.
		/// This causes ReadTypeReference() to use <see cref="DefaultAssemblyReference.CurrentAssembly"/> for references
		/// in that module.
		/// </summary>
		[CLSCompliant(false)]
		public void SetCurrentModule(ModuleDefinition module)
		{
			this.currentModule = module;
		}

		/// <summary>
		/// Loads a type from Cecil.
		/// </summary>
		/// <param name="typeDefinition">The Cecil TypeDefinition.</param>
		/// <returns>ITypeDefinition representing the Cecil type.</returns>
		[CLSCompliant(false)]
		public IUnresolvedTypeDefinition LoadType(TypeDefinition typeDefinition)
		{
			if (typeDefinition == null)
				throw new ArgumentNullException("typeDefinition");
			var td = CreateTopLevelTypeDefinition(typeDefinition);
			InitTypeDefinition(typeDefinition, td);
			return td;
		}
		#endregion

		#region IUnresolvedAssembly implementation
		[Serializable]
		sealed class CecilUnresolvedAssembly : DefaultUnresolvedAssembly, IDocumentationProvider
		{
			readonly IDocumentationProvider documentationProvider;

			public CecilUnresolvedAssembly(string assemblyName, IDocumentationProvider documentationProvider)
				: base(assemblyName)
			{
				Debug.Assert(assemblyName != null);
				this.documentationProvider = documentationProvider;
			}

			DocumentationComment IDocumentationProvider.GetDocumentation(IEntity entity)
			{
				if (documentationProvider != null)
					return documentationProvider.GetDocumentation(entity);
				else
					return null;
			}
		}
		#endregion

		#region Load Assembly From Disk
		public IUnresolvedAssembly LoadAssemblyFile(string fileName)
		{
			if (fileName == null)
				throw new ArgumentNullException("fileName");
			var param = new ReaderParameters { AssemblyResolver = new DummyAssemblyResolver() };
			AssemblyDefinition asm = AssemblyDefinition.ReadAssembly(fileName, param);
			return LoadAssembly(asm);
		}

		// used to prevent Cecil from loading referenced assemblies
		sealed class DummyAssemblyResolver : IAssemblyResolver
		{
			public AssemblyDefinition Resolve(AssemblyNameReference name)
			{
				return null;
			}

			public AssemblyDefinition Resolve(string fullName)
			{
				return null;
			}

			public AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters)
			{
				return null;
			}

			public AssemblyDefinition Resolve(string fullName, ReaderParameters parameters)
			{
				return null;
			}
		}
		#endregion

		#region Read Type Reference
		/// <summary>
		/// Reads a type reference.
		/// </summary>
		/// <param name="type">The Cecil type reference that should be converted into
		/// a type system type reference.</param>
		/// <param name="typeAttributes">Attributes associated with the Cecil type reference.
		/// This is used to support the 'dynamic' type.</param>
		[CLSCompliant(false)]
		public ITypeReference ReadTypeReference(TypeReference type, ICustomAttributeProvider typeAttributes = null)
		{
			int typeIndex = 0;
			return CreateType(type, typeAttributes, ref typeIndex);
		}

		ITypeReference CreateType(TypeReference type, ICustomAttributeProvider typeAttributes, ref int typeIndex)
		{
			while (type is OptionalModifierType || type is RequiredModifierType) {
				type = ((TypeSpecification)type).ElementType;
			}
			if (type == null) {
				return SpecialType.UnknownType;
			}

			if (type is Mono.Cecil.ByReferenceType) {
				typeIndex++;
				return new ByReferenceTypeReference(
					CreateType(
						(type as Mono.Cecil.ByReferenceType).ElementType,
						typeAttributes, ref typeIndex));
			} else if (type is Mono.Cecil.PointerType) {
				typeIndex++;
				return new PointerTypeReference(
					CreateType(
						(type as Mono.Cecil.PointerType).ElementType,
						typeAttributes, ref typeIndex));
			} else if (type is Mono.Cecil.ArrayType) {
				typeIndex++;
				return new ArrayTypeReference(
					CreateType(
						(type as Mono.Cecil.ArrayType).ElementType,
						typeAttributes, ref typeIndex),
					(type as Mono.Cecil.ArrayType).Rank);
			} else if (type is GenericInstanceType) {
				GenericInstanceType gType = (GenericInstanceType)type;
				ITypeReference baseType = CreateType(gType.ElementType, typeAttributes, ref typeIndex);
				ITypeReference[] para = new ITypeReference[gType.GenericArguments.Count];
				for (int i = 0; i < para.Length; ++i) {
					typeIndex++;
					para[i] = CreateType(gType.GenericArguments[i], typeAttributes, ref typeIndex);
				}
				return new ParameterizedTypeReference(baseType, para);
			} else if (type is GenericParameter) {
				GenericParameter typeGP = (GenericParameter)type;
				return new TypeParameterReference(typeGP.Owner is MethodDefinition ? EntityType.Method : EntityType.TypeDefinition, typeGP.Position);
			} else if (type.IsNested) {
				ITypeReference typeRef = CreateType(type.DeclaringType, typeAttributes, ref typeIndex);
				int partTypeParameterCount;
				string namepart = ReflectionHelper.SplitTypeParameterCountFromReflectionName(type.Name, out partTypeParameterCount);
				return new NestedTypeReference(typeRef, namepart, partTypeParameterCount);
			} else {
				string ns = type.Namespace ?? string.Empty;
				string name = type.Name;
				if (name == null)
					throw new InvalidOperationException("type.Name returned null. Type: " + type.ToString());

				if (name == "Object" && ns == "System" && HasDynamicAttribute(typeAttributes, typeIndex)) {
					return SpecialType.Dynamic;
				} else {
					int typeParameterCount;
					name = ReflectionHelper.SplitTypeParameterCountFromReflectionName(name, out typeParameterCount);
					if (currentAssembly != null) {
						IUnresolvedTypeDefinition c = currentAssembly.GetTypeDefinition(ns, name, typeParameterCount);
						if (c != null)
							return c;
					}
					return new GetClassTypeReference(GetAssemblyReference(type.Scope), ns, name, typeParameterCount);
				}
			}
		}

		IAssemblyReference GetAssemblyReference(IMetadataScope scope)
		{
			if (scope == null || scope == currentModule)
				return DefaultAssemblyReference.CurrentAssembly;
			else
				return new DefaultAssemblyReference(scope.Name);
		}

		static bool HasDynamicAttribute(ICustomAttributeProvider attributeProvider, int typeIndex)
		{
			if (attributeProvider == null || !attributeProvider.HasCustomAttributes)
				return false;
			foreach (CustomAttribute a in attributeProvider.CustomAttributes) {
				TypeReference type = a.AttributeType;
				if (type.Name == "DynamicAttribute" && type.Namespace == "System.Runtime.CompilerServices") {
					if (a.ConstructorArguments.Count == 1) {
						CustomAttributeArgument[] values = a.ConstructorArguments[0].Value as CustomAttributeArgument[];
						if (values != null && typeIndex < values.Length && values[typeIndex].Value is bool)
							return (bool)values[typeIndex].Value;
					}
					return true;
				}
			}
			return false;
		}
		#endregion

		#region Read Attributes
		#region Assembly Attributes
		static readonly ITypeReference assemblyVersionAttributeTypeRef = typeof(System.Reflection.AssemblyVersionAttribute).ToTypeReference();

		void AddAttributes(AssemblyDefinition assembly, IList<IUnresolvedAttribute> outputList)
		{
			if (assembly.HasCustomAttributes) {
				AddCustomAttributes(assembly.CustomAttributes, outputList);
			}
			if (assembly.HasSecurityDeclarations) {
				AddSecurityAttributes(assembly.SecurityDeclarations, outputList);
			}

			// AssemblyVersionAttribute
			if (assembly.Name.Version != null) {
				var assemblyVersion = new DefaultUnresolvedAttribute(assemblyVersionAttributeTypeRef, new[] { KnownTypeReference.String });
				assemblyVersion.PositionalArguments.Add(new SimpleConstantValue(KnownTypeReference.String, assembly.Name.Version.ToString()));
				outputList.Add(assemblyVersion);
			}
		}
		#endregion

		#region Module Attributes
		void AddAttributes(ModuleDefinition module, IList<IUnresolvedAttribute> outputList)
		{
			if (module.HasCustomAttributes) {
				AddCustomAttributes(module.CustomAttributes, outputList);
			}
		}
		#endregion

		#region Parameter Attributes
		static readonly IUnresolvedAttribute inAttribute = new DefaultUnresolvedAttribute(typeof(InAttribute).ToTypeReference());
		static readonly IUnresolvedAttribute outAttribute = new DefaultUnresolvedAttribute(typeof(OutAttribute).ToTypeReference());

		void AddAttributes(ParameterDefinition parameter, DefaultUnresolvedParameter targetParameter)
		{
			if (!targetParameter.IsOut) {
				if (parameter.IsIn)
					targetParameter.Attributes.Add(inAttribute);
				if (parameter.IsOut)
					targetParameter.Attributes.Add(outAttribute);
			}
			if (parameter.HasCustomAttributes) {
				AddCustomAttributes(parameter.CustomAttributes, targetParameter.Attributes);
			}
			if (parameter.HasMarshalInfo) {
				targetParameter.Attributes.Add(ConvertMarshalInfo(parameter.MarshalInfo));
			}
		}
		#endregion

		#region Method Attributes
		static readonly ITypeReference dllImportAttributeTypeRef = typeof(DllImportAttribute).ToTypeReference();
		static readonly SimpleConstantValue trueValue = new SimpleConstantValue(KnownTypeReference.Boolean, true);
		static readonly SimpleConstantValue falseValue = new SimpleConstantValue(KnownTypeReference.Boolean, false);
		static readonly ITypeReference callingConventionTypeRef = typeof(CallingConvention).ToTypeReference();
		static readonly IUnresolvedAttribute preserveSigAttribute = new DefaultUnresolvedAttribute(typeof(PreserveSigAttribute).ToTypeReference());
		static readonly ITypeReference methodImplAttributeTypeRef = typeof(MethodImplAttribute).ToTypeReference();
		static readonly ITypeReference methodImplOptionsTypeRef = typeof(MethodImplOptions).ToTypeReference();

		static bool HasAnyAttributes(MethodDefinition methodDefinition)
		{
			if (methodDefinition.HasPInvokeInfo)
				return true;
			if ((methodDefinition.ImplAttributes & ~MethodImplAttributes.CodeTypeMask) != 0)
				return true;
			if (methodDefinition.MethodReturnType.HasFieldMarshal)
				return true;
			return methodDefinition.HasCustomAttributes || methodDefinition.MethodReturnType.HasCustomAttributes;
		}

		void AddAttributes(MethodDefinition methodDefinition, IList<IUnresolvedAttribute> attributes, IList<IUnresolvedAttribute> returnTypeAttributes)
		{
			MethodImplAttributes implAttributes = methodDefinition.ImplAttributes & ~MethodImplAttributes.CodeTypeMask;

			#region DllImportAttribute
			if (methodDefinition.HasPInvokeInfo) {
				PInvokeInfo info = methodDefinition.PInvokeInfo;
				var dllImport = new DefaultUnresolvedAttribute(dllImportAttributeTypeRef, new[] { KnownTypeReference.String });
				dllImport.PositionalArguments.Add(new SimpleConstantValue(KnownTypeReference.String, info.Module.Name));

				if (info.IsBestFitDisabled)
					dllImport.AddNamedFieldArgument("BestFitMapping", falseValue);
				if (info.IsBestFitEnabled)
					dllImport.AddNamedFieldArgument("BestFitMapping", trueValue);

				CallingConvention callingConvention;
				switch (info.Attributes & PInvokeAttributes.CallConvMask) {
					case (PInvokeAttributes)0:
						Debug.WriteLine ("P/Invoke calling convention not set on:" + methodDefinition.FullName);
						callingConvention = CallingConvention.StdCall;
						break;
					case PInvokeAttributes.CallConvCdecl:
						callingConvention = CallingConvention.Cdecl;
						break;
					case PInvokeAttributes.CallConvFastcall:
						callingConvention = CallingConvention.FastCall;
						break;
					case PInvokeAttributes.CallConvStdCall:
						callingConvention = CallingConvention.StdCall;
						break;
					case PInvokeAttributes.CallConvThiscall:
						callingConvention = CallingConvention.ThisCall;
						break;
					case PInvokeAttributes.CallConvWinapi:
						callingConvention = CallingConvention.Winapi;
						break;
					default:
						throw new NotSupportedException("unknown calling convention");
				}
				if (callingConvention != CallingConvention.Winapi)
					dllImport.AddNamedFieldArgument("CallingConvention", callingConventionTypeRef, (int)callingConvention);

				CharSet charSet = CharSet.None;
				switch (info.Attributes & PInvokeAttributes.CharSetMask) {
					case PInvokeAttributes.CharSetAnsi:
						charSet = CharSet.Ansi;
						break;
					case PInvokeAttributes.CharSetAuto:
						charSet = CharSet.Auto;
						break;
					case PInvokeAttributes.CharSetUnicode:
						charSet = CharSet.Unicode;
						break;
				}
				if (charSet != CharSet.None)
					dllImport.AddNamedFieldArgument("CharSet", charSetTypeRef, (int)charSet);

				if (!string.IsNullOrEmpty(info.EntryPoint) && info.EntryPoint != methodDefinition.Name)
					dllImport.AddNamedFieldArgument("EntryPoint", KnownTypeReference.String, info.EntryPoint);

				if (info.IsNoMangle)
					dllImport.AddNamedFieldArgument("ExactSpelling", trueValue);

				if ((implAttributes & MethodImplAttributes.PreserveSig) == MethodImplAttributes.PreserveSig)
					implAttributes &= ~MethodImplAttributes.PreserveSig;
				else
					dllImport.AddNamedFieldArgument("PreserveSig", falseValue);

				if (info.SupportsLastError)
					dllImport.AddNamedFieldArgument("SetLastError", trueValue);

				if (info.IsThrowOnUnmappableCharDisabled)
					dllImport.AddNamedFieldArgument("ThrowOnUnmappableChar", falseValue);
				if (info.IsThrowOnUnmappableCharEnabled)
					dllImport.AddNamedFieldArgument("ThrowOnUnmappableChar", trueValue);

				attributes.Add(dllImport);
			}
			#endregion

			#region PreserveSigAttribute
			if (implAttributes == MethodImplAttributes.PreserveSig) {
				attributes.Add(preserveSigAttribute);
				implAttributes = 0;
			}
			#endregion

			#region MethodImplAttribute
			if (implAttributes != 0) {
				var methodImpl = new DefaultUnresolvedAttribute(methodImplAttributeTypeRef, new[] { methodImplOptionsTypeRef });
				methodImpl.PositionalArguments.Add(new SimpleConstantValue(methodImplOptionsTypeRef, (int)implAttributes));
				attributes.Add(methodImpl);
			}
			#endregion

			if (methodDefinition.HasCustomAttributes) {
				AddCustomAttributes(methodDefinition.CustomAttributes, attributes);
			}
			if (methodDefinition.HasSecurityDeclarations) {
				AddSecurityAttributes(methodDefinition.SecurityDeclarations, attributes);
			}
			if (methodDefinition.MethodReturnType.HasMarshalInfo) {
				returnTypeAttributes.Add(ConvertMarshalInfo(methodDefinition.MethodReturnType.MarshalInfo));
			}
			if (methodDefinition.MethodReturnType.HasCustomAttributes) {
				AddCustomAttributes(methodDefinition.MethodReturnType.CustomAttributes, returnTypeAttributes);
			}
		}
		#endregion

		#region Type Attributes
		static readonly DefaultUnresolvedAttribute serializableAttribute = new DefaultUnresolvedAttribute(typeof(SerializableAttribute).ToTypeReference());
		static readonly DefaultUnresolvedAttribute comImportAttribute = new DefaultUnresolvedAttribute(typeof(ComImportAttribute).ToTypeReference());
		static readonly ITypeReference structLayoutAttributeTypeRef = typeof(StructLayoutAttribute).ToTypeReference();
		static readonly ITypeReference layoutKindTypeRef = typeof(LayoutKind).ToTypeReference();
		static readonly ITypeReference charSetTypeRef = typeof(CharSet).ToTypeReference();

		void AddAttributes(TypeDefinition typeDefinition, IUnresolvedTypeDefinition targetEntity)
		{
			// SerializableAttribute
			if (typeDefinition.IsSerializable)
				targetEntity.Attributes.Add(serializableAttribute);

			// ComImportAttribute
			if (typeDefinition.IsImport)
				targetEntity.Attributes.Add(comImportAttribute);

			#region StructLayoutAttribute
			LayoutKind layoutKind = LayoutKind.Auto;
			switch (typeDefinition.Attributes & TypeAttributes.LayoutMask) {
				case TypeAttributes.SequentialLayout:
					layoutKind = LayoutKind.Sequential;
					break;
				case TypeAttributes.ExplicitLayout:
					layoutKind = LayoutKind.Explicit;
					break;
			}
			CharSet charSet = CharSet.None;
			switch (typeDefinition.Attributes & TypeAttributes.StringFormatMask) {
				case TypeAttributes.AnsiClass:
					charSet = CharSet.Ansi;
					break;
				case TypeAttributes.AutoClass:
					charSet = CharSet.Auto;
					break;
				case TypeAttributes.UnicodeClass:
					charSet = CharSet.Unicode;
					break;
			}
			LayoutKind defaultLayoutKind = (typeDefinition.IsValueType && !typeDefinition.IsEnum) ? LayoutKind.Sequential: LayoutKind.Auto;
			if (layoutKind != defaultLayoutKind || charSet != CharSet.Ansi || typeDefinition.PackingSize > 0 || typeDefinition.ClassSize > 0) {
				DefaultUnresolvedAttribute structLayout = new DefaultUnresolvedAttribute(structLayoutAttributeTypeRef, new[] { layoutKindTypeRef });
				structLayout.PositionalArguments.Add(new SimpleConstantValue(layoutKindTypeRef, (int)layoutKind));
				if (charSet != CharSet.Ansi) {
					structLayout.AddNamedFieldArgument("CharSet", charSetTypeRef, (int)charSet);
				}
				if (typeDefinition.PackingSize > 0) {
					structLayout.AddNamedFieldArgument("Pack", KnownTypeReference.Int32, (int)typeDefinition.PackingSize);
				}
				if (typeDefinition.ClassSize > 0) {
					structLayout.AddNamedFieldArgument("Size", KnownTypeReference.Int32, (int)typeDefinition.ClassSize);
				}
				targetEntity.Attributes.Add(structLayout);
			}
			#endregion

			if (typeDefinition.HasCustomAttributes) {
				AddCustomAttributes(typeDefinition.CustomAttributes, targetEntity.Attributes);
			}
			if (typeDefinition.HasSecurityDeclarations) {
				AddSecurityAttributes(typeDefinition.SecurityDeclarations, targetEntity.Attributes);
			}
		}
		#endregion

		#region Field Attributes
		static readonly ITypeReference fieldOffsetAttributeTypeRef = typeof(FieldOffsetAttribute).ToTypeReference();
		static readonly IUnresolvedAttribute nonSerializedAttribute = new DefaultUnresolvedAttribute(typeof(NonSerializedAttribute).ToTypeReference());

		void AddAttributes(FieldDefinition fieldDefinition, IUnresolvedEntity targetEntity)
		{
			// FieldOffsetAttribute
			if (fieldDefinition.HasLayoutInfo) {
				DefaultUnresolvedAttribute fieldOffset = new DefaultUnresolvedAttribute(fieldOffsetAttributeTypeRef, new[] { KnownTypeReference.Int32 });
				fieldOffset.PositionalArguments.Add(new SimpleConstantValue(KnownTypeReference.Int32, fieldDefinition.Offset));
				targetEntity.Attributes.Add(fieldOffset);
			}

			// NonSerializedAttribute
			if (fieldDefinition.IsNotSerialized) {
				targetEntity.Attributes.Add(nonSerializedAttribute);
			}

			if (fieldDefinition.HasMarshalInfo) {
				targetEntity.Attributes.Add(ConvertMarshalInfo(fieldDefinition.MarshalInfo));
			}

			if (fieldDefinition.HasCustomAttributes) {
				AddCustomAttributes(fieldDefinition.CustomAttributes, targetEntity.Attributes);
			}
		}
		#endregion

		#region Event Attributes
		void AddAttributes(EventDefinition eventDefinition, IUnresolvedEntity targetEntity)
		{
			if (eventDefinition.HasCustomAttributes) {
				AddCustomAttributes(eventDefinition.CustomAttributes, targetEntity.Attributes);
			}
		}
		#endregion

		#region Property Attributes
		void AddAttributes(PropertyDefinition propertyDefinition, IUnresolvedEntity targetEntity)
		{
			if (propertyDefinition.HasCustomAttributes) {
				AddCustomAttributes(propertyDefinition.CustomAttributes, targetEntity.Attributes);
			}
		}
		#endregion

		#region MarshalAsAttribute (ConvertMarshalInfo)
		static readonly ITypeReference marshalAsAttributeTypeRef = typeof(MarshalAsAttribute).ToTypeReference();
		static readonly ITypeReference unmanagedTypeTypeRef = typeof(UnmanagedType).ToTypeReference();

		static IUnresolvedAttribute ConvertMarshalInfo(MarshalInfo marshalInfo)
		{
			DefaultUnresolvedAttribute attr = new DefaultUnresolvedAttribute(marshalAsAttributeTypeRef, new[] { unmanagedTypeTypeRef });
			attr.PositionalArguments.Add(new SimpleConstantValue(unmanagedTypeTypeRef, (int)marshalInfo.NativeType));

			FixedArrayMarshalInfo fami = marshalInfo as FixedArrayMarshalInfo;
			if (fami != null) {
				attr.AddNamedFieldArgument("SizeConst", KnownTypeReference.Int32, (int)fami.Size);
				if (fami.ElementType != NativeType.None)
					attr.AddNamedFieldArgument("ArraySubType", unmanagedTypeTypeRef, (int)fami.ElementType);
			}
			SafeArrayMarshalInfo sami = marshalInfo as SafeArrayMarshalInfo;
			if (sami != null && sami.ElementType != VariantType.None) {
				attr.AddNamedFieldArgument("SafeArraySubType", typeof(VarEnum).ToTypeReference(), (int)sami.ElementType);
			}
			ArrayMarshalInfo ami = marshalInfo as ArrayMarshalInfo;
			if (ami != null) {
				if (ami.ElementType != NativeType.Max)
					attr.AddNamedFieldArgument("ArraySubType", unmanagedTypeTypeRef, (int)ami.ElementType);
				if (ami.Size >= 0)
					attr.AddNamedFieldArgument("SizeConst", KnownTypeReference.Int32, (int)ami.Size);
				if (ami.SizeParameterMultiplier != 0 && ami.SizeParameterIndex >= 0)
					attr.AddNamedFieldArgument("SizeParamIndex", KnownTypeReference.Int16, (short)ami.SizeParameterIndex);
			}
			CustomMarshalInfo cmi = marshalInfo as CustomMarshalInfo;
			if (cmi != null) {
				attr.AddNamedFieldArgument("MarshalType", KnownTypeReference.String, cmi.ManagedType.FullName);
				if (!string.IsNullOrEmpty(cmi.Cookie))
					attr.AddNamedFieldArgument("MarshalCookie", KnownTypeReference.String, cmi.Cookie);
			}
			FixedSysStringMarshalInfo fssmi = marshalInfo as FixedSysStringMarshalInfo;
			if (fssmi != null) {
				attr.AddNamedFieldArgument("SizeConst", KnownTypeReference.Int32, (int)fssmi.Size);
			}

			return attr;
		}
		#endregion

		#region Custom Attributes (ReadAttribute)
		void AddCustomAttributes(Mono.Collections.Generic.Collection<CustomAttribute> attributes, IList<IUnresolvedAttribute> targetCollection)
		{
			foreach (var cecilAttribute in attributes) {
				TypeReference type = cecilAttribute.AttributeType;
				if (type.Namespace == "System.Runtime.CompilerServices") {
					if (type.Name == "DynamicAttribute" || type.Name == "ExtensionAttribute")
						continue;
				} else if (type.Name == "ParamArrayAttribute" && type.Namespace == "System") {
					continue;
				}
				targetCollection.Add(ReadAttribute(cecilAttribute));
			}
		}

		[CLSCompliant(false)]
		public IUnresolvedAttribute ReadAttribute(CustomAttribute attribute)
		{
			if (attribute == null)
				throw new ArgumentNullException("attribute");
			MethodReference ctor = attribute.Constructor;
			ITypeReference attributeType = ReadTypeReference(attribute.AttributeType);
			IList<ITypeReference> ctorParameterTypes = null;
			if (ctor.HasParameters) {
				ctorParameterTypes = new ITypeReference[ctor.Parameters.Count];
				for (int i = 0; i < ctorParameterTypes.Count; i++) {
					ctorParameterTypes[i] = ReadTypeReference(ctor.Parameters[i].ParameterType);
				}
			}
			if (this.InterningProvider != null) {
				attributeType = this.InterningProvider.Intern(attributeType);
				ctorParameterTypes = this.InterningProvider.InternList(ctorParameterTypes);
			}
			return new CecilUnresolvedAttribute(attributeType, ctorParameterTypes ?? EmptyList<ITypeReference>.Instance, attribute.GetBlob());
		}
		#endregion

		#region CecilUnresolvedAttribute
		static int GetBlobHashCode(byte[] blob)
		{
			unchecked {
				int hash = 0;
				foreach (byte b in blob) {
					hash *= 257;
					hash += b;
				}
				return hash;
			}
		}

		static bool BlobEquals(byte[] a, byte[] b)
		{
			if (a.Length != b.Length)
				return false;
			for (int i = 0; i < a.Length; i++) {
				if (a[i] != b[i])
					return false;
			}
			return true;
		}

		[Serializable]
		sealed class CecilUnresolvedAttribute : IUnresolvedAttribute, ISupportsInterning
		{
			internal readonly ITypeReference attributeType;
			internal readonly IList<ITypeReference> ctorParameterTypes;
			internal readonly byte[] blob;

			public CecilUnresolvedAttribute(ITypeReference attributeType, IList<ITypeReference> ctorParameterTypes, byte[] blob)
			{
				Debug.Assert(attributeType != null);
				Debug.Assert(ctorParameterTypes != null);
				Debug.Assert(blob != null);
				this.attributeType = attributeType;
				this.ctorParameterTypes = ctorParameterTypes;
				this.blob = blob;
			}

			DomRegion IUnresolvedAttribute.Region {
				get { return DomRegion.Empty; }
			}

			IAttribute IUnresolvedAttribute.CreateResolvedAttribute(ITypeResolveContext context)
			{
				if (context.CurrentAssembly == null)
					throw new InvalidOperationException("Cannot resolve CecilUnresolvedAttribute without a parent assembly");
				return new CecilResolvedAttribute(context, this);
			}

			void ISupportsInterning.PrepareForInterning(IInterningProvider provider)
			{
				// We already interned our child elements in ReadAttribute().
			}

			int ISupportsInterning.GetHashCodeForInterning()
			{
				return attributeType.GetHashCode() ^ ctorParameterTypes.GetHashCode() ^ GetBlobHashCode(blob);
			}

			bool ISupportsInterning.EqualsForInterning(ISupportsInterning other)
			{
				CecilUnresolvedAttribute o = other as CecilUnresolvedAttribute;
				return o != null && attributeType == o.attributeType && ctorParameterTypes == o.ctorParameterTypes
					&& BlobEquals(blob, o.blob);
			}
		}
		#endregion

		#region CecilResolvedAttribute
		sealed class CecilResolvedAttribute : IAttribute
		{
			readonly ITypeResolveContext context;
			readonly byte[] blob;
			readonly IList<ITypeReference> ctorParameterTypes;
			readonly IType attributeType;

			IMethod constructor;
			volatile bool constructorResolved;

			IList<ResolveResult> positionalArguments;
			IList<KeyValuePair<IMember, ResolveResult>> namedArguments;

			public CecilResolvedAttribute(ITypeResolveContext context, CecilUnresolvedAttribute unresolved)
			{
				this.context = context;
				this.blob = unresolved.blob;
				this.ctorParameterTypes = unresolved.ctorParameterTypes;
				this.attributeType = unresolved.attributeType.Resolve(context);
			}

			public CecilResolvedAttribute(ITypeResolveContext context, IType attributeType)
			{
				this.context = context;
				this.attributeType = attributeType;
				this.ctorParameterTypes = EmptyList<ITypeReference>.Instance;
			}

			public DomRegion Region {
				get { return DomRegion.Empty; }
			}

			public IType AttributeType {
				get { return attributeType; }
			}

			public IMethod Constructor {
				get {
					if (!constructorResolved) {
						constructor = ResolveConstructor();
						constructorResolved = true;
					}
					return constructor;
				}
			}

			IMethod ResolveConstructor()
			{
				var parameterTypes = ctorParameterTypes.Resolve(context);
				foreach (var ctor in attributeType.GetConstructors(m => m.Parameters.Count == parameterTypes.Count)) {
					bool ok = true;
					for (int i = 0; i < parameterTypes.Count; i++) {
						if (!ctor.Parameters[i].Type.Equals(parameterTypes[i])) {
							ok = false;
							break;
						}
					}
					if (ok)
						return ctor;
				}
				return null;
			}

			public IList<ResolveResult> PositionalArguments {
				get {
					var result = LazyInit.VolatileRead(ref this.positionalArguments);
					if (result != null) {
						return result;
					}
					DecodeBlob();
					return positionalArguments;
				}
			}

			public IList<KeyValuePair<IMember, ResolveResult>> NamedArguments {
				get {
					var result = LazyInit.VolatileRead(ref this.namedArguments);
					if (result != null) {
						return result;
					}
					DecodeBlob();
					return namedArguments;
				}
			}

			public override string ToString()
			{
				return "[" + attributeType.ToString() + "(...)]";
			}

			void DecodeBlob()
			{
				var positionalArguments = new List<ResolveResult>();
				var namedArguments = new List<KeyValuePair<IMember, ResolveResult>>();
				DecodeBlob(positionalArguments, namedArguments);
				Interlocked.CompareExchange(ref this.positionalArguments, positionalArguments, null);
				Interlocked.CompareExchange(ref this.namedArguments, namedArguments, null);
			}

			void DecodeBlob(List<ResolveResult> positionalArguments, List<KeyValuePair<IMember, ResolveResult>> namedArguments)
			{
				if (blob == null)
					return;
				BlobReader reader = new BlobReader(blob, context.CurrentAssembly);
				if (reader.ReadUInt16() != 0x0001) {
					Debug.WriteLine("Unknown blob prolog");
					return;
				}
				foreach (var ctorParameter in ctorParameterTypes.Resolve(context)) {
					ResolveResult arg = reader.ReadFixedArg(ctorParameter);
					positionalArguments.Add(arg);
					if (arg.IsError) {
						// After a decoding error, we must stop decoding the blob because
						// we might have read too few bytes due to the error.
						// Just fill up the remaining arguments with ErrorResolveResult:
						while (positionalArguments.Count < ctorParameterTypes.Count)
							positionalArguments.Add(ErrorResolveResult.UnknownError);
						return;
					}
				}
				ushort numNamed = reader.ReadUInt16();
				for (int i = 0; i < numNamed; i++) {
					var namedArg = reader.ReadNamedArg(attributeType);
					if (namedArg.Key != null)
						namedArguments.Add(namedArg);
				}
			}
		}
		#endregion

		#region class BlobReader
		class BlobReader
		{
			byte[] buffer;
			int position;
			readonly IAssembly currentResolvedAssembly;

			public BlobReader(byte[] buffer, IAssembly currentResolvedAssembly)
			{
				if (buffer == null)
					throw new ArgumentNullException("buffer");
				this.buffer = buffer;
				this.currentResolvedAssembly = currentResolvedAssembly;
			}

			public byte ReadByte()
			{
				return buffer[position++];
			}

			public sbyte ReadSByte()
			{
				unchecked {
					return(sbyte) ReadByte();
				}
			}

			public byte[] ReadBytes(int length)
			{
				var bytes = new byte[length];
				Buffer.BlockCopy(buffer, position, bytes, 0, length);
				position += length;
				return bytes;
			}

			public ushort ReadUInt16()
			{
				unchecked {
					ushort value =(ushort)(buffer[position]
					                       |(buffer[position + 1] << 8));
					position += 2;
					return value;
				}
			}

			public short ReadInt16()
			{
				unchecked {
					return(short) ReadUInt16();
				}
			}

			public uint ReadUInt32()
			{
				unchecked {
					uint value =(uint)(buffer[position]
					                   |(buffer[position + 1] << 8)
					                   |(buffer[position + 2] << 16)
					                   |(buffer[position + 3] << 24));
					position += 4;
					return value;
				}
			}

			public int ReadInt32()
			{
				unchecked {
					return(int) ReadUInt32();
				}
			}

			public ulong ReadUInt64()
			{
				unchecked {
					uint low = ReadUInt32();
					uint high = ReadUInt32();

					return(((ulong) high) << 32) | low;
				}
			}

			public long ReadInt64()
			{
				unchecked {
					return(long) ReadUInt64();
				}
			}

			public uint ReadCompressedUInt32()
			{
				unchecked {
					byte first = ReadByte();
					if((first & 0x80) == 0)
						return first;

					if((first & 0x40) == 0)
						return((uint)(first & ~0x80) << 8)
							| ReadByte();

					return((uint)(first & ~0xc0) << 24)
						|(uint) ReadByte() << 16
						|(uint) ReadByte() << 8
						| ReadByte();
				}
			}

			public float ReadSingle()
			{
				unchecked {
					if(!BitConverter.IsLittleEndian) {
						var bytes = ReadBytes(4);
						Array.Reverse(bytes);
						return BitConverter.ToSingle(bytes, 0);
					}

					float value = BitConverter.ToSingle(buffer, position);
					position += 4;
					return value;
				}
			}

			public double ReadDouble()
			{
				unchecked {
					if(!BitConverter.IsLittleEndian) {
						var bytes = ReadBytes(8);
						Array.Reverse(bytes);
						return BitConverter.ToDouble(bytes, 0);
					}

					double value = BitConverter.ToDouble(buffer, position);
					position += 8;
					return value;
				}
			}

			public ResolveResult ReadFixedArg(IType argType)
			{
				if (argType.Kind == TypeKind.Array) {
					if (((ArrayType)argType).Dimensions != 1) {
						// Only single-dimensional arrays are supported
						return ErrorResolveResult.UnknownError;
					}
					IType elementType = ((ArrayType)argType).ElementType;
					uint numElem = ReadUInt32();
					if (numElem == 0xffffffff) {
						// null reference
						return new ConstantResolveResult(argType, null);
					} else {
						ResolveResult[] elements = new ResolveResult[numElem];
						for (int i = 0; i < elements.Length; i++) {
							elements[i] = ReadElem(elementType);
							// Stop decoding when encountering an error:
							if (elements[i].IsError)
								return ErrorResolveResult.UnknownError;
						}
						return new ArrayCreateResolveResult(argType, null, elements);
					}
				} else {
					return ReadElem(argType);
				}
			}

			public ResolveResult ReadElem(IType elementType)
			{
				ITypeDefinition underlyingType;
				if (elementType.Kind == TypeKind.Enum) {
					underlyingType = elementType.GetDefinition().EnumUnderlyingType.GetDefinition();
				} else {
					underlyingType = elementType.GetDefinition();
				}
				if (underlyingType == null)
					return ErrorResolveResult.UnknownError;
				KnownTypeCode typeCode = underlyingType.KnownTypeCode;
				if (typeCode == KnownTypeCode.Object) {
					// boxed value type
					IType boxedTyped = ReadCustomAttributeFieldOrPropType();
					ResolveResult elem = ReadElem(boxedTyped);
					if (elem.IsCompileTimeConstant && elem.ConstantValue == null)
						return new ConstantResolveResult(elementType, null);
					else
						return new ConversionResolveResult(elementType, elem, Conversion.BoxingConversion);
				} else if (typeCode == KnownTypeCode.Type) {
					return new TypeOfResolveResult(underlyingType, ReadType());
				} else {
					return new ConstantResolveResult(elementType, ReadElemValue(typeCode));
				}
			}

			object ReadElemValue(KnownTypeCode typeCode)
			{
				switch (typeCode) {
					case KnownTypeCode.Boolean:
						return ReadByte() != 0;
					case KnownTypeCode.Char:
						return (char)ReadUInt16();
					case KnownTypeCode.SByte:
						return ReadSByte();
					case KnownTypeCode.Byte:
						return ReadByte();
					case KnownTypeCode.Int16:
						return ReadInt16();
					case KnownTypeCode.UInt16:
						return ReadUInt16();
					case KnownTypeCode.Int32:
						return ReadInt32();
					case KnownTypeCode.UInt32:
						return ReadUInt32();
					case KnownTypeCode.Int64:
						return ReadInt64();
					case KnownTypeCode.UInt64:
						return ReadUInt64();
					case KnownTypeCode.Single:
						return ReadSingle();
					case KnownTypeCode.Double:
						return ReadDouble();
					case KnownTypeCode.String:
						return ReadSerString();
					default:
						throw new NotSupportedException();
				}
			}

			public string ReadSerString ()
			{
				if (buffer [position] == 0xff) {
					position++;
					return null;
				}

				int length = (int) ReadCompressedUInt32();
				if (length == 0)
					return string.Empty;

				string @string = System.Text.Encoding.UTF8.GetString(
					buffer, position,
					buffer [position + length - 1] == 0 ? length - 1 : length);

				position += length;
				return @string;
			}

			public KeyValuePair<IMember, ResolveResult> ReadNamedArg(IType attributeType)
			{
				EntityType memberType;
				var b = ReadByte();
				switch (b) {
					case 0x53:
						memberType = EntityType.Field;
						break;
					case 0x54:
						memberType = EntityType.Property;
						break;
					default:
						throw new NotSupportedException(string.Format("Custom member type 0x{0:x} is not supported.", b));
				}
				IType type = ReadCustomAttributeFieldOrPropType();
				string name = ReadSerString();
				ResolveResult val = ReadFixedArg(type);
				IMember member = null;
				// Use last matching member, as GetMembers() returns members from base types first.
				foreach (IMember m in attributeType.GetMembers(m => m.EntityType == memberType && m.Name == name)) {
					if (m.ReturnType.Equals(type))
						member = m;
				}
				return new KeyValuePair<IMember, ResolveResult>(member, val);
			}

			IType ReadCustomAttributeFieldOrPropType()
			{
				ICompilation compilation = currentResolvedAssembly.Compilation;
				var b = ReadByte();
				switch (b) {
					case 0x02:
						return compilation.FindType(KnownTypeCode.Boolean);
					case 0x03:
						return compilation.FindType(KnownTypeCode.Char);
					case 0x04:
						return compilation.FindType(KnownTypeCode.SByte);
					case 0x05:
						return compilation.FindType(KnownTypeCode.Byte);
					case 0x06:
						return compilation.FindType(KnownTypeCode.Int16);
					case 0x07:
						return compilation.FindType(KnownTypeCode.UInt16);
					case 0x08:
						return compilation.FindType(KnownTypeCode.Int32);
					case 0x09:
						return compilation.FindType(KnownTypeCode.UInt32);
					case 0x0a:
						return compilation.FindType(KnownTypeCode.Int64);
					case 0x0b:
						return compilation.FindType(KnownTypeCode.UInt64);
					case 0x0c:
						return compilation.FindType(KnownTypeCode.Single);
					case 0x0d:
						return compilation.FindType(KnownTypeCode.Double);
					case 0x0e:
						return compilation.FindType(KnownTypeCode.String);
					case 0x1d:
						return new ArrayType(compilation, ReadCustomAttributeFieldOrPropType());
					case 0x50:
						return compilation.FindType(KnownTypeCode.Type);
					case 0x51: // boxed value type
						return compilation.FindType(KnownTypeCode.Object);
					case 0x55: // enum
						return ReadType();
					default:
						throw new NotSupportedException(string.Format("Custom attribute type 0x{0:x} is not supported.", b));
				}
			}

			IType ReadType()
			{
				string typeName = ReadSerString();
				ITypeReference typeReference = ReflectionHelper.ParseReflectionName(typeName);
				IType typeInCurrentAssembly = typeReference.Resolve(new SimpleTypeResolveContext(currentResolvedAssembly));
				if (typeInCurrentAssembly.Kind != TypeKind.Unknown)
					return typeInCurrentAssembly;

				// look for the type in mscorlib
				ITypeDefinition systemObject = currentResolvedAssembly.Compilation.FindType(KnownTypeCode.Object).GetDefinition();
				if (systemObject != null) {
					return typeReference.Resolve(new SimpleTypeResolveContext(systemObject.ParentAssembly));
				} else {
					// couldn't find corlib - return the unknown IType for the current assembly
					return typeInCurrentAssembly;
				}
			}
		}
		#endregion

		#region Security Attributes
		static readonly ITypeReference securityActionTypeReference = typeof(System.Security.Permissions.SecurityAction).ToTypeReference();
		static readonly ITypeReference permissionSetAttributeTypeReference = typeof(System.Security.Permissions.PermissionSetAttribute).ToTypeReference();

		/// <summary>
		/// Reads a security declaration.
		/// </summary>
		[CLSCompliant(false)]
		public IList<IUnresolvedAttribute> ReadSecurityDeclaration(SecurityDeclaration secDecl)
		{
			if (secDecl == null)
				throw new ArgumentNullException("secDecl");
			var result = new List<IUnresolvedAttribute>();
			AddSecurityAttributes(secDecl, result);
			return result;
		}

		void AddSecurityAttributes(Mono.Collections.Generic.Collection<SecurityDeclaration> securityDeclarations, IList<IUnresolvedAttribute> targetCollection)
		{
			foreach (var secDecl in securityDeclarations) {
				AddSecurityAttributes(secDecl, targetCollection);
			}
		}

		void AddSecurityAttributes(SecurityDeclaration secDecl, IList<IUnresolvedAttribute> targetCollection)
		{
			byte[] blob = secDecl.GetBlob();
			BlobReader reader = new BlobReader(blob, null);
			var securityAction = new SimpleConstantValue(securityActionTypeReference, (int)secDecl.Action);
			if (reader.ReadByte() == '.') {
				// binary attribute
				uint attributeCount = reader.ReadCompressedUInt32();
				UnresolvedSecurityDeclaration unresolvedSecDecl = new UnresolvedSecurityDeclaration(securityAction, blob);
				if (this.InterningProvider != null) {
					unresolvedSecDecl = this.InterningProvider.Intern(unresolvedSecDecl);
				}
				for (uint i = 0; i < attributeCount; i++) {
					targetCollection.Add(new UnresolvedSecurityAttribute(unresolvedSecDecl, (int)i));
				}
			} else {
				// for backward compatibility with .NET 1.0: XML-encoded attribute
				var attr = new DefaultUnresolvedAttribute(permissionSetAttributeTypeReference);
				attr.ConstructorParameterTypes.Add(securityActionTypeReference);
				attr.PositionalArguments.Add(securityAction);
				string xml = System.Text.Encoding.Unicode.GetString(blob);
				attr.AddNamedPropertyArgument("XML", KnownTypeReference.String, xml);
				targetCollection.Add(attr);
			}
		}

		[Serializable]
		sealed class UnresolvedSecurityDeclaration : ISupportsInterning
		{
			IConstantValue securityAction;
			byte[] blob;

			public UnresolvedSecurityDeclaration(IConstantValue securityAction, byte[] blob)
			{
				Debug.Assert(securityAction != null);
				Debug.Assert(blob != null);
				this.securityAction = securityAction;
				this.blob = blob;
			}

			public IList<IAttribute> Resolve(IAssembly currentAssembly)
			{
				// TODO: make this a per-assembly cache
//				CacheManager cache = currentAssembly.Compilation.CacheManager;
//				IList<IAttribute> result = (IList<IAttribute>)cache.GetShared(this);
//				if (result != null)
//					return result;

				ITypeResolveContext context = new SimpleTypeResolveContext(currentAssembly);
				BlobReader reader = new BlobReader(blob, currentAssembly);
				if (reader.ReadByte() != '.') {
					// should not use UnresolvedSecurityDeclaration for XML secdecls
					throw new InvalidOperationException();
				}
				ResolveResult securityActionRR = securityAction.Resolve(context);
				uint attributeCount = reader.ReadCompressedUInt32();
				IAttribute[] attributes = new IAttribute[attributeCount];
				try {
					ReadSecurityBlob(reader, attributes, context, securityActionRR);
				} catch (NotSupportedException ex) {
					// ignore invalid blobs
					Debug.WriteLine(ex.ToString());
				}
				for (int i = 0; i < attributes.Length; i++) {
					if (attributes[i] == null)
						attributes[i] = new CecilResolvedAttribute(context, SpecialType.UnknownType);
				}
				return attributes;
//				return (IList<IAttribute>)cache.GetOrAddShared(this, attributes);
			}

			void ReadSecurityBlob(BlobReader reader, IAttribute[] attributes, ITypeResolveContext context, ResolveResult securityActionRR)
			{
				for (int i = 0; i < attributes.Length; i++) {
					string attributeTypeName = reader.ReadSerString();
					ITypeReference attributeTypeRef = ReflectionHelper.ParseReflectionName(attributeTypeName);
					IType attributeType = attributeTypeRef.Resolve(context);

					reader.ReadCompressedUInt32(); // ??
					// The specification seems to be incorrect here, so I'm using the logic from Cecil instead.
					uint numNamed = reader.ReadCompressedUInt32();

					var namedArgs = new List<KeyValuePair<IMember, ResolveResult>>((int)numNamed);
					for (uint j = 0; j < numNamed; j++) {
						var namedArg = reader.ReadNamedArg(attributeType);
						if (namedArg.Key != null)
							namedArgs.Add(namedArg);

					}
					attributes[i] = new DefaultAttribute(
						attributeType,
						positionalArguments: new ResolveResult[] { securityActionRR },
						namedArguments: namedArgs);
				}
			}

			void ISupportsInterning.PrepareForInterning(IInterningProvider provider)
			{
				securityAction = provider.Intern(securityAction);
			}

			int ISupportsInterning.GetHashCodeForInterning()
			{
				return securityAction.GetHashCode() ^ GetBlobHashCode(blob);
			}

			bool ISupportsInterning.EqualsForInterning(ISupportsInterning other)
			{
				UnresolvedSecurityDeclaration o = other as UnresolvedSecurityDeclaration;
				return o != null && securityAction == o.securityAction && BlobEquals(blob, o.blob);
			}
		}

		[Serializable]
		sealed class UnresolvedSecurityAttribute : IUnresolvedAttribute
		{
			readonly UnresolvedSecurityDeclaration secDecl;
			readonly int index;

			public UnresolvedSecurityAttribute(UnresolvedSecurityDeclaration secDecl, int index)
			{
				Debug.Assert(secDecl != null);
				this.secDecl = secDecl;
				this.index = index;
			}

			DomRegion IUnresolvedAttribute.Region {
				get { return DomRegion.Empty; }
			}

			IAttribute IUnresolvedAttribute.CreateResolvedAttribute(ITypeResolveContext context)
			{
				return secDecl.Resolve(context.CurrentAssembly)[index];
			}
		}
		#endregion
		#endregion

		#region Read Type Definition
		DefaultUnresolvedTypeDefinition CreateTopLevelTypeDefinition(TypeDefinition typeDefinition)
		{
			string name = ReflectionHelper.SplitTypeParameterCountFromReflectionName(typeDefinition.Name);
			var td = new DefaultUnresolvedTypeDefinition(typeDefinition.Namespace, name);
			if (typeDefinition.HasGenericParameters)
				InitTypeParameters(typeDefinition, td.TypeParameters);
			return td;
		}

		static void InitTypeParameters(TypeDefinition typeDefinition, IList<IUnresolvedTypeParameter> typeParameters)
		{
			// Type parameters are initialized within the constructor so that the class can be put into the type storage
			// before the rest of the initialization runs - this allows it to be available for early binding as soon as possible.
			for (int i = 0; i < typeDefinition.GenericParameters.Count; i++) {
				if (typeDefinition.GenericParameters[i].Position != i)
					throw new InvalidOperationException("g.Position != i");
				typeParameters.Add(new DefaultUnresolvedTypeParameter(
					EntityType.TypeDefinition, i, typeDefinition.GenericParameters[i].Name));
			}
		}

		void InitTypeParameterConstraints(TypeDefinition typeDefinition, IList<IUnresolvedTypeParameter> typeParameters)
		{
			for (int i = 0; i < typeParameters.Count; i++) {
				AddConstraints((DefaultUnresolvedTypeParameter)typeParameters[i], typeDefinition.GenericParameters[i]);
			}
		}

		void InitTypeDefinition(TypeDefinition typeDefinition, DefaultUnresolvedTypeDefinition td)
		{
			td.Kind = GetTypeKind(typeDefinition);
			InitTypeModifiers(typeDefinition, td);
			InitTypeParameterConstraints(typeDefinition, td.TypeParameters);

			// nested types can be initialized only after generic parameters were created
			InitNestedTypes(typeDefinition, td, td.NestedTypes);
			AddAttributes(typeDefinition, td);
			td.HasExtensionMethods = HasExtensionAttribute(typeDefinition);

			InitBaseTypes(typeDefinition, td.BaseTypes);

			td.AddDefaultConstructorIfRequired = (td.Kind == TypeKind.Struct || td.Kind == TypeKind.Enum);
			InitMembers(typeDefinition, td, td.Members);
			if (this.InterningProvider != null) {
				td.ApplyInterningProvider(this.InterningProvider);
			}
			td.Freeze();
			RegisterCecilObject(td, typeDefinition);
		}

		void InitBaseTypes(TypeDefinition typeDefinition, IList<ITypeReference> baseTypes)
		{
			// set base classes
			if (typeDefinition.IsEnum) {
				foreach (FieldDefinition enumField in typeDefinition.Fields) {
					if (!enumField.IsStatic) {
						baseTypes.Add(ReadTypeReference(enumField.FieldType));
						break;
					}
				}
			} else {
				if (typeDefinition.BaseType != null) {
					baseTypes.Add(ReadTypeReference(typeDefinition.BaseType));
				}
				if (typeDefinition.HasInterfaces) {
					foreach (TypeReference iface in typeDefinition.Interfaces) {
						baseTypes.Add(ReadTypeReference(iface));
					}
				}
			}
		}

		void InitNestedTypes(TypeDefinition typeDefinition, IUnresolvedTypeDefinition declaringTypeDefinition, IList<IUnresolvedTypeDefinition> nestedTypes)
		{
			if (!typeDefinition.HasNestedTypes)
				return;
			foreach (TypeDefinition nestedTypeDef in typeDefinition.NestedTypes) {
				TypeAttributes visibility = nestedTypeDef.Attributes & TypeAttributes.VisibilityMask;
				if (this.IncludeInternalMembers
				    || visibility == TypeAttributes.NestedPublic
				    || visibility == TypeAttributes.NestedFamily
				    || visibility == TypeAttributes.NestedFamORAssem)
				{
					string name = nestedTypeDef.Name;
					int pos = name.LastIndexOf('/');
					if (pos > 0)
						name = name.Substring(pos + 1);
					name = ReflectionHelper.SplitTypeParameterCountFromReflectionName(name);
					var nestedType = new DefaultUnresolvedTypeDefinition(declaringTypeDefinition, name);
					InitTypeParameters(nestedTypeDef, nestedType.TypeParameters);
					nestedTypes.Add(nestedType);
					InitTypeDefinition(nestedTypeDef, nestedType);
				}
			}
		}

		static TypeKind GetTypeKind(TypeDefinition typeDefinition)
		{
			// set classtype
			if (typeDefinition.IsInterface) {
				return TypeKind.Interface;
			} else if (typeDefinition.IsEnum) {
				return TypeKind.Enum;
			} else if (typeDefinition.IsValueType) {
				return TypeKind.Struct;
			} else if (IsDelegate(typeDefinition)) {
				return TypeKind.Delegate;
			} else if (IsModule(typeDefinition)) {
				return TypeKind.Module;
			} else {
				return TypeKind.Class;
			}
		}

		static void InitTypeModifiers(TypeDefinition typeDefinition, AbstractUnresolvedEntity td)
		{
			td.IsSealed = typeDefinition.IsSealed;
			td.IsAbstract = typeDefinition.IsAbstract;
			switch (typeDefinition.Attributes & TypeAttributes.VisibilityMask) {
				case TypeAttributes.NotPublic:
				case TypeAttributes.NestedAssembly:
					td.Accessibility = Accessibility.Internal;
					break;
				case TypeAttributes.Public:
				case TypeAttributes.NestedPublic:
					td.Accessibility = Accessibility.Public;
					break;
				case TypeAttributes.NestedPrivate:
					td.Accessibility = Accessibility.Private;
					break;
				case TypeAttributes.NestedFamily:
					td.Accessibility = Accessibility.Protected;
					break;
				case TypeAttributes.NestedFamANDAssem:
					td.Accessibility = Accessibility.ProtectedAndInternal;
					break;
				case TypeAttributes.NestedFamORAssem:
					td.Accessibility = Accessibility.ProtectedOrInternal;
					break;
			}
		}

		static bool IsDelegate(TypeDefinition type)
		{
			if (type.BaseType != null && type.BaseType.Namespace == "System") {
				if (type.BaseType.Name == "MulticastDelegate")
					return true;
				if (type.BaseType.Name == "Delegate" && type.Name != "MulticastDelegate")
					return true;
			}
			return false;
		}

		static bool IsModule(TypeDefinition type)
		{
			if (!type.HasCustomAttributes)
				return false;
			foreach (var att in type.CustomAttributes) {
				if (att.AttributeType.FullName == "Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute"
				    || att.AttributeType.FullName == "System.Runtime.CompilerServices.CompilerGlobalScopeAttribute")
				{
					return true;
				}
			}
			return false;
		}

		void InitMembers(TypeDefinition typeDefinition, IUnresolvedTypeDefinition td, IList<IUnresolvedMember> members)
		{
			if (typeDefinition.HasMethods) {
				foreach (MethodDefinition method in typeDefinition.Methods) {
					if (IsVisible(method.Attributes) && !IsAccessor(method.SemanticsAttributes)) {
						EntityType type = EntityType.Method;
						if (method.IsSpecialName) {
							if (method.IsConstructor)
								type = EntityType.Constructor;
							else if (method.Name.StartsWith("op_", StringComparison.Ordinal))
								type = EntityType.Operator;
						}
						members.Add(ReadMethod(method, td, type));
					}
				}
			}
			if (typeDefinition.HasFields) {
				foreach (FieldDefinition field in typeDefinition.Fields) {
					if (IsVisible(field.Attributes) && !field.IsSpecialName) {
						members.Add(ReadField(field, td));
					}
				}
			}
			if (typeDefinition.HasProperties) {
				string defaultMemberName = null;
				var defaultMemberAttribute = typeDefinition.CustomAttributes.FirstOrDefault(
					a => a.AttributeType.FullName == typeof(System.Reflection.DefaultMemberAttribute).FullName);
				if (defaultMemberAttribute != null && defaultMemberAttribute.ConstructorArguments.Count == 1) {
					defaultMemberName = defaultMemberAttribute.ConstructorArguments[0].Value as string;
				}
				foreach (PropertyDefinition property in typeDefinition.Properties) {
					bool getterVisible = property.GetMethod != null && IsVisible(property.GetMethod.Attributes);
					bool setterVisible = property.SetMethod != null && IsVisible(property.SetMethod.Attributes);
					if (getterVisible || setterVisible) {
						EntityType type = EntityType.Property;
						if (property.HasParameters) {
							// Try to detect indexer:
							if (property.Name == defaultMemberName) {
								type = EntityType.Indexer; // normal indexer
							} else if (property.Name.EndsWith(".Item", StringComparison.Ordinal) && (property.GetMethod ?? property.SetMethod).HasOverrides) {
								// explicit interface implementation of indexer
								type = EntityType.Indexer;
								// We can't really tell parameterized properties and indexers apart in this case without
								// resolving the interface, so we rely on the "Item" naming convention instead.
							}
						}
						members.Add(ReadProperty(property, td, type));
					}
				}
			}
			if (typeDefinition.HasEvents) {
				foreach (EventDefinition ev in typeDefinition.Events) {
					if (ev.AddMethod != null && IsVisible(ev.AddMethod.Attributes)) {
						members.Add(ReadEvent(ev, td));
					}
				}
			}
		}

		static bool IsAccessor(MethodSemanticsAttributes semantics)
		{
			return !(semantics == MethodSemanticsAttributes.None || semantics == MethodSemanticsAttributes.Other);
		}
		#endregion

		#region Lazy-Loaded Type Definition
		sealed class LazyCecilTypeDefinition : AbstractUnresolvedEntity, IUnresolvedTypeDefinition
		{
			readonly CecilLoader loader;
			readonly string namespaceName;
			readonly TypeDefinition cecilTypeDef;
			readonly TypeKind kind;
			readonly IList<IUnresolvedTypeParameter> typeParameters;

			IList<ITypeReference> baseTypes;
			IList<IUnresolvedTypeDefinition> nestedTypes;
			IList<IUnresolvedMember> members;

			public LazyCecilTypeDefinition(CecilLoader loader, TypeDefinition typeDefinition)
			{
				this.loader = loader;
				this.cecilTypeDef = typeDefinition;
				this.EntityType = EntityType.TypeDefinition;
				this.namespaceName = cecilTypeDef.Namespace;
				this.Name = ReflectionHelper.SplitTypeParameterCountFromReflectionName(cecilTypeDef.Name);
				var tps = new List<IUnresolvedTypeParameter>();
				InitTypeParameters(cecilTypeDef, tps);
				this.typeParameters = FreezableHelper.FreezeList(tps);

				this.kind = GetTypeKind(typeDefinition);
				InitTypeModifiers(typeDefinition, this);
				loader.InitTypeParameterConstraints(typeDefinition, typeParameters);

				loader.AddAttributes(typeDefinition, this);
				flags[FlagHasExtensionMethods] = HasExtensionAttribute(typeDefinition);

				if (loader.InterningProvider != null) {
					this.ApplyInterningProvider(loader.InterningProvider);
				}
				this.Freeze();
			}

			public override string Namespace {
				get { return namespaceName; }
				set { throw new NotSupportedException(); }
			}

			public override string FullName {
				// This works because LazyCecilTypeDefinition is only used for top-level types
				get { return cecilTypeDef.FullName; }
			}

			public override string ReflectionName {
				get { return cecilTypeDef.FullName; }
			}

			public TypeKind Kind {
				get { return kind; }
			}

			public IList<IUnresolvedTypeParameter> TypeParameters {
				get { return typeParameters; }
			}

			public IList<ITypeReference> BaseTypes {
				get {
					var result = LazyInit.VolatileRead(ref this.baseTypes);
					if (result != null) {
						return result;
					}
					lock (loader.currentModule) {
						result = new List<ITypeReference>();
						loader.InitBaseTypes(cecilTypeDef, result);
						return LazyInit.GetOrSet(ref this.baseTypes, FreezableHelper.FreezeList(result));
					}
				}
			}

			public IList<IUnresolvedTypeDefinition> NestedTypes {
				get {
					var result = LazyInit.VolatileRead(ref this.nestedTypes);
					if (result != null) {
						return result;
					}
					lock (loader.currentModule) {
						if (this.nestedTypes != null)
							return this.nestedTypes;
						result = new List<IUnresolvedTypeDefinition>();
						loader.InitNestedTypes(cecilTypeDef, this, result);
						return LazyInit.GetOrSet(ref this.nestedTypes, FreezableHelper.FreezeList(result));
					}
				}
			}

			public IList<IUnresolvedMember> Members {
				get {
					var result = LazyInit.VolatileRead(ref this.members);
					if (result != null) {
						return result;
					}
					lock (loader.currentModule) {
						if (this.members != null)
							return this.members;
						result = new List<IUnresolvedMember>();
						loader.InitMembers(cecilTypeDef, this, result);
						return LazyInit.GetOrSet(ref this.members, FreezableHelper.FreezeList(result));
					}
				}
			}

			public IEnumerable<IUnresolvedMethod> Methods {
				get { return Members.OfType<IUnresolvedMethod>(); }
			}

			public IEnumerable<IUnresolvedProperty> Properties {
				get { return Members.OfType<IUnresolvedProperty>(); }
			}

			public IEnumerable<IUnresolvedField> Fields {
				get { return Members.OfType<IUnresolvedField>(); }
			}

			public IEnumerable<IUnresolvedEvent> Events {
				get { return Members.OfType<IUnresolvedEvent>(); }
			}

			public bool AddDefaultConstructorIfRequired {
				get { return kind == TypeKind.Struct || kind == TypeKind.Enum; }
			}

			public bool? HasExtensionMethods {
				get { return flags[FlagHasExtensionMethods]; }
				// we always return true or false, never null.
				// FlagHasNoExtensionMethods is unused in LazyCecilTypeDefinition
			}

			public override object Clone()
			{
				throw new NotSupportedException();
			}

			public IType Resolve(ITypeResolveContext context)
			{
				if (context == null)
					throw new ArgumentNullException("context");
				if (context.CurrentAssembly == null)
					throw new ArgumentException("An ITypeDefinition cannot be resolved in a context without a current assembly.");
				return context.CurrentAssembly.GetTypeDefinition(this)
					?? (IType)new UnknownType(this.Namespace, this.Name, this.TypeParameters.Count);
			}

			public ITypeResolveContext CreateResolveContext(ITypeResolveContext parentContext)
			{
				return parentContext;
			}
		}
		#endregion

		#region Read Method
		[CLSCompliant(false)]
		public IUnresolvedMethod ReadMethod(MethodDefinition method, IUnresolvedTypeDefinition parentType, EntityType methodType = EntityType.Method)
		{
			return ReadMethod(method, parentType, methodType, null);
		}

		IUnresolvedMethod ReadMethod(MethodDefinition method, IUnresolvedTypeDefinition parentType, EntityType methodType, IUnresolvedMember accessorOwner)
		{
			if (method == null)
				return null;
			DefaultUnresolvedMethod m = new DefaultUnresolvedMethod(parentType, method.Name);
			m.EntityType = methodType;
			m.AccessorOwner = accessorOwner;
			m.HasBody = method.HasBody;
			if (method.HasGenericParameters) {
				for (int i = 0; i < method.GenericParameters.Count; i++) {
					if (method.GenericParameters[i].Position != i)
						throw new InvalidOperationException("g.Position != i");
					m.TypeParameters.Add(new DefaultUnresolvedTypeParameter(
						EntityType.Method, i, method.GenericParameters[i].Name));
				}
				for (int i = 0; i < method.GenericParameters.Count; i++) {
					AddConstraints((DefaultUnresolvedTypeParameter)m.TypeParameters[i], method.GenericParameters[i]);
				}
			}

			m.ReturnType = ReadTypeReference(method.ReturnType, typeAttributes: method.MethodReturnType);

			if (HasAnyAttributes(method))
				AddAttributes(method, m.Attributes, m.ReturnTypeAttributes);
			TranslateModifiers(method, m);

			if (method.HasParameters) {
				foreach (ParameterDefinition p in method.Parameters) {
					m.Parameters.Add(ReadParameter(p));
				}
			}

			// mark as extension method if the attribute is set
			if (method.IsStatic && HasExtensionAttribute(method)) {
				m.IsExtensionMethod = true;
			}

			int lastDot = method.Name.LastIndexOf('.');
			if (lastDot >= 0 && method.HasOverrides) {
				// To be consistent with the parser-initialized type system, shorten the method name:
				m.Name = method.Name.Substring(lastDot + 1);
				m.IsExplicitInterfaceImplementation = true;
				foreach (var or in method.Overrides) {
					m.ExplicitInterfaceImplementations.Add(new DefaultMemberReference(
						accessorOwner != null ? EntityType.Accessor : EntityType.Method,
						ReadTypeReference(or.DeclaringType),
						or.Name, or.GenericParameters.Count, m.Parameters.Select(p => p.Type).ToList()));
				}
			}

			FinishReadMember(m, method);
			return m;
		}

		static bool HasExtensionAttribute(ICustomAttributeProvider provider)
		{
			if (provider.HasCustomAttributes) {
				foreach (var attr in provider.CustomAttributes) {
					if (attr.AttributeType.Name == "ExtensionAttribute" && attr.AttributeType.Namespace == "System.Runtime.CompilerServices")
						return true;
				}
			}
			return false;
		}

		bool IsVisible(MethodAttributes att)
		{
			att &= MethodAttributes.MemberAccessMask;
			return IncludeInternalMembers
				|| att == MethodAttributes.Public
				|| att == MethodAttributes.Family
				|| att == MethodAttributes.FamORAssem;
		}

		static Accessibility GetAccessibility(MethodAttributes attr)
		{
			switch (attr & MethodAttributes.MemberAccessMask) {
				case MethodAttributes.Public:
					return Accessibility.Public;
				case MethodAttributes.FamANDAssem:
					return Accessibility.ProtectedAndInternal;
				case MethodAttributes.Assembly:
					return Accessibility.Internal;
				case MethodAttributes.Family:
					return Accessibility.Protected;
				case MethodAttributes.FamORAssem:
					return Accessibility.ProtectedOrInternal;
				default:
					return Accessibility.Private;
			}
		}

		void TranslateModifiers(MethodDefinition method, AbstractUnresolvedMember m)
		{
			if (m.DeclaringTypeDefinition.Kind == TypeKind.Interface) {
				// interface members don't have modifiers, but we want to handle them as "public abstract"
				m.Accessibility = Accessibility.Public;
				m.IsAbstract = true;
			} else {
				m.Accessibility = GetAccessibility(method.Attributes);
				if (method.IsAbstract) {
					m.IsAbstract = true;
					m.IsOverride = !method.IsNewSlot;
				} else if (method.IsFinal) {
					if (!method.IsNewSlot) {
						m.IsSealed = true;
						m.IsOverride = true;
					}
				} else if (method.IsVirtual) {
					if (method.IsNewSlot)
						m.IsVirtual = true;
					else
						m.IsOverride = true;
				}
				m.IsStatic = method.IsStatic;
			}
		}
		#endregion

		#region Read Parameter
		[CLSCompliant(false)]
		public IUnresolvedParameter ReadParameter(ParameterDefinition parameter)
		{
			if (parameter == null)
				throw new ArgumentNullException("parameter");
			var type = ReadTypeReference(parameter.ParameterType, typeAttributes: parameter);
			var p = new DefaultUnresolvedParameter(type, parameter.Name);

			if (parameter.ParameterType is Mono.Cecil.ByReferenceType) {
				if (!parameter.IsIn && parameter.IsOut)
					p.IsOut = true;
				else
					p.IsRef = true;
			}
			AddAttributes(parameter, p);

			if (parameter.IsOptional) {
				p.DefaultValue = new SimpleConstantValue(type, parameter.Constant);
			}

			if (parameter.ParameterType is Mono.Cecil.ArrayType) {
				foreach (CustomAttribute att in parameter.CustomAttributes) {
					if (att.AttributeType.FullName == typeof(ParamArrayAttribute).FullName) {
						p.IsParams = true;
						break;
					}
				}
			}

			return p;
		}
		#endregion

		#region Read Field
		bool IsVisible(FieldAttributes att)
		{
			att &= FieldAttributes.FieldAccessMask;
			return IncludeInternalMembers
				|| att == FieldAttributes.Public
				|| att == FieldAttributes.Family
				|| att == FieldAttributes.FamORAssem;
		}

		[CLSCompliant(false)]
		public IUnresolvedField ReadField(FieldDefinition field, IUnresolvedTypeDefinition parentType)
		{
			if (field == null)
				throw new ArgumentNullException("field");
			if (parentType == null)
				throw new ArgumentNullException("parentType");

			DefaultUnresolvedField f = new DefaultUnresolvedField(parentType, field.Name);
			f.Accessibility = GetAccessibility(field.Attributes);
			f.IsReadOnly = field.IsInitOnly;
			f.IsStatic = field.IsStatic;
			f.ReturnType = ReadTypeReference(field.FieldType, typeAttributes: field);
			if (field.HasConstant) {
				f.ConstantValue = new SimpleConstantValue(f.ReturnType, field.Constant);
			}
			AddAttributes(field, f);

			RequiredModifierType modreq = field.FieldType as RequiredModifierType;
			if (modreq != null && modreq.ModifierType.FullName == typeof(IsVolatile).FullName) {
				f.IsVolatile = true;
			}

			FinishReadMember(f, field);
			return f;
		}

		static Accessibility GetAccessibility(FieldAttributes attr)
		{
			switch (attr & FieldAttributes.FieldAccessMask) {
				case FieldAttributes.Public:
					return Accessibility.Public;
				case FieldAttributes.FamANDAssem:
					return Accessibility.ProtectedAndInternal;
				case FieldAttributes.Assembly:
					return Accessibility.Internal;
				case FieldAttributes.Family:
					return Accessibility.Protected;
				case FieldAttributes.FamORAssem:
					return Accessibility.ProtectedOrInternal;
				default:
					return Accessibility.Private;
			}
		}
		#endregion

		#region Type Parameter Constraints
		void AddConstraints(DefaultUnresolvedTypeParameter tp, GenericParameter g)
		{
			switch (g.Attributes & GenericParameterAttributes.VarianceMask) {
				case GenericParameterAttributes.Contravariant:
					tp.Variance = VarianceModifier.Contravariant;
					break;
				case GenericParameterAttributes.Covariant:
					tp.Variance = VarianceModifier.Covariant;
					break;
			}

			tp.HasReferenceTypeConstraint = g.HasReferenceTypeConstraint;
			tp.HasValueTypeConstraint = g.HasNotNullableValueTypeConstraint;
			tp.HasDefaultConstructorConstraint = g.HasDefaultConstructorConstraint;

			if (g.HasConstraints) {
				foreach (TypeReference constraint in g.Constraints) {
					tp.Constraints.Add(ReadTypeReference(constraint));
				}
			}
		}
		#endregion

		#region Read Property

		[CLSCompliant(false)]
		public IUnresolvedProperty ReadProperty(PropertyDefinition property, IUnresolvedTypeDefinition parentType, EntityType propertyType = EntityType.Property)
		{
			if (property == null)
				throw new ArgumentNullException("property");
			if (parentType == null)
				throw new ArgumentNullException("parentType");
			DefaultUnresolvedProperty p = new DefaultUnresolvedProperty(parentType, property.Name);
			p.EntityType = propertyType;
			TranslateModifiers(property.GetMethod ?? property.SetMethod, p);
			p.ReturnType = ReadTypeReference(property.PropertyType, typeAttributes: property);

			p.Getter = ReadMethod(property.GetMethod, parentType, EntityType.Accessor, p);
			p.Setter = ReadMethod(property.SetMethod, parentType, EntityType.Accessor, p);

			if (property.HasParameters) {
				foreach (ParameterDefinition par in property.Parameters) {
					p.Parameters.Add(ReadParameter(par));
				}
			}
			AddAttributes(property, p);

			var accessor = p.Getter ?? p.Setter;
			if (accessor != null && accessor.IsExplicitInterfaceImplementation) {
				p.Name = property.Name.Substring(property.Name.LastIndexOf('.') + 1);
				p.IsExplicitInterfaceImplementation = true;
				foreach (var mr in accessor.ExplicitInterfaceImplementations) {
					p.ExplicitInterfaceImplementations.Add(new AccessorOwnerMemberReference(mr));
				}
			}

			FinishReadMember(p, property);
			return p;
		}
		#endregion

		#region Read Event
		[CLSCompliant(false)]
		public IUnresolvedEvent ReadEvent(EventDefinition ev, IUnresolvedTypeDefinition parentType)
		{
			if (ev == null)
				throw new ArgumentNullException("ev");
			if (parentType == null)
				throw new ArgumentNullException("parentType");

			DefaultUnresolvedEvent e = new DefaultUnresolvedEvent(parentType, ev.Name);
			TranslateModifiers(ev.AddMethod, e);
			e.ReturnType = ReadTypeReference(ev.EventType, typeAttributes: ev);

			e.AddAccessor    = ReadMethod(ev.AddMethod,    parentType, EntityType.Accessor, e);
			e.RemoveAccessor = ReadMethod(ev.RemoveMethod, parentType, EntityType.Accessor, e);
			e.InvokeAccessor = ReadMethod(ev.InvokeMethod, parentType, EntityType.Accessor, e);

			AddAttributes(ev, e);

			var accessor = e.AddAccessor ?? e.RemoveAccessor ?? e.InvokeAccessor;
			if (accessor != null && accessor.IsExplicitInterfaceImplementation) {
				e.Name = ev.Name.Substring(ev.Name.LastIndexOf('.') + 1);
				e.IsExplicitInterfaceImplementation = true;
				foreach (var mr in accessor.ExplicitInterfaceImplementations) {
					e.ExplicitInterfaceImplementations.Add(new AccessorOwnerMemberReference(mr));
				}
			}

			FinishReadMember(e, ev);

			return e;
		}
		#endregion

		void FinishReadMember(AbstractUnresolvedMember member, MemberReference cecilDefinition)
		{
			if (this.InterningProvider != null)
				member.ApplyInterningProvider(this.InterningProvider);
			member.Freeze();
			RegisterCecilObject(member, cecilDefinition);
		}

		#region Type system translation table
		readonly Dictionary<object, object> typeSystemTranslationTable;

		void RegisterCecilObject(IUnresolvedEntity typeSystemObject, MemberReference cecilObject)
		{
			if (OnEntityLoaded != null)
				OnEntityLoaded(typeSystemObject, cecilObject);

			AddToTypeSystemTranslationTable(typeSystemObject, cecilObject);
		}

		void AddToTypeSystemTranslationTable(object typeSystemObject, object cecilObject)
		{
			if (typeSystemTranslationTable != null) {
				// When lazy-loading, the dictionary might be shared between multiple cecil-loaders that are used concurrently
				lock (typeSystemTranslationTable) {
					typeSystemTranslationTable[typeSystemObject] = cecilObject;
				}
			}
		}

		T InternalGetCecilObject<T> (object typeSystemObject) where T : class
		{
			if (typeSystemObject == null)
				throw new ArgumentNullException ("typeSystemObject");
			if (!HasCecilReferences)
				throw new NotSupportedException ("This instance contains no cecil references.");
			object result;
			lock (typeSystemTranslationTable) {
				if (!typeSystemTranslationTable.TryGetValue (typeSystemObject, out result))
					return null;
			}
			return result as T;
		}

		[CLSCompliant(false)]
		public AssemblyDefinition GetCecilObject (IUnresolvedAssembly content)
		{
			return InternalGetCecilObject<AssemblyDefinition> (content);
		}

		[CLSCompliant(false)]
		public TypeDefinition GetCecilObject (IUnresolvedTypeDefinition type)
		{
			if (type == null)
				throw new ArgumentNullException ("type");
			return InternalGetCecilObject<TypeDefinition> (type);
		}

		[CLSCompliant(false)]
		public MethodDefinition GetCecilObject (IUnresolvedMethod method)
		{
			return InternalGetCecilObject<MethodDefinition> (method);
		}

		[CLSCompliant(false)]
		public FieldDefinition GetCecilObject (IUnresolvedField field)
		{
			return InternalGetCecilObject<FieldDefinition> (field);
		}

		[CLSCompliant(false)]
		public EventDefinition GetCecilObject (IUnresolvedEvent evt)
		{
			return InternalGetCecilObject<EventDefinition> (evt);
		}

		[CLSCompliant(false)]
		public PropertyDefinition GetCecilObject (IUnresolvedProperty property)
		{
			return InternalGetCecilObject<PropertyDefinition> (property);
		}
		#endregion
	}
}

redpajama_set_name: RedPajamaGithub


text:
Greg Laurie Harvest Daily Devotional
You Never Plan to Fall - Greg Laurie Daily Devotion - April 24, 2020
<< Greg Laurie Daily Devotions
You Never Plan to Fall
"Return, you backsliding children, and I will heal your backslidings" (Jeremiah 3:22 nkjv).
Awhile back, I'd taken up racquetball again. I hate treadmills and cardio, but I will run endlessly around in circles to chase a silly little ball with a racket.
One time, I was running to get a shot, and somehow, I pivoted and landed flat on my back. Some guy who was on a treadmill stopped and said, "Are you okay?" I was okay, but I had to take some Tylenol afterward.
The thing was, I wasn't planning on falling. And a lot of times that happens to us spiritually. People fall, and they weren't planning on it. But maybe they were setting themselves up for a fall.
I think when a person falls away spiritually, it's because there's neglect in their spiritual life. Because they're failing to move forward, they naturally (but not immediately) start going backward.
Then one day they wake up and say, "How did I end up in this state? How did I end up in this place I'm in? I don't remember when this happened." That's because it happened gradually.
The Bible warns about backsliding in Jeremiah 2:19: "'Your own wickedness will correct you, and your backslidings will rebuke you. Know therefore and see that it is an evil and bitter thing that you have forsaken the Lord your God, and the fear of Me is not in you,' says the Lord God of hosts" (nkjv).
Then, in Jeremiah 3:22, God says, "Return, you backsliding children, and I will heal your backslidings" (nkjv).
We need to be on guard against this, because the Bible says that one of the signs of the last days will be people falling away from the faith. We want to be very careful that we don't become those people. And if you're not moving forward, then you're automatically going backward.
Copyright © 2020 by Harvest Ministries. All rights reserved.
For more relevant and biblical teaching from Pastor Greg Laurie, go to www.harvest.org
Listen to Greg Laurie's daily broadcast on OnePlace.com.
Watch Greg Laurie's weekly television broadcast on LightSource.com.
In thanks for your gift, you can receive Jesus Revolution.
Discover how God transformed an unlikely generation . . . and how He can do it again today! This book, soon to be released in the form of a major motion picture, is our gift to you in thanks for your support in the month of January.
Click here to find out more!
Read More Greg Laurie Daily Devotions
Lopsided Christians - Greg Laurie Devotion - January 30, 2023 Jan 30, 2023
Lead a Worthy Life - Greg Laurie Devotion - January 28/29, 2023 Jan 28, 2023
Losing Yourself and Finding God's Best - Greg Laurie Devotion - January 27, 2023 Jan 27, 2023
The Crucified Life - Greg Laurie Devotion - January 26, 2023 Jan 26, 2023
More Greg Laurie Daily Devotions Articles

redpajama_set_name: RedPajamaCommonCrawl


The curtain came down on the soccer season 2010-2011 in what was another very successful one for the Tipperary Southern and District League. Despite the season being disrupted by the adverse weather credit must go to Hon Secretary Tom Lewis, who organised the fixtures and made sure the season still finished on time.
On the international scene the TSDL saw two more players wear the green of Ireland, with Richard Ryan of Clonmel Town joining St. Michael's Chris Higgins. Both played with established international players from this area - the St. Michael's duo, record-breaking skipper James Walsh (who made his 64th appearance) and Paul Breen (making his 29th appearance) in an Amateur International against Northern Ireland in Dundalk in March.
While all teams in the TSDL were in action in the various domestic competitions from the end of August 2010, late October saw another national record being achieved. St. Michael's and Irish Amateur/Junior skipper James Walsh became the most capped non-professional soccer player in the Republic of Ireland, leading the Irish Amateurs to yet another UEFA Regions Cup Finals. The qualifiers, played in Dublin, saw Ireland defeat San Marino 2-0; draw with Italy 0-0 and defeat France 3-0 to finish top. James Walsh will lead Ireland in back-to-back UEFA Regions Cup Finals in Portugal at the end of June. The squad will also include his St. Michael's team-mates Paul Breen and Chris Higgins.
On the national scene there was heartbreak for St. Michael's for the fourth time in the last decade in the FAI Junior Cup Final, as the Tipp town outfit were beaten by Pike Rovers of Limerick 2-1 in Cork. Teams to reach the last 64 of the FAI Junior Cup were Clonmel Town, Ballingarry Albion (for a second successive season) and debutants St. Nicholas FC of Solohead.
The TSDL Inter-League team reached the semi-final of the FAI Oscar Traynor Trophy but were beaten 1-0 by the Dublin AUL. The TSDL Youths went down 1-0 to Galway Youths in the quarter-final of the FAI Youth Inter-League Cup. St. Michael's reached the semi-final of the FAI Youth Cup, losing in a penalty shoot-out to Killarney Celtic.
A new competition was organised between the Tipperary Southern and District League and the North Tipperary and District League - the John Delaney Cup, named in honour of the current FAI CEO. This trophy saw the top four teams from the TSDL - Peake Villa, Clonmel Celtic, St. Michael's and Clonmel Town - taking on the top four from the NTDL - Nenagh FC, Nenagh Celtic, Blackcastle Utd and Cloughjordan FC, in late July. The final, played on the 8th August at Newhill Park, Littleton saw St. Michael's. with an empathic 6-2 victory over Nenagh FC, become the inaugural winners.
The status quo was restored in the Premier League in 2010/'11 in the TSDL with the big two, Clonmel Town and St. Michael's occupying the top two places, with Town winning a 16th TSDL crown by pipping Saints. Wilderness Rovers consolidated their place in the top flight at the first time of asking, finishing a creditable fourth.
The Tipperary Challenge Cup Final saw St. Michael's defeat a Clonmel Celtic side chasing a third consecutive title on a 1-0 scoreline in Cashel.
League Division 1 saw Two Mile Borris lifting the title, with St. Nicholas taking the runners-up spot. Two Mile Borris made it a double by defeating St. Nicholas in a penalty shoot-out in the Shield Final in Cooke Park, Tipp Town.
Clonmel Town B took the title in League Division 2, with Glengoole United making history by claiming the runners-up spot after defeating Killenaule Rovers in a play-off. Cashel Town B also made history, defeating Clonmel Celtic B 1-0 in the Shield Final at Newhill Park, Littleton.
In League Division 3 Cahir Park B won the title at the first time of asking, with Cullen-Lattin taking the runners-up spot. The big losers were FC Dundrum, who fielded a suspended player on two occasions that resulted in them being deducted 4 points. The Shield Final saw Vee Rovers defeat Redmondstown in Cahir Park.
Two of the newer clubs made history in League Division 4, with Ballypatrick FC becoming champions and newcomers Tipperary Town the runners-up. The Shield Final saw Dualla defeat Donohill-Doon Celtic at Danny O'Dwyer Park, Bohertrine.
A new name was etched on the Paddy Purtill Cup, as Glengoole United defeated holders Moyglass United 4-1 at Newhill Park, Littleton. Likewise there was a new name also on the Peter O'Reilly Cup, with Tipperary Town defeating Ballypatrick FC 3-2 at Celtic Park, Clonmel.
In the Youths competitions St. Michael's won the TSDL Youth Championship for a third successive season. There was a treble for Clonmel Celtic, who not only won the Youth Division 2 crown but were successful in both the Tipperary Youth Cup, defeating Cahir Park 1-0 in Cashel, and the Division 2 Youth Cup, defeating Cashel Town 7-0 in Cahir. The only other competition still to be finalised is the Joe Delaney Youth Cup between Nenagh AFC and Clonmel Town and the final is fixed for Rearcross on Sunday, 12 June at 3pm.
On behalf of the Tipperary Southern and District League, PRO John Butler thanks The Nationalist for their extensive coverage throughout the season. This wouldn't have happened without the co-operation of all the clubs that submitted match details each week. Thanks are also extended to the League's main sponsors - Clonmel Credit Union; the Shamrock Lounge, Castle Street, Cahir; Kelly Travel, Pallasgreen and John Quirke Jewellers, Cahir.
The annual general meeting of the Tipperary Southern and District League will be held on Wednesday, June 15th in Cooke Park, Tipp town at 8pm sharp.


Alexander Forbes has reported on the large scale of deficits faced by charities, which the company now estimates exceed £1 billion in total. Many are struggling to finance deficits on past pension liabilities and facing a recession where fundraising may be more of a battle than in the recent past. According to Alexander Forbes, the financial climate has presented a double whammy, affecting not only likely income but also the value of the investments backing their pension liabilities.
Accounting as a going concern, with future fundraising to meet their recovery plans, charities may look in a less difficult position than looking at the solvency position. Is it possible, perhaps, that wellknown charities might be future candidates for Pension Protection Fund calls?


text:
Agitation in Alzheimer's Disease
TNX-102 SL for Fibromyalgia
TNX-601 for Major Depressive Disorder (Depression)
TNX-601 for PTSD
TNX-102 SL for AAD
TNX-801 for Biodefense
TNX-1800 (Coronavirus Vaccine)
Tonix In The News
IR Events
Tonix Pharmaceuticals Holding Corp. on Facebook
Tonix Pharmaceuticals Holding Corp. on Twitter
Tonix Pharmaceuticals Holding Corp. on LinkedIn
Tonix Pharmaceuticals Holding Corp. on Google Plus
Tonix Pharmaceuticals Holding Corp. RSS
Tonix Pharmaceuticals is enrolling participants in a Phase 3 trial for fibromyalgia, the RALLY study.
For more information, please visit www.RALLYStudy.com or www.clinicaltrials.gov (NCT04508621).
: TNX-1800 (Coronavirus Vaccine)
Scientific Rationale for TNX-1800 as a vaccine for coronavirus
TNX-1800 (live modified horsepox virus vaccine) is being developed by Tonix Pharmaceuticals in a strategic collaboration with Southern Research to support the development of a vaccine to protect against the new coronavirus disease, COVID-19. TNX-1800 is based on Tonix's proprietary horsepox vaccine platform. It is believed that horsepox has the potential to serve as a vector for vaccines to protect against other infectious agents. The new research collaboration will develop and test a potential horsepox vaccine that expresses protein from the virus that causes COVID-19 to protect against the disease.
About TNX-801* and TNX-1800*
TNX-801 is a live virus vaccine based on synthesized horsepox1,2. TNX-1800 is a modified horsepox virus that is designed to express a protein from the virus that causes COVID-19, which is known as SARS-CoV-2. Molecular analysis suggests that TNX-801 has relatively "complete" left and right inverted terminal repeats (ITRs) while different vaccinia isolates have a variety of deletions in the left and right ITRs. Therefore, TNX-801 has additional genes, relative to vaccinia vaccines, that may play roles in host immune interactions and one or more of such proteins may serve as antigens for protective immunity. Molecular analysis also shows that horsepox is closer than modern vaccines in DNA sequence to the vaccine discovered and disseminated by Dr. Edward Jenner2,3,4. No new gene elements were added to the natural isolate and the small plaque size in culture appears identical to the U.S. Centers for Disease Control publication of the natural isolate5. Relative to vaccinia, horsepox has substantially decreased virulence in mice1. TNX-801 vaccinated macaques showed no overt clinical signs after monkeypox challenge6.
*TNX-801 and TNX-1800 are in the pre-IND stage and have not been approved for any indication.
About Orthopoxvirus Vectors
Horsepox and vaccinia are closely related orthopoxvirus that are believed to share a common ancestor. The name "horsepox" was derived from the animal from which the virus was isolated. The natural host is presumed to be wild rodents. The name "vaccinia" is a term that is applied to a group of related vaccine viruses that were industrially produced by infecting cows. The terms "vaccinia" and "vaccine" were originally coined by Dr. Edward Jenner (derived from the Latin "vacca" for "a cow") in his description of an illness in cows (cowpox) that was transferred inadvertently by human hands from horses to cows and from cows to human hands. Jenner was the first to use infectious matter (vaccinia or vaccine) from cowpox to elicit protective immunity to smallpox by intentional "vaccination". Although horsepox is not considered to be a vaccinia, modern DNA analysis reveals more variation between different vaccinia strains than between horsepox and certain vaccinia strains. Live replicating orthopoxvirus, like vaccinia or horsepox, can be engineered to express foreign genes and have been explored as platforms for vaccine development because they possess; (1) large packaging capacity for exogenous DNA inserts, (2) precise virus-specific control of exogenous gene insert expression, (3) lack of persistence or genomic integration in the host, (4) strong immunogenicity as a vaccine, (5) ability to rapidly generate vector/insert constructs, (6) readily manufacturable at scale, and (7) ability to provide direct antigen presentation.
Click here to learn more about Coronavirus
What makes TNX-1800 unique?
TNX-1800, as a horsepox vaccine, has potential advantages over vaccinia-based vaccines, including:
Maintains strong immunogenicity with potentially improved tolerability
Relative to non-replicating vaccinia, horsepox's replication in human cells provides direct antigen presentation by Class I MHC
Horsepox may behave differently as a vector, in part because of its different repertoire of genes that modulate immune responses and host range
TNX-1800 is being developed by Tonix Pharmaceuticals in a strategic collaboration with Southern Research, an independent, 501(c)(3) nonprofit, scientific research organization.
Basis for Exclusivity
Tonix recently filed a provisional patent on TNX-1800's technology. In addition, we expect TNX-1800 to be eligible for 12 years of non-patent-based exclusivity under the Patient Protection and Affordable Care Act, or PPACA.
Noyce RS, et al. (2018) PLoS One. 13(1):e0188453
Tulman ER, et al. (2006) J Virol. 80(18):9244-58.PMID:16940536
Schrick L et al. N Engl J Med. (2017) 377:1491.
Qin et al. J. Virol. 89:1809 (2015).
Trindale GS et al. Viruses (2016) (12). pii: E328. PMID:27973399
Noyce, RS, et al. Synthetic Chimeric Horsepox Virus (scHPXV) Vaccination Protects Macaques from Monkeypox* Presented as a poster at the American Society of Microbiology BioThreats Conference - January 29, 2020, Arlington, VA. (https://content.equisolve.net/tonixpharma/media/10929ac27f4fb5f5204f5cf41d59a121.pdf )
© 2021 Tonix Pharmaceuticals Holding Corp.
All rights reserved. Website by Equisolve.