System.Data.SQLite
Check-in [297b44b1ef]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Enhance the design-time components installer to support creating a log file of all registry write operations.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 297b44b1efd98e05b43f43a516392e724a6a02d5
User & Date: mistachkin 2017-12-06 22:38:29
Context
2017-12-06
22:47
Coding style improvements to the design-time components installer. check-in: 9e4a7c8f46 user: mistachkin tags: trunk
22:38
Enhance the design-time components installer to support creating a log file of all registry write operations. check-in: 297b44b1ef user: mistachkin tags: trunk
22:32
Fix typo. Fix RegistryKey lifetime issue. Cleanup output format and improve code. Closed-Leaf check-in: a5dd05dc21 user: mistachkin tags: designTimeInstaller
2017-12-04
18:01
Minor corrections to test suite infrastructure. check-in: 8314652c94 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tools/install/Installer.cs.

485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
...
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
...
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
....
1184
1185
1186
1187
1188
1189
1190









1191
1192
1193
1194
1195
1196
1197
....
1421
1422
1423
1424
1425
1426
1427








1428
1429
1430
1431
1432
1433
1434
....
1462
1463
1464
1465
1466
1467
1468




















































































































































































































1469
1470
1471
1472
1473
1474
1475
....
1507
1508
1509
1510
1511
1512
1513

1514

1515
1516
1517
1518
1519
1520
1521
....
1602
1603
1604
1605
1606
1607
1608
















1609
1610
1611
1612
1613
1614
1615
....
1661
1662
1663
1664
1665
1666
1667





















1668
1669
1670
1671
1672
1673
1674
....
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
....
1935
1936
1937
1938
1939
1940
1941


1942
1943
1944
1945
1946
1947
1948
....
1965
1966
1967
1968
1969
1970
1971


1972
1973
1974
1975
1976
1977
1978
....
1992
1993
1994
1995
1996
1997
1998


1999
2000
2001
2002
2003
2004
2005
....
2074
2075
2076
2077
2078
2079
2080


2081
2082
2083
2084
2085
2086
2087
....
2102
2103
2104
2105
2106
2107
2108


2109
2110




































































































































































































































































































































































































































































2111
2112
2113
2114
2115
2116
2117
....
2330
2331
2332
2333
2334
2335
2336

2337
2338
2339
2340
2341
2342
2343
....
2380
2381
2382
2383
2384
2385
2386

2387
2388
2389
2390
2391
2392
2393
....
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
....
3470
3471
3472
3473
3474
3475
3476




3477
3478
3479
3480
3481
3482
3483
....
3783
3784
3785
3786
3787
3788
3789



















3790
3791
3792
3793
3794
3795
3796
....
4318
4319
4320
4321
4322
4323
4324





4325
4326
4327
4328
4329
4330
4331
....
4663
4664
4665
4666
4667
4668
4669









4670
4671
4672
4673
4674
4675
4676
....
5455
5456
5457
5458
5459
5460
5461






5462
5463
5464
5465
5466
5467
5468
....
8362
8363
8364
8365
8366
8367
8368














8369
8370
8371
8372
8373
8374
8375
            {
                return dateTime.ToString(Iso8601DateTimeOutputFormat);
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            private static string GetMethodName(
                StackTrace stackTrace,
                int level
                )
            {
                try
                {
                    //
................................................................................
            ///////////////////////////////////////////////////////////////////

            public static void DebugCore(
                string message,
                string category
                )
            {
                lock (syncRoot)
                {
                    if (debugListeners != null)
                    {
                        foreach (TraceListener listener in debugListeners)
                        {
                            listener.WriteLine(message, category);
                            listener.Flush();
................................................................................
            ///////////////////////////////////////////////////////////////////

            public static void TraceCore(
                string message,
                string category
                )
            {
                lock (syncRoot)
                {
                    //
                    // NOTE: Write the message to all the active trace
                    //       listeners.
                    //
                    Trace.WriteLine(message, category);
                    Trace.Flush();
................................................................................
                //       should be just like calling Dispose.
                //
                Dispose(true);
            }

            ///////////////////////////////////////////////////////////////////










            public MockRegistryKey CreateSubKey(
                string subKeyName
                )
            {
                CheckDisposed();
                CheckReadOnly();

................................................................................
            ///////////////////////////////////////////////////////////////////

            public bool safe;
            public bool Safe
            {
                get { CheckDisposed(); return safe; }
            }








            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Methods
            private void CheckReadOnly()
            {
................................................................................
            public override string ToString()
            {
                CheckDisposed();

                return this.Name;
            }
            #endregion





















































































































































































































            ///////////////////////////////////////////////////////////////////

            #region Implicit Conversion Operators
            //
            // BUGBUG: Remove me?  This should be safe because in "what-if"
            //         mode all keys are opened read-only.
................................................................................
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (key != null)
                        {

                            key.Close();

                            key = null;
                        }
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
................................................................................
        };
        #endregion

        ///////////////////////////////////////////////////////////////////////

        private static class RegistryHelper
        {
















            #region Public Static Properties
            private static MockRegistry readOnlyRegistry;
            public static MockRegistry ReadOnlyRegistry
            {
                get { return readOnlyRegistry; }
            }

................................................................................
                get { return keyValuesDeleted; }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Static Methods





















            public static void ReinitializeDefaultRegistries(
                bool whatIf,
                bool safe
                )
            {
                if (readOnlyRegistry != null)
                {
................................................................................
                MockRegistry registry,
                string name
                )
            {
                if (registry == null)
                    return null;

                if (String.Equals(
                        name, RegistryRootKeyNames.HKEY_CLASSES_ROOT,
                        StringComparison.OrdinalIgnoreCase) ||
                    String.Equals(
                        name, RegistryRootKeyNames.HKCR,
                        StringComparison.OrdinalIgnoreCase))
                {
                    return registry.ClassesRoot;
                }
                else if (String.Equals(
                        name, RegistryRootKeyNames.HKEY_CURRENT_CONFIG,
                        StringComparison.OrdinalIgnoreCase) ||
                    String.Equals(
                        name, RegistryRootKeyNames.HKCC,
                        StringComparison.OrdinalIgnoreCase))
                {
                    return registry.CurrentConfig;
                }
                else if (String.Equals(
                        name, RegistryRootKeyNames.HKEY_CURRENT_USER,
                        StringComparison.OrdinalIgnoreCase) ||
                    String.Equals(
                        name, RegistryRootKeyNames.HKCU,
                        StringComparison.OrdinalIgnoreCase))
                {
                    return registry.CurrentUser;
                }
                else if (String.Equals(
                        name, RegistryRootKeyNames.HKEY_DYN_DATA,
                        StringComparison.OrdinalIgnoreCase) ||
                    String.Equals(
                        name, RegistryRootKeyNames.HKDD,
                        StringComparison.OrdinalIgnoreCase))
                {
                    return registry.DynData;
                }
                else if (String.Equals(
                        name, RegistryRootKeyNames.HKEY_LOCAL_MACHINE,
                        StringComparison.OrdinalIgnoreCase) ||
                    String.Equals(
                        name, RegistryRootKeyNames.HKLM,
                        StringComparison.OrdinalIgnoreCase))
                {
                    return registry.LocalMachine;
                }
                else if (String.Equals(
                        name, RegistryRootKeyNames.HKEY_PERFORMANCE_DATA,
                        StringComparison.OrdinalIgnoreCase) ||
                    String.Equals(
                        name, RegistryRootKeyNames.HKPD,
                        StringComparison.OrdinalIgnoreCase))
                {
                    return registry.PerformanceData;
                }
                else if (String.Equals(
                        name, RegistryRootKeyNames.HKEY_USERS,
                        StringComparison.OrdinalIgnoreCase) ||
                    String.Equals(
                        name, RegistryRootKeyNames.HKU,
                        StringComparison.OrdinalIgnoreCase))
                {
                    return registry.Users;
                }

                return null;
            }

................................................................................
                        return new MockRegistryKey(
                            rootKey.CreateSubKey(subKeyName), whatIf, false,
                            false);
                    }
                }
                finally
                {


                    subKeysCreated++;
                }
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
................................................................................

                if (rootKey == null)
                    return;

                if (!whatIf)
                    rootKey.DeleteSubKey(subKeyName, throwOnMissing);



                subKeysDeleted++;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static void DeleteSubKeyTree(
................................................................................
                }

                if (rootKey == null)
                    return;

                if (!whatIf)
                    rootKey.DeleteSubKeyTree(subKeyName);



                subKeysDeleted++;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
................................................................................

                if (key == null)
                    return;

                if (!whatIf)
                    key.SetValue(name, value);



                keyValuesWritten++;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static void DeleteValue(
................................................................................

                if (key == null)
                    return;

                if (!whatIf)
                    key.DeleteValue(name, throwOnMissing);



                keyValuesDeleted++;
            }




































































































































































































































































































































































































































































            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region StringList Class
................................................................................

            ///////////////////////////////////////////////////////////////////

            #region Private Constructors
            private Configuration(
                Assembly assembly,
                string logFileName,

                string directory,
                string coreFileName,
                string linqFileName,
                string ef6FileName,
                string designerFileName,
                string registryVersion,
                string configVersion,
................................................................................
                bool debug,
                bool verbose,
                bool confirm
                )
            {
                this.assembly = assembly;
                this.logFileName = logFileName;

                this.directory = directory;
                this.coreFileName = coreFileName;
                this.linqFileName = linqFileName;
                this.ef6FileName = ef6FileName;
                this.designerFileName = designerFileName;
                this.registryVersion = registryVersion;
                this.configVersion = configVersion;
................................................................................
                string designerFileName = null;

                GetDefaultFileNames(
                    ref directory, ref coreFileName, ref linqFileName,
                    ref ef6FileName, ref designerFileName);

                return new Configuration(
                    thisAssembly, null, directory, coreFileName, linqFileName,
                    ef6FileName, designerFileName, null, null, null,
                    TraceOps.DebugFormat, TraceOps.TraceFormat,
                    InstallFlags.Default, ProviderFlags.Default,
                    TracePriority.Default, TracePriority.Default, false, true,
                    false, false, false, false, false, false, false, false,
                    false, false, false, false, false, false, false, false,
                    false, false, false, false, false, false, false, false,
                    false, true, true, false, false, false);
            }
................................................................................
                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.providerFlags = (ProviderFlags)value;




                        }
                        else if (MatchOption(newArg, "registryVersion"))
                        {
                            configuration.registryVersion = text;
                        }
                        else if (MatchOption(newArg, "strict"))
                        {
................................................................................
                    {
                        TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                            debugCallback, traceCallback,
                            "No actual changes will be made to this " +
                            "system because \"what-if\" mode is enabled.",
                            traceCategory);
                    }




















                    //
                    // NOTE: If the command line has not been manually
                    //       confirmed (i.e. via the explicit command line
                    //       option), then stop processing now.  We enforce
                    //       this rule so that simply double-clicking the
                    //       executable will not result in any changes being
................................................................................
                    traceCallback(String.Format(NameAndValueFormat,
                        "Assembly", ForDisplay(assembly)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "LogFileName", ForDisplay(logFileName)),
                        traceCategory);






                    traceCallback(String.Format(NameAndValueFormat,
                        "Directory", ForDisplay(directory)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "CoreFileName", ForDisplay(coreFileName)),
................................................................................

            private string logFileName;
            public string LogFileName
            {
                get { return logFileName; }
                set { logFileName = value; }
            }










            ///////////////////////////////////////////////////////////////////

            private string directory;
            public string Directory
            {
                get { return directory; }
................................................................................
            }
            else if (type == typeof(DataReceivedEventArgs))
            {
                DataReceivedEventArgs eventArgs = (DataReceivedEventArgs)value;

                result = ForDisplay(eventArgs.Data); /* RECURSIVE */
            }






            else
            {
                result = value.ToString();

                if (result.Length == 0)
                    return "<empty>";

................................................................................
                    TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                        debugCallback, traceCallback, String.Format(
                        "filesCreated = {0}, filesModified = {1}, " +
                        "filesDeleted = {2}", ForDisplay(filesCreated),
                        ForDisplay(filesModified), ForDisplay(filesDeleted)),
                        traceCategory);
                    #endregion















                    ///////////////////////////////////////////////////////////

                    TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                        debugCallback, traceCallback, "Success.",
                        traceCategory);








|







 







|







 







|







 







>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
|
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|
|
<
|
<



|
|
|
<
|
<



|
|
|
<
|
<



|
|
|
<
|
<



|
|
|
<
|
<



|
|
|
<
|
<



|
|
|
<
|
<







 







>
>







 







>
>







 







>
>







 







>
>







 







>
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>







 







>







 







|
|
|







 







>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>







 







>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>







485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
...
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
...
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
....
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
....
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
....
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
....
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
....
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
....
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
....
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987

1988

1989
1990
1991
1992
1993
1994

1995

1996
1997
1998
1999
2000
2001

2002

2003
2004
2005
2006
2007
2008

2009

2010
2011
2012
2013
2014
2015

2016

2017
2018
2019
2020
2021
2022

2023

2024
2025
2026
2027
2028
2029

2030

2031
2032
2033
2034
2035
2036
2037
....
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
....
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
....
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
....
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
....
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
....
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
....
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
....
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
....
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
....
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
....
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
....
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
....
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
....
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
            {
                return dateTime.ToString(Iso8601DateTimeOutputFormat);
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static string GetMethodName(
                StackTrace stackTrace,
                int level
                )
            {
                try
                {
                    //
................................................................................
            ///////////////////////////////////////////////////////////////////

            public static void DebugCore(
                string message,
                string category
                )
            {
                lock (syncRoot) /* TRANSACTIONAL */
                {
                    if (debugListeners != null)
                    {
                        foreach (TraceListener listener in debugListeners)
                        {
                            listener.WriteLine(message, category);
                            listener.Flush();
................................................................................
            ///////////////////////////////////////////////////////////////////

            public static void TraceCore(
                string message,
                string category
                )
            {
                lock (syncRoot) /* TRANSACTIONAL */
                {
                    //
                    // NOTE: Write the message to all the active trace
                    //       listeners.
                    //
                    Trace.WriteLine(message, category);
                    Trace.Flush();
................................................................................
                //       should be just like calling Dispose.
                //
                Dispose(true);
            }

            ///////////////////////////////////////////////////////////////////

            public void DisableClose()
            {
                CheckDisposed();

                noClose = true;
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistryKey CreateSubKey(
                string subKeyName
                )
            {
                CheckDisposed();
                CheckReadOnly();

................................................................................
            ///////////////////////////////////////////////////////////////////

            public bool safe;
            public bool Safe
            {
                get { CheckDisposed(); return safe; }
            }

            ///////////////////////////////////////////////////////////////////

            public bool noClose;
            public bool NoClose
            {
                get { CheckDisposed(); return noClose; }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Methods
            private void CheckReadOnly()
            {
................................................................................
            public override string ToString()
            {
                CheckDisposed();

                return this.Name;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Static Methods
            public static bool NameEquals(
                string name1,
                string name2
                )
            {
                return String.Equals(
                    name1, name2, StringComparison.OrdinalIgnoreCase);
            }

            ///////////////////////////////////////////////////////////////////

            public static bool ValueEquals(
                object value1,
                object value2
                )
            {
                if ((value1 == null) || (value2 == null))
                    return ((value1 == null) && (value2 == null));

                if (Object.ReferenceEquals(value1, value2))
                    return true;

                Type type1 = value1.GetType();
                Type type2 = value2.GetType();

                if (!Object.ReferenceEquals(type1, type2))
                    return false;

                if (type1 == typeof(int)) // DWord
                {
                    return ((int)value1 == (int)value2);
                }
                else if (type1 == typeof(long)) // QWord
                {
                    return ((long)value1 == (long)value2);
                }
                else if (type1 == typeof(string)) // String / ExpandString
                {
                    return String.Equals(
                        (string)value1, (string)value2,
                        StringComparison.Ordinal);
                }
                else if (type1 == typeof(string[])) // MultiString
                {
                    string[] array1 = (string[])value1;
                    string[] array2 = (string[])value2;

                    int length1 = array1.Length;

                    if (length1 != array2.Length)
                        return false;

                    for (int index1 = 0; index1 < length1; index1++)
                    {
                        if (!String.Equals(
                                array1[index1], array2[index1],
                                StringComparison.Ordinal))
                        {
                            return false;
                        }
                    }

                    return true;
                }
                else if (type1 == typeof(byte[])) // Binary
                {
                    byte[] array1 = (byte[])value1;
                    byte[] array2 = (byte[])value2;

                    int length1 = array1.Length;

                    if (length1 != array2.Length)
                        return false;

                    for (int index1 = 0; index1 < length1; index1++)
                        if (array1[index1] != array2[index1])
                            return false;

                    return true;
                }

                return false;
            }

            ///////////////////////////////////////////////////////////////////

            public static int ValueHashCode(
                object value
                )
            {
                int result = 0;

                if (value != null)
                {
                    Type type = value.GetType();

                    if ((type == typeof(int)) || // DWord
                        (type == typeof(long)) || // QWord
                        (type == typeof(string))) // String / ExpandString
                    {
                        result = value.GetHashCode();
                    }
                    else if ((type == typeof(string[])) || // MultiString
                        (type == typeof(byte[]))) // Binary
                    {
                        Array array = (Array)value;
                        int length = array.Length;

                        for (int index = 0; index < length; index++)
                        {
                            object element = array.GetValue(index);

                            if (element == null)
                                continue;

                            result ^= element.GetHashCode();
                        }
                    }
                }

                return result;
            }

            ///////////////////////////////////////////////////////////////////

            public static string ValueToString(
                object value,
                string delimiter,
                string nullValue
                )
            {
                string result = null;

                if (value != null)
                {
                    Type type = value.GetType();

                    if ((type == typeof(int)) || // DWord
                        (type == typeof(long)) || // QWord
                        (type == typeof(string))) // String / ExpandString
                    {
                        result = value.ToString();
                    }
                    else if ((type == typeof(string[])) || // MultiString
                        (type == typeof(byte[]))) // Binary
                    {
                        StringBuilder builder = new StringBuilder();
                        Array array = (Array)value;
                        int length = array.Length;

                        for (int index = 0; index < length; index++)
                        {
                            if ((index > 0) && (delimiter != null))
                                builder.Append(delimiter);

                            object element = array.GetValue(index);

                            if (element == null)
                            {
                                if (nullValue != null)
                                    builder.Append(nullValue);

                                continue;
                            }

                            builder.Append(element.ToString());
                        }

                        result = builder.ToString();
                    }
                }

                return result;
            }

            ///////////////////////////////////////////////////////////////////

            public static bool Equals(
                MockRegistryKey key1,
                MockRegistryKey key2
                )
            {
                if ((key1 == null) || (key2 == null))
                    return ((key1 == null) && (key2 == null));

                if (Object.ReferenceEquals(key1, key2))
                    return true;

                return NameEquals(key1.Name, key2.Name);
            }

            ///////////////////////////////////////////////////////////////////

            public static int GetHashCode(
                MockRegistryKey key
                )
            {
                if (key != null)
                {
                    string name = key.Name;

                    if (name != null)
                        return name.GetHashCode();
                }

                return 0;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Implicit Conversion Operators
            //
            // BUGBUG: Remove me?  This should be safe because in "what-if"
            //         mode all keys are opened read-only.
................................................................................
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (key != null)
                        {
                            if (!noClose)
                                key.Close();

                            key = null;
                        }
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
................................................................................
        };
        #endregion

        ///////////////////////////////////////////////////////////////////////

        private static class RegistryHelper
        {
            #region Private Data
            //
            // NOTE: This is used to synchronize access to the list of logged
            //       registry operations (just below).
            //
            private static object syncRoot = new object();

            //
            // NOTE: This is the list of registry write operations when it is
            //       set to non-null.
            //
            private static RegistryOperationList operationList;
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Static Properties
            private static MockRegistry readOnlyRegistry;
            public static MockRegistry ReadOnlyRegistry
            {
                get { return readOnlyRegistry; }
            }

................................................................................
                get { return keyValuesDeleted; }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Static Methods
            public static void EnableOrDisableOperationList(
                bool enable
                )
            {
                lock (syncRoot) /* TRANSACTIONAL */
                {
                    if (enable)
                    {
                        if (operationList == null)
                            operationList = new RegistryOperationList();
                    }
                    else if (operationList != null)
                    {
                        operationList.Dispose();
                        operationList = null;
                    }
                }
            }

            ///////////////////////////////////////////////////////////////////

            public static void ReinitializeDefaultRegistries(
                bool whatIf,
                bool safe
                )
            {
                if (readOnlyRegistry != null)
                {
................................................................................
                MockRegistry registry,
                string name
                )
            {
                if (registry == null)
                    return null;

                if (MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKEY_CLASSES_ROOT) ||
                    MockRegistryKey.NameEquals(

                        name, RegistryRootKeyNames.HKCR))

                {
                    return registry.ClassesRoot;
                }
                else if (MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKEY_CURRENT_CONFIG) ||
                    MockRegistryKey.NameEquals(

                        name, RegistryRootKeyNames.HKCC))

                {
                    return registry.CurrentConfig;
                }
                else if (MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKEY_CURRENT_USER) ||
                    MockRegistryKey.NameEquals(

                        name, RegistryRootKeyNames.HKCU))

                {
                    return registry.CurrentUser;
                }
                else if (MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKEY_DYN_DATA) ||
                    MockRegistryKey.NameEquals(

                        name, RegistryRootKeyNames.HKDD))

                {
                    return registry.DynData;
                }
                else if (MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKEY_LOCAL_MACHINE) ||
                    MockRegistryKey.NameEquals(

                        name, RegistryRootKeyNames.HKLM))

                {
                    return registry.LocalMachine;
                }
                else if (MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKEY_PERFORMANCE_DATA) ||
                    MockRegistryKey.NameEquals(

                        name, RegistryRootKeyNames.HKPD))

                {
                    return registry.PerformanceData;
                }
                else if (MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKEY_USERS) ||
                    MockRegistryKey.NameEquals(

                        name, RegistryRootKeyNames.HKU))

                {
                    return registry.Users;
                }

                return null;
            }

................................................................................
                        return new MockRegistryKey(
                            rootKey.CreateSubKey(subKeyName), whatIf, false,
                            false);
                    }
                }
                finally
                {
                    MaybeLogOperation(GetMethodName(), rootKey, subKeyName);

                    subKeysCreated++;
                }
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
................................................................................

                if (rootKey == null)
                    return;

                if (!whatIf)
                    rootKey.DeleteSubKey(subKeyName, throwOnMissing);

                MaybeLogOperation(GetMethodName(), rootKey, subKeyName);

                subKeysDeleted++;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static void DeleteSubKeyTree(
................................................................................
                }

                if (rootKey == null)
                    return;

                if (!whatIf)
                    rootKey.DeleteSubKeyTree(subKeyName);

                MaybeLogOperation(GetMethodName(), rootKey, subKeyName);

                subKeysDeleted++;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
................................................................................

                if (key == null)
                    return;

                if (!whatIf)
                    key.SetValue(name, value);

                MaybeLogOperation(GetMethodName(), key, name, value);

                keyValuesWritten++;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static void DeleteValue(
................................................................................

                if (key == null)
                    return;

                if (!whatIf)
                    key.DeleteValue(name, throwOnMissing);

                MaybeLogOperation(GetMethodName(), key, name, null);

                keyValuesDeleted++;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static int WriteOperationList(
                string fileName,
                bool verbose
                )
            {
                int count = 0;

                if (String.IsNullOrEmpty(fileName))
                {
                    if (verbose)
                    {
                        TraceOps.DebugAndTrace(TracePriority.Highest,
                            debugCallback, traceCallback,
                            "Registry operation log file name not set.",
                            traceCategory);
                    }

                    return count;
                }

                lock (syncRoot) /* TRANSACTIONAL */
                {
                    if (operationList == null)
                    {
                        if (verbose)
                        {
                            TraceOps.DebugAndTrace(TracePriority.Highest,
                                debugCallback, traceCallback,
                                "Registry operation list is invalid.",
                                traceCategory);
                        }

                        return count;
                    }

                    using (StreamWriter streamWriter = new StreamWriter(
                            fileName))
                    {
                        foreach (RegistryOperation operation in operationList)
                        {
                            if (operation == null)
                                continue;

                            streamWriter.WriteLine(operation.ToString());
                            count++;
                        }

                        streamWriter.Flush();
                    }
                }

                if (verbose)
                {
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback, String.Format(
                        "Wrote {0} registry operations to its log file.",
                        count), traceCategory);
                }

                return count;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Static Methods
            [MethodImpl(MethodImplOptions.NoInlining)]
            private static string GetMethodName()
            {
                return TraceOps.GetMethodName(null, 1);
            }

            ///////////////////////////////////////////////////////////////////

            private static void MaybeLogOperation(
                string methodName,
                MockRegistryKey key,
                string subKeyName
                )
            {
                MaybeLogOperation(methodName, key, subKeyName, null, null);
            }

            ///////////////////////////////////////////////////////////////////

            private static void MaybeLogOperation(
                string methodName,
                MockRegistryKey key,
                string valueName,
                object value
                )
            {
                MaybeLogOperation(methodName, key, null, valueName, value);
            }

            ///////////////////////////////////////////////////////////////////

            private static void MaybeLogOperation(
                string methodName,
                MockRegistryKey key,
                string subKeyName,
                string valueName,
                object value
                )
            {
                lock (syncRoot) /* TRANSACTIONAL */
                {
                    if (operationList == null)
                        return;

                    operationList.Add(new RegistryOperation(
                        methodName, key, subKeyName, valueName, value));
                }
            }
            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region RegistryOperationList Class
        [Serializable()]
        private sealed class RegistryOperationList :
            List<RegistryOperation>, IDisposable
        {
            #region Public Constructors
            public RegistryOperationList()
            {
                // do nothing.
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IDisposable "Pattern" Members
            private bool disposed;
            private void CheckDisposed() /* throw */
            {
                if (!disposed)
                    return;

                throw new ObjectDisposedException(
                    typeof(RegistryOperationList).Name);
            }

            ///////////////////////////////////////////////////////////////////

            private /* protected virtual */ void Dispose(
                bool disposing
                )
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        foreach (RegistryOperation operation in this)
                        {
                            if (operation == null)
                                continue;

                            operation.Dispose();
                        }

                        Clear();
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    //
                    // NOTE: This object is now disposed.
                    //
                    disposed = true;
                }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IDisposable Members
            public void Dispose()
            {
                Dispose(true);
                GC.SuppressFinalize(this);
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Destructor
            ~RegistryOperationList()
            {
                Dispose(false);
            }
            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region RegistryOperation Class
        private sealed class RegistryOperation
        {
            #region Private Constants
            private const char FieldDelimiter = '\t';
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Constructors
            public RegistryOperation(
                string methodName,
                MockRegistryKey key,
                string subKeyName,
                string valueName,
                object value
                )
            {
                this.methodName = methodName;
                this.subKeyName = subKeyName;
                this.valueName = valueName;
                this.value = value;

                SetKey(key);
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Methods
            private void SetKey(
                MockRegistryKey key
                )
            {
                if (key != null)
                {
                    //
                    // NOTE: Make sure this copy of the root registry key
                    //       cannot be used to accidentally make registry
                    //       changes.  Also, prevent this MockRegistryKey
                    //       object from closing its underlying registry
                    //       key as we will need it later.  This instance
                    //       will close it.
                    //
                    this.key = new MockRegistryKey(key, true, true, true);

                    key.DisableClose();
                }
                else
                {
                    this.key = null;
                }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Properties
            private string methodName;
            public string MethodName
            {
                get { CheckDisposed(); return methodName; }
            }

            ///////////////////////////////////////////////////////////////////

            private MockRegistryKey key;
            public MockRegistryKey Key
            {
                get { CheckDisposed(); return key; }
            }

            ///////////////////////////////////////////////////////////////////

            private string subKeyName;
            public string SubKeyName
            {
                get { CheckDisposed(); return subKeyName; }
            }

            ///////////////////////////////////////////////////////////////////

            private string valueName;
            public string ValueName
            {
                get { CheckDisposed(); return valueName; }
            }

            ///////////////////////////////////////////////////////////////////

            private object value;
            public object Value
            {
                get { CheckDisposed(); return value; }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region System.Object Overrides
            public override bool Equals(
                object obj
                )
            {
                CheckDisposed();

                RegistryOperation operation = obj as RegistryOperation;

                if (operation == null)
                    return false;

                if (!String.Equals(operation.methodName, methodName))
                    return false;

                if (!MockRegistryKey.Equals(operation.key, key))
                    return false;

                if (!MockRegistryKey.NameEquals(
                        operation.subKeyName, subKeyName))
                {
                    return false;
                }

                if (!String.Equals(operation.valueName, valueName))
                    return false;

                if (!MockRegistryKey.ValueEquals(operation.value, value))
                    return false;

                return true;
            }

            ///////////////////////////////////////////////////////////////////

            public override int GetHashCode()
            {
                CheckDisposed();

                int result = 0;

                if (methodName != null)
                    result ^= methodName.GetHashCode();

                result ^= MockRegistryKey.GetHashCode(key);

                if (subKeyName != null)
                    result ^= subKeyName.GetHashCode();

                if (valueName != null)
                    result ^= valueName.GetHashCode();

                result ^= MockRegistryKey.ValueHashCode(value);

                return result;
            }

            ///////////////////////////////////////////////////////////////////

            public override string ToString()
            {
                CheckDisposed();

                StringBuilder builder = new StringBuilder();

                builder.Append(ForDisplay(methodName));
                builder.Append(FieldDelimiter);
                builder.Append(ForDisplay(key));
                builder.Append(FieldDelimiter);
                builder.Append(ForDisplay(subKeyName));
                builder.Append(FieldDelimiter);
                builder.Append(ForDisplay(valueName));
                builder.Append(FieldDelimiter);

                builder.Append(ForDisplay(
                    MockRegistryKey.ValueToString(value, ", ", "<null>")));

                return builder.ToString();
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IDisposable "Pattern" Members
            private bool disposed;
            private void CheckDisposed() /* throw */
            {
                if (!disposed)
                    return;

                throw new ObjectDisposedException(
                    typeof(RegistryOperation).Name);
            }

            ///////////////////////////////////////////////////////////////////

            private /* protected virtual */ void Dispose(
                bool disposing
                )
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (key != null)
                        {
                            key.Close();
                            key = null;
                        }
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    //
                    // NOTE: This object is now disposed.
                    //
                    disposed = true;
                }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IDisposable Members
            public void Dispose()
            {
                Dispose(true);
                GC.SuppressFinalize(this);
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Destructor
            ~RegistryOperation()
            {
                Dispose(false);
            }
            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region StringList Class
................................................................................

            ///////////////////////////////////////////////////////////////////

            #region Private Constructors
            private Configuration(
                Assembly assembly,
                string logFileName,
                string registryLogFileName,
                string directory,
                string coreFileName,
                string linqFileName,
                string ef6FileName,
                string designerFileName,
                string registryVersion,
                string configVersion,
................................................................................
                bool debug,
                bool verbose,
                bool confirm
                )
            {
                this.assembly = assembly;
                this.logFileName = logFileName;
                this.registryLogFileName = registryLogFileName;
                this.directory = directory;
                this.coreFileName = coreFileName;
                this.linqFileName = linqFileName;
                this.ef6FileName = ef6FileName;
                this.designerFileName = designerFileName;
                this.registryVersion = registryVersion;
                this.configVersion = configVersion;
................................................................................
                string designerFileName = null;

                GetDefaultFileNames(
                    ref directory, ref coreFileName, ref linqFileName,
                    ref ef6FileName, ref designerFileName);

                return new Configuration(
                    thisAssembly, null, null, directory, coreFileName,
                    linqFileName, ef6FileName, designerFileName, null, null,
                    null, TraceOps.DebugFormat, TraceOps.TraceFormat,
                    InstallFlags.Default, ProviderFlags.Default,
                    TracePriority.Default, TracePriority.Default, false, true,
                    false, false, false, false, false, false, false, false,
                    false, false, false, false, false, false, false, false,
                    false, false, false, false, false, false, false, false,
                    false, true, true, false, false, false);
            }
................................................................................
                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.providerFlags = (ProviderFlags)value;
                        }
                        else if (MatchOption(newArg, "registryLogFileName"))
                        {
                            configuration.registryLogFileName = text;
                        }
                        else if (MatchOption(newArg, "registryVersion"))
                        {
                            configuration.registryVersion = text;
                        }
                        else if (MatchOption(newArg, "strict"))
                        {
................................................................................
                    {
                        TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                            debugCallback, traceCallback,
                            "No actual changes will be made to this " +
                            "system because \"what-if\" mode is enabled.",
                            traceCategory);
                    }

                    //
                    // NOTE: If the registry log file name has been set, its
                    //       value will be used verbatim as the place where
                    //       all registry write operations will (eventually)
                    //       be logged.  Make sure the registry helper class
                    //       has a valid operation list; otherwise, it will
                    //       not perform any logging.
                    //
                    if (configuration.registryLogFileName != null)
                    {
                        RegistryHelper.EnableOrDisableOperationList(true);

                        TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                            debugCallback, traceCallback, String.Format(
                            "Registry logging to file {0} enabled.",
                            ForDisplay(configuration.registryLogFileName)),
                            traceCategory);
                    }

                    //
                    // NOTE: If the command line has not been manually
                    //       confirmed (i.e. via the explicit command line
                    //       option), then stop processing now.  We enforce
                    //       this rule so that simply double-clicking the
                    //       executable will not result in any changes being
................................................................................
                    traceCallback(String.Format(NameAndValueFormat,
                        "Assembly", ForDisplay(assembly)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "LogFileName", ForDisplay(logFileName)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "RegistryLogFileName",
                        ForDisplay(registryLogFileName)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "Directory", ForDisplay(directory)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "CoreFileName", ForDisplay(coreFileName)),
................................................................................

            private string logFileName;
            public string LogFileName
            {
                get { return logFileName; }
                set { logFileName = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string registryLogFileName;
            public string RegistryLogFileName
            {
                get { return registryLogFileName; }
                set { registryLogFileName = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string directory;
            public string Directory
            {
                get { return directory; }
................................................................................
            }
            else if (type == typeof(DataReceivedEventArgs))
            {
                DataReceivedEventArgs eventArgs = (DataReceivedEventArgs)value;

                result = ForDisplay(eventArgs.Data); /* RECURSIVE */
            }
            else if (type == typeof(MockRegistryKey))
            {
                MockRegistryKey key = (MockRegistryKey)value;

                result = ForDisplay(key.ToString()); /* RECURSIVE */
            }
            else
            {
                result = value.ToString();

                if (result.Length == 0)
                    return "<empty>";

................................................................................
                    TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                        debugCallback, traceCallback, String.Format(
                        "filesCreated = {0}, filesModified = {1}, " +
                        "filesDeleted = {2}", ForDisplay(filesCreated),
                        ForDisplay(filesModified), ForDisplay(filesDeleted)),
                        traceCategory);
                    #endregion

                    ///////////////////////////////////////////////////////////

                    #region Write Registry Log (Optional)
                    //
                    // NOTE: If applicable, write the list of registry write
                    //       operations now.
                    //
                    RegistryHelper.WriteOperationList(
                        configuration.RegistryLogFileName,
                        configuration.Verbose);

                    RegistryHelper.EnableOrDisableOperationList(false);
                    #endregion

                    ///////////////////////////////////////////////////////////

                    TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                        debugCallback, traceCallback, "Success.",
                        traceCategory);