本文整理汇总了C#中MonoDevelop.GetConfiguration方法的典型用法代码示例。如果您正苦于以下问题:C# MonoDevelop.GetConfiguration方法的具体用法?C# MonoDevelop.GetConfiguration怎么用?C# MonoDevelop.GetConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoDevelop
的用法示例。
在下文中一共展示了MonoDevelop.GetConfiguration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCompilerArguments
public static CSharpParseOptions GetCompilerArguments (MonoDevelop.Projects.Project project)
{
var compilerArguments = new CSharpParseOptions ();
// compilerArguments.TabSize = 1;
if (project == null || MonoDevelop.Ide.IdeApp.Workspace == null) {
// compilerArguments.AllowUnsafeBlocks = true;
return compilerArguments;
}
var configuration = project.GetConfiguration (MonoDevelop.Ide.IdeApp.Workspace.ActiveConfiguration) as DotNetProjectConfiguration;
if (configuration == null)
return compilerArguments;
compilerArguments = compilerArguments.WithPreprocessorSymbols (configuration.GetDefineSymbols ());
var par = configuration.CompilationParameters as CSharpCompilerParameters;
if (par == null)
return compilerArguments;
// compilerArguments.AllowUnsafeBlocks = par.UnsafeCode;
compilerArguments = compilerArguments.WithLanguageVersion (ConvertLanguageVersion (par.LangVersion));
// compilerArguments.CheckForOverflow = par.GenerateOverflowChecks;
// compilerArguments.WarningLevel = par.WarningLevel;
// compilerArguments.TreatWarningsAsErrors = par.TreatWarningsAsErrors;
// if (!string.IsNullOrEmpty (par.NoWarnings)) {
// foreach (var warning in par.NoWarnings.Split (';', ',', ' ', '\t')) {
// int w;
// try {
// w = int.Parse (warning);
// } catch (Exception) {
// continue;
// }
// compilerArguments.DisabledWarnings.Add (w);
// }
// }
return compilerArguments;
}
示例2: LoadProject
async Task<ProjectInfo> LoadProject (MonoDevelop.Projects.Project p, CancellationToken token)
{
if (!projectIdMap.ContainsKey (p)) {
p.FileAddedToProject += OnFileAdded;
p.FileRemovedFromProject += OnFileRemoved;
p.FileRenamedInProject += OnFileRenamed;
p.Modified += OnProjectModified;
}
var projectId = GetOrCreateProjectId (p);
var projectData = GetOrCreateProjectData (projectId);
var references = await CreateMetadataReferences (p, projectId, token).ConfigureAwait (false);
if (token.IsCancellationRequested)
return null;
var config = IdeApp.Workspace != null ? p.GetConfiguration (IdeApp.Workspace.ActiveConfiguration) as MonoDevelop.Projects.DotNetProjectConfiguration : null;
MonoDevelop.Projects.DotNetCompilerParameters cp = null;
if (config != null)
cp = config.CompilationParameters;
FilePath fileName = IdeApp.Workspace != null ? p.GetOutputFileName (IdeApp.Workspace.ActiveConfiguration) : (FilePath)"";
if (fileName.IsNullOrEmpty)
fileName = new FilePath (p.Name + ".dll");
var sourceFiles = await p.GetSourceFilesAsync (config != null ? config.Selector : null).ConfigureAwait (false);
var info = ProjectInfo.Create (
projectId,
VersionStamp.Create (),
p.Name,
fileName.FileNameWithoutExtension,
LanguageNames.CSharp,
p.FileName,
fileName,
cp != null ? cp.CreateCompilationOptions () : null,
cp != null ? cp.CreateParseOptions (config) : null,
CreateDocuments (projectData, p, token, sourceFiles),
CreateProjectReferences (p, token),
references
);
projectData.Info = info;
return info;
}
示例3: GetDefinedSymbols
public static IEnumerable<string> GetDefinedSymbols (MonoDevelop.Projects.Project project)
{
var workspace = IdeApp.Workspace;
if (workspace == null || project == null)
yield break;
var configuration = project.GetConfiguration (workspace.ActiveConfiguration) as DotNetProjectConfiguration;
if (configuration != null) {
foreach (string s in configuration.GetDefineSymbols ())
yield return s;
// Workaround for mcs defined symbol
if (configuration.TargetRuntime.RuntimeId == "Mono")
yield return "__MonoCS__";
}
}