1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
4
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
7
using System.Windows.Forms;
8
using ICSharpCode.Core;
9
using ICSharpCode.SharpDevelop.Gui;
11
namespace ICSharpCode.CodeAnalysis
14
/// Option panel to choose the FxCop path from.
16
public class AnalysisIdeOptionsPanel : XmlFormsOptionPanel
18
public override void LoadPanelContents()
20
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.CodeAnalysis.Resources.AnalysisIdeOptionPanel.xfrm"));
23
Get<Button>("findFxCopPath").Click += FindFxCopPathClick;
28
string path = FxCopWrapper.FindFxCopPath();
30
Get<Label>("status").Text = StringParser.Parse("${res:ICSharpCode.CodeAnalysis.IdeOptions.FxCopNotFound}");
32
Get<Label>("status").Text = StringParser.Parse("${res:ICSharpCode.CodeAnalysis.IdeOptions.FxCopFoundInPath}")
33
+ Environment.NewLine + path;
37
void FindFxCopPathClick(object sender, EventArgs e)
39
using (OpenFileDialog dlg = new OpenFileDialog()) {
40
dlg.DefaultExt = "exe";
41
dlg.Filter = StringParser.Parse("FxCop|fxcop.exe|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
42
if (dlg.ShowDialog() == DialogResult.OK) {
43
string path = Path.GetDirectoryName(dlg.FileName);
44
if (FxCopWrapper.IsFxCopPath(path)) {
47
MessageService.ShowError("${res:ICSharpCode.CodeAnalysis.IdeOptions.DirectoryDoesNotContainFxCop}");
54
public static string FxCopPath {
56
return PropertyService.Get("CodeAnalysis.FxCopPath");
59
PropertyService.Set("CodeAnalysis.FxCopPath", value);