Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Remove unnecessary nesting of 'if' blocks in the command line argument processing. Add comments and fixup some whitespace. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f909e1b7b15407de6a7ad30a9c3657cc |
User & Date: | mistachkin 2012-01-04 07:15:51 |
Context
2012-01-05
| ||
06:37 | Merge the VS installer integration fixes and changes to the trunk. check-in: 2db8c0b5a5 user: mistachkin tags: trunk | |
2012-01-04
| ||
09:41 | Add the VS designer components and the rewritten installer for them to the setup package. check-in: bcdca9ada5 user: mistachkin tags: VsSetupIntegration | |
07:15 | Remove unnecessary nesting of 'if' blocks in the command line argument processing. Add comments and fixup some whitespace. check-in: f909e1b7b1 user: mistachkin tags: trunk | |
05:55 | Fix an incorrect comment. check-in: 8887a9f786 user: mistachkin tags: trunk | |
Changes
Changes to tools/install/Installer.cs.
95 95 Lowest = 0x1, 96 96 Lower = 0x2, 97 97 Low = 0x4, 98 98 Medium = 0x8, 99 99 High = 0x10, 100 100 Higher = 0x20, 101 101 Highest = 0x40, 102 - Debug = Medium, 103 - Trace = Medium 102 + Debug = Medium, /* NOTE: Default for debug messages. */ 103 + Trace = Medium /* NOTE: Default for trace messages. */ 104 104 } 105 105 #endregion 106 106 107 107 /////////////////////////////////////////////////////////////////////////// 108 108 109 109 #region Installer Class 110 110 internal static class Installer ................................................................................ 386 386 public static void DebugCore( 387 387 string message, 388 388 string category 389 389 ) 390 390 { 391 391 lock (syncRoot) 392 392 { 393 +#if DEBUG 394 + // 395 + // NOTE: Write the message to all the active debug 396 + // listeners. 397 + // 398 + Debug.WriteLine(message, category); 399 + Debug.Flush(); 400 +#else 393 401 // 394 402 // NOTE: For a build without "DEBUG" defined, we cannot 395 403 // simply use the Debug class (i.e. it will do 396 404 // nothing); therefore, use the console directly 397 405 // instead. 398 406 // 399 -#if DEBUG 400 - Debug.WriteLine(message, category); 401 - Debug.Flush(); 402 -#else 403 407 Console.WriteLine(String.Format("{1}: {0}", message, 404 408 category)); 405 409 #endif 406 410 } 407 411 } 408 412 409 413 /////////////////////////////////////////////////////////////////// ................................................................................ 411 415 public static void TraceCore( 412 416 string message, 413 417 string category 414 418 ) 415 419 { 416 420 lock (syncRoot) 417 421 { 422 + // 423 + // NOTE: Write the message to all the active trace 424 + // listeners. 425 + // 418 426 Trace.WriteLine(message, category); 419 427 Trace.Flush(); 420 428 } 421 429 } 422 430 423 431 /////////////////////////////////////////////////////////////////// 424 432 ................................................................................ 490 498 // 491 499 // NOTE: If not specified, use the default debug callback. 492 500 // 493 501 if (debugCallback == null) 494 502 debugCallback = DebugCore; 495 503 496 504 // 497 - // NOTE: Write the formatted message to all the active 498 - // debug listeners. 505 + // NOTE: Invoke the debug callback with the formatted 506 + // message and the category specified by the 507 + // caller. 499 508 // 500 509 debugCallback(formatted, category); 501 510 } 502 511 503 512 // 504 513 // NOTE: If the trace priority of this message is less than 505 514 // what we currently want to trace, skip it. ................................................................................ 509 518 // 510 519 // NOTE: If not specified, use the default trace callback. 511 520 // 512 521 if (traceCallback == null) 513 522 traceCallback = TraceCore; 514 523 515 524 // 516 - // NOTE: Write the formatted message to all the active 517 - // trace listeners. 525 + // NOTE: Invoke the trace callback with the formatted 526 + // message and the category specified by the 527 + // caller. 518 528 // 519 529 traceCallback(formatted, category); 520 530 } 521 531 522 532 return message; 523 533 } 524 534 #endregion ................................................................................ 942 952 #region IDisposable "Pattern" Members 943 953 private bool disposed; 944 954 private void CheckDisposed() /* throw */ 945 955 { 946 956 if (!disposed) 947 957 return; 948 958 949 - throw new ObjectDisposedException(typeof(MockRegistryKey).Name); 959 + throw new ObjectDisposedException( 960 + typeof(MockRegistryKey).Name); 950 961 } 951 962 952 963 /////////////////////////////////////////////////////////////////// 953 964 954 965 private /* protected virtual */ void Dispose( 955 966 bool disposing 956 967 ) ................................................................................ 1088 1099 bool verbose 1089 1100 ) 1090 1101 { 1091 1102 if (rootKey == null) 1092 1103 return null; 1093 1104 1094 1105 if (verbose) 1095 - TraceOps.DebugAndTrace( 1096 - writable ? TracePriority.Highest : TracePriority.Higher, 1106 + TraceOps.DebugAndTrace(writable ? 1107 + TracePriority.Highest : TracePriority.Higher, 1097 1108 debugCallback, traceCallback, String.Format( 1098 1109 "rootKey = {0}, subKeyName = {1}, writable = {2}", 1099 1110 ForDisplay(rootKey), ForDisplay(subKeyName), 1100 1111 ForDisplay(writable)), traceCategory); 1101 1112 1102 1113 // 1103 1114 // HACK: Always forbid writable access when operating in ................................................................................ 1121 1132 { 1122 1133 if (rootKey == null) 1123 1134 return null; 1124 1135 1125 1136 if (verbose) 1126 1137 TraceOps.DebugAndTrace(TracePriority.Highest, 1127 1138 debugCallback, traceCallback, String.Format( 1128 - "rootKey = {0}, subKeyName = {1}", ForDisplay(rootKey), 1129 - ForDisplay(subKeyName)), traceCategory); 1139 + "rootKey = {0}, subKeyName = {1}", 1140 + ForDisplay(rootKey), ForDisplay(subKeyName)), 1141 + traceCategory); 1130 1142 1131 1143 try 1132 1144 { 1133 1145 // 1134 1146 // HACK: Always open a key, rather than creating one when 1135 1147 // operating in 'what-if' mode. 1136 1148 // 1137 1149 if (whatIf) 1138 1150 { 1139 1151 // 1140 1152 // HACK: Attempt to open the specified sub-key. If 1141 - // this fails, we will simply return the root key 1142 - // itself since no writes are allowed in 1153 + // this fails, we will simply return the root 1154 + // key itself since no writes are allowed in 1143 1155 // 'what-if' mode anyhow. 1144 1156 // 1145 1157 MockRegistryKey key = rootKey.OpenSubKey(subKeyName); 1146 1158 1147 1159 return (key != null) ? 1148 1160 key : new MockRegistryKey( 1149 1161 rootKey, subKeyName, true, false, false); ................................................................................ 1172 1184 { 1173 1185 if (rootKey == null) 1174 1186 return; 1175 1187 1176 1188 if (verbose) 1177 1189 TraceOps.DebugAndTrace(TracePriority.Highest, 1178 1190 debugCallback, traceCallback, String.Format( 1179 - "rootKey = {0}, subKeyName = {1}", ForDisplay(rootKey), 1180 - ForDisplay(subKeyName)), traceCategory); 1191 + "rootKey = {0}, subKeyName = {1}", 1192 + ForDisplay(rootKey), ForDisplay(subKeyName)), 1193 + traceCategory); 1181 1194 1182 1195 if (!whatIf) 1183 1196 rootKey.DeleteSubKey(subKeyName); 1184 1197 1185 1198 subKeysDeleted++; 1186 1199 } 1187 1200 ................................................................................ 1196 1209 { 1197 1210 if (rootKey == null) 1198 1211 return; 1199 1212 1200 1213 if (verbose) 1201 1214 TraceOps.DebugAndTrace(TracePriority.Highest, 1202 1215 debugCallback, traceCallback, String.Format( 1203 - "rootKey = {0}, subKeyName = {1}", ForDisplay(rootKey), 1204 - ForDisplay(subKeyName)), traceCategory); 1216 + "rootKey = {0}, subKeyName = {1}", 1217 + ForDisplay(rootKey), ForDisplay(subKeyName)), 1218 + traceCategory); 1205 1219 1206 1220 if (!whatIf) 1207 1221 rootKey.DeleteSubKeyTree(subKeyName); 1208 1222 1209 1223 subKeysDeleted++; 1210 1224 } 1211 1225 ................................................................................ 1263 1277 { 1264 1278 if (key == null) 1265 1279 return; 1266 1280 1267 1281 if (verbose) 1268 1282 TraceOps.DebugAndTrace(TracePriority.Highest, 1269 1283 debugCallback, traceCallback, String.Format( 1270 - "key = {0}, name = {1}, value = {2}", ForDisplay(key), 1271 - ForDisplay(name), ForDisplay(value)), traceCategory); 1284 + "key = {0}, name = {1}, value = {2}", 1285 + ForDisplay(key), ForDisplay(name), ForDisplay(value)), 1286 + traceCategory); 1272 1287 1273 1288 if (!whatIf) 1274 1289 key.SetValue(name, value); 1275 1290 1276 1291 keyValuesSet++; 1277 1292 } 1278 1293 ................................................................................ 1686 1701 1687 1702 int length = args.Length; 1688 1703 1689 1704 for (int index = 0; index < length; index++) 1690 1705 { 1691 1706 string arg = args[index]; 1692 1707 1708 + // 1709 + // NOTE: Skip any argument that is null (?) or an empty 1710 + // string. 1711 + // 1693 1712 if (String.IsNullOrEmpty(arg)) 1694 1713 continue; 1695 1714 1715 + // 1716 + // NOTE: We are going to modify the original argument 1717 + // by removing any leading option characters; 1718 + // therefore, we use a new string to hold the 1719 + // modified argument. 1720 + // 1696 1721 string newArg = arg; 1697 1722 1698 - if (CheckOption(ref newArg)) 1723 + // 1724 + // NOTE: All the supported command line options must 1725 + // begin with an option character (e.g. a minus 1726 + // or forward slash); attempt to validate that 1727 + // now. If we fail in strict mode, we are done; 1728 + // otherwise, just skip this argument and advance 1729 + // to the next one. 1730 + // 1731 + if (!CheckOption(ref newArg)) 1699 1732 { 1733 + error = TraceOps.DebugAndTrace( 1734 + TracePriority.Lowest, debugCallback, 1735 + traceCallback, String.Format( 1736 + "Unsupported command line argument: {0}", 1737 + ForDisplay(arg)), traceCategory); 1738 + 1739 + if (strict) 1740 + return false; 1741 + 1742 + continue; 1743 + } 1744 + 1745 + // 1746 + // NOTE: All the supported command line options must 1747 + // have a value; therefore, attempt to advance 1748 + // to it now. If we fail, we are done. 1749 + // 1750 + index++; 1751 + 1752 + if (index >= length) 1753 + { 1754 + error = TraceOps.DebugAndTrace( 1755 + TracePriority.Lowest, debugCallback, 1756 + traceCallback, String.Format( 1757 + "Missing value for option: {0}", 1758 + ForDisplay(arg)), traceCategory); 1759 + 1760 + if (strict) 1761 + return false; 1762 + 1763 + break; 1764 + } 1765 + 1766 + // 1767 + // NOTE: Grab the textual value of this command line 1768 + // option. 1769 + // 1770 + string text = args[index]; 1771 + 1772 + // 1773 + // NOTE: Figure out which command line option this is 1774 + // (based on a partial name match) and then try 1775 + // to interpret the textual value as the correct 1776 + // type. 1777 + // 1778 + if (MatchOption(newArg, "strict")) 1779 + { 1780 + bool? value = ParseBoolean(text); 1781 + 1782 + if (value == null) 1783 + { 1784 + error = TraceOps.DebugAndTrace( 1785 + TracePriority.Lowest, debugCallback, 1786 + traceCallback, String.Format( 1787 + "Invalid {0} boolean value: {1}", 1788 + ForDisplay(arg), ForDisplay(text)), 1789 + traceCategory); 1790 + 1791 + if (strict) 1792 + return false; 1793 + 1794 + continue; 1795 + } 1796 + 1797 + // 1798 + // NOTE: Allow the command line arguments to 1799 + // override the "strictness" setting 1800 + // provided by our caller. 1801 + // 1802 + strict = (bool)value; 1803 + } 1804 + else if (MatchOption(newArg, "logFileName")) 1805 + { 1806 + configuration.logFileName = text; 1807 + } 1808 + else if (MatchOption(newArg, "directory")) 1809 + { 1810 + configuration.directory = text; 1811 + 1700 1812 // 1701 - // NOTE: All the supported command line options must 1702 - // have a value; therefore, attempt to advance 1703 - // to it now. If we fail, we are done. 1813 + // NOTE: *SPECIAL* Must refresh the file names 1814 + // here because the underlying directory 1815 + // has changed. 1704 1816 // 1705 - index++; 1706 - 1707 - if (index >= length) 1817 + string coreFileName = configuration.coreFileName; 1818 + 1819 + if (!String.IsNullOrEmpty(coreFileName)) 1820 + coreFileName = Path.GetFileName(coreFileName); 1821 + 1822 + if (String.IsNullOrEmpty(coreFileName)) 1823 + coreFileName = Installer.CoreFileName; 1824 + 1825 + configuration.coreFileName = Path.Combine( 1826 + configuration.directory, coreFileName); 1827 + 1828 + string linqFileName = configuration.linqFileName; 1829 + 1830 + if (!String.IsNullOrEmpty(linqFileName)) 1831 + linqFileName = Path.GetFileName(linqFileName); 1832 + 1833 + if (String.IsNullOrEmpty(linqFileName)) 1834 + linqFileName = Installer.LinqFileName; 1835 + 1836 + configuration.linqFileName = Path.Combine( 1837 + configuration.directory, linqFileName); 1838 + 1839 + string designerFileName = configuration.designerFileName; 1840 + 1841 + if (!String.IsNullOrEmpty(designerFileName)) 1842 + designerFileName = Path.GetFileName(designerFileName); 1843 + 1844 + if (String.IsNullOrEmpty(designerFileName)) 1845 + designerFileName = Installer.DesignerFileName; 1846 + 1847 + configuration.designerFileName = Path.Combine( 1848 + configuration.directory, designerFileName); 1849 + } 1850 + else if (MatchOption(newArg, "coreFileName")) 1851 + { 1852 + configuration.coreFileName = text; 1853 + } 1854 + else if (MatchOption(newArg, "linqFileName")) 1855 + { 1856 + configuration.linqFileName = text; 1857 + } 1858 + else if (MatchOption(newArg, "designerFileName")) 1859 + { 1860 + configuration.designerFileName = text; 1861 + } 1862 + else if (MatchOption(newArg, "debugFormat")) 1863 + { 1864 + configuration.debugFormat = text; 1865 + TraceOps.DebugFormat = configuration.debugFormat; 1866 + } 1867 + else if (MatchOption(newArg, "traceFormat")) 1868 + { 1869 + configuration.traceFormat = text; 1870 + TraceOps.TraceFormat = configuration.traceFormat; 1871 + } 1872 + else if (MatchOption(newArg, "debugPriority")) 1873 + { 1874 + object value = ParseEnum( 1875 + typeof(TracePriority), text, true); 1876 + 1877 + if (value == null) 1878 + { 1879 + error = TraceOps.DebugAndTrace( 1880 + TracePriority.Lowest, debugCallback, 1881 + traceCallback, String.Format( 1882 + "Invalid {0} value: {1}", 1883 + ForDisplay(arg), ForDisplay(text)), 1884 + traceCategory); 1885 + 1886 + if (strict) 1887 + return false; 1888 + 1889 + continue; 1890 + } 1891 + 1892 + configuration.debugPriority = (TracePriority)value; 1893 + TraceOps.DebugPriority = configuration.debugPriority; 1894 + } 1895 + else if (MatchOption(newArg, "tracePriority")) 1896 + { 1897 + object value = ParseEnum( 1898 + typeof(TracePriority), text, true); 1899 + 1900 + if (value == null) 1901 + { 1902 + error = TraceOps.DebugAndTrace( 1903 + TracePriority.Lowest, debugCallback, 1904 + traceCallback, String.Format( 1905 + "Invalid {0} value: {1}", 1906 + ForDisplay(arg), ForDisplay(text)), 1907 + traceCategory); 1908 + 1909 + if (strict) 1910 + return false; 1911 + 1912 + continue; 1913 + } 1914 + 1915 + configuration.tracePriority = (TracePriority)value; 1916 + TraceOps.TracePriority = configuration.tracePriority; 1917 + } 1918 + else if (MatchOption(newArg, "install")) 1919 + { 1920 + bool? value = ParseBoolean(text); 1921 + 1922 + if (value == null) 1923 + { 1924 + error = TraceOps.DebugAndTrace( 1925 + TracePriority.Lowest, debugCallback, 1926 + traceCallback, String.Format( 1927 + "Invalid {0} boolean value: {1}", 1928 + ForDisplay(arg), ForDisplay(text)), 1929 + traceCategory); 1930 + 1931 + if (strict) 1932 + return false; 1933 + 1934 + continue; 1935 + } 1936 + 1937 + configuration.install = (bool)value; 1938 + } 1939 + else if (MatchOption(newArg, "installFlags")) 1940 + { 1941 + object value = ParseEnum( 1942 + typeof(InstallFlags), text, true); 1943 + 1944 + if (value == null) 1945 + { 1946 + error = TraceOps.DebugAndTrace( 1947 + TracePriority.Lowest, debugCallback, 1948 + traceCallback, String.Format( 1949 + "Invalid install flags value: {0}", 1950 + ForDisplay(text)), traceCategory); 1951 + 1952 + if (strict) 1953 + return false; 1954 + 1955 + continue; 1956 + } 1957 + 1958 + configuration.installFlags = (InstallFlags)value; 1959 + } 1960 + else if (MatchOption(newArg, "noRuntimeVersion")) 1961 + { 1962 + bool? value = ParseBoolean(text); 1963 + 1964 + if (value == null) 1965 + { 1966 + error = TraceOps.DebugAndTrace( 1967 + TracePriority.Lowest, debugCallback, 1968 + traceCallback, String.Format( 1969 + "Invalid {0} boolean value: {1}", 1970 + ForDisplay(arg), ForDisplay(text)), 1971 + traceCategory); 1972 + 1973 + if (strict) 1974 + return false; 1975 + 1976 + continue; 1977 + } 1978 + 1979 + configuration.noRuntimeVersion = (bool)value; 1980 + } 1981 + else if (MatchOption(newArg, "whatIf")) 1982 + { 1983 + bool? value = ParseBoolean(text); 1984 + 1985 + if (value == null) 1986 + { 1987 + error = TraceOps.DebugAndTrace( 1988 + TracePriority.Lowest, debugCallback, 1989 + traceCallback, String.Format( 1990 + "Invalid {0} boolean value: {1}", 1991 + ForDisplay(arg), ForDisplay(text)), 1992 + traceCategory); 1993 + 1994 + if (strict) 1995 + return false; 1996 + 1997 + continue; 1998 + } 1999 + 2000 + configuration.whatIf = (bool)value; 2001 + } 2002 + else if (MatchOption(newArg, "verbose")) 2003 + { 2004 + bool? value = ParseBoolean(text); 2005 + 2006 + if (value == null) 2007 + { 2008 + error = TraceOps.DebugAndTrace( 2009 + TracePriority.Lowest, debugCallback, 2010 + traceCallback, String.Format( 2011 + "Invalid {0} boolean value: {1}", 2012 + ForDisplay(arg), ForDisplay(text)), 2013 + traceCategory); 2014 + 2015 + if (strict) 2016 + return false; 2017 + 2018 + continue; 2019 + } 2020 + 2021 + configuration.verbose = (bool)value; 2022 + } 2023 + else if (MatchOption(newArg, "confirm")) 2024 + { 2025 + bool? value = ParseBoolean(text); 2026 + 2027 + if (value == null) 2028 + { 2029 + error = TraceOps.DebugAndTrace( 2030 + TracePriority.Lowest, debugCallback, 2031 + traceCallback, String.Format( 2032 + "Invalid {0} boolean value: {1}", 2033 + ForDisplay(arg), ForDisplay(text)), 2034 + traceCategory); 2035 + 2036 + if (strict) 2037 + return false; 2038 + 2039 + continue; 2040 + } 2041 + 2042 + configuration.confirm = (bool)value; 2043 + } 2044 + else if (MatchOption(newArg, "noDesktop")) 2045 + { 2046 + bool? value = ParseBoolean(text); 2047 + 2048 + if (value == null) 2049 + { 2050 + error = TraceOps.DebugAndTrace( 2051 + TracePriority.Lowest, debugCallback, 2052 + traceCallback, String.Format( 2053 + "Invalid {0} boolean value: {1}", 2054 + ForDisplay(arg), ForDisplay(text)), 2055 + traceCategory); 2056 + 2057 + if (strict) 2058 + return false; 2059 + 2060 + continue; 2061 + } 2062 + 2063 + configuration.noDesktop = (bool)value; 2064 + } 2065 + else if (MatchOption(newArg, "noCompact")) 2066 + { 2067 + bool? value = ParseBoolean(text); 2068 + 2069 + if (value == null) 2070 + { 2071 + error = TraceOps.DebugAndTrace( 2072 + TracePriority.Lowest, debugCallback, 2073 + traceCallback, String.Format( 2074 + "Invalid {0} boolean value: {1}", 2075 + ForDisplay(arg), ForDisplay(text)), 2076 + traceCategory); 2077 + 2078 + if (strict) 2079 + return false; 2080 + 2081 + continue; 2082 + } 2083 + 2084 + configuration.noCompact = (bool)value; 2085 + } 2086 + else if (MatchOption(newArg, "noNetFx20")) 2087 + { 2088 + bool? value = ParseBoolean(text); 2089 + 2090 + if (value == null) 2091 + { 2092 + error = TraceOps.DebugAndTrace( 2093 + TracePriority.Lowest, debugCallback, 2094 + traceCallback, String.Format( 2095 + "Invalid {0} boolean value: {1}", 2096 + ForDisplay(arg), ForDisplay(text)), 2097 + traceCategory); 2098 + 2099 + if (strict) 2100 + return false; 2101 + 2102 + continue; 2103 + } 2104 + 2105 + configuration.noNetFx20 = (bool)value; 2106 + } 2107 + else if (MatchOption(newArg, "noNetFx40")) 2108 + { 2109 + bool? value = ParseBoolean(text); 2110 + 2111 + if (value == null) 2112 + { 2113 + error = TraceOps.DebugAndTrace( 2114 + TracePriority.Lowest, debugCallback, 2115 + traceCallback, String.Format( 2116 + "Invalid {0} boolean value: {1}", 2117 + ForDisplay(arg), ForDisplay(text)), 2118 + traceCategory); 2119 + 2120 + if (strict) 2121 + return false; 2122 + 2123 + continue; 2124 + } 2125 + 2126 + configuration.noNetFx40 = (bool)value; 2127 + } 2128 + else if (MatchOption(newArg, "noVs2008")) 2129 + { 2130 + bool? value = ParseBoolean(text); 2131 + 2132 + if (value == null) 2133 + { 2134 + error = TraceOps.DebugAndTrace( 2135 + TracePriority.Lowest, debugCallback, 2136 + traceCallback, String.Format( 2137 + "Invalid {0} boolean value: {1}", 2138 + ForDisplay(arg), ForDisplay(text)), 2139 + traceCategory); 2140 + 2141 + if (strict) 2142 + return false; 2143 + 2144 + continue; 2145 + } 2146 + 2147 + configuration.noVs2008 = (bool)value; 2148 + } 2149 + else if (MatchOption(newArg, "noVs2010")) 2150 + { 2151 + bool? value = ParseBoolean(text); 2152 + 2153 + if (value == null) 2154 + { 2155 + error = TraceOps.DebugAndTrace( 2156 + TracePriority.Lowest, debugCallback, 2157 + traceCallback, String.Format( 2158 + "Invalid {0} boolean value: {1}", 2159 + ForDisplay(arg), ForDisplay(text)), 2160 + traceCategory); 2161 + 2162 + if (strict) 2163 + return false; 2164 + 2165 + continue; 2166 + } 2167 + 2168 + configuration.noVs2010 = (bool)value; 2169 + } 2170 + else if (MatchOption(newArg, "noTrace")) 2171 + { 2172 + bool? value = ParseBoolean(text); 2173 + 2174 + if (value == null) 2175 + { 2176 + error = TraceOps.DebugAndTrace( 2177 + TracePriority.Lowest, debugCallback, 2178 + traceCallback, String.Format( 2179 + "Invalid {0} boolean value: {1}", 2180 + ForDisplay(arg), ForDisplay(text)), 2181 + traceCategory); 2182 + 2183 + if (strict) 2184 + return false; 2185 + 2186 + continue; 2187 + } 2188 + 2189 + configuration.noTrace = (bool)value; 2190 + } 2191 + else if (MatchOption(newArg, "noConsole")) 2192 + { 2193 + bool? value = ParseBoolean(text); 2194 + 2195 + if (value == null) 1708 2196 { 1709 2197 error = TraceOps.DebugAndTrace( 1710 2198 TracePriority.Lowest, debugCallback, 1711 2199 traceCallback, String.Format( 1712 - "Missing value for option: {0}", 1713 - ForDisplay(arg)), traceCategory); 2200 + "Invalid {0} boolean value: {1}", 2201 + ForDisplay(arg), ForDisplay(text)), 2202 + traceCategory); 1714 2203 1715 2204 if (strict) 1716 2205 return false; 1717 2206 1718 - break; 2207 + continue; 1719 2208 } 1720 2209 1721 - // 1722 - // NOTE: Grab the textual value of this command line 1723 - // option. 1724 - // 1725 - string text = args[index]; 1726 - 1727 - // 1728 - // NOTE: Figure out which command line option this is 1729 - // (based on a partial name match) and then try 1730 - // to interpret the textual value as the correct 1731 - // type. 1732 - // 1733 - if (MatchOption(newArg, "strict")) 1734 - { 1735 - bool? value = ParseBoolean(text); 1736 - 1737 - if (value == null) 1738 - { 1739 - error = TraceOps.DebugAndTrace( 1740 - TracePriority.Lowest, debugCallback, 1741 - traceCallback, String.Format( 1742 - "Invalid {0} boolean value: {1}", 1743 - ForDisplay(arg), ForDisplay(text)), 1744 - traceCategory); 1745 - 1746 - if (strict) 1747 - return false; 1748 - 1749 - continue; 1750 - } 1751 - 1752 - // 1753 - // NOTE: Allow the command line arguments to override 1754 - // the "strictness" setting provided by our caller. 1755 - // 1756 - strict = (bool)value; 1757 - } 1758 - else if (MatchOption(newArg, "logFileName")) 1759 - { 1760 - configuration.logFileName = text; 1761 - } 1762 - else if (MatchOption(newArg, "directory")) 1763 - { 1764 - configuration.directory = text; 1765 - 1766 - // 1767 - // NOTE: *SPECIAL* Must refresh the file names 1768 - // here because the underlying directory 1769 - // has changed. 1770 - // 1771 - string coreFileName = configuration.coreFileName; 1772 - 1773 - if (!String.IsNullOrEmpty(coreFileName)) 1774 - coreFileName = Path.GetFileName(coreFileName); 1775 - 1776 - if (String.IsNullOrEmpty(coreFileName)) 1777 - coreFileName = Installer.CoreFileName; 1778 - 1779 - configuration.coreFileName = Path.Combine( 1780 - configuration.directory, coreFileName); 1781 - 1782 - string linqFileName = configuration.linqFileName; 1783 - 1784 - if (!String.IsNullOrEmpty(linqFileName)) 1785 - linqFileName = Path.GetFileName(linqFileName); 1786 - 1787 - if (String.IsNullOrEmpty(linqFileName)) 1788 - linqFileName = Installer.LinqFileName; 1789 - 1790 - configuration.linqFileName = Path.Combine( 1791 - configuration.directory, linqFileName); 1792 - 1793 - string designerFileName = configuration.designerFileName; 1794 - 1795 - if (!String.IsNullOrEmpty(designerFileName)) 1796 - designerFileName = Path.GetFileName(designerFileName); 1797 - 1798 - if (String.IsNullOrEmpty(designerFileName)) 1799 - designerFileName = Installer.DesignerFileName; 1800 - 1801 - configuration.designerFileName = Path.Combine( 1802 - configuration.directory, designerFileName); 1803 - } 1804 - else if (MatchOption(newArg, "coreFileName")) 1805 - { 1806 - configuration.coreFileName = text; 1807 - } 1808 - else if (MatchOption(newArg, "linqFileName")) 1809 - { 1810 - configuration.linqFileName = text; 1811 - } 1812 - else if (MatchOption(newArg, "designerFileName")) 1813 - { 1814 - configuration.designerFileName = text; 1815 - } 1816 - else if (MatchOption(newArg, "debugFormat")) 1817 - { 1818 - configuration.debugFormat = text; 1819 - TraceOps.DebugFormat = configuration.debugFormat; 1820 - } 1821 - else if (MatchOption(newArg, "traceFormat")) 1822 - { 1823 - configuration.traceFormat = text; 1824 - TraceOps.TraceFormat = configuration.traceFormat; 1825 - } 1826 - else if (MatchOption(newArg, "debugPriority")) 1827 - { 1828 - object value = ParseEnum( 1829 - typeof(TracePriority), text, true); 1830 - 1831 - if (value == null) 1832 - { 1833 - error = TraceOps.DebugAndTrace( 1834 - TracePriority.Lowest, debugCallback, 1835 - traceCallback, String.Format( 1836 - "Invalid {0} value: {1}", 1837 - ForDisplay(arg), ForDisplay(text)), 1838 - traceCategory); 1839 - 1840 - if (strict) 1841 - return false; 1842 - 1843 - continue; 1844 - } 1845 - 1846 - configuration.debugPriority = (TracePriority)value; 1847 - TraceOps.DebugPriority = configuration.debugPriority; 1848 - } 1849 - else if (MatchOption(newArg, "tracePriority")) 1850 - { 1851 - object value = ParseEnum( 1852 - typeof(TracePriority), text, true); 1853 - 1854 - if (value == null) 1855 - { 1856 - error = TraceOps.DebugAndTrace( 1857 - TracePriority.Lowest, debugCallback, 1858 - traceCallback, String.Format( 1859 - "Invalid {0} value: {1}", 1860 - ForDisplay(arg), ForDisplay(text)), 1861 - traceCategory); 1862 - 1863 - if (strict) 1864 - return false; 1865 - 1866 - continue; 1867 - } 1868 - 1869 - configuration.tracePriority = (TracePriority)value; 1870 - TraceOps.TracePriority = configuration.tracePriority; 1871 - } 1872 - else if (MatchOption(newArg, "install")) 1873 - { 1874 - bool? value = ParseBoolean(text); 1875 - 1876 - if (value == null) 1877 - { 1878 - error = TraceOps.DebugAndTrace( 1879 - TracePriority.Lowest, debugCallback, 1880 - traceCallback, String.Format( 1881 - "Invalid {0} boolean value: {1}", 1882 - ForDisplay(arg), ForDisplay(text)), 1883 - traceCategory); 1884 - 1885 - if (strict) 1886 - return false; 1887 - 1888 - continue; 1889 - } 1890 - 1891 - configuration.install = (bool)value; 1892 - } 1893 - else if (MatchOption(newArg, "installFlags")) 1894 - { 1895 - object value = ParseEnum( 1896 - typeof(InstallFlags), text, true); 1897 - 1898 - if (value == null) 1899 - { 1900 - error = TraceOps.DebugAndTrace( 1901 - TracePriority.Lowest, debugCallback, 1902 - traceCallback, String.Format( 1903 - "Invalid install flags value: {0}", 1904 - ForDisplay(text)), traceCategory); 1905 - 1906 - if (strict) 1907 - return false; 1908 - 1909 - continue; 1910 - } 1911 - 1912 - configuration.installFlags = (InstallFlags)value; 1913 - } 1914 - else if (MatchOption(newArg, "noRuntimeVersion")) 1915 - { 1916 - bool? value = ParseBoolean(text); 1917 - 1918 - if (value == null) 1919 - { 1920 - error = TraceOps.DebugAndTrace( 1921 - TracePriority.Lowest, debugCallback, 1922 - traceCallback, String.Format( 1923 - "Invalid {0} boolean value: {1}", 1924 - ForDisplay(arg), ForDisplay(text)), 1925 - traceCategory); 1926 - 1927 - if (strict) 1928 - return false; 1929 - 1930 - continue; 1931 - } 1932 - 1933 - configuration.noRuntimeVersion = (bool)value; 1934 - } 1935 - else if (MatchOption(newArg, "whatIf")) 1936 - { 1937 - bool? value = ParseBoolean(text); 1938 - 1939 - if (value == null) 1940 - { 1941 - error = TraceOps.DebugAndTrace( 1942 - TracePriority.Lowest, debugCallback, 1943 - traceCallback, String.Format( 1944 - "Invalid {0} boolean value: {1}", 1945 - ForDisplay(arg), ForDisplay(text)), 1946 - traceCategory); 1947 - 1948 - if (strict) 1949 - return false; 1950 - 1951 - continue; 1952 - } 1953 - 1954 - configuration.whatIf = (bool)value; 1955 - } 1956 - else if (MatchOption(newArg, "verbose")) 1957 - { 1958 - bool? value = ParseBoolean(text); 1959 - 1960 - if (value == null) 1961 - { 1962 - error = TraceOps.DebugAndTrace( 1963 - TracePriority.Lowest, debugCallback, 1964 - traceCallback, String.Format( 1965 - "Invalid {0} boolean value: {1}", 1966 - ForDisplay(arg), ForDisplay(text)), 1967 - traceCategory); 1968 - 1969 - if (strict) 1970 - return false; 1971 - 1972 - continue; 1973 - } 1974 - 1975 - configuration.verbose = (bool)value; 1976 - } 1977 - else if (MatchOption(newArg, "confirm")) 1978 - { 1979 - bool? value = ParseBoolean(text); 1980 - 1981 - if (value == null) 1982 - { 1983 - error = TraceOps.DebugAndTrace( 1984 - TracePriority.Lowest, debugCallback, 1985 - traceCallback, String.Format( 1986 - "Invalid {0} boolean value: {1}", 1987 - ForDisplay(arg), ForDisplay(text)), 1988 - traceCategory); 1989 - 1990 - if (strict) 1991 - return false; 1992 - 1993 - continue; 1994 - } 1995 - 1996 - configuration.confirm = (bool)value; 1997 - } 1998 - else if (MatchOption(newArg, "noDesktop")) 1999 - { 2000 - bool? value = ParseBoolean(text); 2001 - 2002 - if (value == null) 2003 - { 2004 - error = TraceOps.DebugAndTrace( 2005 - TracePriority.Lowest, debugCallback, 2006 - traceCallback, String.Format( 2007 - "Invalid {0} boolean value: {1}", 2008 - ForDisplay(arg), ForDisplay(text)), 2009 - traceCategory); 2010 - 2011 - if (strict) 2012 - return false; 2013 - 2014 - continue; 2015 - } 2016 - 2017 - configuration.noDesktop = (bool)value; 2018 - } 2019 - else if (MatchOption(newArg, "noCompact")) 2020 - { 2021 - bool? value = ParseBoolean(text); 2022 - 2023 - if (value == null) 2024 - { 2025 - error = TraceOps.DebugAndTrace( 2026 - TracePriority.Lowest, debugCallback, 2027 - traceCallback, String.Format( 2028 - "Invalid {0} boolean value: {1}", 2029 - ForDisplay(arg), ForDisplay(text)), 2030 - traceCategory); 2031 - 2032 - if (strict) 2033 - return false; 2034 - 2035 - continue; 2036 - } 2037 - 2038 - configuration.noCompact = (bool)value; 2039 - } 2040 - else if (MatchOption(newArg, "noNetFx20")) 2041 - { 2042 - bool? value = ParseBoolean(text); 2043 - 2044 - if (value == null) 2045 - { 2046 - error = TraceOps.DebugAndTrace( 2047 - TracePriority.Lowest, debugCallback, 2048 - traceCallback, String.Format( 2049 - "Invalid {0} boolean value: {1}", 2050 - ForDisplay(arg), ForDisplay(text)), 2051 - traceCategory); 2052 - 2053 - if (strict) 2054 - return false; 2055 - 2056 - continue; 2057 - } 2058 - 2059 - configuration.noNetFx20 = (bool)value; 2060 - } 2061 - else if (MatchOption(newArg, "noNetFx40")) 2062 - { 2063 - bool? value = ParseBoolean(text); 2064 - 2065 - if (value == null) 2066 - { 2067 - error = TraceOps.DebugAndTrace( 2068 - TracePriority.Lowest, debugCallback, 2069 - traceCallback, String.Format( 2070 - "Invalid {0} boolean value: {1}", 2071 - ForDisplay(arg), ForDisplay(text)), 2072 - traceCategory); 2073 - 2074 - if (strict) 2075 - return false; 2076 - 2077 - continue; 2078 - } 2079 - 2080 - configuration.noNetFx40 = (bool)value; 2081 - } 2082 - else if (MatchOption(newArg, "noVs2008")) 2083 - { 2084 - bool? value = ParseBoolean(text); 2085 - 2086 - if (value == null) 2087 - { 2088 - error = TraceOps.DebugAndTrace( 2089 - TracePriority.Lowest, debugCallback, 2090 - traceCallback, String.Format( 2091 - "Invalid {0} boolean value: {1}", 2092 - ForDisplay(arg), ForDisplay(text)), 2093 - traceCategory); 2094 - 2095 - if (strict) 2096 - return false; 2097 - 2098 - continue; 2099 - } 2100 - 2101 - configuration.noVs2008 = (bool)value; 2102 - } 2103 - else if (MatchOption(newArg, "noVs2010")) 2104 - { 2105 - bool? value = ParseBoolean(text); 2106 - 2107 - if (value == null) 2108 - { 2109 - error = TraceOps.DebugAndTrace( 2110 - TracePriority.Lowest, debugCallback, 2111 - traceCallback, String.Format( 2112 - "Invalid {0} boolean value: {1}", 2113 - ForDisplay(arg), ForDisplay(text)), 2114 - traceCategory); 2115 - 2116 - if (strict) 2117 - return false; 2118 - 2119 - continue; 2120 - } 2121 - 2122 - configuration.noVs2010 = (bool)value; 2123 - } 2124 - else if (MatchOption(newArg, "noTrace")) 2125 - { 2126 - bool? value = ParseBoolean(text); 2127 - 2128 - if (value == null) 2129 - { 2130 - error = TraceOps.DebugAndTrace( 2131 - TracePriority.Lowest, debugCallback, 2132 - traceCallback, String.Format( 2133 - "Invalid {0} boolean value: {1}", 2134 - ForDisplay(arg), ForDisplay(text)), 2135 - traceCategory); 2136 - 2137 - if (strict) 2138 - return false; 2139 - 2140 - continue; 2141 - } 2142 - 2143 - configuration.noTrace = (bool)value; 2144 - } 2145 - else if (MatchOption(newArg, "noConsole")) 2146 - { 2147 - bool? value = ParseBoolean(text); 2148 - 2149 - if (value == null) 2150 - { 2151 - error = TraceOps.DebugAndTrace( 2152 - TracePriority.Lowest, debugCallback, 2153 - traceCallback, String.Format( 2154 - "Invalid {0} boolean value: {1}", 2155 - ForDisplay(arg), ForDisplay(text)), 2156 - traceCategory); 2157 - 2158 - if (strict) 2159 - return false; 2160 - 2161 - continue; 2162 - } 2163 - 2164 - configuration.noConsole = (bool)value; 2165 - } 2166 - else if (MatchOption(newArg, "noLog")) 2167 - { 2168 - bool? value = ParseBoolean(text); 2169 - 2170 - if (value == null) 2171 - { 2172 - error = TraceOps.DebugAndTrace( 2173 - TracePriority.Lowest, debugCallback, 2174 - traceCallback, String.Format( 2175 - "Invalid {0} boolean value: {1}", 2176 - ForDisplay(arg), ForDisplay(text)), 2177 - traceCategory); 2178 - 2179 - if (strict) 2180 - return false; 2181 - 2182 - continue; 2183 - } 2184 - 2185 - configuration.noLog = (bool)value; 2186 - } 2187 - else 2210 + configuration.noConsole = (bool)value; 2211 + } 2212 + else if (MatchOption(newArg, "noLog")) 2213 + { 2214 + bool? value = ParseBoolean(text); 2215 + 2216 + if (value == null) 2188 2217 { 2189 2218 error = TraceOps.DebugAndTrace( 2190 2219 TracePriority.Lowest, debugCallback, 2191 2220 traceCallback, String.Format( 2192 - "Unsupported command line option: {0}", 2193 - ForDisplay(arg)), traceCategory); 2221 + "Invalid {0} boolean value: {1}", 2222 + ForDisplay(arg), ForDisplay(text)), 2223 + traceCategory); 2194 2224 2195 2225 if (strict) 2196 2226 return false; 2227 + 2228 + continue; 2197 2229 } 2230 + 2231 + configuration.noLog = (bool)value; 2198 2232 } 2199 2233 else 2200 2234 { 2201 2235 error = TraceOps.DebugAndTrace( 2202 2236 TracePriority.Lowest, debugCallback, 2203 2237 traceCallback, String.Format( 2204 - "Unsupported command line argument: {0}", 2238 + "Unsupported command line option: {0}", 2205 2239 ForDisplay(arg)), traceCategory); 2206 2240 2207 2241 if (strict) 2208 2242 return false; 2209 2243 } 2210 2244 } 2211 2245 ................................................................................ 4943 4977 if (!Configuration.FromArgs( 4944 4978 args, true, ref configuration, ref error) || 4945 4979 !Configuration.Process( 4946 4980 args, configuration, true, ref error) || 4947 4981 !Configuration.CheckRuntimeVersion( 4948 4982 configuration, true, ref error)) 4949 4983 { 4950 - TraceOps.ShowMessage( 4951 - TracePriority.Highest, debugCallback, traceCallback, 4952 - thisAssembly, error, traceCategory, 4953 - MessageBoxButtons.OK, MessageBoxIcon.Error); 4984 + TraceOps.ShowMessage(TracePriority.Highest, 4985 + debugCallback, traceCallback, thisAssembly, 4986 + error, traceCategory, MessageBoxButtons.OK, 4987 + MessageBoxIcon.Error); 4954 4988 4955 4989 return 1; /* FAILURE */ 4956 4990 } 4957 4991 #endregion 4958 4992 4959 4993 /////////////////////////////////////////////////////////////////// 4960 4994