Beispiel #1
0
        private static ServicingIndex LoadIndex()
        {
            return LazyInitializer.EnsureInitialized(ref _index, ref _indexInitialized, ref _indexSync, () =>
            {
                var index = new ServicingIndex();
                var runtimeServicing = Environment.GetEnvironmentVariable(EnvironmentNames.Servicing);
                if (string.IsNullOrEmpty(runtimeServicing))
                {
                    var servicingRoot = Environment.GetEnvironmentVariable("PROGRAMFILES(X86)");
                    if (string.IsNullOrEmpty(servicingRoot))
                    {
                        Environment.GetEnvironmentVariable("PROGRAMFILES");
                    }

                    if (string.IsNullOrEmpty(servicingRoot))
                    {
                        // Nothing to do, we don't have Program Files. Just return the uninitialized index.
                        return index;
                    }

                    runtimeServicing = Path.Combine(
                        servicingRoot,
                        "KRE",
                        "Servicing");
                }

                index.Initialize(runtimeServicing);
                return index;
            });
        }
Beispiel #2
0
        private static ServicingIndex LoadIndex()
        {
            return(LazyInitializer.EnsureInitialized(ref _index, ref _indexInitialized, ref _indexSync, () =>
            {
                var index = new ServicingIndex();
                var runtimeServicing = Environment.GetEnvironmentVariable(EnvironmentNames.Servicing);
                if (string.IsNullOrEmpty(runtimeServicing))
                {
                    var servicingRoot = Environment.GetEnvironmentVariable("PROGRAMFILES(X86)");
                    if (string.IsNullOrEmpty(servicingRoot))
                    {
                        Environment.GetEnvironmentVariable("PROGRAMFILES");
                    }

                    if (string.IsNullOrEmpty(servicingRoot))
                    {
                        // Nothing to do, we don't have Program Files. Just return the uninitialized index.
                        return index;
                    }

                    runtimeServicing = Path.Combine(
                        servicingRoot,
                        Constants.RuntimeShortName.ToUpper(),
                        "Servicing");
                }

                index.Initialize(runtimeServicing);
                return index;
            }));
        }
Beispiel #3
0
        private static List <ServicingIndex> LoadIndex()
        {
            return(LazyInitializer.EnsureInitialized(ref _index, ref _indexInitialized, ref _indexSync, () =>
            {
                var compositeIndex = new List <ServicingIndex>();

                foreach (var servicingRoot in GetServicingRoots())
                {
                    var index = new ServicingIndex();
                    if (servicingRoot != null && servicingRoot.IndexOfAny(Path.GetInvalidPathChars()) == -1)
                    {
                        index.Initialize(servicingRoot);
                    }

                    compositeIndex.Add(index);
                }

                return compositeIndex;
            }));
        }
Beispiel #4
0
        private static List<ServicingIndex> LoadIndex()
        {
            return LazyInitializer.EnsureInitialized(ref _index, ref _indexInitialized, ref _indexSync, () =>
            {
                var compositeIndex = new List<ServicingIndex>();

                foreach (var servicingRoot in GetServicingRoots())
                {
                    var index = new ServicingIndex();
                    if (servicingRoot != null && servicingRoot.IndexOfAny(Path.GetInvalidPathChars()) == -1)
                    {
                        index.Initialize(servicingRoot);
                    }

                    compositeIndex.Add(index);
                }

                return compositeIndex;
            });
        }
Beispiel #5
0
        private static ServicingIndex LoadIndex()
        {
            return(LazyInitializer.EnsureInitialized(ref _index, ref _indexInitialized, ref _indexSync, () =>
            {
                var index = new ServicingIndex();
                var kreServicing = Environment.GetEnvironmentVariable("KRE_SERVICING");
                if (string.IsNullOrEmpty(kreServicing))
                {
                    var servicingRoot = Environment.GetEnvironmentVariable("ProgramFiles") ??
                                        Environment.GetEnvironmentVariable("HOME");

                    kreServicing = Path.Combine(
                        servicingRoot,
                        "KRE",
                        "Servicing");
                }

                index.Initialize(kreServicing);
                return index;
            }));
        }
Beispiel #6
0
        private static void ServicingTest(string indexContent, Action<ServicingIndex, string> validator)
        {
            const string fakePatchesFolder = @"C:/foo/patchesFolder/";

            using (MemoryStream indexStream = new MemoryStream(Encoding.UTF8.GetBytes(indexContent)))
            {
                var index = new ServicingIndex();
                index.Initialize(fakePatchesFolder, indexStream);
                validator(index, fakePatchesFolder);
            }
        }