Beispiel #1
0
        public static void EmbedManyFiles(string fileToReadFrom, string assemblyToEmbedTo)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(EmbedData));
            EmbedData     data       = default(EmbedData);

            using (var fileStream = File.OpenRead(fileToReadFrom))
            {
                data = (EmbedData)serializer.Deserialize(fileStream);
            }

            var directory = new DirectoryInfo(data.directoryRelativeTo);

            //Console.WriteLine("All Files = " + data.files);

            foreach (var file in data.files.Split(';'))
            {
                if (file != "")
                {
                    //Console.WriteLine("File = " + file);
                    //Console.WriteLine("Directory = " + directory.FullName);
                    //Console.WriteLine("Full File Name = " + directory.FullName + "\\" + file);
                    EmbedResourceCMD.EmbedResource(assemblyToEmbedTo, directory.FullName + "\\" + file, file, compression: Enums.CompressionMethod.NoCompression);
                }
            }
        }
        public static void EmbedDirectory(string directoryToEmbed, string assemblyToEmbedTo, string extensionFilter = "*.*")
        {
            var dir = new DirectoryInfo(directoryToEmbed);

            var files = dir.GetFiles(extensionFilter, SearchOption.AllDirectories);

            foreach (var file in files)
            {
                var relativePath = PathUtilities.MakePathRelative(dir.FullName, file.FullName);

                EmbedResourceCMD.EmbedResource(assemblyToEmbedTo, file.FullName, relativePath, compression: CompressionMethod.NoCompression);
            }
        }