Esempio n. 1
0
        public void EnsureCorrectWinFabManifestVersionLoaded(string etlFileName, out bool exactMatchFound)
        {
            List <string> manifestFiles = GetManifestsForEtl(Path.GetFileName(etlFileName), out exactMatchFound);

            foreach (string manifestFile in manifestFiles)
            {
                string manifestFileName = Path.GetFileName(manifestFile);
                if (WinFabricManifestManager.IsFabricManifestFileName(manifestFileName))
                {
                    this.EnsureCorrectWinFabManifestVersionLoaded(ref this.currentFabricManifest, manifestFile);
                }
                else if (WinFabricManifestManager.IsLeaseLayerManifestFileName(manifestFileName))
                {
                    this.EnsureCorrectWinFabManifestVersionLoaded(ref this.currentLeaseLayerManifest, manifestFile);
                }
                else if (WinFabricManifestManager.IsKtlManifestFileName(manifestFileName))
                {
                    this.EnsureCorrectWinFabManifestVersionLoaded(ref this.currentKtlManifest, manifestFile);
                }
                else
                {
                    Debug.Assert(false, "Unexpected manifest file.");
                    throw new InvalidDataException(
                              String.Format(
                                  System.Globalization.CultureInfo.CurrentCulture,
                                  StringResources.ETLReaderError_UnexpectedManifestFileReturned_formatted,
                                  manifestFile,
                                  etlFileName));
                }
            }
        }
Esempio n. 2
0
        public WinFabricManifestManager(IEnumerable <string> manifests, LoadWindowsFabricManifest loadManifestMethod, UnloadWindowsFabricManifest unloadManifestMethod)
        {
            this.fabricManifests            = new Dictionary <long, string>();
            this.leaseLayerManifests        = new Dictionary <long, string>();
            this.ktlManifests               = new Dictionary <long, string>();
            this.fabricManifestVersions     = new List <long>();
            this.leaseLayerManifestVersions = new List <long>();
            this.ktlManifestVersions        = new List <long>();
            this.loadManifest               = loadManifestMethod;
            this.unloadManifest             = unloadManifestMethod;

            if (manifests != null)
            {
                foreach (string manifest in manifests)
                {
                    long version;
                    var  manifestFileName = Path.GetFileName(manifest);
                    version = GetManifestVersion(manifestFileName);

                    if (WinFabricManifestManager.IsFabricManifestFileName(manifestFileName))
                    {
                        AddManifest(manifest, version, this.fabricManifests, this.fabricManifestVersions);
                    }
                    else if (WinFabricManifestManager.IsLeaseLayerManifestFileName(manifestFileName))
                    {
                        AddManifest(manifest, version, this.leaseLayerManifests, this.leaseLayerManifestVersions);
                    }
                    else if (WinFabricManifestManager.IsKtlManifestFileName(manifestFileName))
                    {
                        AddManifest(manifest, version, this.ktlManifests, this.ktlManifestVersions);
                    }
                }
            }
        }