예제 #1
0
        /// <summary>
        ///     Initializes the new instance of <see cref="ManifestBuilder"/> class.
        /// </summary>
        /// <param name="issuerName">Name of the issuer of the signing.</param>
        /// <param name="issuerXmlPath">Path to the file with issuer.</param>
        /// <param name="assemblyName">Name of the assembly for which manifest is going to be created.</param>
        /// <param name="directory">Directory within this assembly.</param>
        /// <param name="keyStore">Flag which describes whether to use information from PKI or from Nomad key mechanism.</param>
        /// <param name="keyPassword">Password for PKI certificate.</param>
        /// <param name="configuration">Configuration on manifest builder class.</param>
        public ManifestBuilder(string issuerName, string issuerXmlPath, string assemblyName,
                               string directory, KeyStorage keyStore, string keyPassword,
                               ManifestBuilderConfiguration configuration)
        {
            _issuerName    = issuerName;
            _issuerXmlPath = issuerXmlPath;
            _assemblyName  = assemblyName;
            _directory     = directory;
            _keyStore      = keyStore;
            _keyPassword   = keyPassword;

            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            _configuration = configuration;

            LoadKey();
        }
예제 #2
0
        /// <summary>
        ///		Generates the manifest for the file with coping all the dependencies and then removing them
        /// </summary>
        /// <remarks>
        ///		This method will be problematic with duplcate names and so on...
        /// </remarks>
        /// <param name="references">Path to all references</param>
        ///<returns>
        ///		The path to the generated manifest
        /// </returns>
        public string SetUpModuleWithManifest(string outputDirectory, string srcPath,
            ManifestBuilderConfiguration configuration,
            params string[] references)
        {
            OutputDirectory = outputDirectory;

            string modulePath = GenerateModuleFromCode(srcPath, references);

            // copy the references into folder with
            foreach (string reference in references)
            {
                File.Copy(reference, Path.Combine(outputDirectory, Path.GetFileName(reference)));
            }

            string KeyFile = @"alaMaKota.xml";
            if (File.Exists(KeyFile))
            {
                File.Delete(KeyFile);
            }
            KeysGeneratorProgram.Main(new[] {KeyFile});

            // manifest generating is for folder
            string file = GenerateManifestForModule(modulePath, KeyFile, configuration);

            if (File.Exists(KeyFile))
            {
                File.Delete(KeyFile);
            }

            // remove those references
            foreach (string reference in references)
            {
                File.Delete(Path.Combine(outputDirectory, Path.GetFileName(reference)));
            }

            return file;
        }
예제 #3
0
        /// <summary>
        ///     Wrapps the generating manifest with values that should be provided. Provides access to <paramref name="configuration"/>.
        /// </summary>
        /// <param name="modulePath"></param>
        /// <param name="keyLocation"></param>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public string GenerateManifestForModule(string modulePath, string keyLocation,
            ManifestBuilderConfiguration configuration)
        {
            string directory = Path.GetFullPath(Path.GetDirectoryName(modulePath));
            var builder = new ManifestBuilder("TEST_ISSUER_COMPILER",
                                              keyLocation,
                                              Path.GetFileName(modulePath), directory, KeyStorage.Nomad, string.Empty,
                                              configuration);
            builder.CreateAndPublish();

            return modulePath + ModuleManifest.ManifestFileNameSuffix;
        }
        protected void SetUpModuleWithManifest(string outputDirectory, string srcPath, ManifestBuilderConfiguration configuration,
            params string[] references)
        {
            _moduleCompiler.OutputDirectory = outputDirectory;

            string modulePath = _moduleCompiler.GenerateModuleFromCode(srcPath, references);

            // copy the references into folder with
            foreach (string reference in references)
            {
                File.Copy(reference, Path.Combine(outputDirectory, Path.GetFileName(reference)));
            }

            // manifest generating is for folder
            _moduleCompiler.GenerateManifestForModule(modulePath, KeyFile,configuration);

            // remove those references
            foreach (string reference in references)
            {
                File.Delete(Path.Combine(outputDirectory, Path.GetFileName(reference)));
            }
        }