當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。