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

C# Mono类代码示例

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

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



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

示例1: Construct

        /// <summary>
        /// Generates a proxy that forwards all virtual method calls
        /// to a single <see cref="IInterceptor"/> instance.
        /// </summary>
        /// <param name="originalBaseType">The base class of the type being constructed.</param>
        /// <param name="baseInterfaces">The list of interfaces that the new type must implement.</param>
        /// <param name="module">The module that will hold the brand new type.</param>
        /// <param name="targetType">The <see cref="TypeDefinition"/> that represents the type to be created.</param>
        public override void Construct(Type originalBaseType, IEnumerable<Type> baseInterfaces, ModuleDefinition module, Mono.Cecil.TypeDefinition targetType)
        {
            var interfaces = new HashSet<Type>(baseInterfaces);

            if (!interfaces.Contains(typeof(ISerializable)))
                interfaces.Add(typeof(ISerializable));

            var serializableInterfaceType = module.ImportType<ISerializable>();
            if (!targetType.Interfaces.Contains(serializableInterfaceType))
                targetType.Interfaces.Add(serializableInterfaceType);

            // Create the proxy type
            base.Construct(originalBaseType, interfaces, module, targetType);

            // Add the Serializable attribute
            targetType.IsSerializable = true;

            var serializableCtor = module.ImportConstructor<SerializableAttribute>();
            var serializableAttribute = new CustomAttribute(serializableCtor);
            targetType.CustomAttributes.Add(serializableAttribute);

            ImplementGetObjectData(originalBaseType, baseInterfaces, module, targetType);
            DefineSerializationConstructor(module, targetType);

            var interceptorType = module.ImportType<IInterceptor>();
            var interceptorGetterProperty = (from PropertyDefinition m in targetType.Properties
                                          where m.Name == "Interceptor" && m.PropertyType == interceptorType
                                          select m).First();
        }
开发者ID:sdether,项目名称:LinFu,代码行数:37,代码来源:SerializableProxyBuilder.cs


示例2: LoadModule

        public void LoadModule(System.IO.Stream dllStream, System.IO.Stream pdbStream, Mono.Cecil.Cil.ISymbolReaderProvider debugInfoLoader)
        {
            var module = Mono.Cecil.ModuleDefinition.ReadModule(dllStream);
            if (debugInfoLoader != null && pdbStream != null)
            {
                module.ReadSymbols(debugInfoLoader.GetSymbolReader(module, pdbStream));
            }
            if (module.HasAssemblyReferences)
            {
                foreach (var ar in module.AssemblyReferences)
                {
                    if (moduleref.Contains(ar.Name) == false)
                        moduleref.Add(ar.Name);
                    if (moduleref.Contains(ar.FullName) == false)
                        moduleref.Add(ar.FullName);
                }
            }
            //mapModule[module.Name] = module;
            if (module.HasTypes)
            {
                foreach (var t in module.Types)
                {

                    mapType[t.FullName] = new Type_Common_CLRSharp(this, t);

                }
            }

        }
开发者ID:qq1792,项目名称:LSharp,代码行数:29,代码来源:CLRSharp_Env.cs


示例3: GenerateHtml

		public static string GenerateHtml (TextDocument doc, Mono.TextEditor.Highlighting.ISyntaxMode mode, Mono.TextEditor.Highlighting.ColorScheme style, ITextEditorOptions options)
		{

			var htmlText = new StringBuilder ();
			htmlText.AppendLine (@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">");
			htmlText.AppendLine ("<HTML>");
			htmlText.AppendLine ("<HEAD>");
			htmlText.AppendLine ("<META HTTP-EQUIV=\"CONTENT-TYPE\" CONTENT=\"text/html; charset=utf-8\">");
			htmlText.AppendLine ("<META NAME=\"GENERATOR\" CONTENT=\"Mono Text Editor\">");
			htmlText.AppendLine ("</HEAD>");
			htmlText.AppendLine ("<BODY>"); 

			var selection = new TextSegment (0, doc.TextLength);
			int startLineNumber = doc.OffsetToLineNumber (selection.Offset);
			int endLineNumber = doc.OffsetToLineNumber (selection.EndOffset);
			htmlText.AppendLine ("<FONT face = '" + options.Font.Family + "'>");
			bool first = true;
			if (mode is SyntaxMode) {
				SyntaxModeService.StartUpdate (doc, (SyntaxMode)mode, selection.Offset, selection.EndOffset);
				SyntaxModeService.WaitUpdate (doc);
			}

			foreach (var line in doc.GetLinesBetween (startLineNumber, endLineNumber)) {
				if (!first) {
					htmlText.AppendLine ("<BR>");
				} else {
					first = false;
				}

				if (mode == null) {
					AppendHtmlText (htmlText, doc, options, System.Math.Max (selection.Offset, line.Offset), System.Math.Min (line.EndOffset, selection.EndOffset));
					continue;
				}
				int curSpaces = 0;

				foreach (var chunk in mode.GetChunks (style, line, line.Offset, line.Length)) {
					int start = System.Math.Max (selection.Offset, chunk.Offset);
					int end = System.Math.Min (chunk.EndOffset, selection.EndOffset);
					var chunkStyle = style.GetChunkStyle (chunk);
					if (start < end) {
						htmlText.Append ("<SPAN style='");
						if (chunkStyle.FontWeight != Xwt.Drawing.FontWeight.Normal)
							htmlText.Append ("font-weight:" + ((int)chunkStyle.FontWeight) + ";");
						if (chunkStyle.FontStyle != Xwt.Drawing.FontStyle.Normal)
							htmlText.Append ("font-style:" + chunkStyle.FontStyle.ToString ().ToLower () + ";");
						htmlText.Append ("color:" + ((HslColor)chunkStyle.Foreground).ToPangoString () + ";");
						htmlText.Append ("'>");
						AppendHtmlText (htmlText, doc, options, start, end);
						htmlText.Append ("</SPAN>");
					}
				}
			}
			htmlText.AppendLine ("</FONT>");
            htmlText.AppendLine ("</BODY></HTML>");

			if (Platform.IsWindows)
                return GenerateCFHtml (htmlText.ToString ());

			return htmlText.ToString ();
		}
开发者ID:handless,项目名称:monodevelop,代码行数:60,代码来源:HtmlWriter.cs


示例4: UnixSocket

		protected UnixSocket (Mono.Unix.UnixEndPoint localEndPoint)
			: base (System.Net.Sockets.AddressFamily.Unix,
			        System.Net.Sockets.SocketType.Stream,
			        System.Net.Sockets.ProtocolType.IP,
			        localEndPoint)
		{
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:7,代码来源:UnixSocket.cs


示例5: ModuleMetadataInfo

			public ModuleMetadataInfo(Module module, Mono.Cecil.ModuleDefinition cecilModule)
			{
				this.Module = module;
				this.CecilModule = cecilModule;
				typeRefLoader = new CecilLoader();
				typeRefLoader.SetCurrentModule(cecilModule);
			}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:7,代码来源:TypeSystemExtensions.cs


示例6: AddMember

			public void AddMember(IUnresolvedEntity entity, Mono.Cecil.MemberReference cecilObject)
			{
				rwLock.EnterWriteLock();
				try {
					uint token = cecilObject.MetadataToken.ToUInt32();
					metadataTokens[entity] = token;
					
					var cecilMethod = cecilObject as Mono.Cecil.MethodDefinition;
					if (cecilMethod != null) {
						IUnresolvedMethod method = (IUnresolvedMethod)entity;
						tokenToMethod[token] = method;
						if (cecilMethod.HasBody) {
							var locals = cecilMethod.Body.Variables;
							if (locals.Count > 0) {
								localVariableTypes[method] = locals.Select(v => typeRefLoader.ReadTypeReference(v.VariableType)).ToArray();
							}
							if (cecilMethod.RVA != 0) {
								// The method was loaded from image - we can free the memory for the body
								// because Cecil will re-initialize it on demand
								cecilMethod.Body = null;
							}
						}
					}
				} finally {
					rwLock.ExitWriteLock();
				}
			}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:27,代码来源:TypeSystemExtensions.cs


示例7: PickTypeWriter

        public ITypeWriter PickTypeWriter(Mono.Cecil.TypeDefinition td, int indentCount, TypeCollection typeCollection, ConfigBase config)
        {
            if (td.IsEnum)
            {
                return new EnumWriter(td, indentCount, typeCollection, config);
            }

            if (td.IsInterface)
            {
                return new InterfaceWriter(td, indentCount, typeCollection, config);
            }

            if (td.IsClass)
            {
                
                if (td.BaseType.FullName == "System.MulticastDelegate" ||
                    td.BaseType.FullName == "System.Delegate")
                {
                    return new DelegateWriter(td, indentCount, typeCollection, config);
                }

                return new ClassWriter(td, indentCount, typeCollection, config);
            }

            throw new NotImplementedException("Could not get a type to generate for:" + td.FullName);
        }
开发者ID:sumitkm,项目名称:ToTypeScriptD,代码行数:26,代码来源:WinMDTypeWriterTypeSelector.cs


示例8: Collect

        public void Collect(Mono.Cecil.TypeDefinition td, TypeCollection typeCollection, ConfigBase config)
        {
            if (td.ShouldIgnoreType())
            {
                return;
            }

            // don't duplicate types
            if (typeCollection.Contains(td.FullName))
            {
                return;
            }

            StringBuilder sb = new StringBuilder();
            var indentCount = 0;
            ITypeWriter typeWriter = typeSelector.PickTypeWriter(td, indentCount, typeCollection, config);

            td.Interfaces.Each(item =>
            {
                var foundType = typeCollection.LookupType(item);

                if (foundType == null)
                {
                    //TODO: This reporting a missing type is too early in the process.
                    // typeNotFoundErrorHandler.Handle(item);
                    return;
                }

                var itemWriter = typeSelector.PickTypeWriter(foundType, indentCount, typeCollection, config);
                typeCollection.Add(foundType.Namespace, foundType.Name, itemWriter);

            });

            typeCollection.Add(td.Namespace, td.Name, typeWriter);
        }
开发者ID:sumitkm,项目名称:ToTypeScriptD,代码行数:35,代码来源:TypeWriterCollector.cs


示例9: ActivateEvent

		public override void ActivateEvent (Mono.Debugger.Event ev)
		{
			if (Process.MainThread.IsStopped)
				ev.Activate (Process.MainThread);
			else
				ThrowNotSupported ("Breakpoints can't be changed while the process is running.");
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:MdbAdaptor-2-4-2.cs


示例10: ProcessType

 public override void ProcessType(Mono.Cecil.TypeDefinition type)
 {
     switch (type.Namespace) {
     case "System.Runtime.Serialization.Json":
         switch (type.Name) {
         case "JsonFormatWriterInterpreter":
             TypeDefinition jwd = GetType ("System.Runtime.Serialization", "System.Runtime.Serialization.Json.JsonWriterDelegator");
             PreserveMethods (jwd);
             break;
         }
         break;
     case "System.Runtime.Serialization":
         // MS referencesource use reflection to call the required methods to serialize each PrimitiveDataContract subclasses
         // this goes thru XmlFormatGeneratorStatics and it's a better candidate (than PrimitiveDataContract) as there are other callers
         switch (type.Name) {
         case "XmlFormatGeneratorStatics":
             TypeDefinition xwd = GetType ("System.Runtime.Serialization", "System.Runtime.Serialization.XmlWriterDelegator");
             PreserveMethods (xwd);
             TypeDefinition xoswc = GetType ("System.Runtime.Serialization", "System.Runtime.Serialization.XmlObjectSerializerWriteContext");
             PreserveMethods (xoswc);
             TypeDefinition xosrc = GetType ("System.Runtime.Serialization", "System.Runtime.Serialization.XmlObjectSerializerReadContext");
             PreserveMethods (xosrc);
             TypeDefinition xrd = GetType ("System.Runtime.Serialization", "System.Runtime.Serialization.XmlReaderDelegator");
             PreserveMethods (xrd);
             break;
         case "CollectionDataContract":
             // ensure the nested type, DictionaryEnumerator and GenericDictionaryEnumerator`2, can be created thru reflection
             foreach (var nt in type.NestedTypes)
                 PreserveConstructors (nt);
             break;
         }
         break;
     }
 }
开发者ID:yudhitech,项目名称:xamarin-android,代码行数:34,代码来源:PreserveRuntimeSerialization.cs


示例11: CopyFrom

		public override void CopyFrom (Mono.Debugging.Evaluation.EvaluationContext gctx)
		{
			base.CopyFrom (gctx);
			MdbEvaluationContext ctx = (MdbEvaluationContext) gctx;
			thread = ctx.thread;
			frame = ctx.frame;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:EvaluationContext.cs


示例12: Process

 protected async override Task Process(Mono.Net.HttpListenerContext context)
 {
     var writer = new StreamWriter(context.Response.OutputStream);
     writer.Write(string.Empty);
     writer.Flush();
     context.Response.OutputStream.Close();
 }
开发者ID:faint32,项目名称:snowflake-1,代码行数:7,代码来源:BaseHttpServerTests.cs


示例13: AssemblyData

 /// <summary>
 /// Initializes a new instance of the <see cref="AssemblyData"/> class.
 /// </summary>
 /// <param name="assembly">The assembly.</param>
 private AssemblyData(Mono.Cecil.AssemblyDefinition assembly)
 {
     if (assembly == null)
         throw new ArgumentNullException("assembly");
     _assemblyDefinition = assembly;
     Refresh();
 }
开发者ID:bszafko,项目名称:Monoflector,代码行数:11,代码来源:AssemblyData.cs


示例14: EnableEvent

		public override void EnableEvent (Mono.Debugger.Event ev, bool enable)
		{
			if (enable)
				ev.Activate (Process.MainThread);
			else
				ev.Deactivate (Process.MainThread);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:MdbAdaptor-2-0.cs


示例15: InitBlock

				private void  InitBlock(Mono.Lucene.Net.Search.StringIndex fcsi, int inclusiveLowerPoint, int inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter enclosingInstance)
				{
					this.fcsi = fcsi;
					this.inclusiveLowerPoint = inclusiveLowerPoint;
					this.inclusiveUpperPoint = inclusiveUpperPoint;
					this.enclosingInstance = enclosingInstance;
				}
开发者ID:carrie901,项目名称:mono,代码行数:7,代码来源:FieldCacheRangeFilter.cs


示例16: GetParserContext

//		Mono.TextEditor.Document document;
//		MonoDevelop.Ide.Gui.Document doc;
//		IParser parser;
//		IResolver resolver;
//		IExpressionFinder expressionFinder;
		
/*		void Init (Mono.TextEditor.Document document)
		{
			
//			parser = ProjectDomService.GetParser (document.FileName, document.MimeType);
//			expressionFinder = ProjectDomService.GetExpressionFinder (document.FileName);
		}*/
		
		
		ProjectDom GetParserContext (Mono.TextEditor.Document document)
		{
			var project = IdeApp.ProjectOperations.CurrentSelectedProject;
			if (project != null)
				return ProjectDomService.GetProjectDom (project);
			return ProjectDom.Empty;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:21,代码来源:HighlightCSharpSemanticRule.cs


示例17: CreateNode

		public ILSpyTreeNode CreateNode(Mono.Cecil.Resource resource)
		{
			EmbeddedResource er = resource as EmbeddedResource;
			if (er != null)
				return CreateNode(er.Name, er.GetResourceStream());
			return null;
		}
开发者ID:rmattuschka,项目名称:ILSpy,代码行数:7,代码来源:XmlResourceNode.cs


示例18: PostStream

	static string PostStream (Mono.Security.Protocol.Tls.SecurityProtocolType protocol, string url, byte[] buffer)
	{
		Uri uri = new Uri (url);
		string post = "POST " + uri.AbsolutePath + " HTTP/1.0\r\n";
		post += "Content-Type: application/x-www-form-urlencoded\r\n";
		post += "Content-Length: " + (buffer.Length + 5).ToString () + "\r\n";
		post += "Host: " + uri.Host + "\r\n\r\n";
		post += "TEST=";
		byte[] bytes = Encoding.Default.GetBytes (post);

		IPHostEntry host = Dns.Resolve (uri.Host);
		IPAddress ip = host.AddressList [0];
		Socket socket = new Socket (ip.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
		socket.Connect (new IPEndPoint (ip, uri.Port));
		NetworkStream ns = new NetworkStream (socket, false);
		SslClientStream ssl = new SslClientStream (ns, uri.Host, false, protocol);
		ssl.ServerCertValidationDelegate += new CertificateValidationCallback (CertificateValidation);

		ssl.Write (bytes, 0, bytes.Length);
		ssl.Write (buffer, 0, buffer.Length);
		ssl.Flush ();

		StreamReader reader = new StreamReader (ssl, Encoding.UTF8);
		string result = reader.ReadToEnd ();
		int start = result.IndexOf ("\r\n\r\n") + 4;
		start = result.IndexOf ("\r\n\r\n") + 4;
		return result.Substring (start);
	}
开发者ID:Jakosa,项目名称:MonoLibraries,代码行数:28,代码来源:postecho.cs


示例19: TypedVariableReferenceExpression

        public TypedVariableReferenceExpression(Mono.Cecil.Cil.VariableReference variable)
            : base(variable)
        {
            var type = Type.GetType(variable.VariableType.FullName, true);

            this.ElementType = TypedTransformer.GetElementType(type);
        }
开发者ID:kthompson,项目名称:csharpos,代码行数:7,代码来源:TypedVariableReferenceExpression.cs


示例20: InformMouseHover

		public override void InformMouseHover (Mono.TextEditor.MonoTextEditor editor, Margin margin, MarginMouseEventArgs args)
		{
			if (!(margin is ActionMargin))
				return;
			string toolTip;
			if (unitTest.IsFixture) {
				if (isFailed) {
					toolTip = GettextCatalog.GetString ("NUnit Fixture failed (click to run)");
					if (!string.IsNullOrEmpty (failMessage))
						toolTip += Environment.NewLine + failMessage.TrimEnd ();
				} else {
					toolTip = GettextCatalog.GetString ("NUnit Fixture (click to run)");
				}
			} else {
				if (isFailed) {
					toolTip = GettextCatalog.GetString ("NUnit Test failed (click to run)");
					if (!string.IsNullOrEmpty (failMessage))
						toolTip += Environment.NewLine + failMessage.TrimEnd ();
					foreach (var id in unitTest.TestCases) {
						if (host.IsFailure (unitTest.UnitTestIdentifier, id)) {
							var msg = host.GetMessage (unitTest.UnitTestIdentifier, id);
							if (!string.IsNullOrEmpty (msg)) {
								toolTip += Environment.NewLine + "Test" + id + ":";
								toolTip += Environment.NewLine + msg.TrimEnd ();
							}
						}
					}
				} else {
					toolTip = GettextCatalog.GetString ("NUnit Test (click to run)");
				}

			}
			editor.TooltipText = toolTip;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:34,代码来源:UnitTestMarker.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Index.IndexReader类代码示例发布时间:2022-05-24
下一篇:
C# Monks类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap