Esempio n. 1
0
        /// <summary>
        /// Udpate the source baml into a target stream with all the resource udpates applied.
        /// </summary>
        /// <param name="target">target stream</param>
        /// <param name="updates">resource updates to be applied when generating the localized baml</param>
        public void UpdateBaml(
            Stream target,
            BamlLocalizationDictionary updates
            )
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (updates == null)
            {
                throw new ArgumentNullException("updates");
            }

            // we duplicate the internal baml tree here because
            // we will need to modify the tree to do generation
            // UpdateBaml can be called multiple times
            BamlTree _duplicateTree = _tree.Copy();

            _bamlTreeMap.EnsureMap();

            // Udpate the tree
            BamlTreeUpdater.UpdateTree(
                _duplicateTree,
                _bamlTreeMap,
                updates
                );

            // Serialize the tree into Baml
            BamlResourceSerializer.Serialize(
                this,
                _duplicateTree,
                target
                );
        }
        /// <summary>Applies resource updates to the BAML source and writes the updated version to a specified stream in order to create a localized version of the source BAML. </summary>
        /// <param name="target">The stream that will receive the updated BAML.</param>
        /// <param name="updates">The resource updates to be applied to the source BAML.</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///         <paramref name="target" /> or <paramref name="updates" /> are <see langword="null" />.</exception>
        // Token: 0x0600250E RID: 9486 RVA: 0x000B2E68 File Offset: 0x000B1068
        public void UpdateBaml(Stream target, BamlLocalizationDictionary updates)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (updates == null)
            {
                throw new ArgumentNullException("updates");
            }
            BamlTree tree = this._tree.Copy();

            this._bamlTreeMap.EnsureMap();
            BamlTreeUpdater.UpdateTree(tree, this._bamlTreeMap, updates);
            BamlResourceSerializer.Serialize(this, tree, target);
        }