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


C# Options.ProcessArgs方法代码示例

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


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

示例1: Main

	static void Main (string [] args)
	{
		Options options = new Options ();
		if (!options.ProcessArgs (args))
			return;
		
		if (options.AssemblyReference != null) {
			assembly = options.AssemblyReference;
			
			if (options.Type == null) {
				if (options.PrintRefs)
					PrintRefs (assembly);
				else
					PrintTypes (assembly, options.ShowPrivate, options.FilterObsolete);
				return;
			}
		}

		string message = null;
		string tname = options.Type;
		Type t = null;
		int count;

		if (options.Search) {
			string matches = SearchTypes (tname, ref t, out count);

			if (count == 0)
				goto notfound;

			if (count == 1)
				goto found;
			
			if (count > 1){
				Console.WriteLine ("Found " + count + " types that match:");
				Console.WriteLine (matches);
				return;
			}
		}
			
		t = GetType (tname);

		if (t == null) {
			// Try some very common ones, dont load anything
			foreach (string ns in v_common_ns) {
				t = GetType (ns + "." + tname, true);
				if (t != null)
					goto found;
			}
		}

		if (t == null) {
			foreach (string assm in GetKnownAssemblyNames ()) {
				try {
					Assembly a = GetAssembly (assm, false);
					t = a.GetType (tname, false, true);
					if (t != null) {
						message = String.Format ("{0} is included in the {1} assembly.",
								t.FullName, 
								t.Assembly.GetName ().Name);
						goto found;
					}
					foreach (string ns in common_ns) {
						t = a.GetType (ns + "." + tname, false, true);
						if (t != null) {
							message = String.Format ("{0} is included in the {1} assembly.",
									t.FullName, 
									t.Assembly.GetName ().Name);
							goto found;
						}
					}
				} catch {
				}
			}
		}

	notfound:
		if (t == null) {
			Console.WriteLine ("Could not find {0}", tname);
			return;
		}
	found:
		//
		// This gets us nice buffering
		//
		StreamWriter sw = new StreamWriter (Console.OpenStandardOutput (), Console.Out.Encoding);				
		new Outline (t, sw, options.DeclaredOnly, options.ShowPrivate, options.FilterObsolete).OutlineType ();
		sw.Flush ();

		if (message != null)
			Console.WriteLine (message);
	}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:91,代码来源:monop.cs


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