Example #1
0
        private void PatchExistingGenericThemesXaml(
            ResourceWriter resourceWriter, BamlDocument bamlDocument, IEnumerable <string> genericThemeResources)
        {
            _logger.Info("Patching existing themes/generic.xaml");

            _bamlGenerator.AddMergedDictionaries(bamlDocument, genericThemeResources);

            SetPreserializedData(resourceWriter, GenericThemesBamlName,
                                 BamlUtils.ToResourceBytes(bamlDocument));
        }
Example #2
0
        private void AddNewGenericThemesXaml(
            ResourceWriter resourceWriter, IEnumerable <string> genericThemeResources)
        {
            _logger.Info("Creating new themes/generic.xaml");
            var newBamlDocument = _bamlGenerator.GenerateThemesGenericXaml(genericThemeResources);

            resourceWriter.AddResourceData(
                GenericThemesBamlName, "ResourceTypeCode.Stream",
                BamlUtils.ToResourceBytes(newBamlDocument));
        }
        private byte[] GetProcessedResource(Res resource, AssemblyDefinition containingAssembly)
        {
            BamlDocument bamlDocument = BamlUtils.FromResourceBytes(resource.data);

            foreach (dynamic node in bamlDocument)
            {
                ProcessRecord(node, containingAssembly);
            }

            //TODO: diminishing return optimisation: remove duplications + update assembly ids

            return(BamlUtils.ToResourceBytes(bamlDocument));
        }
Example #4
0
        private byte[] GetProcessedResource(Res resource, AssemblyDefinition containingAssembly)
        {
            BamlDocument bamlDocument = BamlUtils.FromResourceBytes(resource.data);

            foreach (BamlRecord node in bamlDocument)
            {
                ProcessRecord(node as PropertyWithConverterRecord, containingAssembly);
                ProcessRecord(node as TextWithConverterRecord, containingAssembly);
                ProcessRecord(node as AssemblyInfoRecord, containingAssembly);
                ProcessRecord(node as XmlnsPropertyRecord, containingAssembly);
                ProcessRecord(node as TypeInfoRecord, containingAssembly);
            }

            //TODO: diminishing return optimisation: remove duplications + update assembly ids

            return(BamlUtils.ToResourceBytes(bamlDocument));
        }
Example #5
0
        private byte[] GetProcessedResource(Res resource, AssemblyDefinition containingAssembly)
        {
            BamlDocument bamlDocument = BamlUtils.FromResourceBytes(resource.data);

            foreach (BamlRecord node in bamlDocument)
            {
                Action <BamlRecord, AssemblyDefinition> recordProcessor;

                if (_nodeProcessors.TryGetValue(node.GetType(), out recordProcessor))
                {
                    recordProcessor(node, containingAssembly);
                }
            }

            //TODO: diminishing return optimisation: remove duplications + update assembly ids

            return(BamlUtils.ToResourceBytes(bamlDocument));
        }