From ca47896204482bf4a6979e3838bf7f09f61cebeb Mon Sep 17 00:00:00 2001
From: giy <giy@omp-system.ru>
Date: Fri, 02 Sep 2022 14:16:56 +0300
Subject: [PATCH] Обновление до версии 2.9.0

---
 QtVsTools.Core/QtMsBuild.cs |   80 +++++++++++++++++++---------------------
 1 files changed, 38 insertions(+), 42 deletions(-)

diff --git a/QtVsTools.Core/QtMsBuild.cs b/QtVsTools.Core/QtMsBuild.cs
index 45ce0b9..02a1d99 100644
--- a/QtVsTools.Core/QtMsBuild.cs
+++ b/QtVsTools.Core/QtMsBuild.cs
@@ -26,17 +26,17 @@
 **
 ****************************************************************************/
 
+using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Text;
-using System;
-using System.IO;
-
-using CommandLineParser = QtVsTools.Core.CommandLine.Parser;
-using CommandLineOption = QtVsTools.Core.CommandLine.Option;
 
 namespace QtVsTools.Core.QtMsBuild
 {
+    using CommandLineParser = CommandLine.Parser;
+    using CommandLineOption = CommandLine.Option;
+
     public interface IVSMacroExpander
     {
         string ExpandString(string stringToExpand);
@@ -84,8 +84,7 @@
 
     public class QtMsBuildContainer
     {
-
-        IPropertyStorageProvider provider;
+        readonly IPropertyStorageProvider provider;
         public QtMsBuildContainer(IPropertyStorageProvider provider)
         {
             this.provider = provider;
@@ -198,16 +197,15 @@
             return provider.GetProjectConfiguration(GetProject(), configName);
         }
 
-        Dictionary<string, ItemPropertyChange> itemPropertyChanges
+        readonly Dictionary<string, ItemPropertyChange> itemPropertyChanges
             = new Dictionary<string, ItemPropertyChange>();
-        Dictionary<string, List<ItemPropertyChange>> itemPropertyChangesGrouped
+        readonly Dictionary<string, List<ItemPropertyChange>> itemPropertyChangesGrouped
             = new Dictionary<string, List<ItemPropertyChange>>();
         bool pendingChanges = false;
 
         void AddChange(ItemPropertyChange newChange)
         {
-            ItemPropertyChange oldChange;
-            if (itemPropertyChanges.TryGetValue(newChange.Key, out oldChange)) {
+            if (itemPropertyChanges.TryGetValue(newChange.Key, out ItemPropertyChange oldChange)) {
                 if (oldChange.GroupKey == newChange.GroupKey) {
                     oldChange.CopyFrom(newChange);
                     return;
@@ -509,7 +507,8 @@
 
         #region QtRcc
         static QtRcc qtRccInstance;
-        public static QtRcc QtRccInstance
+
+        private static QtRcc QtRccInstance
         {
             get
             {
@@ -558,7 +557,8 @@
 
         #region QtRepc
         static QtRepc qtRepcInstance;
-        public static QtRepc QtRepcInstance
+
+        private static QtRepc QtRepcInstance
         {
             get
             {
@@ -607,7 +607,8 @@
 
         #region QtUic
         static QtUic qtUicInstance;
-        public static QtUic QtUicInstance
+
+        private static QtUic QtUicInstance
         {
             get
             {
@@ -658,10 +659,10 @@
 
     public abstract class QtTool
     {
-        protected CommandLineParser parser;
-        protected CommandLineOption outputOption;
-        protected CommandLineOption helpOption;
-        protected CommandLineOption versionOption;
+        protected readonly CommandLineParser parser;
+        private readonly CommandLineOption outputOption;
+        private CommandLineOption helpOption;
+        private CommandLineOption versionOption;
 
         protected QtTool(bool defaultInputOutput = true)
         {
@@ -779,7 +780,7 @@
             AdditionalDependencies,
         }
 
-        Dictionary<Property, CommandLineOption> options
+        readonly Dictionary<Property, CommandLineOption> options
             = new Dictionary<Property, CommandLineOption>();
 
         public QtMoc() : base()
@@ -881,14 +882,13 @@
         {
             properties = new Dictionary<Property, string>();
 
-            string qtDir, inputPath, outputPath;
             if (!ParseCommandLine(
                 commandLine,
                 macros,
                 ToolExecName,
-                out qtDir,
-                out inputPath,
-                out outputPath)) {
+                out string qtDir,
+                out string inputPath,
+                out string outputPath)) {
                 return false;
             }
 
@@ -1078,7 +1078,7 @@
             AdditionalDependencies,
         }
 
-        Dictionary<Property, CommandLineOption> options
+        readonly Dictionary<Property, CommandLineOption> options
             = new Dictionary<Property, CommandLineOption>();
 
         public QtRcc() : base()
@@ -1130,14 +1130,13 @@
         {
             properties = new Dictionary<Property, string>();
 
-            string qtDir, inputPath, outputPath;
             if (!ParseCommandLine(
                 commandLine,
                 macros,
                 ToolExecName,
-                out qtDir,
-                out inputPath,
-                out outputPath)) {
+                out string qtDir,
+                out string inputPath,
+                out string outputPath)) {
                 return false;
             }
 
@@ -1157,8 +1156,7 @@
                 properties[Property.Root] = parser.Value(options[Property.Root]);
 
             if (parser.IsSet(options[Property.Compression])) {
-                int level;
-                if (!int.TryParse(parser.Value(options[Property.Compression]), out level))
+                if (!int.TryParse(parser.Value(options[Property.Compression]), out int level))
                     return false;
                 if (level < 1 || 9 < level)
                     return false;
@@ -1272,7 +1270,7 @@
             PrintDebug,
         }
 
-        Dictionary<Property, CommandLineOption> options
+        readonly Dictionary<Property, CommandLineOption> options
             = new Dictionary<Property, CommandLineOption>();
 
         public QtRepc() : base(defaultInputOutput: false)
@@ -1330,14 +1328,13 @@
         {
             properties = new Dictionary<Property, string>();
 
-            string qtDir, inputPath, outputPath;
             if (!ParseCommandLine(
                 commandLine,
                 macros,
                 ToolExecName,
-                out qtDir,
-                out inputPath,
-                out outputPath)) {
+                out string qtDir,
+                out string inputPath,
+                out string outputPath)) {
                 return false;
             }
 
@@ -1385,8 +1382,8 @@
                 GenerateCommandLineOption(cmd, options[Property.InputFileType], inputType);
 
             var outputType = container.GetPropertyValue(propertyStorage, Property.OutputFileType);
-            if (!string.IsNullOrEmpty(inputType))
-                GenerateCommandLineOption(cmd, options[Property.InputFileType], inputType);
+            if (!string.IsNullOrEmpty(outputType))
+                GenerateCommandLineOption(cmd, options[Property.OutputFileType], outputType);
 
             string value = container.GetPropertyValue(propertyStorage, Property.IncludePath);
             if (!string.IsNullOrEmpty(value))
@@ -1436,7 +1433,7 @@
             AdditionalDependencies,
         }
 
-        Dictionary<Property, CommandLineOption> options
+        readonly Dictionary<Property, CommandLineOption> options
             = new Dictionary<Property, CommandLineOption>();
 
         public QtUic() : base()
@@ -1473,14 +1470,13 @@
         {
             properties = new Dictionary<Property, string>();
 
-            string qtDir, inputPath, outputPath;
             if (!ParseCommandLine(
                 commandLine,
                 macros,
                 ToolExecName,
-                out qtDir,
-                out inputPath,
-                out outputPath)) {
+                out string qtDir,
+                out string inputPath,
+                out string outputPath)) {
                 return false;
             }
 

--
Gitblit v1.9.1