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


C# MonoDevelop.GetType方法代码示例

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


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

示例1: UpgradeMonoGameProject

		static bool UpgradeMonoGameProject (MonoDevelop.Core.IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MSBuildProject project)
		{
			bool needsSave = false;
			bool containsMGCB = project.ItemGroups.Any (x => x.Items.Any (i => System.IO.Path.GetExtension (i.Include) == ".mgcb"));
			bool isMonoGame = project.PropertyGroups.Any (x => x.Properties.Any (p => p.Name == "MonoGamePlatform")) ||
				project.ItemGroups.Any (x => x.Items.Any (i => i.Name == "Reference" && i.Include == "MonoGame.Framework")) ||
				containsMGCB;
			bool isApplication = project.PropertyGroups.Any (x => x.Properties.Any (p => p.Name == "OutputType" && p.GetValue () == "Exe")) ||
				project.PropertyGroups.Any (x => x.Properties.Any (p => p.Name == "AndroidApplication" && string.Compare (p.GetValue (), bool.TrueString, true)==0));
			bool isShared = project.PropertyGroups.Any (x => x.Properties.Any (p => p.Name == "HasSharedItems" && p.GetValue () == "true"));
			var type = item.GetType ().Name;
			monitor.Log.WriteLine ("Found {0}", type);
			var platform = Environment.OSVersion.Platform == PlatformID.Win32NT ? "Windows" : "DesktopGL";
			var path = MonoGameExtensionsPath;
			switch (type) {
			case "XamarinIOSProject":
				platform = "iOS";
				break;
			case "MonoDroidProject":
				platform = "Android";
				break;
			case "XamMac2Project":
			case "MonoGameProject":
				platform = "DesktopGL";
				break;
			case "XamMac":
			case "XamMacProject":
				platform = "DesktopGL";
				// Xamarin.Mac Classic does not use MSBuild so we need to absolute path.
				path = MonoGameExtensionsAbsolutePath;
				break;
			case "MonoMac":
			case "MonoMacProject":
				platform = "MacOSX";
				// Xamarin.Mac Classic does not use MSBuild so we need to absolute path.
				path = MonoGameExtensionsAbsolutePath;
				break;
			}
			monitor.Log.WriteLine ("Platform = {0}", platform);
			monitor.Log.WriteLine ("Path = {0}", path);
			monitor.Log.WriteLine ("isMonoGame {0}", isMonoGame);
			if (isMonoGame) {
				var ritems = new List<MSBuildItem> ();
				foreach (var ig in project.ItemGroups) {
					foreach (var i in ig.Items.Where (x => x.Name == "Reference" && x.Include == "MonoGame.Framework")) {
						if (!i.HasMetadata ("HintPath")) {
							monitor.Log.WriteLine ("Fixing {0} to be MonoGameContentReference", i.Include);
							var a = ig.AddNewItem ("Reference", i.Include);
							a.SetMetadata ("HintPath", string.Format (path, platform, "MonoGame.Framework.dll"));
							ritems.Add (i);
							needsSave = true;
						}
					}
					foreach (var i in ig.Items.Where (x => x.Name == "Reference" && x.Include == "Tao.Sdl")) {
						if (!i.HasMetadata ("HintPath")) {
							monitor.Log.WriteLine ("Fixing {0} to be Tao.Sdl", i.Include);
							var a = ig.AddNewItem ("Reference", i.Include);
							a.SetMetadata ("HintPath", string.Format (path, platform, "Tao.Sdl.dll"));
							ritems.Add (i);
							needsSave = true;
						}
					}
					foreach (var i in ig.Items.Where (x => x.Name == "Reference" && x.Include.StartsWith ("OpenTK") &&
							(platform != "iOS" && platform != "Android"))) {
						if (!i.HasMetadata ("HintPath")) {
							monitor.Log.WriteLine ("Fixing {0} to be OpenTK", i.Include);
							var a = ig.AddNewItem ("Reference", i.Include);
							a.SetMetadata ("HintPath", string.Format (path, platform, "OpenTK.dll"));
							a.SetMetadata ("SpecificVersion", "true");
							ritems.Add (i);
							needsSave = true;
						}
					}
					foreach (var i in ig.Items.Where (x => x.Name == "Reference" && x.Include == "NVorbis")) {
						if (!i.HasMetadata ("HintPath")) {
							monitor.Log.WriteLine ("Fixing {0} to be NVorbis", i.Include);
							var a = ig.AddNewItem ("Reference", i.Include);
							a.SetMetadata ("HintPath", string.Format (path, platform, "NVorbis.dll"));
							ritems.Add (i);
							needsSave = true;
						}
					}
				}
				foreach (var a in ritems) {
					project.RemoveItem (a);
				}
				var dotNetProject = item as DotNetProject;
				if (dotNetProject != null && (type == "MonoMacProject" || type == "XamMacProject" )) {
					var items = new List<ProjectReference> ();
					var newitems = new List<ProjectReference> ();
					foreach (var reference in dotNetProject.References) {
						if (reference.Reference == "MonoGame.Framework" && string.IsNullOrEmpty (reference.HintPath)) {
							items.Add (reference);
							newitems.Add (new ProjectReference (ReferenceType.Assembly, reference.Reference, string.Format (path, platform, "MonoGame.Framework.dll")));
						}
						if (reference.Reference.StartsWith ("OpenTK") && string.IsNullOrEmpty (reference.HintPath)) {
							items.Add (reference);
							newitems.Add (new ProjectReference (ReferenceType.Assembly, reference.Reference, string.Format (path, platform, "OpenTK.dll")));
						}
						if (reference.Reference == "NVorbis" && string.IsNullOrEmpty (reference.HintPath)) {
//.........这里部分代码省略.........
开发者ID:Cardanis,项目名称:MonoGame,代码行数:101,代码来源:MonoGameMSBuildImports.cs


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