/// <summary>
 ///   Extract binary file from an assembly to a location on disk
 /// </summary>
 /// <param name="fileSystem">The file system.</param>
 /// <param name="assembly">The assembly.</param>
 /// <param name="manifestLocation">The manifest location.</param>
 /// <param name="filePath">The file path.</param>
 /// <param name="overwriteExisting">
 ///   if set to <c>true</c> [overwrite existing].
 /// </param>
 public static void extract_binary_file_from_assembly(IFileSystem fileSystem, IAssembly assembly, string manifestLocation, string filePath, bool overwriteExisting = false)
 {
     if (overwriteExisting || !fileSystem.file_exists(filePath))
     {
         fileSystem.create_directory_if_not_exists(fileSystem.get_directory_name(filePath));
         fileSystem.write_file(filePath, () => assembly.get_manifest_stream(manifestLocation));
     }
 }
示例#2
0
 /// <summary>
 ///   Extract binary file from an assembly to a location on disk
 /// </summary>
 /// <param name="fileSystem">The file system.</param>
 /// <param name="assembly">The assembly.</param>
 /// <param name="manifestLocation">The manifest location.</param>
 /// <param name="filePath">The file path.</param>
 /// <param name="overwriteExisting">
 ///   if set to <c>true</c> [overwrite existing].
 /// </param>
 public static void extract_binary_file_from_assembly(IFileSystem fileSystem, IAssembly assembly, string manifestLocation, string filePath, bool overwriteExisting = false)
 {
     if (overwriteExisting || !fileSystem.file_exists(filePath))
     {
         fileSystem.create_directory_if_not_exists(fileSystem.get_directory_name(filePath));
         fileSystem.write_file(filePath, () => assembly.get_manifest_stream(manifestLocation));
     }
 }
 /// <summary>
 ///   Extract binary file from an assembly to a location on disk
 /// </summary>
 /// <param name="fileSystem">The file system.</param>
 /// <param name="assembly">The assembly.</param>
 /// <param name="manifestLocation">The manifest location.</param>
 /// <param name="filePath">The file path.</param>
 /// <param name="overwriteExisting">
 ///   if set to <c>true</c> [overwrite existing].
 /// </param>
 /// <param name="throwEror">Throw an error if there are issues</param>
 public static void extract_binary_file_from_assembly(IFileSystem fileSystem, IAssembly assembly, string manifestLocation, string filePath, bool overwriteExisting = false, bool throwEror = true)
 {
     if (overwriteExisting || !fileSystem.file_exists(filePath))
     {
         FaultTolerance.try_catch_with_logging_exception(
             () =>
         {
             fileSystem.create_directory_if_not_exists(fileSystem.get_directory_name(filePath));
             fileSystem.write_file(filePath, () => assembly.get_manifest_stream(manifestLocation));
         },
             errorMessage: "Unable to extract binary",
             throwError: throwEror,
             logWarningInsteadOfError: false,
             logDebugInsteadOfError: !throwEror,
             isSilent: !throwEror);
     }
 }