Exemplo n.º 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;
            });
        }
Exemplo n.º 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;
            }));
        }
Exemplo n.º 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;
            }));
        }
Exemplo n.º 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;
            });
        }
Exemplo n.º 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;
            }));
        }
Exemplo n.º 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);
            }
        }