System.Data.SQLite

Check-in [3f2760ab0f]
Login

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

Overview
Comment:Further refinements to the design-time components installer in preparation for future enhancements.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3f2760ab0feafaa23f53514f58fbd7cdbe6d85eb
User & Date: mistachkin 2017-12-06 23:53:44.521
Context
2017-12-07
00:57
Remove type name prefix from the method names in the registry operation log output. check-in: eab7df35a4 user: mistachkin tags: trunk
2017-12-06
23:53
Further refinements to the design-time components installer in preparation for future enhancements. check-in: 3f2760ab0f user: mistachkin tags: trunk
23:18
In the design-time components installer, enhance MockRegistryKey class to enable cloning without regard to its safety settings; however, the safety settings are preserved in the clone. check-in: f8e8c3d8dc user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to tools/install/Installer.cs.
293
294
295
296
297
298
299





















300
301






302
303
304
305
306
307
308
#endif
        }
        #endregion

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

        #region Private Helper Classes





















        #region AnyPair Class
        private sealed class AnyPair<T1, T2>






        {
            #region Public Constructors
            //
            // WARNING: This constructor produces an immutable "empty" pair
            //          object.
            //
            public AnyPair()







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

|
>
>
>
>
>
>







293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
#endif
        }
        #endregion

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

        #region Private Helper Classes
        #region ObjectHelper Class
        private static class ObjectHelper
        {
            public static bool AreEqual(
                object value1,
                object value2
                )
            {
                if ((value1 == null) || (value2 == null))
                    return ((value1 == null) && (value2 == null));

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

                return value1.Equals(value2);
            }
        }
        #endregion

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

        #region AnyPair Class
        private sealed class AnyPair<T1, T2> :
            IComparer<AnyPair<T1, T2>>,
            IComparable<AnyPair<T1, T2>>,
            IComparable,
            IEquatable<AnyPair<T1, T2>>,
            IEqualityComparer<AnyPair<T1, T2>>,
            ICloneable
        {
            #region Public Constructors
            //
            // WARNING: This constructor produces an immutable "empty" pair
            //          object.
            //
            public AnyPair()
341
342
343
344
345
346
347


























































































































































348
349
350
351
352
353
354

            private T2 y;
            public T2 Y
            {
                get { return y; }
            }
            #endregion


























































































































































        }
        #endregion

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

        #region TraceOps Class
        private static class TraceOps







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







368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535

            private T2 y;
            public T2 Y
            {
                get { return y; }
            }
            #endregion

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

            #region System.Object Overrides
            public override bool Equals(
                object obj
                )
            {
                AnyPair<T1, T2> anyPair = obj as AnyPair<T1, T2>;

                if (anyPair != null)
                {
                    if (!ObjectHelper.AreEqual(X, anyPair.X))
                        return false;

                    if (!ObjectHelper.AreEqual(Y, anyPair.Y))
                        return false;

                    return true;
                }

                return false;
            }

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

            public override string ToString()
            {
                //
                // TODO: The delimiter here is hard-coded to a space.  This
                //       may need to be changed, e.g. if the use-cases for
                //       this class change.
                //
                return String.Format("{0} {1}", X, Y);
            }

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

            public override int GetHashCode()
            {
                int result = 0;
                T1 x = X;

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

                T2 y = Y;

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

                return result;
            }
            #endregion

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

            #region IComparer<AnyPair<T1,T2>> Members
            public int Compare(
                AnyPair<T1, T2> x,
                AnyPair<T1, T2> y
                )
            {
                if ((x == null) && (y == null))
                {
                    return 0;
                }
                else if (x == null)
                {
                    return -1;
                }
                else if (y == null)
                {
                    return 1;
                }
                else
                {
                    int result = Comparer<T1>.Default.Compare(x.X, y.X);

                    if (result != 0)
                        return result;

                    return Comparer<T2>.Default.Compare(x.Y, y.Y);
                }
            }
            #endregion

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

            #region IComparable<AnyPair<T1,T2>> Members
            public int CompareTo(
                AnyPair<T1, T2> other
                )
            {
                return Compare(this, other);
            }
            #endregion

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

            #region IComparable Members
            public int CompareTo(
                object obj
                )
            {
                AnyPair<T1, T2> anyPair = obj as AnyPair<T1, T2>;

                if (anyPair == null)
                    throw new ArgumentException();

                return CompareTo(anyPair);
            }
            #endregion

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

            #region IEquatable<AnyPair<T1,T2>> Members
            public bool Equals(
                AnyPair<T1, T2> other
                )
            {
                return CompareTo(other) == 0;
            }
            #endregion

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

            #region IEqualityComparer<AnyPair<T1,T2>> Members
            public bool Equals(
                AnyPair<T1, T2> x,
                AnyPair<T1, T2> y
                )
            {
                return ObjectHelper.AreEqual(x, y);
            }

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

            public int GetHashCode(
                AnyPair<T1, T2> obj
                )
            {
                return (obj != null) ? obj.GetHashCode() : 0;
            }
            #endregion

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

            #region ICloneable Members
            public object Clone()
            {
                return new AnyPair<T1, T2>(X, Y);
            }
            #endregion
        }
        #endregion

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

        #region TraceOps Class
        private static class TraceOps
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
                if (key == null)
                    return null;

                if (whatIf)
                {
                    //
                    // HACK: Attempt to open the specified sub-key.  If this
                    //       fails, we will simply return the wrapped root key
                    //       itself since no writes are allowed in "what-if"
                    //       mode anyhow.
                    //
                    RegistryKey subKey = key.OpenSubKey(subKeyName);

                    if (subKey != null)
                    {







|







1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
                if (key == null)
                    return null;

                if (whatIf)
                {
                    //
                    // HACK: Attempt to open the specified sub-key.  If this
                    //       fails, we'll simply return the wrapped root key
                    //       itself since no writes are allowed in "what-if"
                    //       mode anyhow.
                    //
                    RegistryKey subKey = key.OpenSubKey(subKeyName);

                    if (subKey != null)
                    {