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


C# Projects.FileFormat类代码示例

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


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

示例1: ExportSolutionDialog

        public ExportSolutionDialog(WorkspaceItem item, FileFormat selectedFormat)
        {
            this.Build();

            labelNewFormat.Text = item.FileFormat.Name;

            formats = Services.ProjectService.FileFormats.GetFileFormatsForObject (item);
            foreach (FileFormat format in formats)
                comboFormat.AppendText (format.Name);

            int sel = Array.IndexOf (formats, selectedFormat);
            if (sel == -1) sel = 0;
            comboFormat.Active = sel;

            if (formats.Length < 2) {
                table.Remove (newFormatLabel);
                newFormatLabel.Destroy ();
                newFormatLabel = null;
                table.Remove (comboFormat);
                comboFormat.Destroy ();
                comboFormat = null;
            }

            //auto height
            folderEntry.WidthRequest = 380;
            Resize (1, 1);

            folderEntry.Path = item.ItemDirectory;
            UpdateControls ();
        }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:30,代码来源:ExportSolutionDialog.cs

示例2: GetDefaultTargetFrameworkForFormat

		public override TargetFrameworkMoniker GetDefaultTargetFrameworkForFormat (FileFormat format)
		{
			// Note: This value is used only when serializing the TargetFramework to the .csproj file.
			// Any component of the TargetFramework that is different from this base TargetFramework
			// value will be serialized.
			//
			// Therefore, if we only specify the TargetFrameworkIdentifier, then both the
			// TargetFrameworkVersion and TargetFrameworkProfile values will be serialized.
			return new TargetFrameworkMoniker (".NETPortable", "1.0");
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:10,代码来源:PortableDotNetProject.cs

示例3: GetDefaultTargetFrameworkForFormat

		public override TargetFrameworkMoniker GetDefaultTargetFrameworkForFormat (FileFormat format)
		{
			switch (format.Id) {
			case "MSBuild05":
				return TargetFrameworkMoniker.NET_2_0;
			case "MSBuild08":
				return TargetFrameworkMoniker.NET_2_0;
			case "MSBuild10":
				return TargetFrameworkMoniker.NET_4_0;
			}
			return Services.ProjectService.DefaultTargetFramework.Id;
		}
开发者ID:nieve,项目名称:monodevelop,代码行数:12,代码来源:DotNetAssemblyProject.cs

示例4: SupportsFormat

		public override bool SupportsFormat (FileFormat format)
		{
			int version;
			
			if (!format.Id.StartsWith ("MSBuild"))
				return false;
			
			if (!int.TryParse (format.Id.Substring ("MSBuild".Length), out version))
				return false;
			
			return version >= 10;
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:12,代码来源:PortableDotNetProject.cs

示例5: ExportProjectDialog

		public ExportProjectDialog (IWorkspaceObject entry, FileFormat selectedFormat)
		{
			this.Build();
			
			FileFormat f = entry is WorkspaceItem ? ((WorkspaceItem)entry).FileFormat : ((SolutionEntityItem)entry).FileFormat;
			labelNewFormat.Text = f.Name;
			
			formats = Services.ProjectService.FileFormats.GetFileFormatsForObject (entry);
			foreach (FileFormat format in formats)
				comboFormat.AppendText (format.Name);

			int sel = Array.IndexOf (formats, selectedFormat);
			if (sel == -1) sel = 0;
			comboFormat.Active = sel;
			
			folderEntry.Path = entry.ItemDirectory;
			UpdateControls ();
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:18,代码来源:ExportProjectDialog.cs

示例6: SourcesZipEditorWidget

		public SourcesZipEditorWidget (PackageBuilder target, FileFormat selectedFormat)
		{
			this.Build();
			this.target = (SourcesZipPackageBuilder) target;
			loading = true;
			
			if (target.RootSolutionItem is SolutionFolder)
				formats = Services.ProjectService.FileFormats.GetFileFormatsForObject (target.Solution);
			else
				formats = Services.ProjectService.FileFormats.GetFileFormatsForObject (target.RootSolutionItem);
			
			if (selectedFormat == null) selectedFormat = this.target.FileFormat;
			if (selectedFormat == null)
				selectedFormat = formats [0];
			
			int sel = 0;
			for (int n=0; n<formats.Length; n++) {
				comboFormat.AppendText (formats[n].Name);
				if (formats[n].Name == selectedFormat.Name)
					sel = n;
			}

			comboFormat.Active = sel;
			this.target.FileFormat = formats [sel];
			
			string[] archiveFormats = DeployService.SupportedArchiveFormats;
			int zel = 1;
			for (int n=0; n<archiveFormats.Length; n++) {
				comboZip.AppendText (archiveFormats [n]);
				if (this.target.TargetFile.EndsWith (archiveFormats [n]))
					zel = n;
			}
			
			if (!string.IsNullOrEmpty (this.target.TargetFile)) {
				string ext = archiveFormats [zel];
				folderEntry.Path = System.IO.Path.GetDirectoryName (this.target.TargetFile);
				entryZip.Text = System.IO.Path.GetFileName (this.target.TargetFile.Substring (0, this.target.TargetFile.Length - ext.Length));
				comboZip.Active = zel;
			}
			loading = false;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:41,代码来源:SourcesZipEditorWidget.cs

示例7: WriteFile

		string WriteFile (IProgressMonitor monitor, string file, object item, FileFormat format)
		{
			if (format == null) {
				if (defaultFormat.CanWrite (item))
					format = defaultFormat;
				else {
					FileFormat[] formats = formatManager.GetFileFormatsForObject (item);
					format = formats.Length > 0 ? formats [0] : null;
				}
				
				if (format == null)
					return null;
				file = format.GetValidFileName (item, file);
			}
			
			if (!FileService.RequestFileEdit (file))
				throw new UserException (GettextCatalog.GetString ("The project could not be saved"), GettextCatalog.GetString ("Write permission has not been granted for file '{0}'", file));
			
			format.Format.WriteFile (file, item, monitor);
			return file;
		}
开发者ID:hduregger,项目名称:monodevelop,代码行数:21,代码来源:ProjectService.cs

示例8: GetDefaultTargetFrameworkForFormat

		/// <summary>
		/// Returns the default framework for a given format
		/// </summary>
		/// <returns>
		/// The default target framework for the format.
		/// </returns>
		/// <param name='format'>
		/// A format
		/// </param>
		/// <remarks>
		/// This method is used to determine what's the correct target framework for a project
		/// deserialized using a specific format.
		/// </remarks>
		public virtual TargetFrameworkMoniker GetDefaultTargetFrameworkForFormat (FileFormat format)
		{
			return GetDefaultTargetFrameworkId ();
		}
开发者ID:John-Colvin,项目名称:monodevelop,代码行数:17,代码来源:DotNetProject.cs

示例9: ReadFile

		object ReadFile (IProgressMonitor monitor, string file, Type expectedType, out FileFormat format)
		{
			FileFormat[] formats = formatManager.GetFileFormats (file, expectedType);

			if (formats.Length == 0)
				throw new InvalidOperationException ("Unknown file format: " + file);
			
			format = formats [0];
			object obj = format.Format.ReadFile (file, expectedType, monitor);
			if (obj == null)
				throw new InvalidOperationException ("Invalid file format: " + file);

			return obj;
		}
开发者ID:hduregger,项目名称:monodevelop,代码行数:14,代码来源:ProjectService.cs

示例10: SupportsFormat

		public override bool SupportsFormat (FileFormat format)
		{
			return format.Id == "MSBuild10";
		}
开发者ID:Poiros,项目名称:monodevelop,代码行数:4,代码来源:MonoMacProject.cs

示例11: SetClosestSupportedTargetFramework

		static void SetClosestSupportedTargetFramework (FileFormat format, DotNetProject project)
		{
			// If the solution format can't write this project due to an unsupported framework, try finding the
			// closest valid framework. DOn't worry about whether it's installed, that's up to the user to correct.
			TargetFramework curFx = project.TargetFramework;
			var candidates = Runtime.SystemAssemblyService.GetTargetFrameworks ()
				.Where (fx =>
					//only frameworks with the same ID, else version comparisons are meaningless
					fx.Id.Identifier == curFx.Id.Identifier &&
					//don't consider profiles, only full frameworks
					fx.Id.Profile == null &&
					//and the project and format must support the framework
					project.SupportsFramework (fx) && format.SupportsFramework (fx))
					//FIXME: string comparisons aren't a valid way to compare profiles, but it works w/released .NET versions
				.OrderBy (fx => fx.Id.Version)
				.ToList ();
			
			TargetFramework newFx =
				candidates.FirstOrDefault (fx => string.CompareOrdinal (fx.Id.Version, curFx.Id.Version) > 0)
				 ?? candidates.LastOrDefault ();
			
			if (newFx != null)
				project.TargetFramework = newFx;
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:24,代码来源:ProjectDescriptor.cs

示例12: TryFixingFramework

		public void TryFixingFramework (FileFormat format, DotNetProject item)
		{
			// If the solution format can't write this project it may be due to an unsupported
			// framework. Try finding a compatible framework.

			TargetFramework curFx = item.TargetFramework;
			foreach (TargetFramework fx in Runtime.SystemAssemblyService.GetTargetFrameworks ()) {
				item.TargetFramework = fx;
				if (format.CanWrite (item))
					return;
			}
			item.TargetFramework = curFx;
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:13,代码来源:ProjectDescriptor.cs

示例13: ProjectService

		internal ProjectService ()
		{
			extensionChainSlot = Thread.AllocateDataSlot ();
			AddinManager.AddExtensionNodeHandler (FileFormatsExtensionPath, OnFormatExtensionChanged);
			AddinManager.AddExtensionNodeHandler (SerializableClassesExtensionPath, OnSerializableExtensionChanged);
			AddinManager.AddExtensionNodeHandler (ExtendedPropertiesExtensionPath, OnPropertiesExtensionChanged);
			AddinManager.AddExtensionNodeHandler (ProjectBindingsExtensionPath, OnProjectsExtensionChanged);
			AddinManager.ExtensionChanged += OnExtensionChanged;
			
			defaultFormat = formatManager.GetFileFormat ("MSBuild05");
		}
开发者ID:hduregger,项目名称:monodevelop,代码行数:11,代码来源:ProjectService.cs

示例14: ProjectService

		internal ProjectService ()
		{
			AddinManager.AddExtensionNodeHandler (FileFormatsExtensionPath, OnFormatExtensionChanged);
			AddinManager.AddExtensionNodeHandler (SerializableClassesExtensionPath, OnSerializableExtensionChanged);
			AddinManager.AddExtensionNodeHandler (ExtendedPropertiesExtensionPath, OnPropertiesExtensionChanged);
			AddinManager.AddExtensionNodeHandler (ProjectBindingsExtensionPath, OnProjectsExtensionChanged);
			AddinManager.ExtensionChanged += OnExtensionChanged;
			
			defaultFormat = formatManager.GetFileFormat (MSBuildProjectService.DefaultFormat);
		}
开发者ID:riverans,项目名称:monodevelop,代码行数:10,代码来源:ProjectService.cs

示例15: WriteFile

		FilePath WriteFile (IProgressMonitor monitor, FilePath file, object item, FileFormat format)
		{
			if (format == null) {
				if (defaultFormat.CanWrite (item))
					format = defaultFormat;
				else {
					FileFormat[] formats = formatManager.GetFileFormatsForObject (item);
					format = formats.Length > 0 ? formats [0] : null;
				}
				
				if (format == null)
					return null;

				file = format.GetValidFileName (item, file);
			}
			
			FileService.RequestFileEdit (file);

			format.Format.WriteFile (file, item, monitor);
			return file;
		}
开发者ID:jgranick,项目名称:haxedevelop,代码行数:21,代码来源:ProjectService.cs


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