本文整理汇总了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 ();
}
示例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");
}
示例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;
}
示例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;
}
示例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 ();
}
示例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;
}
示例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;
}
示例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 ();
}
示例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;
}
示例10: SupportsFormat
public override bool SupportsFormat (FileFormat format)
{
return format.Id == "MSBuild10";
}
示例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;
}
示例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;
}
示例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");
}
示例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);
}
示例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;
}