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


C# CommandLineParser.ShowError方法代码示例

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


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

示例1: Main

		/// <summary>
		/// Run with following arguments:
		/// 
		/// </summary>
		/// <param name="args"></param>
		/// <returns></returns>
		static int Main ( string[] args )
		{
			Thread.CurrentThread.CurrentCulture	=	System.Globalization.CultureInfo.InvariantCulture;
			Log.AddListener( new StdLogListener() );

			var options = new BuildOptions();
			var parser = new CommandLineParser( options );


			try {

				if ( args.Any( a => a=="/help" )) {
					PrintHelp( parser );
					return 0;
				}

				if ( !parser.ParseCommandLine( args ) ) {
					return 1;
				}

				Builder.Build( options );


			} catch ( Exception ex ) {
				parser.ShowError( ex.Message );
				return 1;
			}

			return 0;
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:36,代码来源:FBuild.cs

示例2: Main

		static int Main ( string[] args )
		{
			Thread.CurrentThread.CurrentCulture	=	System.Globalization.CultureInfo.InvariantCulture;
			Log.AddListener( new StdLogListener() );

			var options = new Options();
			var parser = new CommandLineParser( options );

			try {

				//	parse arguments :
				if (!parser.ParseCommandLine( args )) {
					return 1;
				}

				//	change extension of output not set :
				if (options.Output==null) {
					options.Output = Path.ChangeExtension( options.Input, ".scene");
				}
				

				//
				//	run fbx loader :
				//
				Log.Message("Reading FBX: {0}", options.Input);

				var loader = new FbxLoader();
				using ( var scene  = loader.LoadScene( options.Input, options ) ) {
				
					//
					//	Save scene :
					//					
					Log.Message("Preparation...");
					foreach ( var mesh in scene.Meshes ) {
						if (mesh!=null) {
							mesh.MergeVertices( options.MergeTolerance );
							mesh.DefragmentSubsets(scene, true);
							mesh.ComputeTangentFrame();
							mesh.ComputeBoundingBox();
						}
					}

					Log.Message("Merging instances...");
					scene.DetectAndMergeInstances();
					
					if (options.BaseDirectory!=null) {

						Log.Message("Resolving assets path...");
						
						var relativePath = ContentUtils.MakeRelativePath( options.BaseDirectory + @"\", options.Input );
						var relativeDir  = Path.GetDirectoryName( relativePath );
						var sceneDir	 = Path.GetDirectoryName( options.Input );
						Log.Message("...scene directory      : {0}", sceneDir);
						Log.Message("...scene base directory : {0}", options.BaseDirectory);
						Log.Message("...scene relative path  : {0}", relativePath);
						Log.Message("...scene relative dir   : {0}", relativeDir);

						foreach ( var mtrl in scene.Materials ) {
							ResolveMaterial( mtrl, relativeDir, sceneDir );
						}
					}

					//
					//	Save scene :
					//					
					Log.Message("Writing binary file: {0}", options.Output);
					using ( var stream = File.OpenWrite( options.Output ) ) {
						scene.Save( stream );
					}


					if (options.Report) {
						var reportPath = options.Input + ".html";
						Log.Message("Writing report: {0}", reportPath);
						File.WriteAllText( reportPath, SceneReport.CreateHtmlReport(scene));
					}
				}

				Log.Message("Done.");

			} catch ( Exception e ) {
				parser.ShowError( "{0}", e.ToString() );

				if (options.Wait) {
					Log.Message("Press any key to continue...");
					Console.ReadKey();
				}

				return 1;
			}

			if (options.Wait) {
				Log.Message("Press any key to continue...");
				Console.ReadKey();
			}

			return 0;
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:98,代码来源:FScene.cs


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