aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2016-11-02 14:17:57 +0100
committerKarsten Heimrich <karsten.heimrich@qt.io>2016-11-08 09:58:15 +0000
commit09e0c10ce273d63bd7fa8f6ce582cefb61f336c6 (patch)
treeba2391561f2e0b497de3910c40070b202cca79d4 /src
parentdec2ba0bba6bac1994a515be118fdc317f36e550 (diff)
Code change: Remove redundant code
Change-Id: I3dabe7259a843e15fc232b8f584a8b68e50c96d3 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qtappwrapper/NativeMethods.cs2
-rw-r--r--src/qtprojectlib/CompilerToolWrapper.cs52
-rw-r--r--src/qtprojectlib/CxxStreamReader.cs20
-rw-r--r--src/qtprojectlib/ExportProjectDialog.cs42
-rw-r--r--src/qtprojectlib/HelperClasses.cs6
-rw-r--r--src/qtprojectlib/HelperFunctions.cs125
-rw-r--r--src/qtprojectlib/ImageButton.cs6
-rw-r--r--src/qtprojectlib/LinkerToolWrapper.cs8
-rw-r--r--src/qtprojectlib/Messages.cs4
-rw-r--r--src/qtprojectlib/MocCmdChecker.cs2
-rw-r--r--src/qtprojectlib/ProjectExporter.cs108
-rw-r--r--src/qtprojectlib/ProjectImporter.cs12
-rw-r--r--src/qtprojectlib/QMakeConf.cs2
-rw-r--r--src/qtprojectlib/QMakeProcess.cs22
-rw-r--r--src/qtprojectlib/QrcParser.cs2
-rw-r--r--src/qtprojectlib/QtConfig.cs2
-rw-r--r--src/qtprojectlib/QtModules.cs10
-rw-r--r--src/qtprojectlib/QtProject.cs80
-rw-r--r--src/qtprojectlib/QtVSIPSettings.cs2
-rw-r--r--src/qtprojectlib/QtVersionManager.cs6
-rw-r--r--src/qtprojectlib/ResClass.cs6
-rw-r--r--src/qtvstools/AddQtVersionDialog.cs20
-rw-r--r--src/qtvstools/AddTranslationDialog.cs8
-rw-r--r--src/qtvstools/DefaultEditorsClient.cs2
-rw-r--r--src/qtvstools/DteEventsHandler.cs30
-rw-r--r--src/qtvstools/FormChangeQtVersion.cs2
-rw-r--r--src/qtvstools/FormVSQtSettings.cs2
-rw-r--r--src/qtvstools/QmlClassifier.cs29
-rw-r--r--src/qtvstools/QmlTokenTypes.cs2
-rw-r--r--src/qtvstools/QtHelpLinkChooser.xaml.cs4
-rw-r--r--src/qtvstools/QtHelpMenu.cs6
-rw-r--r--src/qtvstools/QtItemContextMenu.cs4
-rw-r--r--src/qtvstools/QtMainMenu.cs2
-rw-r--r--src/qtvstools/QtProjectContextMenu.cs2
-rw-r--r--src/qtvstools/QtSolutionContextMenu.cs6
-rw-r--r--src/qtvstools/QtVersionDialog.cs10
-rw-r--r--src/qtvstools/ResClass.cs2
-rw-r--r--src/qtvstools/Translation.cs24
-rw-r--r--src/qtvstools/Vsix.cs6
-rw-r--r--src/qtwizard/AddClassPage.xaml.cs4
-rw-r--r--src/qtwizard/CoreClassWizard.cs4
-rw-r--r--src/qtwizard/DesignerWizard.cs6
-rw-r--r--src/qtwizard/GuiClassWizard.cs4
-rw-r--r--src/qtwizard/ModulePage.xaml.cs1
-rw-r--r--src/qtwizard/ServerWizard.cs6
45 files changed, 353 insertions, 352 deletions
diff --git a/src/qtappwrapper/NativeMethods.cs b/src/qtappwrapper/NativeMethods.cs
index 1773983e..9d53ef0d 100644
--- a/src/qtappwrapper/NativeMethods.cs
+++ b/src/qtappwrapper/NativeMethods.cs
@@ -48,7 +48,7 @@ namespace QtAppWrapper
public uint dwFlags;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szExeFile;
- };
+ }
internal const int TH32CS_SNAPPROCESS = 0x00000002;
internal static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1);
diff --git a/src/qtprojectlib/CompilerToolWrapper.cs b/src/qtprojectlib/CompilerToolWrapper.cs
index 3a9db5b7..5315d230 100644
--- a/src/qtprojectlib/CompilerToolWrapper.cs
+++ b/src/qtprojectlib/CompilerToolWrapper.cs
@@ -131,7 +131,7 @@ namespace QtProjectLib
return new List<string>();
// double quotes are escaped
directories = directories.Replace("\\\"", "\"");
- var dirArray = directories.Split(new char[] { ';', ',' }, StringSplitOptions
+ var dirArray = directories.Split(new[] { ';', ',' }, StringSplitOptions
.RemoveEmptyEntries);
var lst = new List<string>(dirArray);
var i = 0;
@@ -165,7 +165,7 @@ namespace QtProjectLib
else
newDirectories += ";";
- if (dir.IndexOfAny(new char[] { ' ', '\t' }) > 0 || !Path.IsPathRooted(dir))
+ if (dir.IndexOfAny(new[] { ' ', '\t' }) > 0 || !Path.IsPathRooted(dir))
newDirectories += "\"" + dir + "\"";
else
newDirectories += dir;
@@ -193,7 +193,7 @@ namespace QtProjectLib
if (string.IsNullOrEmpty(ppdefsstr))
return new List<string>();
- var ppdefs = ppdefsstr.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
+ var ppdefs = ppdefsstr.Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
return new List<string>(ppdefs);
}
}
@@ -206,7 +206,7 @@ namespace QtProjectLib
{
var preprocessorDefs = GetPreprocessorDefinitions();
if (preprocessorDefs != null) {
- var definesArray = preprocessorDefs.Split(new char[] { ';', ',' },
+ var definesArray = preprocessorDefs.Split(new[] { ';', ',' },
StringSplitOptions.RemoveEmptyEntries);
var definesList = new List<string>(definesArray);
if (definesList.Contains(value))
@@ -231,7 +231,7 @@ namespace QtProjectLib
if (preprocessorDefs == null)
return;
- var definesArray = preprocessorDefs.Split(new char[] { ';', ',' },
+ var definesArray = preprocessorDefs.Split(new[] { ';', ',' },
StringSplitOptions.RemoveEmptyEntries);
var definesList = new List<string>(definesArray);
if (definesList == null || !definesList.Remove(value))
@@ -286,7 +286,7 @@ namespace QtProjectLib
return;
bool directoryAdded = false;
- var directories = value.Split(new char[] { ';', ',' }, StringSplitOptions
+ var directories = value.Split(new[] { ';', ',' }, StringSplitOptions
.RemoveEmptyEntries);
List<string> lst = AdditionalIncludeDirectories;
foreach (var directory in directories) {
@@ -303,10 +303,8 @@ namespace QtProjectLib
public string[] GetAdditionalIncludeDirectoriesList()
{
- var includes = GetAdditionalIncludeDirectories()
- .Split(new char[] { ',', ';' });
- string[] fixedincludes;
- fixedincludes = new string[includes.Length];
+ var includes = GetAdditionalIncludeDirectories().Split(',', ';');
+ string[] fixedincludes = new string[includes.Length];
int i = 0;
foreach (var include in includes) {
var incl = include;
@@ -346,7 +344,7 @@ namespace QtProjectLib
return compilerTool.UsePrecompiledHeader;
var obj = compilerType.InvokeMember("UsePrecompiledHeader",
- System.Reflection.BindingFlags.GetProperty, null, compilerObj, null);
+ BindingFlags.GetProperty, null, compilerObj, null);
if (obj == null)
return pchOption.pchNone;
return (pchOption) obj;
@@ -359,10 +357,10 @@ namespace QtProjectLib
} else {
compilerType.InvokeMember(
"DebugInformationFormat",
- System.Reflection.BindingFlags.SetProperty,
+ BindingFlags.SetProperty,
null,
compilerObj,
- new object[] { @value });
+ new object[] { value });
}
}
@@ -384,7 +382,7 @@ namespace QtProjectLib
{
if (compilerTool == null) {
compilerType.InvokeMember("RuntimeLibrary", BindingFlags.SetProperty,
- null, compilerObj, new object[] { @value });
+ null, compilerObj, new object[] { value });
} else {
compilerTool.RuntimeLibrary = value;
}
@@ -398,10 +396,10 @@ namespace QtProjectLib
} else {
compilerType.InvokeMember(
"Optimization",
- System.Reflection.BindingFlags.SetProperty,
+ BindingFlags.SetProperty,
null,
compilerObj,
- new object[] { @value });
+ new object[] { value });
}
}
@@ -412,10 +410,10 @@ namespace QtProjectLib
} else {
compilerType.InvokeMember(
"TreatWChar_tAsBuiltInType",
- System.Reflection.BindingFlags.SetProperty,
+ BindingFlags.SetProperty,
null,
compilerObj,
- new object[] { @value });
+ new object[] { value });
}
}
@@ -426,10 +424,10 @@ namespace QtProjectLib
} else {
compilerType.InvokeMember(
"PrecompiledHeaderFile",
- System.Reflection.BindingFlags.SetProperty,
+ BindingFlags.SetProperty,
null,
compilerObj,
- new object[] { @file });
+ new object[] { file });
}
}
@@ -440,10 +438,10 @@ namespace QtProjectLib
} else {
compilerType.InvokeMember(
"PrecompiledHeaderThrough",
- System.Reflection.BindingFlags.SetProperty,
+ BindingFlags.SetProperty,
null,
compilerObj,
- new object[] { @value });
+ new object[] { value });
}
}
@@ -454,10 +452,10 @@ namespace QtProjectLib
} else {
compilerType.InvokeMember(
"UsePrecompiledHeader",
- System.Reflection.BindingFlags.SetProperty,
+ BindingFlags.SetProperty,
null,
compilerObj,
- new object[] { @value });
+ new object[] { value });
}
}
@@ -465,17 +463,17 @@ namespace QtProjectLib
{
compilerType.InvokeMember(
name,
- System.Reflection.BindingFlags.SetProperty,
+ BindingFlags.SetProperty,
null,
compilerObj,
- new object[] { @value });
+ new object[] { value });
}
private string GetStringProperty(string name)
{
object obj;
try {
- obj = compilerType.InvokeMember(name, System.Reflection.BindingFlags.GetProperty,
+ obj = compilerType.InvokeMember(name, BindingFlags.GetProperty,
null, compilerObj, null);
} catch {
obj = null;
diff --git a/src/qtprojectlib/CxxStreamReader.cs b/src/qtprojectlib/CxxStreamReader.cs
index f4d08514..4689da21 100644
--- a/src/qtprojectlib/CxxStreamReader.cs
+++ b/src/qtprojectlib/CxxStreamReader.cs
@@ -111,11 +111,11 @@ namespace QtProjectLib
i = endIdx + 1;
j = i + 1;
continue;
- } else {
- state = State.Comment;
- break;
}
- } else if (lineCopy[j] == '/') {
+ state = State.Comment;
+ break;
+ }
+ if (lineCopy[j] == '/') {
// C++ style comment detected
break;
}
@@ -137,13 +137,12 @@ namespace QtProjectLib
}
line = string.Empty;
break;
- } else {
- if (!removeStrings)
- line += lineCopy.Substring(i, endIdx - i + 1);
- i = endIdx;
- j = i + 1;
- continue;
}
+ if (!removeStrings)
+ line += lineCopy.Substring(i, endIdx - i + 1);
+ i = endIdx;
+ j = i + 1;
+ continue;
}
line += lineCopy[i];
}
@@ -155,7 +154,6 @@ namespace QtProjectLib
if (idx >= 0) {
state = State.Normal;
line = line.Substring(idx + 2);
- break;
} else {
line = string.Empty; // skip line
}
diff --git a/src/qtprojectlib/ExportProjectDialog.cs b/src/qtprojectlib/ExportProjectDialog.cs
index 3e8fc88f..62f961d4 100644
--- a/src/qtprojectlib/ExportProjectDialog.cs
+++ b/src/qtprojectlib/ExportProjectDialog.cs
@@ -34,24 +34,24 @@ namespace QtProjectLib
/// <summary>
/// Summary description for ExportProjectDialog.
/// </summary>
- internal class ExportProjectDialog : System.Windows.Forms.Form
+ internal class ExportProjectDialog : Form
{
- private System.Windows.Forms.Button cancelButton;
- private System.Windows.Forms.Button okButton;
- private System.Windows.Forms.Label projLabel;
- private System.Windows.Forms.ListBox optionListBox;
- private System.Windows.Forms.Label optionLabel;
- private System.Windows.Forms.ComboBox optionComboBox;
- private System.Windows.Forms.Label commentLabel;
- private System.Windows.Forms.TextBox optionTextBox;
- private System.Windows.Forms.CheckBox openCheckBox;
- private System.Windows.Forms.CheckedListBox projListBox;
- private System.Windows.Forms.GroupBox lineBox;
- private System.Windows.Forms.CheckBox createPriFileCheckBox;
- private System.Windows.Forms.Panel panel1;
- private System.Windows.Forms.Panel panel2;
- private System.Windows.Forms.Button newButton;
- private System.Windows.Forms.Button delButton;
+ private Button cancelButton;
+ private Button okButton;
+ private Label projLabel;
+ private ListBox optionListBox;
+ private Label optionLabel;
+ private ComboBox optionComboBox;
+ private Label commentLabel;
+ private TextBox optionTextBox;
+ private CheckBox openCheckBox;
+ private CheckedListBox projListBox;
+ private GroupBox lineBox;
+ private CheckBox createPriFileCheckBox;
+ private Panel panel1;
+ private Panel panel2;
+ private Button newButton;
+ private Button delButton;
public ExportProjectDialog()
{
@@ -326,7 +326,7 @@ namespace QtProjectLib
private void optionComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
{
- currentOpt = (ProFileOption) currentPro.Options[optionComboBox.SelectedIndex];
+ currentOpt = currentPro.Options[optionComboBox.SelectedIndex];
UpdateCurrentListItem();
optionTextBox.Text = string.Empty;
@@ -414,16 +414,16 @@ namespace QtProjectLib
private void projListBox_SelectedIndexChanged(object sender, System.EventArgs e)
{
- currentPro = (ProFileContent) proSln.ProFiles[projListBox.SelectedIndex];
+ currentPro = proSln.ProFiles[projListBox.SelectedIndex];
optionComboBox.DataSource = currentPro.Options;
}
private void projListBox_ItemCheck(object sender, ItemCheckEventArgs e)
{
if (e.NewValue == CheckState.Checked)
- ((ProFileContent) proSln.ProFiles[e.Index]).Export = true;
+ proSln.ProFiles[e.Index].Export = true;
else
- ((ProFileContent) proSln.ProFiles[e.Index]).Export = false;
+ proSln.ProFiles[e.Index].Export = false;
}
private void ExportProjectDialog_Load(object sender, System.EventArgs e)
diff --git a/src/qtprojectlib/HelperClasses.cs b/src/qtprojectlib/HelperClasses.cs
index 07568087..e754113f 100644
--- a/src/qtprojectlib/HelperClasses.cs
+++ b/src/qtprojectlib/HelperClasses.cs
@@ -160,13 +160,13 @@ namespace QtProjectLib
}
#region IWin32Window Members
- public System.IntPtr Handle
+ public IntPtr Handle
{
get
{
if (dteObject != null)
- return new System.IntPtr(dteObject.MainWindow.HWnd);
- return new System.IntPtr(0);
+ return new IntPtr(dteObject.MainWindow.HWnd);
+ return new IntPtr(0);
}
}
#endregion
diff --git a/src/qtprojectlib/HelperFunctions.cs b/src/qtprojectlib/HelperFunctions.cs
index 90946901..10f61f07 100644
--- a/src/qtprojectlib/HelperFunctions.cs
+++ b/src/qtprojectlib/HelperFunctions.cs
@@ -44,7 +44,7 @@ namespace QtProjectLib
{
var versionManager = QtVersionManager.The();
string projectQtVersion = null;
- if (HelperFunctions.IsQtProject(project))
+ if (IsQtProject(project))
projectQtVersion = versionManager.GetProjectQtVersion(project);
return FindQtDirWithTools(projectQtVersion);
}
@@ -70,7 +70,7 @@ namespace QtProjectLib
qtDir = versionManager.GetInstallPath(projectQtVersion);
if (qtDir == null)
- qtDir = System.Environment.GetEnvironmentVariable("QTDIR");
+ qtDir = Environment.GetEnvironmentVariable("QTDIR");
var found = false;
if (tool == null) {
@@ -136,22 +136,22 @@ namespace QtProjectLib
|| fileName.EndsWith(".hxx", StringComparison.OrdinalIgnoreCase);
}
- static public void SetDebuggingEnvironment(EnvDTE.Project prj)
+ static public void SetDebuggingEnvironment(Project prj)
{
SetDebuggingEnvironment(prj, string.Empty);
}
- static public void SetDebuggingEnvironment(EnvDTE.Project prj, string solutionConfig)
+ static public void SetDebuggingEnvironment(Project prj, string solutionConfig)
{
SetDebuggingEnvironment(prj, "PATH=$(QTDIR)\\bin;$(PATH)", false, solutionConfig);
}
- static public void SetDebuggingEnvironment(EnvDTE.Project prj, string envpath, bool overwrite)
+ static public void SetDebuggingEnvironment(Project prj, string envpath, bool overwrite)
{
SetDebuggingEnvironment(prj, envpath, overwrite, string.Empty);
}
- static public void SetDebuggingEnvironment(EnvDTE.Project prj, string envpath, bool overwrite, string solutionConfig)
+ static public void SetDebuggingEnvironment(Project prj, string envpath, bool overwrite, string solutionConfig)
{
// Get platform name from given solution configuration
// or if not available take the active configuration
@@ -197,11 +197,11 @@ namespace QtProjectLib
}
}
- public static bool IsProjectInSolution(EnvDTE.DTE dteObject, string fullName)
+ public static bool IsProjectInSolution(DTE dteObject, string fullName)
{
var fi = new FileInfo(fullName);
- foreach (EnvDTE.Project p in HelperFunctions.ProjectsInSolution(dteObject)) {
+ foreach (Project p in ProjectsInSolution(dteObject)) {
if (p.FullName.ToLower() == fi.FullName.ToLower())
return true;
}
@@ -267,12 +267,12 @@ namespace QtProjectLib
if (line == null)
return null;
- line = line.TrimEnd(new char[] { ' ', '\t' });
+ line = line.TrimEnd(' ', '\t');
while (line.EndsWith("\\", StringComparison.Ordinal)) {
line = line.Remove(line.Length - 1);
var appendix = streamReader.ReadLine();
if (appendix != null)
- line += appendix.TrimEnd(new char[] { ' ', '\t' });
+ line += appendix.TrimEnd(' ', '\t');
}
return line;
}
@@ -359,7 +359,7 @@ namespace QtProjectLib
/// <param name="oldString">String, which is going to be replaced</param>
/// <param name="oldString">String, which is going to replace the other one</param>
/// <returns></returns>
- public static void ReplaceInCustomBuildTools(EnvDTE.Project project, string oldString, string replaceString)
+ public static void ReplaceInCustomBuildTools(Project project, string oldString, string replaceString)
{
var vcPro = (VCProject) project.Object;
if (vcPro == null)
@@ -368,7 +368,7 @@ namespace QtProjectLib
foreach (VCFile vcfile in (IVCCollection) vcPro.Files) {
foreach (VCFileConfiguration config in (IVCCollection) vcfile.FileConfigurations) {
try {
- var tool = HelperFunctions.GetCustomBuildTool(config);
+ var tool = GetCustomBuildTool(config);
if (tool == null)
continue;
@@ -449,7 +449,7 @@ namespace QtProjectLib
/// </summary>
/// <param name="project">Project</param>
/// <returns></returns>
- public static void ToggleProjectKind(EnvDTE.Project project)
+ public static void ToggleProjectKind(Project project)
{
string qtDir = null;
var vcPro = (VCProject) project.Object;
@@ -524,7 +524,7 @@ namespace QtProjectLib
}
}
- HelperFunctions.CleanupQMakeDependencies(project);
+ CleanupQMakeDependencies(project);
foreach (VCConfiguration config in (IVCCollection) vcPro.Configurations) {
var compiler = CompilerToolWrapper.Create(config);
@@ -675,7 +675,7 @@ namespace QtProjectLib
if (!IsQMakeProject(proj))
return false;
- var envPro = proj.Object as EnvDTE.Project;
+ var envPro = proj.Object as Project;
if (envPro.Globals == null || envPro.Globals.VariableNames == null)
return false;
@@ -690,11 +690,11 @@ namespace QtProjectLib
/// Returns true if the specified project is a Qt Project.
/// </summary>
/// <param name="proj">project</param>
- public static bool IsQtProject(EnvDTE.Project proj)
+ public static bool IsQtProject(Project proj)
{
try {
if (proj != null && proj.Kind == "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}")
- return HelperFunctions.IsQtProject(proj.Object as VCProject);
+ return IsQtProject(proj.Object as VCProject);
} catch { }
return false;
}
@@ -719,16 +719,16 @@ namespace QtProjectLib
/// Returns true if the specified project is a QMake -tp vc Project.
/// </summary>
/// <param name="proj">project</param>
- public static bool IsQMakeProject(EnvDTE.Project proj)
+ public static bool IsQMakeProject(Project proj)
{
try {
if (proj != null && proj.Kind == "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}")
- return HelperFunctions.IsQMakeProject(proj.Object as VCProject);
+ return IsQMakeProject(proj.Object as VCProject);
} catch { }
return false;
}
- public static void CleanupQMakeDependencies(EnvDTE.Project project)
+ public static void CleanupQMakeDependencies(Project project)
{
var vcPro = (VCProject) project.Object;
// clean up qmake mess
@@ -797,12 +797,12 @@ namespace QtProjectLib
public static bool HasQObjectDeclaration(VCFile file)
{
- return CxxFileContainsNotCommented(file, new string[] { "Q_OBJECT", "Q_GADGET" }, true, true);
+ return CxxFileContainsNotCommented(file, new[] { "Q_OBJECT", "Q_GADGET" }, true, true);
}
public static bool CxxFileContainsNotCommented(VCFile file, string str, bool caseSensitive, bool suppressStrings)
{
- return CxxFileContainsNotCommented(file, new string[] { str }, caseSensitive, suppressStrings);
+ return CxxFileContainsNotCommented(file, new[] { str }, caseSensitive, suppressStrings);
}
public static bool CxxFileContainsNotCommented(VCFile file, string[] searchStrings, bool caseSensitive, bool suppressStrings)
@@ -828,7 +828,7 @@ namespace QtProjectLib
}
}
sr.Close();
- } catch (System.Exception) {
+ } catch (Exception) {
if (sr != null)
sr.Close();
}
@@ -895,7 +895,7 @@ namespace QtProjectLib
if (innerItem.UIHierarchyItems.Expanded) {
innerItem.UIHierarchyItems.Expanded = false;
- if (innerItem.UIHierarchyItems.Expanded == true) {
+ if (innerItem.UIHierarchyItems.Expanded) {
innerItem.Select(vsUISelectionType.vsUISelectionTypeSelect);
hierarchy.DoDefaultAction();
}
@@ -905,7 +905,7 @@ namespace QtProjectLib
}
if (item.UIHierarchyItems.Expanded) {
item.UIHierarchyItems.Expanded = false;
- if (item.UIHierarchyItems.Expanded == true) {
+ if (item.UIHierarchyItems.Expanded) {
item.Select(vsUISelectionType.vsUISelectionTypeSelect);
hierarchy.DoDefaultAction();
}
@@ -917,7 +917,7 @@ namespace QtProjectLib
{
try {
return IsInFilter(vcfile, Filters.GeneratedFiles());
- } catch (System.Exception e) {
+ } catch (Exception e) {
MessageBox.Show(e.ToString());
return true;
}
@@ -952,19 +952,19 @@ namespace QtProjectLib
{
try {
return IsInFilter(vcfile, Filters.ResourceFiles());
- } catch (System.Exception) {
+ } catch (Exception) {
return false;
}
}
- public static List<string> GetProjectFiles(EnvDTE.Project pro, FilesToList filter)
+ public static List<string> GetProjectFiles(Project pro, FilesToList filter)
{
var fileList = new List<string>();
VCProject vcpro;
try {
vcpro = (VCProject) pro.Object;
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayErrorMessage(e);
return null;
}
@@ -1015,11 +1015,11 @@ namespace QtProjectLib
fileList.Add(ChangePathFormat(vcfile.RelativePath));
break;
case FilesToList.FL_HFiles:
- if (HelperFunctions.HasHeaderFileExtension(vcfile.Name))
+ if (HasHeaderFileExtension(vcfile.Name))
fileList.Add(ChangePathFormat(vcfile.RelativePath));
break;
case FilesToList.FL_CppFiles:
- if (HelperFunctions.HasSourceFileExtension(vcfile.Name))
+ if (HasSourceFileExtension(vcfile.Name))
fileList.Add(ChangePathFormat(vcfile.RelativePath));
break;
}
@@ -1046,13 +1046,13 @@ namespace QtProjectLib
}
}
- public static EnvDTE.Project GetSelectedProject(EnvDTE.DTE dteObject)
+ public static Project GetSelectedProject(DTE dteObject)
{
if (dteObject == null)
return null;
- System.Array prjs = null;
+ Array prjs = null;
try {
- prjs = (System.Array) dteObject.ActiveSolutionProjects;
+ prjs = (Array) dteObject.ActiveSolutionProjects;
} catch {
// When VS2010 is started from the command line,
// we may catch a "Unspecified error" here.
@@ -1061,16 +1061,16 @@ namespace QtProjectLib
return null;
// don't handle multiple selection... use the first one
- if (prjs.GetValue(0) is EnvDTE.Project)
- return (EnvDTE.Project) prjs.GetValue(0);
+ if (prjs.GetValue(0) is Project)
+ return (Project) prjs.GetValue(0);
return null;
}
- public static EnvDTE.Project GetActiveDocumentProject(EnvDTE.DTE dteObject)
+ public static Project GetActiveDocumentProject(DTE dteObject)
{
if (dteObject == null)
return null;
- EnvDTE.Document doc = dteObject.ActiveDocument;
+ Document doc = dteObject.ActiveDocument;
if (doc == null)
return null;
@@ -1080,7 +1080,7 @@ namespace QtProjectLib
return doc.ProjectItem.ContainingProject;
}
- public static EnvDTE.Project GetSingleProjectInSolution(EnvDTE.DTE dteObject)
+ public static Project GetSingleProjectInSolution(DTE dteObject)
{
var projectList = ProjectsInSolution(dteObject);
if (dteObject == null || dteObject.Solution == null ||
@@ -1095,23 +1095,23 @@ namespace QtProjectLib
/// is selected or if the selected project is not a Qt project
/// this function returns null.
/// </summary>
- public static EnvDTE.Project GetSelectedQtProject(EnvDTE.DTE dteObject)
+ public static Project GetSelectedQtProject(DTE dteObject)
{
// can happen sometimes shortly after starting VS
if (dteObject == null || dteObject.Solution == null
- || HelperFunctions.ProjectsInSolution(dteObject).Count == 0)
+ || ProjectsInSolution(dteObject).Count == 0)
return null;
- EnvDTE.Project pro;
+ Project pro;
if ((pro = GetSelectedProject(dteObject)) == null) {
if ((pro = GetSingleProjectInSolution(dteObject)) == null)
pro = GetActiveDocumentProject(dteObject);
}
- return HelperFunctions.IsQtProject(pro) ? pro : null;
+ return IsQtProject(pro) ? pro : null;
}
- public static VCFile GetSelectedFile(EnvDTE.DTE dteObject)
+ public static VCFile GetSelectedFile(DTE dteObject)
{
if (GetSelectedQtProject(dteObject) == null)
return null;
@@ -1128,7 +1128,7 @@ namespace QtProjectLib
VCProjectItem vcitem;
try {
vcitem = (VCProjectItem) item.ProjectItem.Object;
- } catch (System.Exception) {
+ } catch (Exception) {
return null;
}
@@ -1138,7 +1138,7 @@ namespace QtProjectLib
return null;
}
- public static VCFile[] GetSelectedFiles(EnvDTE.DTE dteObject)
+ public static VCFile[] GetSelectedFiles(DTE dteObject)
{
if (GetSelectedQtProject(dteObject) == null)
return null;
@@ -1146,7 +1146,7 @@ namespace QtProjectLib
if (dteObject.SelectedItems.Count <= 0)
return null;
- EnvDTE.SelectedItems items = dteObject.SelectedItems;
+ SelectedItems items = dteObject.SelectedItems;
var files = new VCFile[items.Count + 1];
for (var i = 1; i <= items.Count; ++i) {
@@ -1157,7 +1157,7 @@ namespace QtProjectLib
VCProjectItem vcitem;
try {
vcitem = (VCProjectItem) item.ProjectItem.Object;
- } catch (System.Exception) {
+ } catch (Exception) {
return null;
}
@@ -1181,12 +1181,12 @@ namespace QtProjectLib
public static RccOptions ParseRccOptions(string cmdLine, VCFile qrcFile)
{
- var pro = HelperFunctions.VCProjectToProject((VCProject) qrcFile.project);
+ var pro = VCProjectToProject((VCProject) qrcFile.project);
var rccOpts = new RccOptions(pro, qrcFile);
if (cmdLine.Length > 0) {
- var cmdSplit = cmdLine.Split(new Char[] { ' ', '\t' });
+ var cmdSplit = cmdLine.Split(' ', '\t');
for (var i = 0; i < cmdSplit.Length; ++i) {
var lowercmdSplit = cmdSplit[i].ToLower();
if (lowercmdSplit.Equals("-threshold")) {
@@ -1201,20 +1201,20 @@ namespace QtProjectLib
return rccOpts;
}
- public static EnvDTE.Project VCProjectToProject(VCProject vcproj)
+ public static Project VCProjectToProject(VCProject vcproj)
{
- return (EnvDTE.Project) vcproj.Object;
+ return (Project) vcproj.Object;
}
- public static List<EnvDTE.Project> ProjectsInSolution(EnvDTE.DTE dteObject)
+ public static List<Project> ProjectsInSolution(DTE dteObject)
{
- var projects = new List<EnvDTE.Project>();
+ var projects = new List<Project>();
Solution solution = dteObject.Solution;
if (solution != null) {
var c = solution.Count;
for (var i = 1; i <= c; ++i) {
try {
- var prj = solution.Projects.Item(i) as Project;
+ var prj = solution.Projects.Item(i);
if (prj == null)
continue;
addSubProjects(prj, ref projects);
@@ -1227,7 +1227,7 @@ namespace QtProjectLib
return projects;
}
- private static void addSubProjects(EnvDTE.Project prj, ref List<Project> projects)
+ private static void addSubProjects(Project prj, ref List<Project> projects)
{
// If the actual object of the project is null then the project was probably unloaded.
if (prj.Object == null)
@@ -1243,7 +1243,7 @@ namespace QtProjectLib
}
}
- private static void addSubProjects(EnvDTE.ProjectItems subItems, ref List<Project> projects)
+ private static void addSubProjects(ProjectItems subItems, ref List<Project> projects)
{
if (subItems == null)
return;
@@ -1264,7 +1264,7 @@ namespace QtProjectLib
public static int GetMaximumCommandLineLength()
{
var epsilon = 10; // just to be sure :)
- System.OperatingSystem os = System.Environment.OSVersion;
+ OperatingSystem os = Environment.OSVersion;
if (os.Version.Major >= 6 ||
(os.Version.Major == 5 && os.Version.Minor >= 1))
return 8191 - epsilon; // Windows XP and above
@@ -1329,7 +1329,7 @@ namespace QtProjectLib
return false;
for (var i = 0; i < array1.Length; i++) {
- if (!Object.Equals(array1.GetValue(i), array2.GetValue(i)))
+ if (!Equals(array1.GetValue(i), array2.GetValue(i)))
return false;
}
return true;
@@ -1337,11 +1337,12 @@ namespace QtProjectLib
public static string FindFileInPATH(string fileName)
{
- var envPATH = System.Environment.ExpandEnvironmentVariables("%PATH%");
- var directories = envPATH.Split(new Char[] { ';' });
+ var envPATH = Environment.ExpandEnvironmentVariables("%PATH%");
+ var directories = envPATH.Split(';');
foreach (var directory in directories) {
var fullFilePath = directory;
- if (!fullFilePath.EndsWith("\\", StringComparison.Ordinal)) fullFilePath += '\\';
+ if (!fullFilePath.EndsWith("\\", StringComparison.Ordinal))
+ fullFilePath += '\\';
fullFilePath += fileName;
if (File.Exists(fullFilePath))
return fullFilePath;
diff --git a/src/qtprojectlib/ImageButton.cs b/src/qtprojectlib/ImageButton.cs
index 8a976002..d72adea4 100644
--- a/src/qtprojectlib/ImageButton.cs
+++ b/src/qtprojectlib/ImageButton.cs
@@ -31,14 +31,14 @@ using System.Windows.Forms;
namespace QtProjectLib
{
- public class ImageButton : System.Windows.Forms.Button
+ public class ImageButton : Button
{
private readonly Image img;
private readonly Image dimg;
public ImageButton(Image image)
{
img = image;
- BackColor = System.Drawing.SystemColors.Control;
+ BackColor = SystemColors.Control;
}
// support for disabled image
@@ -46,7 +46,7 @@ namespace QtProjectLib
{
img = image;
dimg = dimage;
- BackColor = System.Drawing.SystemColors.Control;
+ BackColor = SystemColors.Control;
}
protected override void OnPaint(PaintEventArgs pevent)
diff --git a/src/qtprojectlib/LinkerToolWrapper.cs b/src/qtprojectlib/LinkerToolWrapper.cs
index 3ca4fe04..f5d5159d 100644
--- a/src/qtprojectlib/LinkerToolWrapper.cs
+++ b/src/qtprojectlib/LinkerToolWrapper.cs
@@ -52,7 +52,7 @@ namespace QtProjectLib
{
if (linker.AdditionalLibraryDirectories == null)
return null;
- var dirArray = linker.AdditionalLibraryDirectories.Split(new char[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries);
+ var dirArray = linker.AdditionalLibraryDirectories.Split(new[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries);
var lst = new List<string>(dirArray);
for (var i = 0; i < lst.Count; ++i) {
var item = lst[i];
@@ -80,7 +80,7 @@ namespace QtProjectLib
else
newAdditionalLibraryDirectories += ";";
- if (!Path.IsPathRooted(item) || item.IndexOfAny(new char[] { ' ', '\t' }) > 0)
+ if (!Path.IsPathRooted(item) || item.IndexOfAny(new[] { ' ', '\t' }) > 0)
newAdditionalLibraryDirectories += "\"" + item + "\"";
else
newAdditionalLibraryDirectories += item;
@@ -107,7 +107,7 @@ namespace QtProjectLib
}
var newAdditionalDependencies = string.Empty;
- var separators = new char[] { ' ', '\t' };
+ var separators = new[] { ' ', '\t' };
var firstLoop = true;
foreach (var item in value) {
if (firstLoop)
@@ -133,7 +133,7 @@ namespace QtProjectLib
/// <returns></returns>
private static List<string> splitByWhitespace(string str)
{
- var separators = new char[] { ' ', '\t' };
+ var separators = new[] { ' ', '\t' };
var i = str.IndexOf('"');
if (i == -1)
return new List<string>(str.Split(separators, StringSplitOptions.RemoveEmptyEntries));
diff --git a/src/qtprojectlib/Messages.cs b/src/qtprojectlib/Messages.cs
index 99de8be2..7c766e8b 100644
--- a/src/qtprojectlib/Messages.cs
+++ b/src/qtprojectlib/Messages.cs
@@ -43,9 +43,9 @@ namespace QtProjectLib
}
return null;
}
- public static void PaneMessage(EnvDTE.DTE dte, string str)
+ public static void PaneMessage(DTE dte, string str)
{
- var wnd = (EnvDTE.OutputWindow) dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput).Object;
+ var wnd = (OutputWindow) dte.Windows.Item(Constants.vsWindowKindOutput).Object;
if (wndp == null)
wndp = wnd.OutputWindowPanes.Add(SR.GetString("Resources_QtVsTools"));
diff --git a/src/qtprojectlib/MocCmdChecker.cs b/src/qtprojectlib/MocCmdChecker.cs
index 375101d2..85c98e07 100644
--- a/src/qtprojectlib/MocCmdChecker.cs
+++ b/src/qtprojectlib/MocCmdChecker.cs
@@ -114,7 +114,7 @@ namespace QtProjectLib
private static string[] SplitIntoCommands(string cmdLine)
{
- var cmds = cmdLine.Split(new string[] { "&&", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
+ var cmds = cmdLine.Split(new[] { "&&", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
var res = new string[cmds.Length];
for (var i = 0; i < cmds.Length; ++i)
res[i] = cmds[i].Trim();
diff --git a/src/qtprojectlib/ProjectExporter.cs b/src/qtprojectlib/ProjectExporter.cs
index 3b2ff697..c199476d 100644
--- a/src/qtprojectlib/ProjectExporter.cs
+++ b/src/qtprojectlib/ProjectExporter.cs
@@ -41,7 +41,7 @@ namespace QtProjectLib
#region Storage Classes
internal class ProSolution
{
- public ProSolution(EnvDTE.Solution sln)
+ public ProSolution(Solution sln)
{
prosln = sln;
proFiles = new List<ProFileContent>();
@@ -55,7 +55,7 @@ namespace QtProjectLib
}
}
- public EnvDTE.Solution ProjectSolution
+ public Solution ProjectSolution
{
get
{
@@ -64,7 +64,7 @@ namespace QtProjectLib
}
private List<ProFileContent> proFiles;
- private EnvDTE.Solution prosln;
+ private Solution prosln;
}
internal class ProFileOption
@@ -232,9 +232,9 @@ namespace QtProjectLib
public class ProjectExporter
{
- private EnvDTE.DTE dteObject;
+ private DTE dteObject;
- public ProjectExporter(EnvDTE.DTE dte)
+ public ProjectExporter(DTE dte)
{
dteObject = dte;
}
@@ -246,9 +246,9 @@ namespace QtProjectLib
var relPath = string.Empty;
if (files[i].IndexOf(':') != 1) {
relPath = HelperFunctions.GetRelativePath(path,
- vcproj.ProjectDirectory + "\\" + (string) files[i]);
+ vcproj.ProjectDirectory + "\\" + files[i]);
} else {
- relPath = HelperFunctions.GetRelativePath(path, (string) files[i]);
+ relPath = HelperFunctions.GetRelativePath(path, files[i]);
}
files[i] = HelperFunctions.ChangePathFormat(relPath);
}
@@ -281,12 +281,12 @@ namespace QtProjectLib
#endregion
#region Export pri/pro Files Helper Functions
- private ProSolution CreateProFileSolution(EnvDTE.Solution sln)
+ private ProSolution CreateProFileSolution(Solution sln)
{
ProFileContent content;
var prosln = new ProSolution(sln);
- foreach (EnvDTE.Project proj in HelperFunctions.ProjectsInSolution(sln.DTE)) {
+ foreach (Project proj in HelperFunctions.ProjectsInSolution(sln.DTE)) {
try {
// only add qt projects
if (HelperFunctions.IsQtProject(proj)) {
@@ -303,7 +303,7 @@ namespace QtProjectLib
return prosln;
}
- private void addProjectsInFolder(EnvDTE.Project solutionFolder, ProSolution sln)
+ private void addProjectsInFolder(Project solutionFolder, ProSolution sln)
{
foreach (ProjectItem pi in solutionFolder.ProjectItems) {
var containedProject = pi.Object as Project;
@@ -316,7 +316,7 @@ namespace QtProjectLib
}
}
- private static ProFileContent CreateProFileContent(EnvDTE.Project project)
+ private static ProFileContent CreateProFileContent(Project project)
{
ProFileOption option;
var qtPro = QtProject.Create(project);
@@ -530,7 +530,7 @@ namespace QtProjectLib
return content;
}
- private static ProFileContent CreatePriFileContent(EnvDTE.Project project, string priFileDirectory)
+ private static ProFileContent CreatePriFileContent(Project project, string priFileDirectory)
{
ProFileOption option;
var qtPro = QtProject.Create(project);
@@ -598,13 +598,13 @@ namespace QtProjectLib
var excludeList = "UNICODE WIN32 NDEBUG QDESIGNER_EXPORT_WIDGETS ";
excludeList += "QT_THREAD_SUPPORT QT_PLUGIN QT_NO_DEBUG QT_CORE_LIB QT_GUI_LIB";
- foreach (var define in preprocessorDefinitions.Split(new char[] { ';', ',' })) {
+ foreach (var define in preprocessorDefinitions.Split(';', ',')) {
if (excludeList.IndexOf(define, StringComparison.OrdinalIgnoreCase) == -1)
option.List.Add(define);
}
}
- private static void AddIncludePaths(EnvDTE.Project project, ProFileOption option, string includePaths)
+ private static void AddIncludePaths(Project project, ProFileOption option, string includePaths)
{
if (includePaths == null)
return;
@@ -612,13 +612,13 @@ namespace QtProjectLib
var versionManager = QtVersionManager.The();
var qtDir = versionManager.GetInstallPath(project);
if (qtDir == null)
- qtDir = System.Environment.GetEnvironmentVariable("QTDIR");
+ qtDir = Environment.GetEnvironmentVariable("QTDIR");
if (qtDir == null)
qtDir = "";
qtDir = HelperFunctions.NormalizeRelativeFilePath(qtDir);
- foreach (var s in includePaths.Split(new char[] { ';', ',' })) {
+ foreach (var s in includePaths.Split(';', ',')) {
var d = HelperFunctions.NormalizeRelativeFilePath(s);
if (!d.StartsWith("$(qtdir)\\include", StringComparison.OrdinalIgnoreCase) &&
!d.StartsWith(qtDir + "\\include", StringComparison.OrdinalIgnoreCase) &&
@@ -633,19 +633,19 @@ namespace QtProjectLib
}
}
- private static void AddLibraries(EnvDTE.Project project, ProFileOption option, string paths, string deps)
+ private static void AddLibraries(Project project, ProFileOption option, string paths, string deps)
{
var versionManager = QtVersionManager.The();
var qtDir = versionManager.GetInstallPath(project);
if (qtDir == null)
- qtDir = System.Environment.GetEnvironmentVariable("QTDIR");
+ qtDir = Environment.GetEnvironmentVariable("QTDIR");
if (qtDir == null)
qtDir = "";
qtDir = HelperFunctions.NormalizeRelativeFilePath(qtDir);
if (paths != null) {
- foreach (var s in paths.Split(new char[] { ';', ',' })) {
+ foreach (var s in paths.Split(';', ',')) {
var d = HelperFunctions.NormalizeRelativeFilePath(s);
if (!d.StartsWith("$(qtdir)\\lib", StringComparison.OrdinalIgnoreCase) &&
!d.StartsWith(qtDir + "\\lib", StringComparison.OrdinalIgnoreCase)) {
@@ -658,7 +658,7 @@ namespace QtProjectLib
}
if (deps != null) {
- foreach (var d in deps.Split(new char[] { ' ' })) {
+ foreach (var d in deps.Split(' ')) {
if (d.Length > 0 &&
!d.StartsWith("$(qtdir)\\lib", StringComparison.OrdinalIgnoreCase) &&
!d.StartsWith(qtDir + "\\lib", StringComparison.OrdinalIgnoreCase) &&
@@ -711,7 +711,7 @@ namespace QtProjectLib
try {
sw = new StreamWriter(File.Create(slnFileName));
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayErrorMessage(e);
return;
}
@@ -743,11 +743,11 @@ namespace QtProjectLib
using (sw) {
sw.WriteLine(Resources.exportSolutionHeader);
for (int i = 0; i < content.Options.Count; i++)
- WriteProFileOption(sw, (ProFileOption) content.Options[i]);
+ WriteProFileOption(sw, content.Options[i]);
}
if (openFile)
- dteObject.OpenFile(EnvDTE.Constants.vsViewKindTextView, slnFileName).Activate();
+ dteObject.OpenFile(Constants.vsViewKindTextView, slnFileName).Activate();
}
}
@@ -763,7 +763,7 @@ namespace QtProjectLib
try {
sw = new StreamWriter(File.Create(proFile));
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayErrorMessage(e);
return;
}
@@ -787,7 +787,7 @@ namespace QtProjectLib
// open the file in vs
if (openFile)
- dteObject.OpenFile(EnvDTE.Constants.vsViewKindTextView, proFile).Activate();
+ dteObject.OpenFile(Constants.vsViewKindTextView, proFile).Activate();
}
private void WritePriFile(ProFileContent content, string priFile)
@@ -796,7 +796,7 @@ namespace QtProjectLib
try {
sw = new StreamWriter(File.Create(priFile));
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayErrorMessage(e);
return;
}
@@ -826,19 +826,22 @@ namespace QtProjectLib
switch (option.AssignSymbol) {
case ProFileOption.AssignType.AT_Equals:
- sw.Write(" = "); break;
+ sw.Write(" = ");
+ break;
case ProFileOption.AssignType.AT_MinusEquals:
- sw.Write(" -= "); break;
+ sw.Write(" -= ");
+ break;
case ProFileOption.AssignType.AT_PlusEquals:
- sw.Write(" += "); break;
+ sw.Write(" += ");
+ break;
}
for (var i = 0; i < option.List.Count - 1; i++)
- sw.Write((string) option.List[i] + option.NewOption);
- sw.Write((string) option.List[option.List.Count - 1] + sw.NewLine);
+ sw.Write(option.List[i] + option.NewOption);
+ sw.Write(option.List[option.List.Count - 1] + sw.NewLine);
} else {
for (var i = 0; i < option.List.Count; i++)
- sw.WriteLine(option.Name + "(" + (string) option.List[i] + ")");
+ sw.WriteLine(option.Name + "(" + option.List[i] + ")");
}
}
#endregion
@@ -854,18 +857,21 @@ namespace QtProjectLib
return null;
sr = new StreamReader(priFileInfo.FullName);
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayWarningMessage(e);
return null;
}
switch (ftl) {
case FilesToList.FL_CppFiles:
- ParseTag(sr, "SOURCES", fileList); break;
+ ParseTag(sr, "SOURCES", fileList);
+ break;
case FilesToList.FL_HFiles:
- ParseTag(sr, "HEADERS", fileList); break;
+ ParseTag(sr, "HEADERS", fileList);
+ break;
case FilesToList.FL_UiFiles:
- ParseTag(sr, "FORMS", fileList); break;
+ ParseTag(sr, "FORMS", fileList);
+ break;
}
// the filelist should contain the entire path since we can select
@@ -873,7 +879,7 @@ namespace QtProjectLib
var ret = new List<string>();
try {
ret = ConvertFilesToFullPath(ret, priFileInfo.DirectoryName);
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayErrorMessage(SR.GetString("ExportProject_ErrorParsingPriFile", e.Message),
SR.GetString("ExportProject_CheckFileAndSyntax"));
return null;
@@ -962,13 +968,13 @@ namespace QtProjectLib
}
public static void SyncIncludeFiles(VCProject vcproj, List<string> priFiles,
- List<string> projFiles, EnvDTE.DTE dte)
+ List<string> projFiles, DTE dte)
{
SyncIncludeFiles(vcproj, priFiles, projFiles, dte, false, null);
}
public static void SyncIncludeFiles(VCProject vcproj, List<string> priFiles,
- List<string> projFiles, EnvDTE.DTE dte, bool flat, FakeFilter fakeFilter)
+ List<string> projFiles, DTE dte, bool flat, FakeFilter fakeFilter)
{
var cmpPriFiles = new List<string>(priFiles.Count);
foreach (var s in priFiles)
@@ -1047,7 +1053,7 @@ namespace QtProjectLib
{
var expDlg = new ExportProjectDialog();
- EnvDTE.Solution sln = dteObject.Solution;
+ Solution sln = dteObject.Solution;
var prosln = CreateProFileSolution(sln);
if (prosln.ProFiles.Count <= 0) {
@@ -1056,7 +1062,7 @@ namespace QtProjectLib
}
expDlg.ProFileSolution = prosln;
- expDlg.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ expDlg.StartPosition = FormStartPosition.CenterParent;
var ww = new MainWinWrapper(dteObject);
if (expDlg.ShowDialog(ww) == DialogResult.OK) {
WriteProSolution(prosln, expDlg.OpenFiles);
@@ -1078,14 +1084,14 @@ namespace QtProjectLib
}
}
- public void ImportPriFile(EnvDTE.Project proj)
+ public void ImportPriFile(Project proj)
{
VCProject vcproj;
if (HelperFunctions.IsQtProject(proj)) {
try {
vcproj = (VCProject) proj.Object;
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayWarningMessage(e);
return;
}
@@ -1106,7 +1112,7 @@ namespace QtProjectLib
}
}
- public void ImportPriFile(EnvDTE.Project proj, string fileName)
+ public void ImportPriFile(Project proj, string fileName)
{
VCProject vcproj;
@@ -1115,7 +1121,7 @@ namespace QtProjectLib
try {
vcproj = (VCProject) proj.Object;
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayWarningMessage(e);
return;
}
@@ -1127,31 +1133,31 @@ namespace QtProjectLib
return;
projFiles = HelperFunctions.GetProjectFiles(proj, FilesToList.FL_CppFiles);
projFiles = ConvertFilesToFullPath(projFiles, vcproj.ProjectDirectory);
- ProjectExporter.SyncIncludeFiles(vcproj, priFiles, projFiles, dteObject);
+ SyncIncludeFiles(vcproj, priFiles, projFiles, dteObject);
// header files
if ((priFiles = GetFilesInPriFile(priFileInfo, FilesToList.FL_HFiles)) == null)
return;
projFiles = HelperFunctions.GetProjectFiles(proj, FilesToList.FL_HFiles);
projFiles = ConvertFilesToFullPath(projFiles, vcproj.ProjectDirectory);
- ProjectExporter.SyncIncludeFiles(vcproj, priFiles, projFiles, dteObject);
+ SyncIncludeFiles(vcproj, priFiles, projFiles, dteObject);
// form files
if ((priFiles = GetFilesInPriFile(priFileInfo, FilesToList.FL_UiFiles)) == null)
return;
projFiles = HelperFunctions.GetProjectFiles(proj, FilesToList.FL_UiFiles);
projFiles = ConvertFilesToFullPath(projFiles, vcproj.ProjectDirectory);
- ProjectExporter.SyncIncludeFiles(vcproj, priFiles, projFiles, dteObject);
+ SyncIncludeFiles(vcproj, priFiles, projFiles, dteObject);
}
- public string ExportToPriFile(EnvDTE.Project proj)
+ public string ExportToPriFile(Project proj)
{
VCProject vcproj;
if (HelperFunctions.IsQtProject(proj)) {
try {
vcproj = (VCProject) proj.Object;
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayErrorMessage(e);
return null;
}
@@ -1174,7 +1180,7 @@ namespace QtProjectLib
return null;
}
- public void ExportToPriFile(EnvDTE.Project proj, string fileName)
+ public void ExportToPriFile(Project proj, string fileName)
{
var priFile = new FileInfo(fileName);
diff --git a/src/qtprojectlib/ProjectImporter.cs b/src/qtprojectlib/ProjectImporter.cs
index dcf99751..9ca1e4bd 100644
--- a/src/qtprojectlib/ProjectImporter.cs
+++ b/src/qtprojectlib/ProjectImporter.cs
@@ -38,10 +38,10 @@ namespace QtProjectLib
{
public class ProjectImporter
{
- private EnvDTE.DTE dteObject;
+ private DTE dteObject;
const string projectFileExtension = ".vcxproj";
- public ProjectImporter(EnvDTE.DTE dte)
+ public ProjectImporter(DTE dte)
{
dteObject = dte;
}
@@ -130,8 +130,8 @@ namespace QtProjectLib
Messages.PaneMessage(dteObject, "Project already in Solution");
}
- EnvDTE.Project pro = null;
- foreach (EnvDTE.Project p in HelperFunctions.ProjectsInSolution(dteObject)) {
+ Project pro = null;
+ foreach (Project p in HelperFunctions.ProjectsInSolution(dteObject)) {
if (p.FullName.ToLower() == VCInfo.FullName.ToLower()) {
pro = p;
break;
@@ -274,7 +274,7 @@ namespace QtProjectLib
s = s.Substring(index + 1);
}
if (!string.IsNullOrEmpty(s)) {
- s = s.Trim(new char[] { ' ', '\"', ',' });
+ s = s.Trim(' ', '\"', ',');
if (s.StartsWith(">", StringComparison.Ordinal))
s = s.Substring(1);
}
@@ -327,7 +327,7 @@ namespace QtProjectLib
qmake.CloseEvent += dialog.CloseEventHandler;
qmake.PaneMessageDataEvent += PaneMessageDataReceived;
- var qmakeThread = new System.Threading.Thread(new ThreadStart(qmake.RunQMake));
+ var qmakeThread = new System.Threading.Thread(qmake.RunQMake);
qmakeThread.Start();
dialog.ShowDialog();
qmakeThread.Join();
diff --git a/src/qtprojectlib/QMakeConf.cs b/src/qtprojectlib/QMakeConf.cs
index 6a7494db..4832692b 100644
--- a/src/qtprojectlib/QMakeConf.cs
+++ b/src/qtprojectlib/QMakeConf.cs
@@ -117,7 +117,7 @@ namespace QtProjectLib
if (op == "+=") {
entries[lineKey] += " " + lineValue;
} else if (op == "-=") {
- foreach (var remval in lineValue.Split(new char[] { ' ', '\t' }))
+ foreach (var remval in lineValue.Split(' ', '\t'))
RemoveValue(lineKey, remval, entries);
} else {
entries[lineKey] = lineValue;
diff --git a/src/qtprojectlib/QMakeProcess.cs b/src/qtprojectlib/QMakeProcess.cs
index 0f800ef4..0b48cdeb 100644
--- a/src/qtprojectlib/QMakeProcess.cs
+++ b/src/qtprojectlib/QMakeProcess.cs
@@ -51,7 +51,7 @@ namespace QtProjectLib
public InfoDialog(string name)
{
label1 = new Label();
- progressBar1 = new System.Windows.Forms.ProgressBar();
+ progressBar1 = new ProgressBar();
SuspendLayout();
//
// label1
@@ -67,7 +67,7 @@ namespace QtProjectLib
progressBar1.Location = new System.Drawing.Point(13, 28);
progressBar1.Name = "progressBar1";
progressBar1.Size = new System.Drawing.Size(369, 23);
- progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
+ progressBar1.Style = ProgressBarStyle.Marquee;
progressBar1.TabIndex = 1;
//
// Form1
@@ -77,7 +77,7 @@ namespace QtProjectLib
ControlBox = false;
Controls.Add(progressBar1);
Controls.Add(label1);
- FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+ FormBorderStyle = FormBorderStyle.FixedToolWindow;
MaximizeBox = false;
MinimizeBox = false;
Name = "Form1";
@@ -156,7 +156,7 @@ namespace QtProjectLib
var regPath = dteObject.Application.RegistryRoot + "\\Setup\\VC";
var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regPath);
if (key != null) {
- var keyValue = key.GetValue("ProductDir", (object) "").ToString();
+ var keyValue = key.GetValue("ProductDir", "").ToString();
var envVar = qmakeProcess.StartInfo.EnvironmentVariables["path"];
if (envVar != null) {
var value = envVar + ";" + keyValue;
@@ -178,7 +178,7 @@ namespace QtProjectLib
+ "variable QMAKESPEC overwriting Qt version QMAKESPEC.");
InvokeExternalTarget(PaneMessageDataEvent, "--- (qmake) : Qt version "
+ "QMAKESPEC: " + qtVersionInformation.QMakeSpecDirectory);
- InvokeExternalTarget(PaneMessageDataEvent,"--- (qmake) : Environment "
+ InvokeExternalTarget(PaneMessageDataEvent, "--- (qmake) : Environment "
+ "variable QMAKESPEC: " + qmakeSpec + Environment.NewLine);
}
}
@@ -188,8 +188,8 @@ namespace QtProjectLib
errOutputLines = 0;
stdOutput = new StringBuilder();
stdOutputLines = 0;
- var errorThread = new Thread(new ThreadStart(ReadStandardError));
- var outputThread = new Thread(new ThreadStart(ReadStandardOutput));
+ var errorThread = new Thread(ReadStandardError);
+ var outputThread = new Thread(ReadStandardOutput);
errorThread.Start();
outputThread.Start();
@@ -225,7 +225,7 @@ namespace QtProjectLib
protected Process CreateQmakeProcess(string qmakeArgs, string filename, string workingDir)
{
- var qmakeProcess = new System.Diagnostics.Process();
+ var qmakeProcess = new Process();
qmakeProcess.StartInfo.CreateNoWindow = true;
qmakeProcess.StartInfo.UseShellExecute = false;
qmakeProcess.StartInfo.RedirectStandardError = true;
@@ -295,7 +295,7 @@ namespace QtProjectLib
public string query(string property)
{
ReadyEvent += resultObtained;
- var qmakeThread = new System.Threading.Thread(new ParameterizedThreadStart(RunQMakeQuery));
+ var qmakeThread = new Thread(RunQMakeQuery);
qmakeThread.Start(property);
qmakeThread.Join();
return queryResult;
@@ -321,8 +321,8 @@ namespace QtProjectLib
errOutputLines = 0;
stdOutput = new StringBuilder();
stdOutputLines = 0;
- var errorThread = new Thread(new ThreadStart(ReadStandardError));
- var outputThread = new Thread(new ThreadStart(ReadStandardOutput));
+ var errorThread = new Thread(ReadStandardError);
+ var outputThread = new Thread(ReadStandardOutput);
errorThread.Start();
outputThread.Start();
diff --git a/src/qtprojectlib/QrcParser.cs b/src/qtprojectlib/QrcParser.cs
index 455a2702..647103f6 100644
--- a/src/qtprojectlib/QrcParser.cs
+++ b/src/qtprojectlib/QrcParser.cs
@@ -138,7 +138,7 @@ namespace QtProjectLib
prefxs.Add(prefixes.Pop());
} else if (reader.LocalName.ToLower() == "file"
&& prefixes.Peek() != null && currentItem != null) {
- ((QrcPrefix) (prefixes.Peek())).AddQrcItem(currentItem);
+ prefixes.Peek().AddQrcItem(currentItem);
currentItem = null;
}
break;
diff --git a/src/qtprojectlib/QtConfig.cs b/src/qtprojectlib/QtConfig.cs
index 43249c70..524414ec 100644
--- a/src/qtprojectlib/QtConfig.cs
+++ b/src/qtprojectlib/QtConfig.cs
@@ -78,7 +78,7 @@ namespace QtProjectLib
{
line = line.Trim();
if (line.StartsWith("CONFIG", StringComparison.Ordinal)) {
- var values = line.Substring(6).Split(new char[] { ' ', '\t' });
+ var values = line.Substring(6).Split(' ', '\t');
foreach (var s in values) {
if (s == "static")
isStaticBuild = true;
diff --git a/src/qtprojectlib/QtModules.cs b/src/qtprojectlib/QtModules.cs
index 3f651c96..3cdbe5bb 100644
--- a/src/qtprojectlib/QtModules.cs
+++ b/src/qtprojectlib/QtModules.cs
@@ -86,7 +86,7 @@ namespace QtProjectLib
// DesignerComponents = 49,
WebkitWidgets = 50,
Concurrent = 51,
- MultimediaWidgets = 52,
+ MultimediaWidgets = 52
}
public class QtModuleInfo
@@ -158,12 +158,12 @@ namespace QtProjectLib
{
var qtVersion = QtVersionManager.The().GetDefaultVersion();
if (qtVersion == null) {
- throw new QtVSException("Unable to find a Qt build!" + System.Environment.NewLine
+ throw new QtVSException("Unable to find a Qt build!" + Environment.NewLine
+ "To solve this problem specify a Qt build.");
}
var installPath = QtVersionManager.The().GetInstallPath(qtVersion);
- if (moduleName.StartsWith("Qt", System.StringComparison.Ordinal))
+ if (moduleName.StartsWith("Qt", StringComparison.Ordinal))
moduleName = "Qt5" + moduleName.Substring(2);
return new FileInfo(Path.Combine(installPath, "lib", moduleName + ".lib")).Exists;
@@ -215,7 +215,7 @@ namespace QtProjectLib
InitQtModule(QtModule.Script, "QtScript", "QT_SCRIPT_LIB");
InitQtModule(QtModule.XmlPatterns, "QtXmlPatterns", "QT_XMLPATTERNS_LIB");
moduleInfo = InitQtModule(QtModule.ScriptTools, "QtScriptTools", "QT_SCRIPTTOOLS_LIB");
- moduleInfo = InitQtModule(QtModule.Designer, "QtDesigner", new string[] { "QDESIGNER_EXPORT_WIDGETS", "QT_DESIGNER_LIB" });
+ moduleInfo = InitQtModule(QtModule.Designer, "QtDesigner", new[] { "QDESIGNER_EXPORT_WIDGETS", "QT_DESIGNER_LIB" });
moduleInfo = InitQtModule(QtModule.Main, "qtmain", string.Empty);
moduleInfo.proVarQT = null;
moduleInfo.HasDLL = false;
@@ -289,7 +289,7 @@ namespace QtProjectLib
private QtModuleInfo InitQtModule(QtModule moduleId, string libraryPrefix, string define)
{
- return InitQtModule(moduleId, libraryPrefix, new string[] { define });
+ return InitQtModule(moduleId, libraryPrefix, new[] { define });
}
private QtModuleInfo InitQtModule(QtModule moduleId, string libraryPrefix, string[] defines)
diff --git a/src/qtprojectlib/QtProject.cs b/src/qtprojectlib/QtProject.cs
index 2a531296..a9e5438e 100644
--- a/src/qtprojectlib/QtProject.cs
+++ b/src/qtprojectlib/QtProject.cs
@@ -45,8 +45,8 @@ namespace QtProjectLib
/// </summary>
public class QtProject
{
- private EnvDTE.DTE dte;
- private EnvDTE.Project envPro;
+ private DTE dte;
+ private Project envPro;
private VCProject vcPro;
private MocCmdChecker mocCmdChecker;
private Array lastConfigurationRowNames;
@@ -54,10 +54,10 @@ namespace QtProjectLib
public static QtProject Create(VCProject vcProject)
{
- return Create((EnvDTE.Project) vcProject.Object);
+ return Create((Project) vcProject.Object);
}
- public static QtProject Create(EnvDTE.Project project)
+ public static QtProject Create(Project project)
{
QtProject qtProject = null;
if (project != null && !instances.TryGetValue(project, out qtProject)) {
@@ -72,7 +72,7 @@ namespace QtProjectLib
instances.Clear();
}
- private QtProject(EnvDTE.Project project)
+ private QtProject(Project project)
{
if (project == null)
throw new QtVSException(SR.GetString("QtProject_CannotConstructWithoutValidProject"));
@@ -86,7 +86,7 @@ namespace QtProjectLib
get { return vcPro; }
}
- public EnvDTE.Project Project
+ public Project Project
{
get { return envPro; }
}
@@ -514,7 +514,7 @@ namespace QtProjectLib
sw.WriteLine("IDI_ICON1\t\tICON\t\tDISCARDABLE\t\"" + projectName + ".ico\"" + sw.NewLine);
sw.Close();
}
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayErrorMessage(e);
return false;
}
@@ -926,9 +926,7 @@ namespace QtProjectLib
cmdLine = rex.Replace(cmdLine, string.Empty);
}
- var m = System.Text.RegularExpressions.Regex.Match(cmdLine,
- @"(\S*moc.exe|""\S+:\\\.*moc.exe"")");
-
+ var m = Regex.Match(cmdLine, @"(\S*moc.exe|""\S+:\\\.*moc.exe"")");
if (m.Success) {
var start = m.Index;
var end = cmdLine.IndexOf("&&", start, StringComparison.Ordinal);
@@ -1017,7 +1015,8 @@ namespace QtProjectLib
{
if (HelperFunctions.HasHeaderFileExtension(file.Name)) {
return CheckForCommand(file, "moc.exe");
- } else if (HelperFunctions.HasSourceFileExtension(file.Name)) {
+ }
+ if (HelperFunctions.HasSourceFileExtension(file.Name)) {
foreach (VCConfiguration config in (IVCCollection) vcPro.Configurations) {
var mocFileName = string.Empty;
if (mocOutDir == null) {
@@ -1103,9 +1102,9 @@ namespace QtProjectLib
public void UpdateRccStep(VCFile qrcFile, RccOptions rccOpts)
{
var vcpro = (VCProject) qrcFile.project;
- EnvDTE.DTE dteObject = ((EnvDTE.Project) vcpro.Object).DTE;
+ DTE dteObject = ((Project) vcpro.Object).DTE;
- var qtPro = QtProject.Create(vcpro);
+ var qtPro = Create(vcpro);
var parser = new QrcParser(qrcFile.FullPath);
var filesInQrcFile = ProjectMacros.Path;
@@ -1120,7 +1119,7 @@ namespace QtProjectLib
filesInQrcFile += ";" + relativeQrcItemPath;
try {
var addedFile = qtPro.AddFileInFilter(Filters.ResourceFiles(), relativeQrcItemPath, true);
- QtProject.ExcludeFromAllBuilds(addedFile);
+ ExcludeFromAllBuilds(addedFile);
} catch { /* it's not possible to add all kinds of files */ }
}
}
@@ -1158,7 +1157,7 @@ namespace QtProjectLib
cbt.CommandLine = cmdLine + " \"" + ProjectMacros.Path + "\" -o " + cbt.Outputs;
}
AddFileInFilter(Filters.GeneratedFiles(), qrcCppFile, true);
- } catch (System.Exception /*e*/) {
+ } catch (Exception /*e*/) {
Messages.PaneMessage(dteObject, "*** WARNING (RCC): Couldn't add rcc step");
}
}
@@ -1177,7 +1176,7 @@ namespace QtProjectLib
if (generatedFile != null)
RemoveFileFromFilter(generatedFile, Filters.GeneratedFiles());
}
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayWarningMessage(e);
}
}
@@ -1233,7 +1232,7 @@ namespace QtProjectLib
var reg = new Regex("Moc'ing .+\\.\\.\\.");
var addDepends = tool.AdditionalDependencies;
- addDepends = System.Text.RegularExpressions.Regex.Replace(addDepends,
+ addDepends = Regex.Replace(addDepends,
@"(\S*moc.exe|""\S+:\\\.*moc.exe"")", string.Empty);
addDepends = addDepends.Replace(file.RelativePath, string.Empty);
tool.AdditionalDependencies = string.Empty;
@@ -1252,11 +1251,11 @@ namespace QtProjectLib
else if (matchList[1].Length > 1)
outputMocFile = matchList[1].ToString();
}
- tool.Outputs = System.Text.RegularExpressions.Regex.Replace(tool.Outputs,
+ tool.Outputs = Regex.Replace(tool.Outputs,
pattern, string.Empty, RegexOptions.Multiline | RegexOptions.IgnoreCase);
- tool.Outputs = System.Text.RegularExpressions.Regex.Replace(tool.Outputs,
+ tool.Outputs = Regex.Replace(tool.Outputs,
@"\s*;\s*;\s*", ";", RegexOptions.Multiline);
- tool.Outputs = System.Text.RegularExpressions.Regex.Replace(tool.Outputs,
+ tool.Outputs = Regex.Replace(tool.Outputs,
@"(^\s*;|\s*;\s*$)", string.Empty, RegexOptions.Multiline);
if (outputMocFile != null) {
@@ -1304,7 +1303,7 @@ namespace QtProjectLib
if (hFile != null)
RemoveFileFromFilter(hFile, Filters.GeneratedFiles());
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayWarningMessage(e);
}
}
@@ -1411,9 +1410,9 @@ namespace QtProjectLib
/// </summary>
/// <param name="fileName">file name (relative path)</param>
/// <returns></returns>
- public System.Collections.Generic.List<VCFile> GetFilesFromProject(string fileName)
+ public List<VCFile> GetFilesFromProject(string fileName)
{
- var tmpList = new System.Collections.Generic.List<VCFile>();
+ var tmpList = new List<VCFile>();
fileName = HelperFunctions.NormalizeRelativeFilePath(fileName);
var fi = new FileInfo(fileName);
@@ -1424,9 +1423,9 @@ namespace QtProjectLib
return tmpList;
}
- public System.Collections.Generic.List<VCFile> GetAllFilesFromFilter(VCFilter filter)
+ public List<VCFile> GetAllFilesFromFilter(VCFilter filter)
{
- var tmpList = new System.Collections.Generic.List<VCFile>();
+ var tmpList = new List<VCFile>();
foreach (VCFile f in (IVCCollection) filter.Files)
tmpList.Add(f);
@@ -1543,8 +1542,7 @@ namespace QtProjectLib
if (vfilt.CanAddFile(fileName))
return (VCFile) (vfilt.AddFile(fileName));
- else
- throw new QtVSException(SR.GetString("QtProject_CannotAddFile", fileName));
+ throw new QtVSException(SR.GetString("QtProject_CannotAddFile", fileName));
} catch {
throw new QtVSException(SR.GetString("QtProject_CannotAddFile", fileName));
}
@@ -1619,7 +1617,7 @@ namespace QtProjectLib
}
srcFile.MoveTo(destName);
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayWarningMessage(e, SR.GetString("QtProject_DeletedFolderFullOrProteced"));
}
}
@@ -1697,12 +1695,12 @@ namespace QtProjectLib
try {
var solutionExplorer = dte.Windows.Item(Constants.vsWindowKindSolutionExplorer);
if (solutionExplorer != null) {
- var hierarchy = (EnvDTE.UIHierarchy) solutionExplorer.Object;
- EnvDTE.UIHierarchyItems projects = hierarchy.UIHierarchyItems.Item(1).UIHierarchyItems;
+ var hierarchy = (UIHierarchy) solutionExplorer.Object;
+ UIHierarchyItems projects = hierarchy.UIHierarchyItems.Item(1).UIHierarchyItems;
- foreach (EnvDTE.UIHierarchyItem itm in projects) {
+ foreach (UIHierarchyItem itm in projects) {
if (itm.Name == envPro.Name) {
- foreach (EnvDTE.UIHierarchyItem i in itm.UIHierarchyItems) {
+ foreach (UIHierarchyItem i in itm.UIHierarchyItems) {
if (i.Name == Filters.GeneratedFiles().Name)
i.UIHierarchyItems.Expanded = false;
}
@@ -1855,7 +1853,7 @@ namespace QtProjectLib
var reader = new StreamReader(file);
text = reader.ReadToEnd();
reader.Close();
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayErrorMessage(
SR.GetString("QtProject_CannotReplaceTokenRead", token, replacement, e.ToString()));
return;
@@ -1869,7 +1867,7 @@ namespace QtProjectLib
var writer = new StreamWriter(file);
writer.Write(text);
writer.Close();
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayErrorMessage(
SR.GetString("QtProject_CannotReplaceTokenWrite", token, replacement, e.ToString()));
}
@@ -1962,7 +1960,7 @@ namespace QtProjectLib
line = reader.ReadLine();
}
reader.Close();
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayErrorMessage(SR.GetString("QtProject_CannotEnableSectionRead", sectionName, e.ToString()));
return;
}
@@ -1971,7 +1969,7 @@ namespace QtProjectLib
var writer = new StreamWriter(file);
writer.Write(text);
writer.Close();
- } catch (System.Exception e) {
+ } catch (Exception e) {
Messages.DisplayErrorMessage(SR.GetString("QtProject_CannotEnableSectionWrite", sectionName, e.ToString()));
}
}
@@ -2006,7 +2004,7 @@ namespace QtProjectLib
private void UpdateCompilerIncludePaths(string oldDir, string newDir)
{
var fixedOldDir = FixFilePathForComparison(oldDir);
- var dirs = new string[] {
+ var dirs = new[] {
FixFilePathForComparison(QtVSIPSettings.GetUicDirectory(envPro)),
FixFilePathForComparison(QtVSIPSettings.GetMocDirectory(envPro)),
FixFilePathForComparison(QtVSIPSettings.GetRccDirectory(envPro))
@@ -2656,7 +2654,7 @@ namespace QtProjectLib
SolutionContext ctx = null;
try {
ctx = contexts.Item(i);
- } catch (System.ArgumentException) {
+ } catch (ArgumentException) {
// This may happen if we encounter an unloaded project.
continue;
}
@@ -2718,7 +2716,7 @@ namespace QtProjectLib
{
var compiler = CompilerToolWrapper.Create(config);
var minuend = new HashSet<string>(compiler.PreprocessorDefinitions);
- minuend.ExceptWith(viOld.GetQMakeConfEntry("DEFINES").Split(new char[] { ' ', '\t' }));
+ minuend.ExceptWith(viOld.GetQMakeConfEntry("DEFINES").Split(' ', '\t'));
compiler.SetPreprocessorDefinitions(string.Join(",", minuend));
}
@@ -2726,7 +2724,7 @@ namespace QtProjectLib
{
var compiler = CompilerToolWrapper.Create(config);
var ppdefs = new HashSet<string>(compiler.PreprocessorDefinitions);
- ppdefs.UnionWith(viNew.GetQMakeConfEntry("DEFINES").Split(new char[] { ' ', '\t' }));
+ ppdefs.UnionWith(viNew.GetQMakeConfEntry("DEFINES").Split(' ', '\t'));
compiler.SetPreprocessorDefinitions(string.Join(",", ppdefs));
var linker = (VCLinkerTool) ((IVCCollection) config.Tools).Item("VCLinkerTool");
@@ -2985,7 +2983,7 @@ namespace QtProjectLib
var activePlatformName = string.Empty;
if (string.IsNullOrEmpty(solutionConfig)) {
// First get active configuration cause not given as parameter
- EnvDTE.Configuration activeConf = envPro.ConfigurationManager.ActiveConfiguration;
+ Configuration activeConf = envPro.ConfigurationManager.ActiveConfiguration;
solutionConfig = activeConf.ConfigurationName + "|" + activeConf.PlatformName;
activePlatformName = activeConf.PlatformName;
} else {
diff --git a/src/qtprojectlib/QtVSIPSettings.cs b/src/qtprojectlib/QtVSIPSettings.cs
index 4fe1f0bd..1cd26a09 100644
--- a/src/qtprojectlib/QtVSIPSettings.cs
+++ b/src/qtprojectlib/QtVSIPSettings.cs
@@ -517,7 +517,7 @@ namespace QtProjectLib
var regKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\" + Resources.registryPackagePath);
if (regKey == null)
return defaultValue;
- return ((int) regKey.GetValue(key, (defaultValue ? 1 : 0) as object)) > 0;
+ return ((int) regKey.GetValue(key, defaultValue ? 1 : 0)) > 0;
}
private static bool ValueExists(string key)
diff --git a/src/qtprojectlib/QtVersionManager.cs b/src/qtprojectlib/QtVersionManager.cs
index cb0ee745..5a410b3a 100644
--- a/src/qtprojectlib/QtVersionManager.cs
+++ b/src/qtprojectlib/QtVersionManager.cs
@@ -208,7 +208,7 @@ namespace QtProjectLib
if (version == "$(DefaultQtVersion)")
version = GetDefaultVersion(root);
if (version == "$(QTDIR)")
- return System.Environment.GetEnvironmentVariable("QTDIR");
+ return Environment.GetEnvironmentVariable("QTDIR");
var key = root.OpenSubKey("SOFTWARE\\" + Resources.registryRootPath, false);
if (key == null)
@@ -334,7 +334,7 @@ namespace QtProjectLib
var match = regExp.Match(version);
if (match.Success) {
var env = match.Groups["VarName"].Value;
- version = System.Environment.GetEnvironmentVariable(env);
+ version = Environment.GetEnvironmentVariable(env);
}
}
}
@@ -390,7 +390,7 @@ namespace QtProjectLib
}
if (defaultVersion == null) {
// last fallback... try QTDIR
- var qtDir = System.Environment.GetEnvironmentVariable("QTDIR");
+ var qtDir = Environment.GetEnvironmentVariable("QTDIR");
if (qtDir == null)
return null;
var d = new DirectoryInfo(qtDir);
diff --git a/src/qtprojectlib/ResClass.cs b/src/qtprojectlib/ResClass.cs
index 1cf4470c..4382606b 100644
--- a/src/qtprojectlib/ResClass.cs
+++ b/src/qtprojectlib/ResClass.cs
@@ -93,7 +93,7 @@ namespace QtProjectLib
internal SR()
{
- resources = new System.Resources.ResourceManager("QtProjectLib.Resources", GetType().Assembly);
+ resources = new ResourceManager("QtProjectLib.Resources", GetType().Assembly);
}
private static SR GetLoader()
@@ -125,7 +125,7 @@ namespace QtProjectLib
var sys = GetLoader();
if (sys == null)
return null;
- var res = sys.resources.GetString(name, SR.Culture);
+ var res = sys.resources.GetString(name, Culture);
if (args != null && args.Length > 0)
return string.Format(res, args);
@@ -137,7 +137,7 @@ namespace QtProjectLib
var sys = GetLoader();
if (sys == null)
return null;
- return sys.resources.GetString(name, SR.Culture);
+ return sys.resources.GetString(name, Culture);
}
}
}
diff --git a/src/qtvstools/AddQtVersionDialog.cs b/src/qtvstools/AddQtVersionDialog.cs
index 0c599103..ebb5af37 100644
--- a/src/qtvstools/AddQtVersionDialog.cs
+++ b/src/qtvstools/AddQtVersionDialog.cs
@@ -34,15 +34,15 @@ using System.Windows.Forms;
namespace QtVsTools
{
- public class AddQtVersionDialog : System.Windows.Forms.Form
+ public class AddQtVersionDialog : Form
{
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Button okButton;
- private System.Windows.Forms.Button cancelButton;
- private System.Windows.Forms.TextBox nameBox;
- private System.Windows.Forms.TextBox pathBox;
- private System.Windows.Forms.Button browseButton;
+ private Label label1;
+ private Label label2;
+ private Button okButton;
+ private Button cancelButton;
+ private TextBox nameBox;
+ private TextBox pathBox;
+ private Button browseButton;
private bool nameBoxDirty;
private Timer errorTimer;
private Label errorLabel;
@@ -62,7 +62,7 @@ namespace QtVsTools
cancelButton.Text = SR.GetString(SR.Cancel);
Text = SR.GetString("AddQtVersionDialog_Title");
- FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ FormBorderStyle = FormBorderStyle.FixedDialog;
errorTimer = new Timer();
errorTimer.Tick += errorTimer_Tick;
@@ -271,7 +271,7 @@ namespace QtVsTools
if (name != "$(QTDIR)") {
try {
- var di = new System.IO.DirectoryInfo(pathBox.Text);
+ var di = new DirectoryInfo(pathBox.Text);
if (!di.Exists) {
lastErrorString = string.Empty;
okButton.Enabled = false;
diff --git a/src/qtvstools/AddTranslationDialog.cs b/src/qtvstools/AddTranslationDialog.cs
index 5df146ad..5bfd40e1 100644
--- a/src/qtvstools/AddTranslationDialog.cs
+++ b/src/qtvstools/AddTranslationDialog.cs
@@ -215,7 +215,7 @@ namespace QtVsTools
}
}
- public class TranslationItem : System.Globalization.CultureInfo
+ public class TranslationItem : CultureInfo
{
public TranslationItem(int culture)
: base(culture)
@@ -227,7 +227,7 @@ namespace QtVsTools
if (NativeName != DisplayName)
return DisplayName;
- var culture = CultureInfo.GetCultureInfo(Vsix.Instance.Dte.LocaleID);
+ var culture = GetCultureInfo(Vsix.Instance.Dte.LocaleID);
if (culture.TwoLetterISOLanguageName == TwoLetterISOLanguageName)
return DisplayName;
@@ -236,12 +236,12 @@ namespace QtVsTools
public static TranslationItem SystemLanguage()
{
- return new TranslationItem(CultureInfo.CurrentCulture.LCID);
+ return new TranslationItem(CurrentCulture.LCID);
}
public static TranslationItem[] GetTranslationItems()
{
- var cultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures
+ var cultures = GetCultures(CultureTypes.SpecificCultures
& ~CultureTypes.UserCustomCulture & ~CultureTypes.ReplacementCultures);
var transItems = new List<TranslationItem>();
for (var i = 0; i < cultures.Length; i++) {
diff --git a/src/qtvstools/DefaultEditorsClient.cs b/src/qtvstools/DefaultEditorsClient.cs
index aadbd112..6a3b86d4 100644
--- a/src/qtvstools/DefaultEditorsClient.cs
+++ b/src/qtvstools/DefaultEditorsClient.cs
@@ -194,7 +194,7 @@ namespace QtVsTools
// data has successfully been received
var decodedData = new UnicodeEncoding().GetString(data, 0, bytesRead);
- var messages = decodedData.Split(new char[] { '\n' },
+ var messages = decodedData.Split(new[] { '\n' },
StringSplitOptions.RemoveEmptyEntries);
foreach (var message in messages) {
diff --git a/src/qtvstools/DteEventsHandler.cs b/src/qtvstools/DteEventsHandler.cs
index 6499756b..986480cc 100644
--- a/src/qtvstools/DteEventsHandler.cs
+++ b/src/qtvstools/DteEventsHandler.cs
@@ -40,11 +40,11 @@ namespace QtVsTools
class DteEventsHandler
{
private DTE dte;
- private EnvDTE.SolutionEvents solutionEvents;
- private EnvDTE.BuildEvents buildEvents;
- private EnvDTE.DocumentEvents documentEvents;
- private EnvDTE.ProjectItemsEvents projectItemsEvents;
- private EnvDTE.vsBuildAction currentBuildAction = vsBuildAction.vsBuildActionBuild;
+ private SolutionEvents solutionEvents;
+ private BuildEvents buildEvents;
+ private DocumentEvents documentEvents;
+ private ProjectItemsEvents projectItemsEvents;
+ private vsBuildAction currentBuildAction = vsBuildAction.vsBuildActionBuild;
private VCProjectEngineEvents vcProjectEngineEvents;
private CommandEvents debugStartEvents;
private CommandEvents debugStartWithoutDebuggingEvents;
@@ -59,20 +59,20 @@ namespace QtVsTools
dte = _dte;
var events = dte.Events as Events2;
- buildEvents = (EnvDTE.BuildEvents) events.BuildEvents;
+ buildEvents = events.BuildEvents;
buildEvents.OnBuildBegin += buildEvents_OnBuildBegin;
buildEvents.OnBuildProjConfigBegin += OnBuildProjConfigBegin;
buildEvents.OnBuildDone += buildEvents_OnBuildDone;
- documentEvents = (EnvDTE.DocumentEvents) events.get_DocumentEvents(null);
+ documentEvents = events.get_DocumentEvents(null);
documentEvents.DocumentSaved += DocumentSaved;
- projectItemsEvents = (ProjectItemsEvents) events.ProjectItemsEvents;
+ projectItemsEvents = events.ProjectItemsEvents;
projectItemsEvents.ItemAdded += ProjectItemsEvents_ItemAdded;
projectItemsEvents.ItemRemoved += ProjectItemsEvents_ItemRemoved;
projectItemsEvents.ItemRenamed += ProjectItemsEvents_ItemRenamed;
- solutionEvents = (SolutionEvents) events.SolutionEvents;
+ solutionEvents = events.SolutionEvents;
solutionEvents.ProjectAdded += SolutionEvents_ProjectAdded;
solutionEvents.ProjectRemoved += SolutionEvents_ProjectRemoved;
solutionEvents.Opened += SolutionEvents_Opened;
@@ -146,7 +146,7 @@ namespace QtVsTools
public void OnQRCFileSaved(string fileName)
{
- foreach (EnvDTE.Project project in HelperFunctions.ProjectsInSolution(dte)) {
+ foreach (Project project in HelperFunctions.ProjectsInSolution(dte)) {
var vcProject = project.Object as VCProject;
if (vcProject == null || vcProject.Files == null)
continue;
@@ -203,8 +203,8 @@ namespace QtVsTools
return; // Don't do anything, if we're not building.
}
- EnvDTE.Project project = null;
- foreach (EnvDTE.Project p in HelperFunctions.ProjectsInSolution(dte)) {
+ Project project = null;
+ foreach (Project p in HelperFunctions.ProjectsInSolution(dte)) {
if (p.UniqueName == projectName) {
project = p;
break;
@@ -243,7 +243,7 @@ namespace QtVsTools
{
}
- public void DocumentSaved(EnvDTE.Document document)
+ public void DocumentSaved(Document document)
{
var qtPro = QtProject.Create(document.ProjectItem.ContainingProject);
@@ -476,8 +476,6 @@ namespace QtVsTools
}
}
} catch { }
-
- return;
}
void ProjectItemsEvents_ItemRemoved(ProjectItem ProjectItem)
@@ -562,7 +560,7 @@ namespace QtVsTools
/// </summary>
void RegisterVCProjectEngineEvents()
{
- foreach (EnvDTE.Project project in HelperFunctions.ProjectsInSolution(dte)) {
+ foreach (Project project in HelperFunctions.ProjectsInSolution(dte)) {
if (project != null && HelperFunctions.IsQtProject(project))
RegisterVCProjectEngineEvents(project);
}
diff --git a/src/qtvstools/FormChangeQtVersion.cs b/src/qtvstools/FormChangeQtVersion.cs
index c1b8c536..1ee03334 100644
--- a/src/qtvstools/FormChangeQtVersion.cs
+++ b/src/qtvstools/FormChangeQtVersion.cs
@@ -32,7 +32,7 @@ using System.Windows.Forms;
namespace QtVsTools
{
- public enum ChangeFor { Solution, Project };
+ public enum ChangeFor { Solution, Project }
public partial class FormChangeQtVersion : Form
{
diff --git a/src/qtvstools/FormVSQtSettings.cs b/src/qtvstools/FormVSQtSettings.cs
index d7c98f4b..888738bf 100644
--- a/src/qtvstools/FormVSQtSettings.cs
+++ b/src/qtvstools/FormVSQtSettings.cs
@@ -74,7 +74,7 @@ namespace QtVsTools
}
}
- void FormQtVersions_Shown(object sender, System.EventArgs args)
+ void FormQtVersions_Shown(object sender, EventArgs args)
{
string error = null;
if (versionManager.HasInvalidVersions(out error))
diff --git a/src/qtvstools/QmlClassifier.cs b/src/qtvstools/QmlClassifier.cs
index f0b3673e..f7d63e59 100644
--- a/src/qtvstools/QmlClassifier.cs
+++ b/src/qtvstools/QmlClassifier.cs
@@ -72,7 +72,7 @@ namespace QtVsTools
QmlClassifierEnabled = store.GetBoolean(Statics.QtVsToolsQmlClassifierPath,
Statics.QtVsToolsQmlClassifierKey, true);
- whiteSpaceChars = new char[] { ' ', '\t' };
+ whiteSpaceChars = new[] { ' ', '\t' };
separators = new List<char>
{
' ', '\t',
@@ -264,7 +264,7 @@ namespace QtVsTools
token.Length = value_len;
return token;
}
- } catch (System.IndexOutOfRangeException) {
+ } catch (IndexOutOfRangeException) {
// pass
}
@@ -277,7 +277,7 @@ namespace QtVsTools
var next_ch = '\0'; // doesn't matter which the default is until not '*' or '/'
try {
next_ch = text[i + 1];
- } catch (System.IndexOutOfRangeException) {
+ } catch (IndexOutOfRangeException) {
// pass
}
// If we are in beginning of search and not inside multi-line comment parsing
@@ -290,18 +290,19 @@ namespace QtVsTools
return GetStringToken(text, index, length);
}
// Single line comment start found,
- else if (ch == '/' && next_ch == '/') {
+ if (ch == '/' && next_ch == '/') {
// One line comment starting
var token = new CommentToken();
token.Length = length - index;
return token;
}
// Cut now ??
- else if (separators.Contains(ch)) {
+ if (separators.Contains(ch)) {
var token = new OtherToken();
token.Length = 1;
return token;
- } else if (ch == '/' && next_ch == '*') {
+ }
+ if (ch == '/' && next_ch == '*') {
// Multi-line comment start found (can be one liner also)
var token = GetMultiLineCommentToken(text, i, length);
if (!token.ContinueParsing)
@@ -316,7 +317,8 @@ namespace QtVsTools
token = GetToken(tmp);
token.Length = i - index;
return token;
- } else if (separators.Contains(ch)) {
+ }
+ if (separators.Contains(ch)) {
Token token = null;
if (inMultilineComment) {
token = new MultilineCommentToken();
@@ -328,7 +330,8 @@ namespace QtVsTools
}
token.Length = i - index;
return token;
- } else if (ch == '\r' || ch == '\n') {
+ }
+ if (ch == '\r' || ch == '\n') {
Token token = null;
if (inMultilineComment) {
token = new MultilineCommentToken();
@@ -339,16 +342,16 @@ namespace QtVsTools
token.Length = i - index + 1;
return token;
}
- // There is a comment coming so this token ends now
- else if (ch == '/' && next_ch == '/') {
+ // There is a comment coming so this token ends now
+ if (ch == '/' && next_ch == '/') {
Token token = null;
token = GetToken(text.Substring(index, i - index));
token.Length = i - index; // +1;
return token;
}
- // Multi-line comment start found (or sure can be one liner also)
- // so this token ends now
- else if (ch == '/' && next_ch == '*') {
+ // Multi-line comment start found (or sure can be one liner also)
+ // so this token ends now
+ if (ch == '/' && next_ch == '*') {
// Multi-line comment starting, perhaps
inMultilineComment = true;
var tmp = text.Substring(index, i - index);
diff --git a/src/qtvstools/QmlTokenTypes.cs b/src/qtvstools/QmlTokenTypes.cs
index 88bb55e8..2bb6f088 100644
--- a/src/qtvstools/QmlTokenTypes.cs
+++ b/src/qtvstools/QmlTokenTypes.cs
@@ -38,6 +38,6 @@ namespace QtVsTools
Keyword,
JsKeyword,
String,
- Property,
+ Property
}
}
diff --git a/src/qtvstools/QtHelpLinkChooser.xaml.cs b/src/qtvstools/QtHelpLinkChooser.xaml.cs
index 83775e6d..bddfd6b7 100644
--- a/src/qtvstools/QtHelpLinkChooser.xaml.cs
+++ b/src/qtvstools/QtHelpLinkChooser.xaml.cs
@@ -57,7 +57,7 @@ namespace QtVsTools
private void OnLoaded(object sender, RoutedEventArgs e)
{
var view = CollectionViewSource.GetDefaultView(linkListBox.ItemsSource);
- view.Filter = (obj) =>
+ view.Filter = obj =>
{
if (string.IsNullOrEmpty(searchBox.Text))
return true;
@@ -81,7 +81,7 @@ namespace QtVsTools
OnShowButton_Click(sender, null);
}
- private void OnShowButton_Click(object sender, System.Windows.RoutedEventArgs e)
+ private void OnShowButton_Click(object sender, RoutedEventArgs e)
{
DialogResult = true;
Close();
diff --git a/src/qtvstools/QtHelpMenu.cs b/src/qtvstools/QtHelpMenu.cs
index 50a68e62..335cc6aa 100644
--- a/src/qtvstools/QtHelpMenu.cs
+++ b/src/qtvstools/QtHelpMenu.cs
@@ -129,7 +129,7 @@ namespace QtVsTools
var objTextDocument = dte.ActiveDocument.Object() as TextDocument;
var keyword = string.Empty;
- var selection = objTextDocument.Selection as TextSelection;
+ var selection = objTextDocument.Selection;
if (selection.IsEmpty) { // no selection inside the document
var line = selection.ActivePoint.Line; // current line
var offset = selection.ActivePoint.LineCharOffset; // current char offset
@@ -175,7 +175,7 @@ namespace QtVsTools
if (qchFiles.Length == 0)
return;
- var settingsManager = new ShellSettingsManager(QtHelpMenu.Instance.ServiceProvider);
+ var settingsManager = new ShellSettingsManager(Instance.ServiceProvider);
var store = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);
var offline = store.GetBoolean(QtVsToolsHelpPreferencePath, "Offline", true);
@@ -243,7 +243,7 @@ namespace QtVsTools
}
if (string.IsNullOrEmpty(uri)) { // offline mode without a single search hit
- VsShellUtilities.ShowMessageBox(QtHelpMenu.Instance.ServiceProvider,
+ VsShellUtilities.ShowMessageBox(Instance.ServiceProvider,
"Your search - " + keyword + " - did not match any documents.",
string.Empty, OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK,
OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
diff --git a/src/qtvstools/QtItemContextMenu.cs b/src/qtvstools/QtItemContextMenu.cs
index 6d6375fc..5fed7f82 100644
--- a/src/qtvstools/QtItemContextMenu.cs
+++ b/src/qtvstools/QtItemContextMenu.cs
@@ -104,12 +104,12 @@ namespace QtVsTools
if (commandService == null)
return;
- var command = new OleMenuCommand(new EventHandler(execHandler),
+ var command = new OleMenuCommand(execHandler,
new CommandID(ItemContextMenuGuid, lUpdateOnItemId));
command.BeforeQueryStatus += beforeQueryStatus;
commandService.AddCommand(command);
- command = new OleMenuCommand(new EventHandler(execHandler),
+ command = new OleMenuCommand(execHandler,
new CommandID(ItemContextMenuGuid, lReleaseOnItemId));
command.BeforeQueryStatus += beforeQueryStatus;
commandService.AddCommand(command);
diff --git a/src/qtvstools/QtMainMenu.cs b/src/qtvstools/QtMainMenu.cs
index 7297de35..e25d45ff 100644
--- a/src/qtvstools/QtMainMenu.cs
+++ b/src/qtvstools/QtMainMenu.cs
@@ -119,7 +119,7 @@ namespace QtVsTools
return;
foreach (var id in Enum.GetValues(typeof(CommandId))) {
- var command = new OleMenuCommand(new EventHandler(execHandler),
+ var command = new OleMenuCommand(execHandler,
new CommandID(MainMenuGuid, (int) id));
command.BeforeQueryStatus += beforeQueryStatus;
commandService.AddCommand(command);
diff --git a/src/qtvstools/QtProjectContextMenu.cs b/src/qtvstools/QtProjectContextMenu.cs
index 5720bf5c..29cee97f 100644
--- a/src/qtvstools/QtProjectContextMenu.cs
+++ b/src/qtvstools/QtProjectContextMenu.cs
@@ -120,7 +120,7 @@ namespace QtVsTools
return;
foreach (var id in Enum.GetValues(typeof(CommandId))) {
- var command = new OleMenuCommand(new EventHandler(execHandler),
+ var command = new OleMenuCommand(execHandler,
new CommandID(ProjectContextMenuGuid, (int) id));
command.BeforeQueryStatus += beforeQueryStatus;
commandService.AddCommand(command);
diff --git a/src/qtvstools/QtSolutionContextMenu.cs b/src/qtvstools/QtSolutionContextMenu.cs
index a9b00dab..f4159ac3 100644
--- a/src/qtvstools/QtSolutionContextMenu.cs
+++ b/src/qtvstools/QtSolutionContextMenu.cs
@@ -107,13 +107,13 @@ namespace QtVsTools
if (commandService == null)
return;
- commandService.AddCommand(new OleMenuCommand(new EventHandler(execHandler),
+ commandService.AddCommand(new OleMenuCommand(execHandler,
new CommandID(SolutionContextMenuGuid, lUpdateOnSolutionId)));
- commandService.AddCommand(new OleMenuCommand(new EventHandler(execHandler),
+ commandService.AddCommand(new OleMenuCommand(execHandler,
new CommandID(SolutionContextMenuGuid, lReleaseOnSolutionId)));
- commandService.AddCommand(new OleMenuCommand(new EventHandler(execHandler),
+ commandService.AddCommand(new OleMenuCommand(execHandler,
new CommandID(SolutionContextMenuGuid, ChangeSolutionQtVersionId)));
}
diff --git a/src/qtvstools/QtVersionDialog.cs b/src/qtvstools/QtVersionDialog.cs
index 5d4965ec..e265e43a 100644
--- a/src/qtvstools/QtVersionDialog.cs
+++ b/src/qtvstools/QtVersionDialog.cs
@@ -35,12 +35,12 @@ namespace QtVsTools
/// <summary>
/// Summary description for QtVersionDialog.
/// </summary>
- public class QtVersionDialog : System.Windows.Forms.Form
+ public class QtVersionDialog : Form
{
- private System.Windows.Forms.ComboBox versionComboBox;
- private System.Windows.Forms.Button cancelButton;
- private System.Windows.Forms.Button okButton;
- private System.Windows.Forms.GroupBox groupBox1;
+ private ComboBox versionComboBox;
+ private Button cancelButton;
+ private Button okButton;
+ private GroupBox groupBox1;
private EnvDTE.DTE dteObj;
public QtVersionDialog(EnvDTE.DTE dte)
diff --git a/src/qtvstools/ResClass.cs b/src/qtvstools/ResClass.cs
index b1772a72..03528830 100644
--- a/src/qtvstools/ResClass.cs
+++ b/src/qtvstools/ResClass.cs
@@ -137,7 +137,7 @@ namespace QtVsTools
string result;
try {
- result = sys.resources.GetString(name, SR.Culture);
+ result = sys.resources.GetString(name, Culture);
} catch (Exception) {
result = sys.resources.GetString(name, defaultCultureInfo);
}
diff --git a/src/qtvstools/Translation.cs b/src/qtvstools/Translation.cs
index abe4741d..c8cf00e7 100644
--- a/src/qtvstools/Translation.cs
+++ b/src/qtvstools/Translation.cs
@@ -152,13 +152,13 @@ namespace QtVsTools
}
}
var vcPro = (VCProject) pro.Object;
- temporaryProFile = System.IO.Path.GetTempFileName();
- temporaryProFile = System.IO.Path.GetDirectoryName(temporaryProFile) + "\\" +
- System.IO.Path.GetFileNameWithoutExtension(temporaryProFile) + ".pro";
- if (System.IO.File.Exists(temporaryProFile))
- System.IO.File.Delete(temporaryProFile);
+ temporaryProFile = Path.GetTempFileName();
+ temporaryProFile = Path.GetDirectoryName(temporaryProFile) + "\\"
+ + Path.GetFileNameWithoutExtension(temporaryProFile) + ".pro";
+ if (File.Exists(temporaryProFile))
+ File.Delete(temporaryProFile);
- using (var sw = new System.IO.StreamWriter(temporaryProFile)) {
+ using (var sw = new StreamWriter(temporaryProFile)) {
writeFilesToPro(sw, "HEADERS",
ProjectExporter.ConvertFilesToFullPath(headers, vcPro.ProjectDirectory));
writeFilesToPro(sw, "SOURCES",
@@ -190,18 +190,18 @@ namespace QtVsTools
Messages.DisplayErrorMessage(e.Message);
}
- if (temporaryProFile != null && System.IO.File.Exists(temporaryProFile)) {
- System.IO.File.Delete(temporaryProFile);
+ if (temporaryProFile != null && File.Exists(temporaryProFile)) {
+ File.Delete(temporaryProFile);
temporaryProFile = temporaryProFile.Substring(0, temporaryProFile.Length - 3);
temporaryProFile += "TMP";
- if (System.IO.File.Exists(temporaryProFile))
- System.IO.File.Delete(temporaryProFile);
+ if (File.Exists(temporaryProFile))
+ File.Delete(temporaryProFile);
}
return success;
}
- private static void writeFilesToPro(System.IO.StreamWriter pro, string section, List<string> files)
+ private static void writeFilesToPro(StreamWriter pro, string section, List<string> files)
{
if (files.Count > 0) {
pro.Write(section + " = ");
@@ -266,7 +266,7 @@ namespace QtVsTools
var qtPro = QtProject.Create(project);
var file = qtPro.AddFileInFilter(Filters.TranslationFiles(),
transDlg.TranslationFile, true);
- Translation.RunlUpdate(file, project);
+ RunlUpdate(file, project);
} catch (QtVSException e) {
Messages.DisplayErrorMessage(e.Message);
} catch (System.Exception ex) {
diff --git a/src/qtvstools/Vsix.cs b/src/qtvstools/Vsix.cs
index a28637df..f1bd8726 100644
--- a/src/qtvstools/Vsix.cs
+++ b/src/qtvstools/Vsix.cs
@@ -36,7 +36,7 @@ using System.Windows.Forms;
namespace QtVsTools
{
- [Guid(Vsix.PackageGuid)]
+ [Guid(PackageGuid)]
[PackageRegistration(UseManagedResourcesOnly = true)]
[InstalledProductRegistration("#110", "#112", "2.0.0", IconResourceID = 400)]
[ProvideMenuResource("Menus.ctmenu", 1)]
@@ -134,7 +134,7 @@ namespace QtVsTools
try {
UpdateDefaultEditors(Mode.Startup);
- } catch (System.Exception e) {
+ } catch (Exception e) {
MessageBox.Show(e.Message + "\r\n\r\nStacktrace:\r\n" + e.StackTrace);
}
}
@@ -151,7 +151,7 @@ namespace QtVsTools
eventHandler.Disconnect();
try {
UpdateDefaultEditors(Mode.Shutdown);
- } catch (System.Exception e) {
+ } catch (Exception e) {
MessageBox.Show(e.Message + "\r\n\r\nStacktrace:\r\n" + e.StackTrace);
}
return base.QueryClose(out canClose);
diff --git a/src/qtwizard/AddClassPage.xaml.cs b/src/qtwizard/AddClassPage.xaml.cs
index dd0ccf8f..f6c918fe 100644
--- a/src/qtwizard/AddClassPage.xaml.cs
+++ b/src/qtwizard/AddClassPage.xaml.cs
@@ -243,14 +243,14 @@ namespace QtProjectWizard
.GetValueOrDefault()));
}
- private void OnSmallIconsChecked(object sender, System.Windows.RoutedEventArgs e)
+ private void OnSmallIconsChecked(object sender, RoutedEventArgs e)
{
MediumIcons.IsChecked = false;
if (ClassView != null)
ClassView.ItemTemplate = ClassView.FindResource("SmallTemplate") as DataTemplate;
}
- private void OnMediumIconsChecked(object sender, System.Windows.RoutedEventArgs e)
+ private void OnMediumIconsChecked(object sender, RoutedEventArgs e)
{
SmallIcons.IsChecked = false;
if (ClassView != null)
diff --git a/src/qtwizard/CoreClassWizard.cs b/src/qtwizard/CoreClassWizard.cs
index c7593cfd..d3b334bd 100644
--- a/src/qtwizard/CoreClassWizard.cs
+++ b/src/qtwizard/CoreClassWizard.cs
@@ -92,7 +92,7 @@ namespace QtProjectWizard
if (!wizard.DialogResult.HasValue || !wizard.DialogResult.Value)
throw new System.Exception("Unexpected wizard return value.");
- var array = data.ClassName.Split(new string[] { "::" }, System
+ var array = data.ClassName.Split(new[] { "::" }, System
.StringSplitOptions.RemoveEmptyEntries);
data.ClassName = array.LastOrDefault();
@@ -102,7 +102,7 @@ namespace QtProjectWizard
nsEnd = "} // namespace " + array[i] + "\r\n" + nsEnd;
}
- var pro = HelperFunctions.GetSelectedQtProject(dte as EnvDTE.DTE);
+ var pro = HelperFunctions.GetSelectedQtProject(dte);
if (pro == null)
throw new QtVSException("Can't find a selected project");
diff --git a/src/qtwizard/DesignerWizard.cs b/src/qtwizard/DesignerWizard.cs
index b1bd939d..fe018478 100644
--- a/src/qtwizard/DesignerWizard.cs
+++ b/src/qtwizard/DesignerWizard.cs
@@ -43,7 +43,7 @@ namespace QtProjectWizard
{
public class DesignerWizard : IWizard
{
- public void BeforeOpeningFile(EnvDTE.ProjectItem projectItem)
+ public void BeforeOpeningFile(ProjectItem projectItem)
{
if (projectItem.FileCount >= 1) {
var qtProject = QtProject.Create(projectItem.ContainingProject);
@@ -52,7 +52,7 @@ namespace QtProjectWizard
}
}
- public void ProjectFinishedGenerating(EnvDTE.Project project)
+ public void ProjectFinishedGenerating(Project project)
{
var qtProject = QtProject.Create(project);
@@ -104,7 +104,7 @@ namespace QtProjectWizard
qtProject.Finish(); // Collapses all project nodes.
}
- public void ProjectItemFinishedGenerating(EnvDTE.ProjectItem projectItem)
+ public void ProjectItemFinishedGenerating(ProjectItem projectItem)
{
}
diff --git a/src/qtwizard/GuiClassWizard.cs b/src/qtwizard/GuiClassWizard.cs
index 04c031f1..6db256a6 100644
--- a/src/qtwizard/GuiClassWizard.cs
+++ b/src/qtwizard/GuiClassWizard.cs
@@ -97,7 +97,7 @@ namespace QtProjectWizard
if (!wizard.DialogResult.HasValue || !wizard.DialogResult.Value)
throw new System.Exception("Unexpected wizard return value.");
- var array = data.ClassName.Split(new string[] { "::" }, System
+ var array = data.ClassName.Split(new[] { "::" }, System
.StringSplitOptions.RemoveEmptyEntries);
data.ClassName = array.LastOrDefault();
@@ -107,7 +107,7 @@ namespace QtProjectWizard
nsEnd = "} // namespace " + array[i] + "\r\n" + nsEnd;
}
- var pro = HelperFunctions.GetSelectedQtProject(dte as EnvDTE.DTE);
+ var pro = HelperFunctions.GetSelectedQtProject(dte);
if (pro == null)
throw new QtVSException("Can't find a selected project");
diff --git a/src/qtwizard/ModulePage.xaml.cs b/src/qtwizard/ModulePage.xaml.cs
index 9912a3e8..07d0144d 100644
--- a/src/qtwizard/ModulePage.xaml.cs
+++ b/src/qtwizard/ModulePage.xaml.cs
@@ -100,7 +100,6 @@ namespace QtProjectWizard
yield return t;
}
}
- yield break;
}
}
}
diff --git a/src/qtwizard/ServerWizard.cs b/src/qtwizard/ServerWizard.cs
index 16a50b10..1fae78b7 100644
--- a/src/qtwizard/ServerWizard.cs
+++ b/src/qtwizard/ServerWizard.cs
@@ -42,7 +42,7 @@ namespace QtProjectWizard
{
public class ServerWizard : IWizard
{
- public void BeforeOpeningFile(EnvDTE.ProjectItem projectItem)
+ public void BeforeOpeningFile(ProjectItem projectItem)
{
if (projectItem.FileCount >= 1) {
var qtProject = QtProject.Create(projectItem.ContainingProject);
@@ -51,7 +51,7 @@ namespace QtProjectWizard
}
}
- public void ProjectFinishedGenerating(EnvDTE.Project project)
+ public void ProjectFinishedGenerating(Project project)
{
var qtProject = QtProject.Create(project);
@@ -102,7 +102,7 @@ namespace QtProjectWizard
qtProject.Finish(); // Collapses all project nodes.
}
- public void ProjectItemFinishedGenerating(EnvDTE.ProjectItem projectItem)
+ public void ProjectItemFinishedGenerating(ProjectItem projectItem)
{
}