Beispiel #1
0
        /// <summary>
        /// Loads several intermediates from paths on disk using the same definitions.
        /// </summary>
        /// <param name="intermediateFiles">Paths to intermediate files saved on disk.</param>
        /// <param name="creator">ISymbolDefinitionCreator to use when reconstituting the intermediates.</param>
        /// <param name="suppressVersionCheck">Suppress checking for wix.dll version mismatches.</param>
        /// <returns>Returns the loaded intermediates</returns>
        public static IEnumerable <Intermediate> Load(IEnumerable <string> intermediateFiles, ISymbolDefinitionCreator creator, bool suppressVersionCheck = false)
        {
            var jsons         = new Queue <JsonWithPath>();
            var intermediates = new List <Intermediate>();

            foreach (var path in intermediateFiles)
            {
                using (var wixout = WixOutput.Read(path))
                {
                    var data = wixout.GetData(WixOutputStreamName);
                    var json = Intermediate.LoadJson(data, wixout.Uri, suppressVersionCheck);

                    Intermediate.LoadDefinitions(json, creator);

                    jsons.Enqueue(new JsonWithPath {
                        Json = json, Path = wixout.Uri
                    });
                }
            }

            while (jsons.Count > 0)
            {
                var jsonWithPath = jsons.Dequeue();

                var intermediate = Intermediate.FinalizeLoad(jsonWithPath.Json, jsonWithPath.Path, creator);

                intermediates.Add(intermediate);
            }

            return(intermediates);
        }
Beispiel #2
0
        /// <summary>
        /// Loads several intermediates from paths on disk using the same definitions.
        /// </summary>
        /// <param name="intermediateFiles">Paths to intermediate files saved on disk.</param>
        /// <param name="creator">ITupleDefinitionCreator to use when reconstituting the intermediates.</param>
        /// <param name="suppressVersionCheck">Suppress checking for wix.dll version mismatches.</param>
        /// <returns>Returns the loaded intermediates</returns>
        public static IEnumerable <Intermediate> Load(IEnumerable <string> intermediateFiles, ITupleDefinitionCreator creator, bool suppressVersionCheck = false)
        {
            var jsons         = new Queue <JsonWithPath>();
            var intermediates = new List <Intermediate>();

            foreach (var path in intermediateFiles)
            {
                using (var stream = File.OpenRead(path))
                {
                    var uri = new Uri(Path.GetFullPath(path));

                    var json = Intermediate.LoadJson(stream, uri, suppressVersionCheck);

                    Intermediate.LoadDefinitions(json, creator);

                    jsons.Enqueue(new JsonWithPath {
                        Json = json, Path = uri
                    });
                }
            }

            while (jsons.Count > 0)
            {
                var jsonWithPath = jsons.Dequeue();

                var intermediate = Intermediate.FinalizeLoad(jsonWithPath.Json, jsonWithPath.Path, creator);

                intermediates.Add(intermediate);
            }

            return(intermediates);
        }
Beispiel #3
0
        /// <summary>
        /// Loads an intermediate from a path on disk.
        /// </summary>
        /// <param name="stream">Stream to intermediate file.</param>
        /// <param name="baseUri">Path name of intermediate file.</param>
        /// <param name="creator">ITupleDefinitionCreator to use when reconstituting the intermediate.</param>
        /// <param name="suppressVersionCheck">Suppress checking for wix.dll version mismatches.</param>
        /// <returns>Returns the loaded intermediate.</returns>
        private static Intermediate LoadIntermediate(Stream stream, Uri baseUri, ITupleDefinitionCreator creator, bool suppressVersionCheck = false)
        {
            var json = Intermediate.LoadJson(stream, baseUri, suppressVersionCheck);

            Intermediate.LoadDefinitions(json, creator);

            return(Intermediate.FinalizeLoad(json, baseUri, creator));
        }
Beispiel #4
0
        /// <summary>
        /// Loads an intermediate from a WixOutput.
        /// </summary>
        /// <param name="wixout">Source to load from.</param>
        /// <param name="creator">ISymbolDefinitionCreator to use when reconstituting the intermediate.</param>
        /// <param name="suppressVersionCheck">Suppress checking for wix.dll version mismatches.</param>
        /// <returns>Returns the loaded intermediate.</returns>
        private static Intermediate LoadIntermediate(WixOutput wixout, ISymbolDefinitionCreator creator, bool suppressVersionCheck = false)
        {
            var data = wixout.GetData(WixOutputStreamName);
            var json = Intermediate.LoadJson(data, wixout.Uri, suppressVersionCheck);

            Intermediate.LoadDefinitions(json, creator);

            return(Intermediate.FinalizeLoad(json, wixout.Uri, creator));
        }